diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 023da9251..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,131 +0,0 @@ -# Some resuable sections, note the top-level keys 'defaults' and 'tag_filters' -# have no special meaning, they just exist so I can alias them and import them -# in later blocks -defaults: &defaults - working_directory: /go/src/github.com/hyperledger/burrow - docker: - - image: hyperledger/burrow:ci - environment: - - GO_TEST_ARGS: -p 2 - -tag_filters: &tags_filters - tags: - only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ - -setup_docker: &setup_docker - version: 17.11.0-ce - -orbs: - codecov: codecov/codecov@1.0.4 - -version: 2.1 -jobs: - - test: - <<: *defaults - steps: - - run: echo $CIRCLE_PULL_REQUESTS - - run: echo $CIRCLE_BRANCH - - checkout - - run: make test - # In case we miss compile errors not pulled into test paths - - run: make build - - test_cover: - <<: *defaults - steps: - - checkout - - run: make test_cover - - codecov/upload: - file: coverage.html - - test_js: - machine: - image: circleci/classic:201808-01 - steps: - - checkout - # js tests do not need to in docker, however nodejs crashes - # while running mocha when not using image above (not OOM). - # above image needs newer go so docker is used. - - run: docker-compose run burrow make npm_install test_js - - test_integration: - machine: - image: circleci/classic:201808-01 - steps: - - checkout - - run: docker-compose run burrow make test_integration_no_postgres - - build_docker: - <<: *defaults - steps: - - checkout - # This allows us to perform our docker builds - - setup_remote_docker: - <<: *setup_docker - # build docker image and tag the docker image(s) depending on branch/tag - - run: make docker_build - - release_dev: - <<: *defaults - steps: - - setup_remote_docker: - <<: *setup_docker - - checkout - - run: make release_dev - - release: - <<: *defaults - steps: - - setup_remote_docker: - <<: *setup_docker - - checkout - - run: make release - - -workflows: - - test_and_release: - jobs: - - test: - filters: - <<: *tags_filters - - - test_cover: - filters: - branches: - only: develop - - - test_integration: - filters: - <<: *tags_filters - - - test_js: - filters: - <<: *tags_filters - - - build_docker: - filters: - # tags filters and branch filters are applied disjunctively, so we - # will still build tags not on develop (i.e. including tagged - # releases on master that we specifically want to build) - <<: *tags_filters - - - release_dev: - requires: - - test - - test_integration - - test_js - filters: - branches: - only: develop - - - release: - requires: - - test - - test_integration - - test_js - filters: - <<: *tags_filters - branches: - ignore: /.*/ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..2532e5d86 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.pb.go linguist-generated +yarn.lock linguist-generated diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f2f9ab2e7..87cd84f0b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,10 +1,18 @@ # Contributing to `burrow`: -Forked from Docker's [contributing guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) +Forked from Docker's [contributing guidelines](https://github.com/docker/docker/blob/main/CONTRIBUTING.md) ## Developer Certificate of Origin Please always include "signed-off-by" in your commit message and note this constitutes a developer certification you are contributing a patch under Apache 2.0. Please find a verbatim copy of the Developer Certificate of Origin in this repository [here](.github/DEVELOPER_CERTIFICATE_OF_ORIGIN.md) or on [developercertificate.org](https://developercertificate.org/). +## Branches and releases + +All development happens on 'main'. Any other branches should be considered temporary and should have a corresponding pull request where they are the source to help keep track of them. Such branches can be marked WIP/draft. + +There is a special branch called 'prereleae' that is solely used to trigger a build of the JS library and docker images with a special prerelease tag based on the commit hash. This can be triggered by force pushing to 'prerelease'. If you would like a prerelease build please ask a maintainer (via an issue or on https://chat.hyperledger.org/channel/burrow) to force push for you. Since this branch may be overwritten at any time it should never be the only home for durable changes. + +Commits tagged with a 'v'-prefixed semver tag like `v0.11.1` are official releases and will trigger builds of binaries, JS library, and docker images in CI. We will try to make these regularly but will sometimes batch up a few changes and dependency upgrades (particularly Tendermint). + ## Bug Reporting A great way to contribute to the project is to send a detailed report when you encounter an issue. We always appreciate a well-written, thorough bug report, and will thank you for it! @@ -17,15 +25,15 @@ Our [ISSUE_TEMPLATE.md](ISSUE_TEMPLATE.md) will autopopulate the new issue. ## Contribution Tips and Guidelines -### Pull requests are always welcome (to `develop` rather than `master`). +### Pull requests are always welcome (always based on the `main` branch) -Not sure if that typo is worth a pull request? Found a bug and know how to fix it? Do it! We will appreciate it. Any significant improvement should be documented as a GitHub issue or discussed in [The Marmot Den](https://slack.monax.io) Slack community prior to beginning. +Not sure if that typo is worth a pull request? Found a bug and know how to fix it? Do it! We will appreciate it. We are always thrilled to receive pull requests (and bug reports!) and we do our best to process them quickly. ## Conventions -Fork the repository and make changes on your fork in a feature branch (branched from develop), create an issue outlining your feature or a bug, or use an open one. +Fork the repository and make changes on your fork in a feature branch, create an issue outlining your feature or a bug, or use an open one. If it's a bug fix branch, name it something-XXXX where XXXX is the number of the issue. If it's a feature branch, create an enhancement issue to announce your intentions, and name it something-XXXX where XXXX is the number of the issue. @@ -42,11 +50,9 @@ Commit messages must start with a short summary (max. 50 chars) written in the i Code review comments may be added to your pull request. Discuss, then make the suggested modifications and push additional commits to your feature branch. -Pull requests must be cleanly rebased on top of develop without multiple branches mixed into the PR. +Pull requests must be cleanly rebased on top of main without multiple branches mixed into the PR. -*Git tip:* If your PR no longer merges cleanly, use `git rebase develop` in your feature branch to update your pull request rather than merge develop. - -Before you make a pull request, squash your commits into logical units of work using `git rebase -i` and `git push -f`. A logical unit of work is a consistent set of patches that should be reviewed together: for example, upgrading the version of a vendored dependency and taking advantage of its now available new feature constitute two separate units of work. Implementing a new function and calling it in another file constitute a single logical unit of work. The very high majority of submissions should have a single commit, so if in doubt: squash down to one. +*Git tip:* If your PR no longer merges cleanly, use `git rebase main` in your feature branch to update your pull request rather than merge main. After every commit, make sure the test suite passes. Include documentation changes in the same pull request so that a revert would remove all traces of the feature or fix. @@ -54,10 +60,6 @@ After every commit, make sure the test suite passes. Include documentation chang We use LGTM (Looks Good To Me) in commands on the code review to indicate acceptance. -## Errors and Log Messages Style - -TODO - ## Coding Style Unless explicitly stated, we follow all coding guidelines from the Go community. While some of these standards may seem arbitrary, they somehow seem to result in a solid, consistent codebase. @@ -68,7 +70,7 @@ It is possible that the code base does not currently comply with these guideline * All code should follow the guidelines covered in [Effective Go](https://golang.org/doc/effective_go.html) and [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments). * Comment the code. Tell us the why, the history and the context. * Document all declarations and methods, even private ones. Declare expectations, caveats and anything else that may be important. If a type gets exported, having the comments already there will ensure it's ready. -* Variable name length should be proportional to it's context and no longer. noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo. In practice, short methods will have short variable names and globals will have longer names. +* Variable name length should be proportional to its context and no longer. noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo. In practice, short methods will have short variable names and globals will have longer names. * No underscores in package names. If you need a compound name, step back, and re-examine why you need a compound name. If you still think you need a compound name, lose the underscore. * No utils or helpers packages. If a function is not general enough to warrant its own package, it has not been written generally enough to be a part of a `util` package. Just leave it unexported and well-documented. * All tests should run with `go test` and outside tooling should not be required. No, we don't need another unit testing framework. Assertion packages are acceptable if they provide real incremental value. diff --git a/.circleci/Dockerfile b/.github/Dockerfile similarity index 85% rename from .circleci/Dockerfile rename to .github/Dockerfile index 240363bed..537e70c53 100644 --- a/.circleci/Dockerfile +++ b/.github/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12.6-alpine3.10 +FROM golang:1.15-alpine3.13 MAINTAINER Monax ENV DOCKER_VERSION "17.12.1-ce" @@ -7,7 +7,7 @@ ENV GORELEASER_VERSION "v0.104.1" # Update remote with 'make push_ci_image' RUN apk add --update --no-cache \ nodejs \ - npm \ + yarn \ netcat-openbsd \ git \ openssh-client \ @@ -21,15 +21,13 @@ RUN apk add --update --no-cache \ docker \ libffi-dev \ openssl-dev \ - python-dev \ + python3-dev \ py-pip -RUN pip install docker-compose +RUN pip3 install docker-compose # get docker client WORKDIR /usr/bin RUN curl -sS -L https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz | tar xz --strip-components 1 docker/docker RUN curl -sS -L https://github.com/goreleaser/goreleaser/releases/download/$GORELEASER_VERSION/goreleaser_Linux_x86_64.tar.gz | tar xz goreleaser -RUN npm install -g mocha -RUN npm install -g mocha-circleci-reporter ENV CI=true # Protobuf builds require being in GOPATH (more or less) but this disables module support by default ENV GO111MODULE=on diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index ffb759270..000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,12 +0,0 @@ -Please include in your bug report: - -- [ ] `burrow version` (docker image tag or branch if built from source) -- [ ] `monax version` (if applicable) -- [ ] `go version` (if applicable) -- [ ] `docker version` (if applicable) -- [ ] operating system details (osx/windows/linux) -- [ ] what you expected to happen -- [ ] what actually happened -- [ ] steps to reproduction - -If issue is a feature request, tell us why this feature is useful. diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 000000000..7ca5385b4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,26 @@ +--- +name: Bug Report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the Bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior. + +**Expected Behavior** +A clear and concise description of what you expected to happen. + +**Technical Details** +- [ ] Burrow Version (docker image tag or branch if built from source) +- [ ] Go Version (if applicable) +- [ ] Docker Version (if applicable) +- [ ] Operating System (osx/windows/linux) + +**Additional Context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 000000000..e1c9a09ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,20 @@ +--- +name: Feature Request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 000000000..e139b5584 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,51 @@ +name: main +on: + push: + branches: + - main + +jobs: + cover: + name: coverage + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v1 + with: + go-version: 1.15 + id: go + - uses: actions/checkout@v2 + - run: make test + env: + GO_TEST_ARGS: "-coverprofile=coverage.txt -covermode=atomic" + - uses: codecov/codecov-action@v1.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.txt + + docker: + name: docker + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: make docker_build + - name: publish monax + env: + DOCKER_REPO: "hyperledger/burrow" + DOCKER_REPO_DEV: "quay.io/monax/burrow" + DOCKER_PASS_DEV: ${{ secrets.DOCKER_PASS_DEV }} + DOCKER_USER_DEV: ${{ secrets.DOCKER_USER_DEV }} + run: | + version=$(./scripts/local_version.sh) + echo ${DOCKER_PASS_DEV} | docker login --username ${DOCKER_USER_DEV} ${DOCKER_REPO_DEV} --password-stdin + docker tag ${DOCKER_REPO}:${version} ${DOCKER_REPO_DEV}:${version} + docker push --all-tags ${DOCKER_REPO_DEV} + - name: publish hyperledger + env: + DOCKER_REPO: "hyperledger/burrow" + DOCKER_PASS: ${{ secrets.DOCKER_PASS }} + DOCKER_USER: ${{ secrets.DOCKER_USER }} + run: | + version=$(./scripts/local_version.sh) + echo ${DOCKER_PASS} | docker login --username ${DOCKER_USER} --password-stdin + docker tag ${DOCKER_REPO}:${version} ${DOCKER_REPO}:latest + docker push ${DOCKER_REPO}:latest diff --git a/.github/workflows/prerelease.yaml b/.github/workflows/prerelease.yaml new file mode 100644 index 000000000..5889ff01b --- /dev/null +++ b/.github/workflows/prerelease.yaml @@ -0,0 +1,55 @@ +# Force push to 'prerelease' to get a JS/docker build for testing etc +name: prerelease +on: + push: + branches: + - prerelease + tags-ignore: + - 'v*' + +jobs: + js: + name: npm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: git fetch --unshallow --prune + - uses: actions/setup-node@v1 + with: + always-auth: true + node-version: '14.x' + registry-url: 'https://registry.npmjs.org' + - name: publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + git config --global user.email "${GITHUB_ACTOR}" + git config --global user.name "${GITHUB_ACTOR}" + make publish_js + + docker: + name: docker + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: make docker_build + - name: publish monax + env: + DOCKER_REPO: "hyperledger/burrow" + DOCKER_REPO_DEV: "quay.io/monax/burrow" + DOCKER_PASS_DEV: ${{ secrets.DOCKER_PASS_DEV }} + DOCKER_USER_DEV: ${{ secrets.DOCKER_USER_DEV }} + run: | + version=$(./scripts/local_version.sh) + echo ${DOCKER_PASS_DEV} | docker login --username ${DOCKER_USER_DEV} ${DOCKER_REPO_DEV} --password-stdin + docker tag ${DOCKER_REPO}:${version} ${DOCKER_REPO_DEV}:${version} + docker push --all-tags ${DOCKER_REPO_DEV} + - name: publish hyperledger + env: + DOCKER_REPO: "hyperledger/burrow" + DOCKER_PASS: ${{ secrets.DOCKER_PASS }} + DOCKER_USER: ${{ secrets.DOCKER_USER }} + run: | + version=$(./scripts/local_version.sh) + echo ${DOCKER_PASS} | docker login --username ${DOCKER_USER} --password-stdin + docker push --all-tags ${DOCKER_REPO} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..f238760fa --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,73 @@ +name: release +on: + push: + tags: + - 'v*' + +jobs: + go: + name: goreleaser + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: git fetch --prune --unshallow + - uses: actions/setup-go@v1 + with: + go-version: 1.15 + - uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --release-notes "NOTES.md" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + js: + name: npm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: git fetch --unshallow --prune + - uses: actions/setup-node@v1 + with: + always-auth: true + node-version: '14.x' + registry-url: 'https://registry.npmjs.org' + - name: publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + git config --global user.email "${GITHUB_ACTOR}" + git config --global user.name "${GITHUB_ACTOR}" + make publish_js + + + docker: + name: docker + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: git fetch --unshallow --prune + - run: make docker_build + - name: publish + env: + DOCKER_REPO: "hyperledger/burrow" + DOCKER_USER: ${{ secrets.DOCKER_USER }} + DOCKER_PASS: ${{ secrets.DOCKER_PASS }} + run: | + export tag=$(git tag --points-at HEAD) + echo ${DOCKER_PASS} | docker login --username ${DOCKER_USER} --password-stdin + docker tag ${DOCKER_REPO}:${tag#v} ${DOCKER_REPO}:latest + docker push --all-tags ${DOCKER_REPO} + +# TODO: reinstate +# charts: +# runs-on: ubuntu-latest +# env: +# HELM_USERNAME: ${{ secrets.CM_USERNAME }} +# HELM_PASSWORD: ${{ secrets.CM_PASSWORD }} +# HELM_URL: ${{ secrets.CM_URL }} +# steps: +# - uses: actions/checkout@v2 +# - run: git fetch --unshallow --prune +# - run: make helm_deps +# - run: make helm_push diff --git a/.github/workflows/repolinter.yml b/.github/workflows/repolinter.yml new file mode 100644 index 000000000..04781273a --- /dev/null +++ b/.github/workflows/repolinter.yml @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: Apache-2.0 +# Hyperledger Repolinter Action +name: Repolinter + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + container: hyperledger-tools.jfrog.io/repolinter:0.10.0 + steps: + - name: Checkout Code + uses: actions/checkout@v2 + - name: Lint Repo + continue-on-error: true + run: bundle exec /app/bin/repolinter.js --rulesetUrl https://raw.githubusercontent.com/hyperledger-labs/hyperledger-community-management-tools/master/repo_structure/repolint.json --format markdown > /repolinter-report.md + - name: Save repolinter-report file + uses: actions/upload-artifact@v2 + with: + name: repolinter-report + path: /repolinter-report.md diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 000000000..7b5a1c223 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,140 @@ +name: test +on: + pull_request: + push: + branches: + - main + +jobs: + unit: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v1 + with: + go-version: 1.15 + id: go + - uses: actions/checkout@v2 + - run: git fetch --unshallow --prune + - run: make test + - run: make build + - uses: actions/upload-artifact@main + with: + name: burrow + path: bin + + integration: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v1 + with: + go-version: 1.15 + id: go + - uses: actions/checkout@v1 + - run: make test_integration + + vent: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: make test_integration_vent_complete + + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: make docker_build + env: + DOCKER_REPO: "hyperledger/burrow" + + keys: + runs-on: ubuntu-latest + needs: unit + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@main + with: + name: burrow + path: bin + - run: chmod +x $(pwd)/bin/* + - name: test + run: | + export PATH=${PATH}:$(pwd)/bin + make test_keys + + truffle: + runs-on: ubuntu-latest + needs: unit + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - uses: actions/download-artifact@main + with: + name: burrow + path: bin + - run: chmod +x $(pwd)/bin/* + - name: test + run: | + export PATH=${PATH}:$(pwd)/bin + make test_truffle + + deploy: + runs-on: ubuntu-latest + needs: unit + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@main + with: + name: burrow + path: bin + - run: chmod +x $(pwd)/bin/* + - name: test + run: | + export PATH=${PATH}:$(pwd)/bin + make test_deploy + + restore: + runs-on: ubuntu-latest + needs: unit + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@main + with: + name: burrow + path: bin + - run: chmod +x $(pwd)/bin/* + - name: test + run: | + export PATH=${PATH}:$(pwd)/bin + make test_restore + + js: + runs-on: ubuntu-latest + needs: unit + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - uses: actions/download-artifact@main + with: + name: burrow + path: bin + - run: chmod +x $(pwd)/bin/* + - name: test + run: | + export PATH=${PATH}:$(pwd)/bin + make yarn_install + make test_js + + charts: + runs-on: ubuntu-latest + env: + CM_USERNAME: ${{ secrets.CM_USERNAME }} + CM_PASSWORD: ${{ secrets.CM_PASSWORD }} + CM_URL: ${{ secrets.CM_URL }} + steps: + - uses: actions/checkout@v2 + - run: git fetch --unshallow --prune + - run: make helm_package diff --git a/.gitignore b/.gitignore index e0afbb022..7af90816d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,8 @@ tests/keys/ .output.json vendor/ node_modules +js/dist + +helm/package +build/ +.pid diff --git a/.goreleaser.yml b/.goreleaser.yml index 0a27677c3..f360875ec 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,16 +1,22 @@ -# This is an example goreleaser.yaml file with some sane defaults. -# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + - go mod tidy builds: - main: ./cmd/burrow env: - - CGO_ENABLED=0 + - CGO_ENABLED=0 ldflags: - - -extldflags "-static" - - -s -w - - -X github.com/hyperledger/burrow/project.commit={{.Commit}} - - -X github.com/hyperledger/burrow/project.date={{.Date}} -archive: - replacements: + - -extldflags "-static" + - -s -w + - -X github.com/hyperledger/burrow/project.commit={{.Commit}} + - -X github.com/hyperledger/burrow/project.date={{.Date}} + goos: + - darwin + - linux + - freebsd + - windows +archives: +- replacements: darwin: Darwin linux: Linux windows: Windows @@ -24,5 +30,5 @@ changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - '^docs:' + - '^test:' \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6daee7dde..afda61cf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,187 @@ # [Hyperledger Burrow](https://github.com/hyperledger/burrow) Changelog +## [0.31.3] - 2020-03-25 +### Fixed +- [Dump] Make load from dump set tx index so BlockAccumulator continuity conditions are met +- [Dump] Improve error messages + + +## [0.31.2] - 2020-03-24 +### Fixed +- [Dump] Stop TxStack EventStream consumer from rejecting events from dump/restored chain because they lack tx Envelopes (as they are intended to to keep dump format minimal) +- [Genesis] Fix hash instability introduced by accidentally removing omitempty from AppHash in genesis + +### Added +- [Vent] Implement throttling on Ethereum Vent consumer via --max-request-rate= flag to 'vent start' + + +## [0.31.1] - 2020-03-19 +### Changed +- [Repo] main branch replaces master as per Hyperledger TSC guidelines + +### Fixed +- [Docker] Make sure default testnet mode works when running docker images +- [Vent] Use appropriately sized database integral types for EVM integer types (i.e. numeric for uint64 and bigger) +- [Vent] Ethereum block consumer now correctly reads to an _inclusive_ block batch end height +- [Web3] Handle integer ChainID for web3 consistently; return hex-encoded numeric value from web3 RPC, also allow overriding of genesis-hash derived ChainID so Burrow can be connected with from metamask + +### Added +- [Build] Build dev docker and JS releases by force pushing to prerelease branch +- [Vent] Expose BlockConsumerConfig to adjust backoff and read characteristics +- [Vent] Add vent-side continuity test over blocks (to double-check exactly once delivery of events) + + +## [0.31.0] - 2020-03-10 +### Changed +- [Tendermint] Upgraded to Tendermint 0.34.3 +- [Docker] Image will now start testnet by default + +### Added +- [Vent] Added support for building Vent SQL tables from Ethereum web3 JSONRPC chains (useful for oracles/state channels with layer 1) +- [Vent] Added Status to healthcheck endpoint on Vent +- [Natives] Implemented ecrecover using btcec (revised key handling) +- [Engine] Implement cross-engine dispatch +- [WASM] Implement cross-engine calls and calls to precompiles +- [WASM] Significantly extend eWASM support and implement functions +- [WASM] Add printing debug functions +- [WASM] Implement CREATE, GETTXGASPRICE, GETBLOCKDIFFICULTY, SELFDESTRUCT eWASM functions (thanks Yoongbok Lee!) +- [WASM/JS] JS library supports deploying WASM code +- [Deploy] Can specify WASM in playbook +- [EVM] Implement CHAINID and DIFFICULTY opcodes +- [Query] PEG query grammar now supports Not ("NOT") and NotEqual ("!=") operators + +### Fixed +- [Deploy] Fix flaky parallel tests +- [EVM] Use correct opcode for create2 (thanks Vitali Grabovski!) +- [ABI] Check length of input before decoding (thanks Tri-stone!) +- [WASM] Constructor argument handling +- [RLP] Incorrect use of offsets for longer bytes strings +- [RLP] Use minimal encoding for length prefixes (no leading zeros) +- [Web3] Generate correct encoding hash for RawTx (ChainID in hash digest but not payload) +- [Web3] Generate canonical weird Ethereum hex +- [State] Fix read concurrency in RWTree (on which state is based) removing need for CallSim lock workaround + +### Security +- Updated elliptic JS dep to 6.5.3 +- Updated lodash to 4.17.19 + + +## [0.30.5] - 2020-07-09 +### Added +- [Vent] Add BytesToHex flag on projection field mappings that causes bytes fields (e.g. bytes32) solidity fields to be hex-encoded and mapped to varchar(64) rather than bytea/blob columns in postgres/sqlite + + +## [0.30.4] - 2020-04-05 +### Added +- [Build] Added Helm chart +- [State] Account now has EVMOpcodeBitset field to support upcoming EVM fixes + +### Fixed +- [JS] Github actions release of JS lib + + +## [0.30.3] - 2020-04-05 +### Added +- [CLI] Made previously internal Solidity Go fixtures compilation available through 'burrow compile' +- [TS] Default ts client interface implementation + + +## [0.30.2] - 2020-03-13 +### Fixed +- [RPC] add mutex to callSim and callCode + + +## [0.30.1] - 2020-03-06 +### Fixed +- [CLI/Tx] Unbond formulation now specifies amount + + +## [0.30.0] - 2020-03-05 +### Changed +- [JS] Partial rewrite of client API in typescript + +### Fixed +- [State] Blockchain now commits initial AppHash to avoid IAVL panic + + +## [0.29.8] - 2020-02-11 +### Fixed +- [ABI] Fix failure to convert crypto.Address to EVMAddress (https://github.com/hyperledger/burrow/issues/1326) + + +## [0.29.7] - 2020-01-27 +### Fixed +- [Build] Updates to CI build process + + +## [0.29.6] - 2020-01-22 +### Changed +- [CLI] Burrow dump can now stream to STDOUT + +### Fixed +- [NPM] Burrow-js is now published via an auth token + + +## [0.29.5] - 2019-12-09 +### Security +- [Tendermint] Upgraded to v0.32.8, checkTxAsync now includes node ID + +### Changed +- [Vent] Sync every block height to DB and send height notification from _vent_chain table so downstream can check DB sync without --blocks +- [RPC/Query] GetName now returns GRPC NotFound status (rather than unknown) when a requested key is not set. + +### Fixed +- [Execution] Simulated calls (e.g. query contracts) now returns the height of the state on which the query was run. Useful for downstream sync. + + +## [0.29.4] - 2019-11-22 +### Changed +- [Build] Move to solidity 0.5.12 + + +## [0.29.3] - 2019-10-16 +### Changed +- [NPM] Point package.json to index.js + + +## [0.29.2] - 2019-10-15 +### Changed +- [NPM] Publish with index.js in TLD + + +## [0.29.1] - 2019-10-10 +### Changed +- [State] Split metadata and account state to be kinder to downstream EVM integrators + + +## [0.29.0] - 2019-10-08 +### Changed +- [Config] Reverted rename of ValidatorAddress to Address in config (each Burrow node has a specific validator key it uses for signing whether or not it is running as a validator right now) + +### Fixed +- [EVM] Return integer overflow error code (not stack overflow) for integer overflow errors +- [Docs] Fix broken examples +- [Deploy] Set input on QueryContract jobs correctly +- [EVM] Fix byte-printing for DebugOpcodes run mode +- [Crypto] Use Tendermint-compatible secp256k1 addressing +- [Natives] Make natives first class contracts and establish Dispatcher and Callable as a common calling convention for natives, EVM, and WASM (pending for WASM). +- [Natives] Fix Ethereum precompile addresses (addresses were padded on right instead of the left) + + +### Added +- [Web3] Implemented Ethereum web3 JSON RPC including sendRawTransaction! +- [Docs] Much docs (see also: https://www.hyperledger.org/blog/2019/10/08/burrow-the-boring-blockchain) +- [Docs] Generate github pages docs index with docsify: https://hyperledger.github.io/burrow/ +- [JS] Publish burrow.js to @hyperledger/burrow +- [State] Store EVM ABI and contract metadata on-chain see [GetMetadata](https://github.com/hyperledger/burrow/blob/e80aad5d8fac1f67dbfec61ea75670f9a38c61a1/protobuf/rpcquery.proto#L25) +- [Tendermint] Upgrade to v0.32.3 +- [Execution] Added IdentifyTx for introducing nodes (binding their NodeID to ValidatorAddress) +- [Natives] Implement Ethereum precompile number 5 - modular exponentiation + + + ## [0.28.2] - 2019-08-21 ### Fixed -- [Vent] The new decode event ABI _before_ filter provides more keys but means vent must have access to all possible LogEvent ABIs when it is started. This is not practical in general so we now will will only err if an event matches but we have no ABI. This means we might not notice we have forgot to include an ABI since an event that _would_ have matched on an ABI spec field (prefixed 'Event') will not just not match, and so fail silently. +- [Vent] The new decode event ABI _before_ filter provides more keys but means vent must have access to all possible LogEvent ABIs when it is started. This is not practical in general so we now will will only err if an event matches but we have no ABI. This means we might not notice we have forgot to include an ABI since an event that _would_ have matched on an ABI spec field (prefixed 'Event') will not just not match, and so fail silently. ## [0.28.1] - 2019-08-21 @@ -66,7 +246,7 @@ - [Consensus] Tendermint config CreateEmptyBlocks, CreateEmptyBlocksInterval now work as intended and prevent empty blocks being produced (except when needed for proof purposes) or when the interval expires (when set) ### Added -- [Dump] burrow dump now has local variant that produces a dump directly from a compatible burrow directory rather than over GRPC. If dumping/restoring between state-incompatible versions use burrow dump remote. +- [Dump] burrow dump now has local variant that produces a dump directly from a compatible burrow directory rather than over GRPC. If dumping/restoring between state-incompatible versions use burrow dump remote. ## [0.26.0] - 2019-06-14 @@ -107,7 +287,7 @@ ### Added - [CLI] Introduced burrow configure --pool for generation of multiple validator configs suitable for running on a single (or many) machines - [CLI] Burrow deploy can now run multiple burrow deploy files (aka playbooks) and run them in parallel -- [Consensus] Now possible to run Burrow without Tendermint in 'NoConsensus' mode by setting Tendermint.Enabled = false for faster local testing. Execution.TimeoutFactor can be used to control how regularly Burrow commits (and is used +- [Consensus] Now possible to run Burrow without Tendermint in 'NoConsensus' mode by setting Tendermint.Enabled = false for faster local testing. Execution.TimeoutFactor can be used to control how regularly Burrow commits (and is used ### Fixed - [Execution] Fixed uint64 underflow (when subtracting fee from balance) not protected against in CallContext @@ -123,7 +303,7 @@ - [CLI] Introduced burrow configure --pool for generation of multiple validator configs suitable for running on a single (or many) machines ### Fixed -- [Metrics] Fix histogram statistics by making counts cumulative +- [Metrics] Fix histogram statistics by making counts cumulative ## [0.24.5] - 2019-03-14 @@ -212,7 +392,7 @@ - [Deploy] burrow deploy can use key names where addresses are used - [Governance] Added threshold-based governance via Proposal mechanism which allows entities with Root permission to propose and vote on batches of transactions to be executed on a running network with no single entity being able to do so. - [Governance] Added command line and query introspection of proposals as well as burrow deploy support -- [Vent] Merged Vent our SQL projection and mapping layer into the Burrow repository and binary via 'burrow vent'. See [Vent Readme](./vent/README.md) +- [Vent] Merged Vent our SQL projection and mapping layer into the Burrow repository and binary via 'burrow vent'. See [Vent Readme](./vent/vent.md) - [State] Improved read-write separation with RWTree and ImmutableForest data structures - [State] Implemented dump/restore to port state between different version of Burrow or to compress the execution of a chain (with a proof) onto a fresh chain @@ -552,6 +732,25 @@ This release marks the start of Eris-DB as the full permissioned blockchain node - [Blockchain] Fix getBlocks to respect block height cap. +[0.31.3]: https://github.com/hyperledger/burrow/compare/v0.31.2...v0.31.3 +[0.31.2]: https://github.com/hyperledger/burrow/compare/v0.31.1...v0.31.2 +[0.31.1]: https://github.com/hyperledger/burrow/compare/v0.31.0...v0.31.1 +[0.31.0]: https://github.com/hyperledger/burrow/compare/v0.30.5...v0.31.0 +[0.30.5]: https://github.com/hyperledger/burrow/compare/v0.30.4...v0.30.5 +[0.30.4]: https://github.com/hyperledger/burrow/compare/v0.30.3...v0.30.4 +[0.30.3]: https://github.com/hyperledger/burrow/compare/v0.30.2...v0.30.3 +[0.30.2]: https://github.com/hyperledger/burrow/compare/v0.30.1...v0.30.2 +[0.30.1]: https://github.com/hyperledger/burrow/compare/v0.30.0...v0.30.1 +[0.30.0]: https://github.com/hyperledger/burrow/compare/v0.29.8...v0.30.0 +[0.29.8]: https://github.com/hyperledger/burrow/compare/v0.29.7...v0.29.8 +[0.29.7]: https://github.com/hyperledger/burrow/compare/v0.29.6...v0.29.7 +[0.29.6]: https://github.com/hyperledger/burrow/compare/v0.29.5...v0.29.6 +[0.29.5]: https://github.com/hyperledger/burrow/compare/v0.29.4...v0.29.5 +[0.29.4]: https://github.com/hyperledger/burrow/compare/v0.29.3...v0.29.4 +[0.29.3]: https://github.com/hyperledger/burrow/compare/v0.29.2...v0.29.3 +[0.29.2]: https://github.com/hyperledger/burrow/compare/v0.29.1...v0.29.2 +[0.29.1]: https://github.com/hyperledger/burrow/compare/v0.29.0...v0.29.1 +[0.29.0]: https://github.com/hyperledger/burrow/compare/v0.28.2...v0.29.0 [0.28.2]: https://github.com/hyperledger/burrow/compare/v0.28.1...v0.28.2 [0.28.1]: https://github.com/hyperledger/burrow/compare/v0.28.0...v0.28.1 [0.28.0]: https://github.com/hyperledger/burrow/compare/v0.27.0...v0.28.0 diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000000000..9ec6bdf14 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Burrow maintainers +* @hyperledger/burrow-maintainers diff --git a/Dockerfile b/Dockerfile index d32045404..559cb5030 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ # For solc binary -FROM ethereum/solc:0.4.25 as solc-builder +FROM ethereum/solc:0.5.12 as solc-builder # We use a multistage build to avoid bloating our deployment image with build dependencies -FROM golang:1.12.0-alpine3.9 as builder +FROM golang:1.15-alpine3.12 as builder -RUN apk add --no-cache --update git bash make +RUN apk add --no-cache --update git bash make musl-dev gcc libc6-compat ARG REPO=/src/burrow COPY . $REPO @@ -13,7 +13,7 @@ WORKDIR $REPO RUN make build # This will be our base container image -FROM alpine:3.9 +FROM alpine:3.11 # Variable arguments to populate labels ARG USER=burrow @@ -31,9 +31,11 @@ LABEL org.label-schema.vcs-url="https://github.com/hyperledger/burrow" ENV BURROW_PATH /home/$USER RUN addgroup -g 101 -S $USER && adduser -S -D -u 1000 $USER $USER WORKDIR $BURROW_PATH +ADD --chown=$USER /testnet/ $BURROW_PATH # Copy binaries built in previous stage COPY --from=builder /src/burrow/bin/burrow $INSTALL_BASE/ +COPY --from=builder /src/burrow/bin/burrow-debug $INSTALL_BASE/ COPY --from=solc-builder /usr/bin/solc $INSTALL_BASE/ # Expose ports for 26656:peer; 26658:info; 10997:grpc @@ -43,3 +45,4 @@ EXPOSE 10997 USER $USER:$USER ENTRYPOINT [ "burrow" ] +CMD [ "start" ] diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 000000000..7b2d7bdce --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,29 @@ +Maintainers +=========== + +**Active Maintainers** + +| Name | GitHub | email +|------|--------|------------------- +| Greg Hill | gregdhill | +| Sean Young | seanyoung | +| Casey Kuhlman | compleatang | +| Silas Davis | silasdavis | +| Pierrick Hymbert | phymbert | + +**Emeritus** + +| Name | GitHub | email +|------|--------|------------------- +| Benjamin Bollen | benjaminbollen | +| Dennis Mckinnon | dennismckinnon | +| Ethan Buchman | ebuchman | + +**Future Maintainers** + +| Name | GitHub | email +|------|--------|------------------- +| Matias Díaz | madiazp | +| Sean Blucker | smblucker | + + diff --git a/Makefile b/Makefile index 3a4171e8b..1bceec498 100644 --- a/Makefile +++ b/Makefile @@ -10,26 +10,21 @@ # ---------------------------------------------------------- -SHELL := /bin/bash +SHELL := /usr/bin/env bash REPO := $(shell pwd) -GOFILES := $(shell go list -f "{{.Dir}}" ./...) -PACKAGES := $(shell go list ./... ) - -# Protobuf generated go files -PROTO_FILES = $(shell find . -path ./vendor -prune -o -path ./.gopath_bos -prune -o -type f -name '*.proto' -print) -PROTO_GO_FILES = $(patsubst %.proto, %.pb.go, $(PROTO_FILES)) -PROTO_GO_FILES_REAL = $(shell find . -path ./vendor -prune -o -type f -name '*.pb.go' -print) # Our own Go files containing the compiled bytecode of solidity files as a constant -SOLIDITY_FILES = $(shell find . -path ./vendor -prune -o -path ./tests -prune -o -type f -name '*.sol' -print) -SOLIDITY_GO_FILES = $(patsubst %.sol, %.sol.go, $(SOLIDITY_FILES)) -SOLANG_FILES = $(shell find . -path ./vendor -prune -o -path ./tests -prune -o -type f -name '*.solang' -print) -SOLANG_GO_FILES = $(patsubst %.solang, %.solang.go, $(SOLANG_FILES)) -CI_IMAGE="hyperledger/burrow:ci" +export CI_IMAGE=hyperledger/burrow:ci-2 -GOPATH?=${HOME}/go -BIN_PATH?=${GOPATH}/bin +VERSION := $(shell scripts/version.sh) +# Gets implicit default GOPATH if not set +GOPATH?=$(shell go env GOPATH) +BIN_PATH?=$(GOPATH)/bin +HELM_PATH?=helm/package +HELM_PACKAGE=$(HELM_PATH)/burrow-$(VERSION).tgz +ARCH?=linux-amd64 +PID_DIR=.pid export GO111MODULE=on @@ -40,26 +35,26 @@ export GO111MODULE=on .PHONY: check check: @echo "Checking code for formatting style compliance." - @gofmt -l -d ${GOFILES} - @gofmt -l ${GOFILES} | read && echo && echo "Your marmot has found a problem with the formatting style of the code." 1>&2 && exit 1 || true + @gofmt -l -d $(shell go list -f "{{.Dir}}" ./...) + @gofmt -l $(shell go list -f "{{.Dir}}" ./...) | read && echo && echo "Your marmot has found a problem with the formatting style of the code." 1>&2 && exit 1 || true # Just fix it .PHONY: fix fix: - @goimports -l -w ${GOFILES} + @goimports -l -w $(shell go list -f "{{.Dir}}" ./...) # fmt runs gofmt -w on the code, modifying any files that do not match # the style guide. .PHONY: fmt fmt: @echo "Correcting any formatting style corrections." - @gofmt -l -w ${GOFILES} + @gofmt -l -w $(shell go list -f "{{.Dir}}" ./...) # lint installs golint and prints recommendations for coding style. lint: @echo "Running lint checks." go get -u github.com/golang/lint/golint - @for file in $(GOFILES); do \ + @for file in $(shell go list -f "{{.Dir}}" ./...); do \ echo; \ golint --set_exit_status $${file}; \ done @@ -69,33 +64,58 @@ lint: .PHONY: vet vet: @echo "Running go vet." - @go vet ${PACKAGES} + @go vet $(shell go list ./... ) # run the megacheck tool for code compliance .PHONY: megacheck megacheck: @go get honnef.co/go/tools/cmd/megacheck - @for pkg in ${PACKAGES}; do megacheck "$$pkg"; done + @for pkg in $(shell go list ./... ); do megacheck "$$pkg"; done # Protobuffing -.PHONY: protobuf_deps -protobuf_deps: - @go get -u github.com/gogo/protobuf/protoc-gen-gogo -# @go get -u github.com/golang/protobuf/protoc-gen-go + +BURROW_TS_PATH = ./js +PROTO_GEN_TS_PATH = ${BURROW_TS_PATH}/proto +NODE_BIN = ${BURROW_TS_PATH}/node_modules/.bin + +# To access Tendermint bundled protobuf files from go module cache +TENDERMINT_MOD?=github.com/tendermint/tendermint +TENDERMINT_VERSION?=$(shell go list -m -f '{{ .Version }}' $(TENDERMINT_MOD)) +TENDERMINT_SRC?=$(shell go env GOMODCACHE)/$(TENDERMINT_MOD)@$(TENDERMINT_VERSION) +TENDERMINT_PROTO?=$(TENDERMINT_SRC)/proto + +PROTO_FILES = $(shell find . $(TENDERMINT_PROTO) -path $(BURROW_TS_PATH) -prune -o -path ./node_modules -prune -o -type f -name '*.proto' -print) +PROTO_GO_FILES = $(patsubst %.proto, %.pb.go, $(PROTO_FILES)) +PROTO_GO_FILES_REAL = $(shell find . -type f -name '*.pb.go' -print) +PROTO_TS_FILES = $(patsubst %.proto, %.pb.ts, $(PROTO_FILES)) + +.PHONY: protobuf +protobuf: $(PROTO_GO_FILES) $(PROTO_TS_FILES) fix # Implicit compile rule for GRPC/proto files (note since pb.go files no longer generated # in same directory as proto file this just regenerates everything %.pb.go: %.proto - protoc -I ./protobuf $< --gogo_out=plugins=grpc:${GOPATH}/src + protoc -I ./protobuf -I $(TENDERMINT_PROTO) $< --gogo_out=${GOPATH}/src --go-grpc_out=${GOPATH}/src + +# Using this: https://github.com/agreatfool/grpc_tools_node_protoc_ts +%.pb.ts: %.proto + mkdir -p $(PROTO_GEN_TS_PATH) + $(NODE_BIN)/grpc_tools_node_protoc -I protobuf -I $(TENDERMINT_PROTO) \ + --plugin="protoc-gen-ts=$(NODE_BIN)/protoc-gen-ts" \ + --js_out="import_style=commonjs,binary:${PROTO_GEN_TS_PATH}" \ + --ts_out="generate_package_definition:${PROTO_GEN_TS_PATH}" \ + --grpc_out="generate_package_definition:${PROTO_GEN_TS_PATH}" \ + $< -.PHONY: protobuf -protobuf: $(PROTO_GO_FILES) +.PHONY: protobuf_deps +protobuf_deps: + @go get -u github.com/gogo/protobuf/protoc-gen-gogo + @cd ${BURROW_TS_PATH} && yarn install --only=dev .PHONY: clean_protobuf clean_protobuf: @rm -f $(PROTO_GO_FILES_REAL) - ### PEG query grammar # This allows us to filter tagged objects with things like (EventID = 'foo' OR Height > 10) AND EventName CONTAINS 'frog' @@ -118,7 +138,7 @@ commit_hash: # build all targets in github.com/hyperledger/burrow .PHONY: build -build: check build_burrow +build: check build_burrow build_burrow_debug # build all targets in github.com/hyperledger/burrow with checks for race conditions .PHONY: build_race @@ -127,24 +147,29 @@ build_race: check build_race_db # build burrow and vent .PHONY: build_burrow build_burrow: commit_hash - go build -ldflags "-extldflags '-static' \ + go build $(BURROW_BUILD_FLAGS) -ldflags "-extldflags '-static' \ -X github.com/hyperledger/burrow/project.commit=$(shell cat commit_hash.txt) \ -X github.com/hyperledger/burrow/project.date=$(shell date '+%Y-%m-%d')" \ - -o ${REPO}/bin/burrow ./cmd/burrow + -o ${REPO}/bin/burrow$(BURROW_BUILD_SUFFIX) ./cmd/burrow # With the sqlite tag - enabling Vent sqlite adapter support, but building a CGO binary .PHONY: build_burrow_sqlite -build_burrow_sqlite: commit_hash - go build -tags sqlite \ - -ldflags "-extldflags '-static' \ - -X github.com/hyperledger/burrow/project.commit=$(shell cat commit_hash.txt) \ - -X github.com/hyperledger/burrow/project.date=$(shell date -I)" \ - -o ${REPO}/bin/burrow-vent-sqlite ./cmd/burrow +build_burrow_sqlite: export BURROW_BUILD_SUFFIX=-vent-sqlite +build_burrow_sqlite: export BURROW_BUILD_FLAGS=-tags sqlite +build_burrow_sqlite: + $(MAKE) build_burrow + +# Builds a binary suitable for delve line-by-line debugging through CGO with optimisations (-N) and inling (-l) disabled +.PHONY: build_burrow_debug +build_burrow_debug: export BURROW_BUILD_SUFFIX=-debug +build_burrow_debug: export BURROW_BUILD_FLAGS=-gcflags "all=-N -l" +build_burrow_debug: + $(MAKE) build_burrow .PHONY: install install: build_burrow mkdir -p ${BIN_PATH} - install -T ${REPO}/bin/burrow ${BIN_PATH}/burrow + install ${REPO}/bin/burrow ${BIN_PATH}/burrow # build burrow with checks for race conditions .PHONY: build_race_db @@ -161,70 +186,105 @@ docker_build: check commit_hash ### Testing github.com/hyperledger/burrow # Solidity fixtures -%.sol.go: %.sol - @go run ./deploy/compile/solgo/main.go $^ - -# Solidity fixtures -%.solang.go: %.solang - @go run ./deploy/compile/solgo/main.go -wasm $^ - .PHONY: solidity -solidity: $(SOLIDITY_GO_FILES) +solidity: $(patsubst %.sol, %.sol.go, $(wildcard ./execution/solidity/*.sol)) build_burrow + +%.sol.go: %.sol + @burrow compile $^ +# Solang fixtures .PHONY: solang -solang: $(SOLANG_GO_FILES) +solang: $(patsubst %.solang, %.solang.go, $(wildcard ./execution/solidity/*.solang) $(wildcard ./execution/wasm/*.solang)) build_burrow + +%.solang.go: %.solang + @burrow compile --wasm $^ # node/js -# -# Install dependency -.PHONY: npm_install -npm_install: - npm install +.PHONY: yarn_install +yarn_install: + @cd ${BURROW_TS_PATH} && yarn install + +# Test .PHONY: test_js -test_js: bin/solc build_burrow - ./tests/scripts/bin_wrapper.sh npm test +test_js: + @cd ${BURROW_TS_PATH} && yarn test -# Test +.PHONY: publish_js +publish_js: + yarn --cwd js install + yarn --cwd js build + yarn --cwd js publish --access public --non-interactive --no-git-tag-version --new-version $(shell ./scripts/local_version.sh) .PHONY: test -test: check bin/solc -# on circleci we might want to limit memory usage through GO_TEST_ARGS +test: check bin/solc bin/solang @tests/scripts/bin_wrapper.sh go test ./... ${GO_TEST_ARGS} -.PHONY: test_cover -test_cover: check bin/solc - @tests/scripts/bin_wrapper.sh go test -coverprofile=c.out ./... ${GO_TEST_ARGS} - @tests/scripts/bin_wrapper.sh go tool cover -html=c.out -o coverage.html - .PHONY: test_keys -test_keys: build_burrow +test_keys: burrow_bin="${REPO}/bin/burrow" tests/keys_server/test.sh +.PHONY: test_truffle +test_truffle: + burrow_bin="${REPO}/bin/burrow" tests/web3/truffle.sh + .PHONY: test_integration_vent test_integration_vent: # Include sqlite adapter with tests - will build with CGO but that's probably fine - go test -v -tags 'integration sqlite' ./vent/... - -.PHONY: test_integration_vent_postgres -test_integration_vent_postgres: - docker-compose run burrow make test_integration_vent + go test -count=1 -v -tags 'integration sqlite' ./vent/... + +.PHONY: test_integration_vent_complete +test_integration_vent_complete: + docker-compose run burrow make test_integration_vent test_integration_vent_ethereum + +.PHONY: test_integration_vent_ethereum +test_integration_vent_ethereum: start_ganache + go test -count=1 -v -tags 'integration !sqlite ethereum' ./vent/... + $(MAKE) stop_ganache + +.PHONY: test_integration_ethereum +test_integration_ethereum: start_ganache + go test -v -tags 'integration ethereum' ./rpc/... + $(MAKE) stop_ganache + +$(PID_DIR)/ganache.pid: + mkdir -p $(PID_DIR) + yarn --cwd vent/test/eth install + @echo "Starting ganache in background..." + { yarn --cwd vent/test/eth ganache & echo $$! > $@; } + @sleep 3 + @echo "Ganache process started (pid at $@)" + +.PHONY: start_ganache +start_ganache: $(PID_DIR)/ganache.pid + +.PHONY: stop_ganache +stop_ganache: $(PID_DIR)/ganache.pid + @kill $(shell cat $<) && echo "Ganache process stopped." && rm $< || rm $< + +# For local debug +.PHONY: postgres +postgres: + docker run -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgres:11-alpine .PHONY: test_restore -test_restore: build_burrow bin/solc +test_restore: @tests/scripts/bin_wrapper.sh tests/dump/test.sh # Go will attempt to run separate packages in parallel + .PHONY: test_integration -test_integration: test_keys test_deploy test_integration_vent_postgres test_restore - @go test -v -tags integration ./integration/... +test_integration: + @go test -count=1 -v -tags integration ./integration/... + +.PHONY: test_integration_all +test_integration_all: test_keys test_deploy test_integration_vent_complete test_restore test_truffle test_integration -.PHONY: test_integration_no_postgres -test_integration_no_postgres: test_keys test_deploy test_integration_vent test_restore - @go test -v -tags integration ./integration/... +.PHONY: test_integration_all_no_postgres +test_integration_all_no_postgres: test_keys test_deploy test_integration_vent test_restore test_truffle test_integration .PHONY: test_deploy -test_deploy: bin/solc build_burrow +test_deploy: @tests/scripts/bin_wrapper.sh tests/deploy.sh bin/solc: ./tests/scripts/deps/solc.sh @@ -232,10 +292,15 @@ bin/solc: ./tests/scripts/deps/solc.sh @tests/scripts/deps/solc.sh bin/solc @touch bin/solc +bin/solang: ./tests/scripts/deps/solang.sh + @mkdir -p bin + @tests/scripts/deps/solang.sh bin/solang + @touch bin/solang + # test burrow with checks for race conditions .PHONY: test_race test_race: build_race - @go test -race ${PACKAGES} + @go test -race $(shell go list ./... ) ### Clean up @@ -249,7 +314,7 @@ clean: # Print version .PHONY: version version: - @go run ./project/cmd/version/main.go + @echo $(VERSION) # Generate full changelog of all release notes CHANGELOG.md: project/history.go project/cmd/changelog/main.go @@ -265,21 +330,12 @@ docs: CHANGELOG.md NOTES.md # Tag the current HEAD commit with the current release defined in # ./project/history.go .PHONY: tag_release -tag_release: test check CHANGELOG.md NOTES.md build +tag_release: test check docs build @scripts/tag_release.sh -.PHONY: release -release: docs check test docker_build - @scripts/is_checkout_dirty.sh || (echo "checkout is dirty so not releasing!" && exit 1) - @scripts/release.sh - -.PHONY: release_dev -release_dev: test docker_build - @scripts/release_dev.sh - .PHONY: build_ci_image build_ci_image: - docker build -t ${CI_IMAGE} -f ./.circleci/Dockerfile . + docker build -t ${CI_IMAGE} -f ./.github/Dockerfile . .PHONY: push_ci_image push_ci_image: build_ci_image @@ -292,3 +348,37 @@ ready_for_pull_request: docs fix staticcheck: go get honnef.co/go/tools/cmd/staticcheck staticcheck ./... + +# Note --set flag currently needs helm 3 version < 3.0.3 https://github.com/helm/helm/issues/3141 - but hopefully they will reintroduce support +bin/helm: + @echo Downloading helm... + mkdir -p bin + curl https://get.helm.sh/helm-v3.0.2-$(ARCH).tar.gz | tar xvzO $(ARCH)/helm > bin/helm && chmod +x bin/helm + + +// TODO: reinstate + +.PHONY: helm_deps +helm_deps: bin/helm + @bin/helm repo add --username "$(HELM_USERNAME)" --password "$(HELM_PASSWORD)" chartmuseum $(HELM_URL) + +.PHONY: helm_test +helm_test: bin/helm + bin/helm dep up helm/burrow + bin/helm lint helm/burrow + +helm_package: $(HELM_PACKAGE) + +$(HELM_PACKAGE): helm_test bin/helm + bin/helm package helm/burrow \ + --version "$(VERSION)" \ + --app-version "$(VERSION)" \ + --set "image.tag=$(VERSION)" \ + --dependency-update \ + --destination helm/package + +.PHONY: helm_push +helm_push: helm_package + @echo pushing helm chart... + @curl -u ${CM_USERNAME}:${CM_PASSWORD} \ + --data-binary "@$(HELM_PACKAGE)" $(CM_URL)/api/charts diff --git a/NOTES.md b/NOTES.md index 996ae961d..fcdbbffe9 100644 --- a/NOTES.md +++ b/NOTES.md @@ -1,3 +1,4 @@ ### Fixed -- [Vent] The new decode event ABI _before_ filter provides more keys but means vent must have access to all possible LogEvent ABIs when it is started. This is not practical in general so we now will will only err if an event matches but we have no ABI. This means we might not notice we have forgot to include an ABI since an event that _would_ have matched on an ABI spec field (prefixed 'Event') will not just not match, and so fail silently. +- [Dump] Make load from dump set tx index so BlockAccumulator continuity conditions are met +- [Dump] Improve error messages diff --git a/README.md b/README.md deleted file mode 100644 index ab037c674..000000000 --- a/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# [Hyperledger Burrow](https://hyperledger.github.io/burrow) - -[![version](https://img.shields.io/github/tag/hyperledger/burrow.svg)](https://github.com/hyperledger/burrow/releases/latest) -[![GoDoc](https://godoc.org/github.com/burrow?status.png)](https://godoc.org/github.com/hyperledger/burrow) -[![license](https://img.shields.io/github/license/hyperledger/burrow.svg)](LICENSE.md) -[![LoC](https://tokei.rs/b1/github/hyperledger/burrow?category=lines)](https://github.com/hyperledger/burrow) -[![codecov](https://codecov.io/gh/hyperledger/burrow/branch/develop/graph/badge.svg)](https://codecov.io/gh/hyperledger/burrow) - -Branch | Linux -----------|------ -| Master | [![Circle CI](https://circleci.com/gh/hyperledger/burrow/tree/master.svg?style=svg)](https://circleci.com/gh/hyperledger/burrow/tree/master) | -| Develop | [![Circle CI (develop)](https://circleci.com/gh/hyperledger/burrow/tree/develop.svg?style=svg)](https://circleci.com/gh/hyperledger/burrow/tree/develop) | - -Hyperledger Burrow is a permissioned Ethereum smart-contract blockchain node. It executes Ethereum EVM smart contract code (usually written in [Solidity](https://solidity.readthedocs.io)) on a permissioned virtual machine. Burrow provides transaction finality and high transaction throughput on a proof-of-stake [Tendermint](https://tendermint.com) consensus engine. - -![burrow logo](docs/assets/burrow.png) - -## What is Burrow - -Hyperledger Burrow is a permissioned blockchain node that executes smart contract code following the Ethereum specification. Burrow is built for a multi-chain universe with application specific optimization in mind. Burrow as a node is constructed out of three main components: the consensus engine, the permissioned Ethereum virtual machine and the rpc gateway. More specifically Burrow consists of the following: - -- **Consensus Engine:** Transactions are ordered and finalised with the Byzantine fault-tolerant Tendermint protocol. The Tendermint protocol provides high transaction throughput over a set of known validators and prevents the blockchain from forking. -- **Application Blockchain Interface (ABCI):** The smart contract application interfaces with the consensus engine over the [ABCI](https://github.com/tendermint/tendermint/abci). The ABCI allows for the consensus engine to remain agnostic from the smart contract application. -- **Smart Contract Application:** Transactions are validated and applied to the application state in the order that the consensus engine has finalised them. The application state consists of all accounts, the validator set and the name registry. Accounts in Burrow have permissions and either contain smart contract code or correspond to a public-private key pair. A transaction that calls on the smart contract code in a given account will activate the execution of that account’s code in a permissioned virtual machine. -- **Permissioned Ethereum Virtual Machine:** This virtual machine is built to observe the Ethereum operation code specification and additionally asserts the correct permissions have been granted. Permissioning is enforced through secure native functions and underlies all smart contract code. An arbitrary but finite amount of gas is handed out for every execution to ensure a finite execution duration - “You don’t need money to play, when you have permission to play”. -- **Application Binary Interface (ABI):** Transactions need to be formulated in a binary format that can be processed by the blockchain node. Current tooling provides functionality to compile, deploy and link solidity smart contracts and formulate transactions to call smart contracts on the chain. -- **API Gateway:** Burrow exposes REST and JSON-RPC endpoints to interact with the blockchain network and the application state through broadcasting transactions, or querying the current state of the application. Websockets allow subscribing to events, which is particularly valuable as the consensus engine and smart contract application can give unambiguously finalised results to transactions within one blocktime of about one second. - -## JavaScript Client - -There is a [JavaScript API](https://github.com/hyperledger/burrow/tree/develop/js) - -## Project Roadmap - -Project information generally updated on a quarterly basis can be found on the [Hyperledger Burrow Wiki](https://wiki.hyperledger.org/display/burrow). - -## Documentation -Burrow getting started documentation is available in the [docs](docs/README.md) directory and in [GoDocs](https://godoc.org/github.com/hyperledger/burrow). - - -## Contribute - -We welcome any and all contributions. Read the [contributing file](.github/CONTRIBUTING.md) for more information on making your first Pull Request to Burrow! - -You can find us on: -- [Hyperledger Chat](https://chat.hyperledger.org) -- [Hyperledger Mailing List](https://lists.hyperledger.org/mailman/listinfo) -- [here on Github](https://github.com/hyperledger/burrow/issues) - -## License - -[Apache 2.0](LICENSE.md) diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..91509aa05 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,12 @@ +# Hyperledger Security Policy + +## Reporting a Security Bug + +If you think you have discovered a security issue in any of the Hyperledger projects, we'd love to hear from you. We will take all security bugs seriously and if confirmed upon investigation we will patch it within a reasonable amount of time and release a public security bulletin discussing the impact and credit the discoverer. + +There are two ways to report a security bug. The easiest is to email a description of the flaw and any related information (e.g. reproduction steps, version) to [security at hyperledger dot org](mailto:security@hyperledger.org). + +The other way is to file a confidential security bug in our [JIRA bug tracking system](https://jira.hyperledger.org). Be sure to set the “Security Level” to “Security issue”. + +The process by which the Hyperledger Security Team handles security bugs is documented further in our [Defect Response page](https://wiki.hyperledger.org/display/HYP/Defect+Response) on our [wiki](https://wiki.hyperledger.org). + diff --git a/acm/account.go b/acm/account.go index 3e0c281bf..f47060161 100644 --- a/acm/account.go +++ b/acm/account.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package acm @@ -29,7 +18,7 @@ import ( var GlobalPermissionsAddress = crypto.Address(binary.Zero160) -func NewAccount(pubKey crypto.PublicKey) *Account { +func NewAccount(pubKey *crypto.PublicKey) *Account { return &Account{ Address: pubKey.GetAddress(), PublicKey: pubKey, @@ -46,7 +35,7 @@ func (acc *Account) GetAddress() crypto.Address { func (acc *Account) AddToBalance(amount uint64) error { if binary.IsUint64SumOverflow(acc.Balance, amount) { - return errors.ErrorCodef(errors.ErrorCodeIntegerOverflow, + return errors.Errorf(errors.Codes.IntegerOverflow, "uint64 overflow: attempt to add %v to the balance of %s", amount, acc.Address) } acc.Balance += amount @@ -55,13 +44,26 @@ func (acc *Account) AddToBalance(amount uint64) error { func (acc *Account) SubtractFromBalance(amount uint64) error { if amount > acc.Balance { - return errors.ErrorCodef(errors.ErrorCodeInsufficientBalance, + return errors.Errorf(errors.Codes.InsufficientBalance, "insufficient funds: attempt to subtract %v from the balance of %s", amount, acc.Address) } acc.Balance -= amount return nil } +// Return bytes of any code-type value that is set. EVM, WASM, or native name +func (acc *Account) Code() []byte { + switch { + case len(acc.EVMCode) > 0: + return acc.EVMCode + case len(acc.WASMCode) > 0: + return acc.WASMCode + case acc.NativeName != "": + return []byte(acc.NativeName) + } + return nil +} + // Conversions // // Using the naming convention is this package of 'As' being diff --git a/acm/account_test.go b/acm/account_test.go index accc7367b..14a8f0e33 100644 --- a/acm/account_test.go +++ b/acm/account_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package acm @@ -63,7 +52,7 @@ func TestMarshalJSON(t *testing.T) { expected := fmt.Sprintf(`{"Address":"%s","PublicKey":{"CurveType":"ed25519","PublicKey":"%s"},`+ `"Sequence":4,"Balance":10,"EVMCode":"3C172D",`+ - `"Permissions":{"Base":{"Perms":"root | send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole","SetBit":""}}}`, + `"Permissions":{"Base":{"Perms":"root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole","SetBit":""}}}`, acc.Address, acc.PublicKey) assert.Equal(t, expected, string(bs)) assert.NoError(t, err) diff --git a/acm/acm.pb.go b/acm/acm.pb.go index fe361fef9..92c5fe0d8 100644 --- a/acm/acm.pb.go +++ b/acm/acm.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -27,20 +28,32 @@ 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 type Account struct { - Address github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address"` - PublicKey crypto.PublicKey `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"PublicKey"` - Sequence uint64 `protobuf:"varint,3,opt,name=Sequence,proto3" json:"Sequence,omitempty"` - Balance uint64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` - EVMCode Bytecode `protobuf:"bytes,5,opt,name=EVMCode,proto3,customtype=Bytecode" json:"EVMCode"` - Permissions permission.AccountPermissions `protobuf:"bytes,6,opt,name=Permissions,proto3" json:"Permissions"` - WASMCode Bytecode `protobuf:"bytes,7,opt,name=WASMCode,proto3,customtype=Bytecode" json:",omitempty"` - CodeHash github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,8,opt,name=CodeHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"-"` - ContractMeta []*ContractMeta `protobuf:"bytes,9,rep,name=ContractMeta,proto3" json:"ContractMeta,omitempty"` - // The metadata is stored in the deployed account. When the deployed account creates new account (from Solidity/EVM), they point to the original deployed - // account where the metadata is stored. This original account is called the forebear. + Address github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address"` + PublicKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` + // Sequence counts the number of transactions that have been accepted from this account + Sequence uint64 `protobuf:"varint,3,opt,name=Sequence,proto3" json:"Sequence,omitempty"` + // The account's current native token balance + Balance uint64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` + // We expect exactly one of EVMCode, WASMCode, and NativeName to be non-empty + // EVM bytecode + EVMCode Bytecode `protobuf:"bytes,5,opt,name=EVMCode,proto3,customtype=Bytecode" json:"EVMCode"` + Permissions permission.AccountPermissions `protobuf:"bytes,6,opt,name=Permissions,proto3" json:"Permissions"` + // WASM bytecode + WASMCode Bytecode `protobuf:"bytes,7,opt,name=WASMCode,proto3,customtype=Bytecode" json:",omitempty"` + // Fully qualified (`.`) name of native contract this for which this account object + // is a sentinel value. Which is to say this account object is a pointer to compiled code and does not contain + // the contract logic in its entirety + NativeName string `protobuf:"bytes,11,opt,name=NativeName,proto3" json:",omitempty"` + // The sha3 hash of the code associated with the account + CodeHash github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,8,opt,name=CodeHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"-"` + // Pointer to the Metadata associated with this account + ContractMeta []*ContractMeta `protobuf:"bytes,9,rep,name=ContractMeta,proto3" json:"ContractMeta,omitempty"` + // The metadata is stored in the deployed account. When the deployed account creates new account + // (from Solidity/EVM), they point to the original deployed account where the metadata is stored. + // This original account is called the forebear. Forebear *github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,10,opt,name=Forebear,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Forebear,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -57,7 +70,7 @@ func (m *Account) XXX_Unmarshal(b []byte) error { } func (m *Account) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -75,11 +88,11 @@ func (m *Account) XXX_DiscardUnknown() { var xxx_messageInfo_Account proto.InternalMessageInfo -func (m *Account) GetPublicKey() crypto.PublicKey { +func (m *Account) GetPublicKey() *crypto.PublicKey { if m != nil { return m.PublicKey } - return crypto.PublicKey{} + return nil } func (m *Account) GetSequence() uint64 { @@ -103,6 +116,13 @@ func (m *Account) GetPermissions() permission.AccountPermissions { return permission.AccountPermissions{} } +func (m *Account) GetNativeName() string { + if m != nil { + return m.NativeName + } + return "" +} + func (m *Account) GetContractMeta() []*ContractMeta { if m != nil { return m.ContractMeta @@ -135,7 +155,7 @@ func (m *ContractMeta) XXX_Unmarshal(b []byte) error { } func (m *ContractMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -174,44 +194,45 @@ func init() { proto.RegisterFile("acm.proto", fileDescriptor_49ed775bc0a6adf6) } func init() { golang_proto.RegisterFile("acm.proto", fileDescriptor_49ed775bc0a6adf6) } var fileDescriptor_49ed775bc0a6adf6 = []byte{ - // 483 bytes of a gzipped FileDescriptorProto + // 498 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xee, 0x35, 0xa6, 0x76, 0xae, 0x19, 0xca, 0x4d, 0x56, 0x06, 0x3b, 0x74, 0x8a, 0x50, 0xe3, - 0x20, 0x20, 0x4b, 0x98, 0xe2, 0x8a, 0xaa, 0x12, 0x14, 0x15, 0x57, 0x2a, 0x82, 0xed, 0x7c, 0x7e, - 0x24, 0x96, 0x62, 0x9f, 0x39, 0x9f, 0x05, 0xfe, 0x27, 0x8c, 0xfc, 0x14, 0xc6, 0x8c, 0x8c, 0x85, - 0x21, 0x42, 0xe9, 0xd6, 0x5f, 0x81, 0x7c, 0xb9, 0x18, 0x87, 0x21, 0x12, 0x30, 0x25, 0xcf, 0xdf, - 0xf7, 0xbe, 0xef, 0x7b, 0xcf, 0xcf, 0xb8, 0x4d, 0x59, 0xe2, 0x65, 0x82, 0x4b, 0x4e, 0x5a, 0x94, - 0x25, 0xdd, 0xc1, 0x34, 0x96, 0xb3, 0x22, 0xf4, 0x18, 0x4f, 0x86, 0x53, 0x3e, 0xe5, 0x43, 0x85, - 0x85, 0xc5, 0x7b, 0x55, 0xa9, 0x42, 0xfd, 0x5b, 0xf7, 0x74, 0x8f, 0x32, 0x10, 0x49, 0x9c, 0xe7, - 0x31, 0x4f, 0xf5, 0x93, 0x0e, 0x13, 0x65, 0x26, 0x35, 0x7e, 0xfc, 0xdd, 0xc0, 0xe6, 0x84, 0x31, - 0x5e, 0xa4, 0x92, 0xbc, 0xc2, 0xe6, 0x24, 0x8a, 0x04, 0xe4, 0xb9, 0x8d, 0x7a, 0xa8, 0xdf, 0xf1, - 0x9f, 0x2e, 0x96, 0xee, 0xde, 0x8f, 0xa5, 0x7b, 0xd2, 0xf0, 0x9c, 0x95, 0x19, 0x88, 0x39, 0x44, - 0x53, 0x10, 0xc3, 0xb0, 0x10, 0x82, 0x7f, 0x1c, 0x6a, 0x41, 0xdd, 0x1b, 0x6c, 0x44, 0xc8, 0x08, - 0xb7, 0x2f, 0x8b, 0x70, 0x1e, 0xb3, 0x17, 0x50, 0xda, 0xfb, 0x3d, 0xd4, 0x3f, 0x7c, 0x7c, 0xdf, - 0xd3, 0xe4, 0x1a, 0xf0, 0x8d, 0xca, 0x24, 0xf8, 0xcd, 0x24, 0x5d, 0x6c, 0x5d, 0xc1, 0x87, 0x02, - 0x52, 0x06, 0x76, 0xab, 0x87, 0xfa, 0x46, 0x50, 0xd7, 0xc4, 0xc6, 0xa6, 0x4f, 0xe7, 0xb4, 0x82, - 0x0c, 0x05, 0x6d, 0x4a, 0xf2, 0x10, 0x9b, 0xcf, 0xaf, 0x2f, 0x4e, 0x79, 0x04, 0xf6, 0x3d, 0x15, - 0xfe, 0x48, 0x87, 0xb7, 0xfc, 0x52, 0x02, 0xe3, 0x11, 0x04, 0x1b, 0x02, 0x39, 0xc3, 0x87, 0x97, - 0xf5, 0x5a, 0x72, 0xfb, 0x40, 0x45, 0x73, 0xbc, 0xc6, 0xaa, 0xf4, 0x4a, 0x1a, 0x2c, 0x9d, 0xb3, - 0xd9, 0x48, 0xc6, 0xd8, 0x7a, 0x33, 0xb9, 0x5a, 0x9b, 0x9a, 0xca, 0xd4, 0xf9, 0xd3, 0xf4, 0x6e, - 0xe9, 0xe2, 0x13, 0x9e, 0xc4, 0x12, 0x92, 0x4c, 0x96, 0x41, 0xcd, 0x27, 0xd7, 0xd8, 0xaa, 0x7e, - 0xcf, 0x69, 0x3e, 0xb3, 0x2d, 0xd5, 0x3b, 0xd6, 0xbd, 0x83, 0xdd, 0xdb, 0x0e, 0xe3, 0x94, 0x8a, - 0xd2, 0x3b, 0x87, 0x4f, 0x95, 0x47, 0x7e, 0xb7, 0x74, 0xd1, 0x20, 0xa8, 0xb5, 0xc8, 0x08, 0x77, - 0x4e, 0x79, 0x2a, 0x05, 0x65, 0xf2, 0x02, 0x24, 0xb5, 0xdb, 0xbd, 0x96, 0xda, 0x7b, 0x75, 0x46, - 0x4d, 0x20, 0xd8, 0xa2, 0x91, 0x97, 0xd8, 0x3a, 0xe3, 0x02, 0x42, 0xa0, 0xc2, 0xc6, 0x2a, 0xce, - 0xa3, 0xbf, 0x7e, 0xf1, 0xb5, 0xc2, 0xd8, 0xf8, 0xfc, 0xc5, 0xdd, 0x3b, 0xbe, 0x41, 0xdb, 0x59, - 0xc8, 0xeb, 0xc6, 0xcc, 0xeb, 0x0b, 0x1b, 0xfd, 0xd3, 0xcc, 0x8d, 0x71, 0xdf, 0xe2, 0x4e, 0x25, - 0x1d, 0x51, 0x49, 0x95, 0xec, 0xfe, 0xff, 0xc8, 0x6e, 0x49, 0x55, 0x77, 0xb8, 0xa9, 0xd5, 0x1d, - 0xb6, 0x83, 0xba, 0xf6, 0x9f, 0x2d, 0x56, 0x0e, 0xfa, 0xb6, 0x72, 0xd0, 0xcd, 0xca, 0x41, 0x3f, - 0x57, 0x0e, 0xfa, 0x7a, 0xeb, 0xa0, 0xc5, 0xad, 0x83, 0xde, 0x3d, 0xd8, 0x6d, 0x49, 0x59, 0x12, - 0x1e, 0xa8, 0x4f, 0xef, 0xc9, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x68, 0x6a, 0xd3, 0xdb, - 0x03, 0x00, 0x00, + 0x14, 0xee, 0x35, 0x69, 0xe3, 0x5c, 0x22, 0x54, 0x4e, 0x0c, 0xa7, 0x0c, 0x8e, 0xe9, 0x14, 0xa1, + 0xd6, 0x46, 0x40, 0x97, 0x30, 0xc5, 0x15, 0x55, 0x25, 0x68, 0x54, 0x5c, 0xa9, 0x08, 0xb6, 0xf3, + 0xf9, 0x29, 0xb1, 0x14, 0xfb, 0xcc, 0xf9, 0x0c, 0x78, 0xe6, 0x4f, 0x30, 0xf2, 0x53, 0x18, 0x33, + 0x32, 0x56, 0x0c, 0x11, 0x4a, 0xb7, 0xfe, 0x0a, 0xe4, 0x8b, 0x63, 0x9c, 0x0e, 0x95, 0xa0, 0x5b, + 0x5e, 0xbe, 0xef, 0x7d, 0xdf, 0xf7, 0xde, 0x3d, 0xe3, 0x36, 0xe3, 0x91, 0x9d, 0x48, 0xa1, 0x04, + 0x69, 0x30, 0x1e, 0xf5, 0x1e, 0x4d, 0xc4, 0x44, 0xe8, 0xda, 0x29, 0x7e, 0xad, 0xa0, 0xde, 0x5e, + 0x02, 0x32, 0x0a, 0xd3, 0x34, 0x14, 0x71, 0xf9, 0x4f, 0x97, 0xcb, 0x3c, 0x51, 0x25, 0xbe, 0xff, + 0x75, 0x07, 0xb7, 0x46, 0x9c, 0x8b, 0x2c, 0x56, 0x64, 0x8c, 0x5b, 0xa3, 0x20, 0x90, 0x90, 0xa6, + 0x14, 0x59, 0x68, 0xd0, 0x75, 0x5f, 0xcc, 0x17, 0xfd, 0xad, 0x5f, 0x8b, 0xfe, 0xc1, 0x24, 0x54, + 0xd3, 0xcc, 0xb7, 0xb9, 0x88, 0x9c, 0x69, 0x9e, 0x80, 0x9c, 0x41, 0x30, 0x01, 0xe9, 0xf8, 0x99, + 0x94, 0xe2, 0xb3, 0x53, 0x0a, 0x96, 0xbd, 0xde, 0x5a, 0x84, 0x38, 0xb8, 0x7d, 0x9e, 0xf9, 0xb3, + 0x90, 0xbf, 0x86, 0x9c, 0x6e, 0x5b, 0x68, 0xd0, 0x79, 0xf6, 0xd0, 0x2e, 0xc9, 0x15, 0xe0, 0xfd, + 0xe5, 0x90, 0x1e, 0x36, 0x2e, 0xe0, 0x63, 0x06, 0x31, 0x07, 0xda, 0xb0, 0xd0, 0xa0, 0xe9, 0x55, + 0x35, 0xa1, 0xb8, 0xe5, 0xb2, 0x19, 0x2b, 0xa0, 0xa6, 0x86, 0xd6, 0x25, 0x79, 0x82, 0x5b, 0xaf, + 0x2e, 0xcf, 0x8e, 0x45, 0x00, 0x74, 0x47, 0xc7, 0xde, 0x2b, 0x63, 0x1b, 0x6e, 0xae, 0x80, 0x8b, + 0x00, 0xbc, 0x35, 0x81, 0x9c, 0xe0, 0xce, 0x79, 0xb5, 0x90, 0x94, 0xee, 0xea, 0x50, 0xa6, 0x5d, + 0x5b, 0x52, 0xb9, 0x8c, 0x1a, 0xcb, 0x6d, 0x16, 0x7a, 0x5e, 0xbd, 0x91, 0x0c, 0xb1, 0xf1, 0x6e, + 0x74, 0xb1, 0x32, 0x6d, 0x69, 0x53, 0xf3, 0xb6, 0xe9, 0xcd, 0xa2, 0x8f, 0x0f, 0x44, 0x14, 0x2a, + 0x88, 0x12, 0x95, 0x7b, 0x15, 0x9f, 0xd8, 0x18, 0x8f, 0x99, 0x0a, 0x3f, 0xc1, 0x98, 0x45, 0x40, + 0x3b, 0x16, 0x1a, 0xb4, 0xdd, 0x07, 0xb7, 0xd8, 0x35, 0x06, 0xb9, 0xc4, 0x46, 0xd1, 0x77, 0xca, + 0xd2, 0x29, 0x35, 0xb4, 0xd7, 0xb0, 0xf4, 0x3a, 0xbc, 0xfb, 0x5d, 0xfc, 0x30, 0x66, 0x32, 0xb7, + 0x4f, 0xe1, 0x4b, 0x91, 0x29, 0xbd, 0x59, 0xf4, 0xd1, 0xa1, 0x57, 0x69, 0x91, 0x23, 0xdc, 0x3d, + 0x16, 0xb1, 0x92, 0x8c, 0xab, 0x33, 0x50, 0x8c, 0xb6, 0xad, 0x86, 0x7e, 0xa1, 0xe2, 0xae, 0xea, + 0x80, 0xb7, 0x41, 0x23, 0x6f, 0xb0, 0x71, 0x22, 0x24, 0xf8, 0xc0, 0x24, 0xc5, 0x3a, 0xce, 0xd3, + 0x7f, 0x3e, 0x91, 0x4a, 0x61, 0xd8, 0xfc, 0xf6, 0xbd, 0xbf, 0xb5, 0x7f, 0x85, 0x36, 0xb3, 0x90, + 0xb7, 0xb5, 0x99, 0x57, 0xb7, 0x78, 0xf4, 0x5f, 0x33, 0xd7, 0xc6, 0x7d, 0x8f, 0xbb, 0x85, 0x74, + 0xc0, 0x14, 0xd3, 0xb2, 0xdb, 0xf7, 0x91, 0xdd, 0x90, 0x2a, 0xee, 0x76, 0x5d, 0xeb, 0xbb, 0x6d, + 0x7b, 0x55, 0xed, 0xbe, 0x9c, 0x2f, 0x4d, 0xf4, 0x73, 0x69, 0xa2, 0xab, 0xa5, 0x89, 0x7e, 0x2f, + 0x4d, 0xf4, 0xe3, 0xda, 0x44, 0xf3, 0x6b, 0x13, 0x7d, 0x78, 0x7c, 0xb7, 0x25, 0xe3, 0x91, 0xbf, + 0xab, 0x3f, 0xd2, 0xe7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x37, 0xf6, 0x93, 0x98, 0xec, 0x03, + 0x00, 0x00, } func (m *Account) 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 } @@ -219,100 +240,131 @@ func (m *Account) Marshal() (dAtA []byte, err error) { } func (m *Account) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Account) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.Address.Size())) - n1, err := m.Address.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 += n1 - dAtA[i] = 0x12 - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.PublicKey.Size())) - n2, err := m.PublicKey.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.NativeName) > 0 { + i -= len(m.NativeName) + copy(dAtA[i:], m.NativeName) + i = encodeVarintAcm(dAtA, i, uint64(len(m.NativeName))) + i-- + dAtA[i] = 0x5a } - i += n2 - if m.Sequence != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.Sequence)) + if m.Forebear != nil { + { + size := m.Forebear.Size() + i -= size + if _, err := m.Forebear.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAcm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 } - if m.Balance != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.Balance)) + if len(m.ContractMeta) > 0 { + for iNdEx := len(m.ContractMeta) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ContractMeta[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAcm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } } - dAtA[i] = 0x2a - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.EVMCode.Size())) - n3, err := m.EVMCode.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.CodeHash.Size() + i -= size + if _, err := m.CodeHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAcm(dAtA, i, uint64(size)) } - i += n3 - dAtA[i] = 0x32 - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.Permissions.Size())) - n4, err := m.Permissions.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + i-- + dAtA[i] = 0x42 + { + size := m.WASMCode.Size() + i -= size + if _, err := m.WASMCode.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAcm(dAtA, i, uint64(size)) } - i += n4 + i-- dAtA[i] = 0x3a - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.WASMCode.Size())) - n5, err := m.WASMCode.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Permissions.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAcm(dAtA, i, uint64(size)) } - i += n5 - dAtA[i] = 0x42 - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.CodeHash.Size())) - n6, err := m.CodeHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + i-- + dAtA[i] = 0x32 + { + size := m.EVMCode.Size() + i -= size + if _, err := m.EVMCode.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAcm(dAtA, i, uint64(size)) } - i += n6 - if len(m.ContractMeta) > 0 { - for _, msg := range m.ContractMeta { - dAtA[i] = 0x4a - i++ - i = encodeVarintAcm(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + i-- + dAtA[i] = 0x2a + if m.Balance != 0 { + i = encodeVarintAcm(dAtA, i, uint64(m.Balance)) + i-- + dAtA[i] = 0x20 + } + if m.Sequence != 0 { + i = encodeVarintAcm(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x18 + } + if m.PublicKey != nil { + { + size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintAcm(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.Forebear != nil { - dAtA[i] = 0x52 - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.Forebear.Size())) - n7, err := m.Forebear.MarshalTo(dAtA[i:]) - if err != nil { + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n7 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i = encodeVarintAcm(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *ContractMeta) 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 } @@ -320,46 +372,59 @@ func (m *ContractMeta) Marshal() (dAtA []byte, err error) { } func (m *ContractMeta) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContractMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.CodeHash.Size())) - n8, err := m.CodeHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n8 - dAtA[i] = 0x12 - i++ - i = encodeVarintAcm(dAtA, i, uint64(m.MetadataHash.Size())) - n9, err := m.MetadataHash.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 += n9 if len(m.Metadata) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Metadata) + copy(dAtA[i:], m.Metadata) i = encodeVarintAcm(dAtA, i, uint64(len(m.Metadata))) - i += copy(dAtA[i:], m.Metadata) + i-- + dAtA[i] = 0x1a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size := m.MetadataHash.Size() + i -= size + if _, err := m.MetadataHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAcm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.CodeHash.Size() + i -= size + if _, err := m.CodeHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintAcm(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func encodeVarintAcm(dAtA []byte, offset int, v uint64) int { + offset -= sovAcm(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 (m *Account) Size() (n int) { if m == nil { @@ -369,8 +434,10 @@ func (m *Account) Size() (n int) { _ = l l = m.Address.Size() n += 1 + l + sovAcm(uint64(l)) - l = m.PublicKey.Size() - n += 1 + l + sovAcm(uint64(l)) + if m.PublicKey != nil { + l = m.PublicKey.Size() + n += 1 + l + sovAcm(uint64(l)) + } if m.Sequence != 0 { n += 1 + sovAcm(uint64(m.Sequence)) } @@ -395,6 +462,10 @@ func (m *Account) Size() (n int) { l = m.Forebear.Size() n += 1 + l + sovAcm(uint64(l)) } + l = len(m.NativeName) + if l > 0 { + n += 1 + l + sovAcm(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -422,14 +493,7 @@ func (m *ContractMeta) Size() (n int) { } func sovAcm(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozAcm(x uint64) (n int) { return sovAcm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -525,6 +589,9 @@ func (m *Account) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.PublicKey == nil { + m.PublicKey = &crypto.PublicKey{} + } if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -768,16 +835,45 @@ func (m *Account) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NativeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAcm + } + 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 ErrInvalidLengthAcm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAcm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NativeName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAcm(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthAcm - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthAcm } if (iNdEx + skippy) > l { @@ -926,10 +1022,7 @@ func (m *ContractMeta) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthAcm - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthAcm } if (iNdEx + skippy) > l { @@ -948,6 +1041,7 @@ func (m *ContractMeta) Unmarshal(dAtA []byte) error { func skipAcm(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -979,10 +1073,8 @@ func skipAcm(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1003,55 +1095,30 @@ func skipAcm(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthAcm } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthAcm - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAcm - } - 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 := skipAcm(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthAcm - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAcm + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthAcm + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthAcm = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAcm = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthAcm = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAcm = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAcm = fmt.Errorf("proto: unexpected end of group") ) diff --git a/acm/acmstate/memory_state.go b/acm/acmstate/memory_state.go index 300163792..4fb698fc8 100644 --- a/acm/acmstate/memory_state.go +++ b/acm/acmstate/memory_state.go @@ -1,11 +1,11 @@ package acmstate import ( - "fmt" - "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/permission" ) type MemoryState struct { @@ -19,7 +19,11 @@ var _ IterableReaderWriter = &MemoryState{} // Get an in-memory state IterableReader func NewMemoryState() *MemoryState { return &MemoryState{ - Accounts: make(map[crypto.Address]*acm.Account), + Accounts: map[crypto.Address]*acm.Account{ + acm.GlobalPermissionsAddress: { + Permissions: permission.DefaultAccountPermissions, + }, + }, Storage: make(map[crypto.Address]map[binary.Word256][]byte), Metadata: make(map[MetadataHash]string), } @@ -31,7 +35,7 @@ func (ms *MemoryState) GetAccount(address crypto.Address) (*acm.Account, error) func (ms *MemoryState) UpdateAccount(updatedAccount *acm.Account) error { if updatedAccount == nil { - return fmt.Errorf("UpdateAccount passed nil account in MemoryState") + return errors.Errorf(errors.Codes.IllegalWrite, "UpdateAccount passed nil account in MemoryState") } ms.Accounts[updatedAccount.GetAddress()] = updatedAccount return nil @@ -52,15 +56,16 @@ func (ms *MemoryState) RemoveAccount(address crypto.Address) error { } func (ms *MemoryState) GetStorage(address crypto.Address, key binary.Word256) ([]byte, error) { - storage, ok := ms.Storage[address] + _, ok := ms.Accounts[address] if !ok { - return []byte{}, fmt.Errorf("could not find storage for account %s", address) + return nil, errors.Errorf(errors.Codes.NonExistentAccount, + "could not get storage for non-existent account: %v", address) } - value, ok := storage[key] + storage, ok := ms.Storage[address] if !ok { - return []byte{}, fmt.Errorf("could not find key %x for account %s", key, address) + return nil, nil } - return value, nil + return storage[key], nil } func (ms *MemoryState) SetStorage(address crypto.Address, key binary.Word256, value []byte) error { diff --git a/acm/acmstate/metadata_cache.go b/acm/acmstate/metadata_cache.go new file mode 100644 index 000000000..34fdb8308 --- /dev/null +++ b/acm/acmstate/metadata_cache.go @@ -0,0 +1,78 @@ +package acmstate + +import ( + "sync" +) + +type metadataInfo struct { + metadata string + updated bool +} + +type MetadataCache struct { + backend MetadataReader + m sync.Map +} + +func NewMetadataCache(backend MetadataReader) *MetadataCache { + return &MetadataCache{ + backend: backend, + } +} + +func (cache *MetadataCache) SetMetadata(metahash MetadataHash, metadata string) error { + cache.m.Store(metahash, &metadataInfo{updated: true, metadata: metadata}) + return nil +} + +func (cache *MetadataCache) GetMetadata(metahash MetadataHash) (string, error) { + metaInfo, err := cache.getMetadata(metahash) + if err != nil { + return "", err + } + + return metaInfo.metadata, nil +} + +// Syncs changes to the backend in deterministic order. Sends storage updates before updating +// the account they belong so that storage values can be taken account of in the update. +func (cache *MetadataCache) Sync(st MetadataWriter) error { + var err error + cache.m.Range(func(key, value interface{}) bool { + hash := key.(MetadataHash) + info := value.(*metadataInfo) + if info.updated { + err = st.SetMetadata(hash, info.metadata) + if err != nil { + return false + } + } + return true + }) + if err != nil { + return err + } + return nil +} + +func (cache *MetadataCache) Reset(backend MetadataReader) { + cache.backend = backend + cache.m = sync.Map{} +} + +// Get the cache accountInfo item creating it if necessary +func (cache *MetadataCache) getMetadata(metahash MetadataHash) (*metadataInfo, error) { + value, ok := cache.m.Load(metahash) + if !ok { + metadata, err := cache.backend.GetMetadata(metahash) + if err != nil { + return nil, err + } + metaInfo := &metadataInfo{ + metadata: metadata, + } + cache.m.Store(metahash, metaInfo) + return metaInfo, nil + } + return value.(*metadataInfo), nil +} diff --git a/acm/acmstate/state.go b/acm/acmstate/state.go index d32b56ce1..b7ba23f21 100644 --- a/acm/acmstate/state.go +++ b/acm/acmstate/state.go @@ -1,10 +1,13 @@ package acmstate import ( + "fmt" + "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" + "golang.org/x/crypto/sha3" + "github.com/hyperledger/burrow/permission" "github.com/tmthrgd/go-hex" ) @@ -36,7 +39,7 @@ func (ch MetadataHash) String() string { } func GetMetadataHash(metadata string) (metahash MetadataHash) { - hash := sha3.NewKeccak256() + hash := sha3.NewLegacyKeccak256() hash.Write([]byte(metadata)) copy(metahash[:], hash.Sum(nil)) return @@ -107,14 +110,14 @@ type StorageIterable interface { IterateStorage(address crypto.Address, consumer func(key binary.Word256, value []byte) error) (err error) } -type MetadataGetter interface { +type MetadataReader interface { // Get an Metadata by its hash. This is content-addressed GetMetadata(metahash MetadataHash) (string, error) } -type MetadataSetter interface { +type MetadataWriter interface { // Set an Metadata according to it keccak-256 hash. - SetMetadata(metahash MetadataHash, Metadata string) error + SetMetadata(metahash MetadataHash, metadata string) error } type AccountStats struct { @@ -132,7 +135,6 @@ type AccountStatsGetter interface { type Reader interface { AccountGetter StorageGetter - MetadataGetter } type Iterable interface { @@ -155,7 +157,6 @@ type IterableStatsReader interface { type Writer interface { AccountUpdater StorageSetter - MetadataSetter } // Read and write account and storage state @@ -164,26 +165,25 @@ type ReaderWriter interface { Writer } +type MetadataReaderWriter interface { + MetadataReader + MetadataWriter +} + type IterableReaderWriter interface { Iterable Reader Writer } -func GlobalPermissionsAccount(getter AccountGetter) *acm.Account { +// Get global permissions from the account at GlobalPermissionsAddress +func GlobalAccountPermissions(getter AccountGetter) (permission.AccountPermissions, error) { acc, err := getter.GetAccount(acm.GlobalPermissionsAddress) if err != nil { - panic("Could not get global permission account, but this must exist") + return permission.AccountPermissions{}, err } - return acc -} - -// Get global permissions from the account at GlobalPermissionsAddress -func GlobalAccountPermissions(getter AccountGetter) permission.AccountPermissions { - if getter == nil { - return permission.AccountPermissions{ - Roles: []string{}, - } + if acc == nil { + return permission.AccountPermissions{}, fmt.Errorf("global permissions account is not defined but must be") } - return GlobalPermissionsAccount(getter).Permissions + return acc.Permissions, nil } diff --git a/acm/acmstate/state_cache.go b/acm/acmstate/state_cache.go index ef069a24d..59e364c64 100644 --- a/acm/acmstate/state_cache.go +++ b/acm/acmstate/state_cache.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package acmstate @@ -30,7 +19,6 @@ type Cache struct { name string backend Reader accounts map[crypto.Address]*accountInfo - metadata map[MetadataHash]*metadataInfo readonly bool } @@ -42,11 +30,6 @@ type accountInfo struct { updated bool } -type metadataInfo struct { - metadata string - updated bool -} - type CacheOption func(*Cache) *Cache // Returns a Cache that wraps an underlying Reader to use on a cache miss, can write to an output Writer @@ -55,7 +38,6 @@ func NewCache(backend Reader, options ...CacheOption) *Cache { cache := &Cache{ backend: backend, accounts: make(map[crypto.Address]*accountInfo), - metadata: make(map[MetadataHash]*metadataInfo), } for _, option := range options { option(cache) @@ -90,10 +72,10 @@ func (cache *Cache) GetAccount(address crypto.Address) (*acm.Account, error) { func (cache *Cache) UpdateAccount(account *acm.Account) error { if account == nil { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "UpdateAccount called with nil account") + return errors.Errorf(errors.Codes.IllegalWrite, "UpdateAccount called with nil account") } if cache.readonly { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, + return errors.Errorf(errors.Codes.IllegalWrite, "UpdateAccount called in a read-only context on account %v", account.GetAddress()) } accInfo, err := cache.get(account.GetAddress()) @@ -103,38 +85,16 @@ func (cache *Cache) UpdateAccount(account *acm.Account) error { accInfo.Lock() defer accInfo.Unlock() if accInfo.removed { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "UpdateAccount on a removed account: %s", account.GetAddress()) + return errors.Errorf(errors.Codes.IllegalWrite, "UpdateAccount on a removed account: %s", account.GetAddress()) } accInfo.account = account.Copy() accInfo.updated = true return nil } -func (cache *Cache) GetMetadata(metahash MetadataHash) (string, error) { - metaInfo, err := cache.getMetadata(metahash) - if err != nil { - return "", err - } - - return metaInfo.metadata, nil -} - -func (cache *Cache) SetMetadata(metahash MetadataHash, metadata string) error { - if cache.readonly { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "SetMetadata called in read-only context on metadata hash: %v", metahash) - } - - cache.Lock() - defer cache.Unlock() - - cache.metadata[metahash] = &metadataInfo{updated: true, metadata: metadata} - - return nil -} - func (cache *Cache) RemoveAccount(address crypto.Address) error { if cache.readonly { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "RemoveAccount called on read-only account %v", address) + return errors.Errorf(errors.Codes.IllegalWrite, "RemoveAccount called on read-only account %v", address) } accInfo, err := cache.get(address) if err != nil { @@ -191,12 +151,12 @@ func (cache *Cache) GetStorage(address crypto.Address, key binary.Word256) ([]by // NOTE: Set value to zero to remove. func (cache *Cache) SetStorage(address crypto.Address, key binary.Word256, value []byte) error { if cache.readonly { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, + return errors.Errorf(errors.Codes.IllegalWrite, "SetStorage called in a read-only context on account %v", address) } accInfo, err := cache.get(address) if accInfo.account == nil { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, + return errors.Errorf(errors.Codes.IllegalWrite, "SetStorage called on an account that does not exist: %v", address) } accInfo.Lock() @@ -205,7 +165,7 @@ func (cache *Cache) SetStorage(address crypto.Address, key binary.Word256, value return err } if accInfo.removed { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "SetStorage on a removed account: %s", address) + return errors.Errorf(errors.Codes.IllegalWrite, "SetStorage on a removed account: %s", address) } accInfo.storage[key] = value accInfo.updated = true @@ -279,14 +239,6 @@ func (cache *Cache) Sync(st Writer) error { accInfo.RUnlock() } - for metahash, metadataInfo := range cache.metadata { - if metadataInfo.updated { - err := st.SetMetadata(metahash, metadataInfo.metadata) - if err != nil { - return err - } - } - } return nil } @@ -298,16 +250,6 @@ func (cache *Cache) Reset(backend Reader) { cache.accounts = make(map[crypto.Address]*accountInfo, len(cache.accounts)) } -// Syncs the Cache to output and Resets it to use backend as Reader -func (cache *Cache) Flush(output Writer, backend Reader) error { - err := cache.Sync(output) - if err != nil { - return err - } - cache.Reset(backend) - return nil -} - func (cache *Cache) String() string { if cache.name == "" { return fmt.Sprintf("StateCache{Length: %v}", len(cache.accounts)) @@ -338,26 +280,3 @@ func (cache *Cache) get(address crypto.Address) (*accountInfo, error) { } return accInfo, nil } - -// Get the cache accountInfo item creating it if necessary -func (cache *Cache) getMetadata(metahash MetadataHash) (*metadataInfo, error) { - cache.RLock() - metaInfo := cache.metadata[metahash] - cache.RUnlock() - if metaInfo == nil { - cache.Lock() - defer cache.Unlock() - metaInfo = cache.metadata[metahash] - if metaInfo == nil { - metadata, err := cache.backend.GetMetadata(metahash) - if err != nil { - return nil, err - } - metaInfo = &metadataInfo{ - metadata: metadata, - } - cache.metadata[metahash] = metaInfo - } - } - return metaInfo, nil -} diff --git a/acm/balance/balance.go b/acm/balance/balance.go index e8a927c73..f7ad844e1 100644 --- a/acm/balance/balance.go +++ b/acm/balance/balance.go @@ -2,9 +2,14 @@ package balance import ( "fmt" + "math/big" "sort" ) +var ( + ethInWei = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil) +) + type Balances []Balance func (b Balance) String() string { @@ -125,3 +130,13 @@ func (bs Balances) HasNative() bool { func (bs Balances) HasPower() bool { return bs.Has(TypePower) } + +func NativeToWei(n uint64) *big.Int { + // 1 native unit to 1 ether (wei) + x := new(big.Int).SetUint64(n) + return new(big.Int).Mul(x, ethInWei) +} + +func WeiToNative(x *big.Int) *big.Int { + return new(big.Int).Div(x, ethInWei) +} diff --git a/acm/balance/balance.pb.go b/acm/balance/balance.pb.go index 342618c99..6aa7853a2 100644 --- a/acm/balance/balance.pb.go +++ b/acm/balance/balance.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -23,7 +24,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 type Balance struct { Type Type `protobuf:"varint,1,opt,name=Type,proto3,casttype=Type" json:"Type,omitempty"` @@ -41,7 +42,7 @@ func (m *Balance) XXX_Unmarshal(b []byte) error { } func (m *Balance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -85,26 +86,25 @@ func init() { proto.RegisterFile("balance.proto", fileDescriptor_ee25a00b628521b func init() { golang_proto.RegisterFile("balance.proto", fileDescriptor_ee25a00b628521b1) } var fileDescriptor_ee25a00b628521b1 = []byte{ - // 199 bytes of a gzipped FileDescriptorProto + // 190 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4d, 0x4a, 0xcc, 0x49, - 0xcc, 0x4b, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0xa5, 0x74, 0xd3, - 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, - 0xf2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xf4, 0x29, 0xf9, 0x72, 0xb1, 0x3b, - 0x41, 0x74, 0x0a, 0xc9, 0x70, 0xb1, 0x84, 0x54, 0x16, 0xa4, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, - 0x3a, 0x71, 0xfc, 0xba, 0x27, 0x0f, 0xe6, 0x07, 0x81, 0x49, 0x21, 0x31, 0x2e, 0x36, 0xc7, 0xdc, - 0xfc, 0xd2, 0xbc, 0x12, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x28, 0xcf, 0x8a, 0x67, 0xc6, - 0x02, 0x79, 0x86, 0x09, 0x8b, 0xe4, 0x19, 0x66, 0x2c, 0x92, 0x67, 0x70, 0x72, 0x3e, 0xf1, 0x48, - 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x3c, 0xf0, - 0x58, 0x8e, 0xf1, 0xc4, 0x63, 0x39, 0xc6, 0x28, 0x4d, 0x24, 0x77, 0x65, 0x54, 0x16, 0xa4, 0x16, - 0xe5, 0xa4, 0xa6, 0xa4, 0xa7, 0x16, 0xe9, 0x27, 0x95, 0x16, 0x15, 0xe5, 0x97, 0xeb, 0x27, 0x26, - 0xe7, 0xea, 0x43, 0xbd, 0x90, 0xc4, 0x06, 0x76, 0x9a, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xcb, - 0xf5, 0xf6, 0x66, 0xe3, 0x00, 0x00, 0x00, + 0xcc, 0x4b, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0xa5, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0xc1, 0x62, 0xfa, 0x20, 0x16, 0x44, 0x5a, 0xc9, 0x97, 0x8b, 0xdd, 0x09, 0xa2, + 0x40, 0x48, 0x86, 0x8b, 0x25, 0xa4, 0xb2, 0x20, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0xd7, 0x89, + 0xe3, 0xd7, 0x3d, 0x79, 0x30, 0x3f, 0x08, 0x4c, 0x0a, 0x89, 0x71, 0xb1, 0x39, 0xe6, 0xe6, 0x97, + 0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x04, 0x41, 0x79, 0x56, 0x3c, 0x33, 0x16, 0xc8, + 0x33, 0x4c, 0x58, 0x24, 0xcf, 0x30, 0x63, 0x91, 0x3c, 0x83, 0x93, 0xf3, 0x89, 0x47, 0x72, 0x8c, + 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x81, 0xc7, 0x72, + 0x8c, 0x27, 0x1e, 0xcb, 0x31, 0x46, 0x69, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, + 0xe7, 0xea, 0x67, 0x54, 0x16, 0xa4, 0x16, 0xe5, 0xa4, 0xa6, 0xa4, 0xa7, 0x16, 0xe9, 0x27, 0x95, + 0x16, 0x15, 0xe5, 0x97, 0xeb, 0x27, 0x26, 0xe7, 0xea, 0x43, 0x5d, 0x9a, 0xc4, 0x06, 0x76, 0x9a, + 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x53, 0xf0, 0x13, 0xca, 0x00, 0x00, 0x00, } func (m *Balance) 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 } @@ -112,34 +112,42 @@ func (m *Balance) Marshal() (dAtA []byte, err error) { } func (m *Balance) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Balance) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Type != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintBalance(dAtA, i, uint64(m.Type)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Amount != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintBalance(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Type != 0 { + i = encodeVarintBalance(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func encodeVarintBalance(dAtA []byte, offset int, v uint64) int { + offset -= sovBalance(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 (m *Balance) Size() (n int) { if m == nil { @@ -160,14 +168,7 @@ func (m *Balance) Size() (n int) { } func sovBalance(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozBalance(x uint64) (n int) { return sovBalance(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -245,10 +246,7 @@ func (m *Balance) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthBalance - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthBalance } if (iNdEx + skippy) > l { @@ -267,6 +265,7 @@ func (m *Balance) Unmarshal(dAtA []byte) error { func skipBalance(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -298,10 +297,8 @@ func skipBalance(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -322,55 +319,30 @@ func skipBalance(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthBalance } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthBalance - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowBalance - } - 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 := skipBalance(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthBalance - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBalance + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthBalance + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthBalance = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowBalance = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthBalance = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBalance = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBalance = fmt.Errorf("proto: unexpected end of group") ) diff --git a/acm/balance/balance_test.go b/acm/balance/balance_test.go index d69157d46..d0159fdae 100644 --- a/acm/balance/balance_test.go +++ b/acm/balance/balance_test.go @@ -20,3 +20,10 @@ func TestSort(t *testing.T) { sort.Sort(balances) assert.Equal(t, sortedBalances, balances) } + +func TestEtherConversion(t *testing.T) { + wei := NativeToWei(1) + assert.Equal(t, wei.String(), "1000000000000000000", "must equal one ether") + native := WeiToNative(wei) + assert.Equal(t, native.Uint64(), uint64(1)) +} diff --git a/acm/private_account.go b/acm/private_account.go index d7593dfa3..d13a88423 100644 --- a/acm/private_account.go +++ b/acm/private_account.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package acm @@ -35,8 +24,8 @@ func (pa *PrivateAccount) GetAddress() crypto.Address { return pa.concretePrivateAccount.Address } -func (pa *PrivateAccount) GetPublicKey() crypto.PublicKey { - return pa.concretePrivateAccount.PublicKey +func (pa *PrivateAccount) GetPublicKey() *crypto.PublicKey { + return &pa.concretePrivateAccount.PublicKey } func (pa *PrivateAccount) Sign(msg []byte) (*crypto.Signature, error) { @@ -89,7 +78,7 @@ func PrivateAccountFromPrivateKey(privateKey crypto.PrivateKey) *PrivateAccount return &PrivateAccount{ concretePrivateAccount: &ConcretePrivateAccount{ PrivateKey: privateKey, - PublicKey: publicKey, + PublicKey: *publicKey, Address: publicKey.GetAddress(), }, } @@ -105,39 +94,34 @@ func SigningAccounts(concretePrivateAccounts []*PrivateAccount) []AddressableSig } // Generates a new account with private key. -func GeneratePrivateAccount() (*PrivateAccount, error) { - privateKey, err := crypto.GeneratePrivateKey(nil, crypto.CurveTypeEd25519) +func GeneratePrivateAccount(ct crypto.CurveType) (*PrivateAccount, error) { + privateKey, err := crypto.GeneratePrivateKey(nil, ct) if err != nil { return nil, err } publicKey := privateKey.GetPublicKey() return ConcretePrivateAccount{ Address: publicKey.GetAddress(), - PublicKey: publicKey, + PublicKey: *publicKey, PrivateKey: privateKey, }.PrivateAccount(), nil } -// Generates a new account with private key from SHA256 hash of a secret -func GeneratePrivateAccountFromSecret(secret string) *PrivateAccount { - privateKey := crypto.PrivateKeyFromSecret(secret, crypto.CurveTypeEd25519) +func privateAccount(privateKey crypto.PrivateKey) *PrivateAccount { publicKey := privateKey.GetPublicKey() return ConcretePrivateAccount{ Address: publicKey.GetAddress(), - PublicKey: publicKey, + PublicKey: *publicKey, PrivateKey: privateKey, }.PrivateAccount() } -func PrivateAccountFromPrivateKeyBytes(privKeyBytes []byte) (*PrivateAccount, error) { - privateKey, err := crypto.PrivateKeyFromRawBytes(privKeyBytes, crypto.CurveTypeEd25519) - if err != nil { - return nil, err - } - publicKey := privateKey.GetPublicKey() - return ConcretePrivateAccount{ - Address: publicKey.GetAddress(), - PublicKey: publicKey, - PrivateKey: privateKey, - }.PrivateAccount(), nil +// Generates a new account with private key from SHA256 hash of a secret +func GeneratePrivateAccountFromSecret(secret string) *PrivateAccount { + return privateAccount(crypto.PrivateKeyFromSecret(secret, crypto.CurveTypeEd25519)) + +} + +func GenerateEthereumAccountFromSecret(secret string) *PrivateAccount { + return privateAccount(crypto.PrivateKeyFromSecret(secret, crypto.CurveTypeSecp256k1)) } diff --git a/acm/validator/bucket.go b/acm/validator/bucket.go index 81ff76b7d..c632e72c2 100644 --- a/acm/validator/bucket.go +++ b/acm/validator/bucket.go @@ -47,7 +47,7 @@ func (vc *Bucket) Power(id crypto.Address) (*big.Int, error) { } // SetPower ensures that validator power would not change too quickly in a single block -func (vc *Bucket) SetPower(id crypto.PublicKey, power *big.Int) (*big.Int, error) { +func (vc *Bucket) SetPower(id *crypto.PublicKey, power *big.Int) (*big.Int, error) { const errHeader = "Bucket.SetPower():" err := checkPower(power) if err != nil { diff --git a/acm/validator/cache.go b/acm/validator/cache.go index c81189950..972d9b3a5 100644 --- a/acm/validator/cache.go +++ b/acm/validator/cache.go @@ -21,7 +21,7 @@ func (vc *Cache) Reset(backend Iterable) { vc.Bucket = NewBucket(backend) } -func (vc *Cache) Flush(output Writer, backend Iterable) error { +func (vc *Cache) Sync(output Writer) error { err := vc.Delta.IterateValidators(func(id crypto.Addressable, power *big.Int) error { _, err := output.SetPower(id.GetPublicKey(), power) return err @@ -29,6 +29,5 @@ func (vc *Cache) Flush(output Writer, backend Iterable) error { if err != nil { return err } - vc.Reset(backend) return nil } diff --git a/acm/validator/ring.go b/acm/validator/ring.go index 33740fa01..f04c09040 100644 --- a/acm/validator/ring.go +++ b/acm/validator/ring.go @@ -7,7 +7,7 @@ import ( "github.com/hyperledger/burrow/crypto" ) -// Ring stores the validator power history in buckets as a riNng buffer. The primary storage is a the difference between +// Ring stores the validator power history in buckets as a ring buffer. The primary storage is a the difference between // each rotation (commit - i.e. block) in 'delta' and the cumulative result of each delta in cum, where the result of // the delta at i is stored in the cum at i+1. For example suppose we have 4 buckets then graphically: // @@ -63,7 +63,7 @@ func (vc *Ring) GetPower(id crypto.Address) *big.Int { return vc.Head().Previous.GetPower(id) } -func (vc *Ring) SetPower(id crypto.PublicKey, power *big.Int) (*big.Int, error) { +func (vc *Ring) SetPower(id *crypto.PublicKey, power *big.Int) (*big.Int, error) { return vc.Head().SetPower(id, power) } diff --git a/acm/validator/set.go b/acm/validator/set.go index 058151999..a6790aeea 100644 --- a/acm/validator/set.go +++ b/acm/validator/set.go @@ -44,12 +44,12 @@ func NewTrimSet() *Set { } // Implements Writer, but will never error -func (vs *Set) SetPower(id crypto.PublicKey, power *big.Int) (*big.Int, error) { +func (vs *Set) SetPower(id *crypto.PublicKey, power *big.Int) (*big.Int, error) { return vs.ChangePower(id, power), nil } // Add the power of a validator and returns the flow into that validator -func (vs *Set) ChangePower(id crypto.PublicKey, power *big.Int) *big.Int { +func (vs *Set) ChangePower(id *crypto.PublicKey, power *big.Int) *big.Int { address := id.GetAddress() // Calculate flow into this validator (positive means in, negative means out) flow := vs.Flow(id, power) @@ -78,7 +78,7 @@ func (vs *Set) MaxFlow() *big.Int { } // Returns the flow that would be induced by a validator power change -func (vs *Set) Flow(id crypto.PublicKey, power *big.Int) *big.Int { +func (vs *Set) Flow(id *crypto.PublicKey, power *big.Int) *big.Int { return new(big.Int).Sub(power, vs.GetPower(id.GetAddress())) } diff --git a/acm/validator/set_test.go b/acm/validator/set_test.go index 18a44ccba..c56baa9ab 100644 --- a/acm/validator/set_test.go +++ b/acm/validator/set_test.go @@ -20,6 +20,6 @@ func TestValidators_AlterPower(t *testing.T) { assertZero(t, vs.TotalPower()) } -func pubKey(secret interface{}) crypto.PublicKey { +func pubKey(secret interface{}) *crypto.PublicKey { return acm.NewAccountFromSecret(fmt.Sprintf("%v", secret)).PublicKey } diff --git a/acm/validator/validator.go b/acm/validator/validator.go index c428e9be7..eaa09e4a7 100644 --- a/acm/validator/validator.go +++ b/acm/validator/validator.go @@ -9,7 +9,7 @@ import ( "github.com/hyperledger/burrow/acm" ) -func New(publicKey crypto.PublicKey, power *big.Int) *Validator { +func New(publicKey *crypto.PublicKey, power *big.Int) *Validator { v := &Validator{ PublicKey: publicKey, Power: power.Uint64(), @@ -38,10 +38,11 @@ func (v *Validator) GetAddress() crypto.Address { } func FromAccount(acc *acm.Account, power uint64) *Validator { - address := acc.GetAddress() + pubKey := acc.GetPublicKey() + address, _ := crypto.AddressFromBytes(pubKey.TendermintAddress().Bytes()) return &Validator{ Address: &address, - PublicKey: acc.GetPublicKey(), + PublicKey: pubKey, Power: power, } } diff --git a/acm/validator/validator.pb.go b/acm/validator/validator.pb.go index e8987c611..32610e800 100644 --- a/acm/validator/validator.pb.go +++ b/acm/validator/validator.pb.go @@ -5,7 +5,9 @@ package validator import ( fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -24,11 +26,11 @@ 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 type Validator struct { Address *github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address,omitempty"` - PublicKey crypto.PublicKey `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"PublicKey"` + PublicKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` Power uint64 `protobuf:"varint,3,opt,name=Power,proto3" json:"Power,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -41,16 +43,21 @@ func (*Validator) Descriptor() ([]byte, []int) { return fileDescriptor_bf1c6ec7c0d80dd5, []int{0} } func (m *Validator) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Validator.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Validator.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *Validator) XXX_Merge(src proto.Message) { xxx_messageInfo_Validator.Merge(m, src) } func (m *Validator) XXX_Size() int { - return xxx_messageInfo_Validator.Size(m) + return m.Size() } func (m *Validator) XXX_DiscardUnknown() { xxx_messageInfo_Validator.DiscardUnknown(m) @@ -58,11 +65,11 @@ func (m *Validator) XXX_DiscardUnknown() { var xxx_messageInfo_Validator proto.InternalMessageInfo -func (m *Validator) GetPublicKey() crypto.PublicKey { +func (m *Validator) GetPublicKey() *crypto.PublicKey { if m != nil { return m.PublicKey } - return crypto.PublicKey{} + return nil } func (m *Validator) GetPower() uint64 { @@ -84,24 +91,91 @@ func init() { proto.RegisterFile("validator.proto", fileDescriptor_bf1c6ec7c0d80 func init() { golang_proto.RegisterFile("validator.proto", fileDescriptor_bf1c6ec7c0d80dd5) } var fileDescriptor_bf1c6ec7c0d80dd5 = []byte{ - // 238 bytes of a gzipped FileDescriptorProto + // 231 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x4b, 0xcc, 0xc9, 0x4c, 0x49, 0x2c, 0xc9, 0x2f, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x48, - 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, - 0xeb, 0x83, 0x55, 0x24, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0x29, 0xc5, 0x93, - 0x5c, 0x54, 0x59, 0x50, 0x02, 0xe5, 0x29, 0xad, 0x62, 0xe4, 0xe2, 0x0c, 0x83, 0x19, 0x25, 0xe4, - 0xc5, 0xc5, 0xee, 0x98, 0x92, 0x52, 0x94, 0x5a, 0x5c, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe3, - 0x64, 0x70, 0xeb, 0x9e, 0xbc, 0x0e, 0x92, 0xf9, 0x19, 0x95, 0x05, 0xa9, 0x45, 0x39, 0xa9, 0x29, - 0xe9, 0xa9, 0x45, 0xfa, 0x49, 0xa5, 0x45, 0x45, 0xf9, 0xe5, 0xfa, 0x50, 0xe3, 0xa0, 0xfa, 0x82, - 0x60, 0x06, 0x08, 0x99, 0x72, 0x71, 0x06, 0x94, 0x26, 0xe5, 0x64, 0x26, 0x7b, 0xa7, 0x56, 0x4a, - 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x09, 0xea, 0x41, 0x15, 0xc3, 0x25, 0x9c, 0x58, 0x4e, 0xdc, - 0x93, 0x67, 0x08, 0x42, 0xa8, 0x14, 0x12, 0xe1, 0x62, 0x0d, 0xc8, 0x2f, 0x4f, 0x2d, 0x92, 0x60, - 0x56, 0x60, 0xd4, 0x60, 0x09, 0x82, 0x70, 0xac, 0x58, 0x66, 0x2c, 0x90, 0x67, 0x70, 0xb2, 0xbd, - 0xf1, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x03, 0x8f, 0xe5, 0x18, 0x4f, 0x3c, 0x96, 0x63, - 0x8c, 0xd2, 0xc6, 0xef, 0xb6, 0xc4, 0xe4, 0x5c, 0x7d, 0x78, 0x40, 0x25, 0xb1, 0x81, 0xbd, 0x6c, - 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xcf, 0xfa, 0x61, 0xd2, 0x4d, 0x01, 0x00, 0x00, + 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x45, 0xf5, 0x41, 0x2c, 0x88, 0x02, 0x29, 0x9e, 0xe4, 0xa2, + 0xca, 0x82, 0x12, 0x28, 0x4f, 0x69, 0x09, 0x23, 0x17, 0x67, 0x18, 0x4c, 0x87, 0x90, 0x17, 0x17, + 0xbb, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x8f, 0x93, 0xc1, + 0xad, 0x7b, 0xf2, 0x3a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x19, + 0x95, 0x05, 0xa9, 0x45, 0x39, 0xa9, 0x29, 0xe9, 0xa9, 0x45, 0xfa, 0x49, 0xa5, 0x45, 0x45, 0xf9, + 0xe5, 0xfa, 0x50, 0xe3, 0xa0, 0xfa, 0x82, 0x60, 0x06, 0x08, 0xe9, 0x73, 0x71, 0x06, 0x94, 0x26, + 0xe5, 0x64, 0x26, 0x7b, 0xa7, 0x56, 0x4a, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x09, 0xea, 0x41, + 0x15, 0xc3, 0x25, 0x82, 0x10, 0x6a, 0x84, 0x44, 0xb8, 0x58, 0x03, 0xf2, 0xcb, 0x53, 0x8b, 0x24, + 0x98, 0x15, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x2b, 0x96, 0x19, 0x0b, 0xe4, 0x19, 0x9c, 0x5c, + 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, + 0x18, 0x0f, 0x3c, 0x96, 0x63, 0x3c, 0xf1, 0x58, 0x8e, 0x31, 0x4a, 0x1b, 0xbf, 0xeb, 0x12, 0x93, + 0x73, 0xf5, 0xe1, 0x21, 0x92, 0xc4, 0x06, 0xf6, 0xb4, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xd4, + 0x46, 0xd6, 0x6e, 0x36, 0x01, 0x00, 0x00, +} + +func (m *Validator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Validator) MarshalTo(dAtA []byte) (int, error) { + 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 m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Power != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x18 + } + if m.PublicKey != nil { + { + size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Address != nil { + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintValidator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintValidator(dAtA []byte, offset int, v uint64) int { + offset -= sovValidator(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} func (m *Validator) Size() (n int) { if m == nil { return 0 @@ -112,8 +186,10 @@ func (m *Validator) Size() (n int) { l = m.Address.Size() n += 1 + l + sovValidator(uint64(l)) } - l = m.PublicKey.Size() - n += 1 + l + sovValidator(uint64(l)) + if m.PublicKey != nil { + l = m.PublicKey.Size() + n += 1 + l + sovValidator(uint64(l)) + } if m.Power != 0 { n += 1 + sovValidator(uint64(m.Power)) } @@ -124,15 +200,233 @@ func (m *Validator) Size() (n int) { } func sovValidator(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozValidator(x uint64) (n int) { return sovValidator(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *Validator) 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 ErrIntOverflowValidator + } + 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: Validator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Validator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_hyperledger_burrow_crypto.Address + m.Address = &v + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthValidator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthValidator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PublicKey == nil { + m.PublicKey = &crypto.PublicKey{} + } + if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) + } + m.Power = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Power |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipValidator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthValidator + } + 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 skipValidator(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowValidator + } + 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, ErrIntOverflowValidator + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowValidator + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthValidator + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupValidator + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthValidator + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthValidator = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowValidator = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupValidator = fmt.Errorf("proto: unexpected end of group") +) diff --git a/acm/validator/validators.go b/acm/validator/validators.go index ff614d910..8a3c6d796 100644 --- a/acm/validator/validators.go +++ b/acm/validator/validators.go @@ -7,7 +7,7 @@ import ( ) type Writer interface { - SetPower(id crypto.PublicKey, power *big.Int) (flow *big.Int, err error) + SetPower(id *crypto.PublicKey, power *big.Int) (flow *big.Int, err error) } type Reader interface { @@ -38,7 +38,7 @@ type History interface { Validators(blocksAgo int) IterableReader } -func AddPower(vs ReaderWriter, id crypto.PublicKey, power *big.Int) error { +func AddPower(vs ReaderWriter, id *crypto.PublicKey, power *big.Int) error { // Current power + power currentPower, err := vs.Power(id.GetAddress()) if err != nil { @@ -48,7 +48,7 @@ func AddPower(vs ReaderWriter, id crypto.PublicKey, power *big.Int) error { return err } -func SubtractPower(vs ReaderWriter, id crypto.PublicKey, power *big.Int) error { +func SubtractPower(vs ReaderWriter, id *crypto.PublicKey, power *big.Int) error { currentPower, err := vs.Power(id.GetAddress()) if err != nil { return err diff --git a/bcm/bcm.pb.go b/bcm/bcm.pb.go index 4b02315fb..46c0808c2 100644 --- a/bcm/bcm.pb.go +++ b/bcm/bcm.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" time "time" _ "github.com/gogo/protobuf/gogoproto" @@ -29,10 +30,10 @@ 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 SyncInfo struct { - LatestBlockHeight uint64 `protobuf:"varint,1,opt,name=LatestBlockHeight,proto3" json:""` + LatestBlockHeight uint64 `protobuf:"varint,1,opt,name=LatestBlockHeight,proto3" json:"LatestBlockHeight,omitempty"` LatestBlockHash github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,2,opt,name=LatestBlockHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"LatestBlockHash"` LatestAppHash github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,3,opt,name=LatestAppHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"LatestAppHash"` // Timestamp of block as set by the block proposer @@ -57,7 +58,7 @@ func (m *SyncInfo) XXX_Unmarshal(b []byte) error { } func (m *SyncInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -128,7 +129,7 @@ func (m *PersistedState) XXX_Unmarshal(b []byte) error { } func (m *PersistedState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -174,41 +175,40 @@ func init() { proto.RegisterFile("bcm.proto", fileDescriptor_0c9ff3e1ca1cc0f1) } func init() { golang_proto.RegisterFile("bcm.proto", fileDescriptor_0c9ff3e1ca1cc0f1) } var fileDescriptor_0c9ff3e1ca1cc0f1 = []byte{ - // 437 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x3d, 0x8f, 0x94, 0x40, - 0x18, 0xc7, 0x6f, 0x76, 0xf1, 0x72, 0xce, 0xf9, 0x12, 0xc7, 0x98, 0xe0, 0x16, 0xb0, 0x5e, 0x45, - 0x23, 0x24, 0x67, 0xac, 0xac, 0x8e, 0x98, 0x78, 0x9a, 0x8b, 0x31, 0xec, 0xa9, 0x89, 0x16, 0x06, - 0xd8, 0x67, 0x61, 0x72, 0x0b, 0x43, 0x66, 0x86, 0x28, 0xdf, 0xc2, 0xd2, 0x8f, 0x63, 0xb9, 0x85, - 0x85, 0xa5, 0xb1, 0x58, 0x0d, 0xd7, 0xf9, 0x15, 0x6c, 0x0c, 0x03, 0x44, 0xe0, 0x2e, 0x31, 0xeb, - 0x76, 0x3c, 0x6f, 0x3f, 0xe6, 0xf9, 0x3f, 0x7f, 0x7c, 0x35, 0x08, 0x13, 0x3b, 0xe3, 0x4c, 0x32, - 0x32, 0x0e, 0xc2, 0x64, 0x72, 0x3f, 0xa2, 0x32, 0xce, 0x03, 0x3b, 0x64, 0x89, 0x13, 0xb1, 0x88, - 0x39, 0xaa, 0x16, 0xe4, 0x0b, 0x15, 0xa9, 0x40, 0x7d, 0xd5, 0x33, 0x13, 0x33, 0x62, 0x2c, 0x5a, - 0xc2, 0xdf, 0x2e, 0x49, 0x13, 0x10, 0xd2, 0x4f, 0xb2, 0xa6, 0xc1, 0x18, 0x36, 0xcc, 0x73, 0xee, - 0x4b, 0xca, 0xd2, 0xba, 0x7e, 0xf0, 0x7b, 0x8c, 0xf7, 0x66, 0x45, 0x1a, 0x3e, 0x4d, 0x17, 0x8c, - 0x1c, 0xe2, 0x5b, 0x27, 0xbe, 0x04, 0x21, 0xdd, 0x25, 0x0b, 0xcf, 0x8e, 0x81, 0x46, 0xb1, 0xd4, - 0xd1, 0x14, 0x59, 0x9a, 0xab, 0xfd, 0x5a, 0x9b, 0x3b, 0xde, 0xc5, 0x32, 0x79, 0x87, 0x6f, 0x76, - 0x93, 0xbe, 0x88, 0xf5, 0xd1, 0x14, 0x59, 0xd7, 0xdc, 0x87, 0xab, 0xb5, 0xb9, 0xf3, 0x7d, 0x6d, - 0x76, 0x37, 0x8a, 0x8b, 0x0c, 0xf8, 0x12, 0xe6, 0x11, 0x70, 0x27, 0xc8, 0x39, 0x67, 0xef, 0x9d, - 0x80, 0xa6, 0x3e, 0x2f, 0xec, 0x63, 0xf8, 0xe0, 0x16, 0x12, 0x84, 0x37, 0xa4, 0x91, 0xb7, 0xf8, - 0x7a, 0x9d, 0x3a, 0xca, 0x32, 0x85, 0x1f, 0x6f, 0x83, 0xef, 0xb3, 0xc8, 0xf3, 0xde, 0xeb, 0x4f, - 0x69, 0x02, 0xba, 0x36, 0x45, 0xd6, 0xfe, 0xe1, 0xc4, 0xae, 0x85, 0xb3, 0x5b, 0xe1, 0xec, 0xd3, - 0x56, 0x59, 0x77, 0xaf, 0xfa, 0xf5, 0xc7, 0x1f, 0x26, 0xf2, 0x86, 0xc3, 0xe4, 0x15, 0xbe, 0xdd, - 0x49, 0xcd, 0x00, 0x52, 0xc5, 0xbc, 0xb2, 0x01, 0xf3, 0x32, 0x00, 0x79, 0xd9, 0xe3, 0x3e, 0x6e, - 0x6e, 0xa8, 0xef, 0x2a, 0xee, 0xdd, 0x0b, 0xdc, 0xb6, 0xa1, 0xc6, 0x7e, 0x1a, 0x62, 0xdb, 0xf2, - 0xc1, 0x97, 0x11, 0xbe, 0xf1, 0x02, 0xb8, 0xa0, 0x42, 0xc2, 0x7c, 0x26, 0x7d, 0x09, 0xe4, 0x0c, - 0xdf, 0x69, 0xc4, 0x39, 0x5a, 0x48, 0xe0, 0x27, 0x7e, 0x33, 0xa3, 0x7c, 0xf0, 0xdf, 0xb2, 0x5f, - 0xce, 0x24, 0xcf, 0xaa, 0xdb, 0x76, 0xc5, 0x1f, 0x6d, 0x20, 0x54, 0x7f, 0x94, 0x58, 0xd5, 0x29, - 0xfb, 0xd6, 0xad, 0x9c, 0xa2, 0x79, 0xc3, 0x34, 0x79, 0x8d, 0xf7, 0x9f, 0x40, 0x0a, 0x82, 0x0a, - 0xe5, 0x27, 0x6d, 0x9b, 0xc5, 0xba, 0x24, 0xf7, 0xd1, 0xaa, 0x34, 0xd0, 0xd7, 0xd2, 0x40, 0xdf, - 0x4a, 0x03, 0xfd, 0x2c, 0x0d, 0xf4, 0xf9, 0xdc, 0x40, 0xab, 0x73, 0x03, 0xbd, 0xb9, 0xf7, 0x0f, - 0x6a, 0x98, 0x04, 0xbb, 0x6a, 0xd9, 0x07, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x25, 0xfd, 0xe5, - 0xbc, 0x12, 0x04, 0x00, 0x00, + // 428 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x4f, 0x8f, 0x93, 0x40, + 0x18, 0xc6, 0x9d, 0x52, 0x37, 0xeb, 0xac, 0x7f, 0xe2, 0xa8, 0x09, 0xf6, 0x00, 0x75, 0x4f, 0x1c, + 0x14, 0x12, 0x8d, 0x27, 0x4f, 0x4b, 0x4c, 0x5c, 0xcd, 0xc6, 0x98, 0x76, 0xd5, 0x44, 0x0f, 0x06, + 0xe8, 0x5b, 0x98, 0x6c, 0x61, 0xc8, 0xcc, 0x10, 0xe5, 0x5b, 0x78, 0xf4, 0xe3, 0x78, 0xec, 0xc1, + 0x83, 0x47, 0xe3, 0xa1, 0x1a, 0xfa, 0x19, 0xbc, 0x1b, 0x06, 0x48, 0x80, 0x36, 0x31, 0xb5, 0x37, + 0xe6, 0x7d, 0xde, 0xf7, 0xc7, 0xcc, 0xf3, 0x3e, 0xf8, 0x8a, 0x1f, 0xc4, 0x76, 0xca, 0x99, 0x64, + 0x44, 0xf3, 0x83, 0x78, 0x74, 0x3b, 0x64, 0x21, 0x53, 0x67, 0xa7, 0xfc, 0xaa, 0xa4, 0x91, 0x19, + 0x32, 0x16, 0x2e, 0xc0, 0x51, 0x27, 0x3f, 0x9b, 0x3b, 0x92, 0xc6, 0x20, 0xa4, 0x17, 0xa7, 0x75, + 0x83, 0xd1, 0x6f, 0x98, 0x65, 0xdc, 0x93, 0x94, 0x25, 0x95, 0x7e, 0xfc, 0x47, 0xc3, 0x87, 0xd3, + 0x3c, 0x09, 0x9e, 0x27, 0x73, 0x46, 0xee, 0xe3, 0x9b, 0x67, 0x9e, 0x04, 0x21, 0xdd, 0x05, 0x0b, + 0x2e, 0x4e, 0x81, 0x86, 0x91, 0xd4, 0xd1, 0x18, 0x59, 0xc3, 0xc9, 0xa6, 0x40, 0x3e, 0xe0, 0x1b, + 0xed, 0xa2, 0x27, 0x22, 0x7d, 0x30, 0x46, 0xd6, 0x55, 0xf7, 0xf1, 0x72, 0x65, 0x5e, 0xfa, 0xb9, + 0x32, 0x1f, 0x84, 0x54, 0x46, 0x99, 0x6f, 0x07, 0x2c, 0x76, 0xa2, 0x3c, 0x05, 0xbe, 0x80, 0x59, + 0x08, 0xdc, 0xf1, 0x33, 0xce, 0xd9, 0x47, 0xc7, 0xa7, 0x89, 0xc7, 0x73, 0xfb, 0x14, 0x3e, 0xb9, + 0xb9, 0x04, 0x31, 0xe9, 0xd3, 0xc8, 0x7b, 0x7c, 0xad, 0x2a, 0x9d, 0xa4, 0xa9, 0xc2, 0x6b, 0xfb, + 0xe0, 0xbb, 0x2c, 0xf2, 0xb2, 0x73, 0xfb, 0x73, 0x1a, 0x83, 0x3e, 0x1c, 0x23, 0xeb, 0xe8, 0xe1, + 0xc8, 0xae, 0x2c, 0xb3, 0x1b, 0xcb, 0xec, 0xf3, 0xc6, 0x53, 0xf7, 0xb0, 0xfc, 0xf5, 0xe7, 0x5f, + 0x26, 0x9a, 0xf4, 0x87, 0xc9, 0x1b, 0x7c, 0xab, 0x55, 0x9a, 0x02, 0x24, 0x8a, 0x79, 0x79, 0x07, + 0xe6, 0x36, 0x00, 0x79, 0xdd, 0xe1, 0x3e, 0xad, 0xb7, 0xa7, 0x1f, 0x28, 0xee, 0xdd, 0x0d, 0x6e, + 0xd3, 0x50, 0x61, 0xbf, 0xf4, 0xb1, 0x8d, 0x7c, 0xfc, 0x6d, 0x80, 0xaf, 0xbf, 0x02, 0x2e, 0xa8, + 0x90, 0x30, 0x9b, 0x4a, 0x4f, 0x02, 0xb9, 0xc0, 0x77, 0x6a, 0x73, 0x4e, 0xe6, 0x12, 0xf8, 0x99, + 0x57, 0xcf, 0xa8, 0x04, 0xfc, 0xb7, 0xed, 0xdb, 0x99, 0xe4, 0x45, 0xb9, 0xdb, 0xb6, 0xf9, 0x83, + 0x1d, 0x8c, 0xea, 0x8e, 0x12, 0xab, 0x5c, 0x65, 0x37, 0xb4, 0x9a, 0x0a, 0x6d, 0xbf, 0x4c, 0xde, + 0xe2, 0xa3, 0x67, 0x90, 0x80, 0xa0, 0x42, 0xe5, 0x69, 0xb8, 0xcf, 0xc3, 0xda, 0x24, 0xf7, 0xc9, + 0xb2, 0x30, 0xd0, 0xf7, 0xc2, 0x40, 0x3f, 0x0a, 0x03, 0xfd, 0x2e, 0x0c, 0xf4, 0x75, 0x6d, 0xa0, + 0xe5, 0xda, 0x40, 0xef, 0xee, 0xfd, 0x83, 0x1a, 0xc4, 0xfe, 0x81, 0x7a, 0xec, 0xa3, 0xbf, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x6e, 0x6b, 0x06, 0x93, 0xf3, 0x03, 0x00, 0x00, } func (m *SyncInfo) 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 } @@ -216,65 +216,75 @@ func (m *SyncInfo) Marshal() (dAtA []byte, err error) { } func (m *SyncInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SyncInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.LatestBlockHeight != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintBcm(dAtA, i, uint64(m.LatestBlockHeight)) - } - dAtA[i] = 0x12 - i++ - i = encodeVarintBcm(dAtA, i, uint64(m.LatestBlockHash.Size())) - n1, err := m.LatestBlockHash.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 += n1 - dAtA[i] = 0x1a - i++ - i = encodeVarintBcm(dAtA, i, uint64(m.LatestAppHash.Size())) - n2, err := m.LatestAppHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LatestBlockDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LatestBlockDuration):]) + if err1 != nil { + return 0, err1 } - i += n2 - dAtA[i] = 0x22 - i++ - i = encodeVarintBcm(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.LatestBlockTime))) - n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LatestBlockTime, dAtA[i:]) - if err != nil { - return 0, err + i -= n1 + i = encodeVarintBcm(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x32 + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LatestBlockSeenTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LatestBlockSeenTime):]) + if err2 != nil { + return 0, err2 } - i += n3 + i -= n2 + i = encodeVarintBcm(dAtA, i, uint64(n2)) + i-- dAtA[i] = 0x2a - i++ - i = encodeVarintBcm(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.LatestBlockSeenTime))) - n4, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LatestBlockSeenTime, dAtA[i:]) - if err != nil { - return 0, err + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LatestBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LatestBlockTime):]) + if err3 != nil { + return 0, err3 } - i += n4 - dAtA[i] = 0x32 - i++ - i = encodeVarintBcm(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.LatestBlockDuration))) - n5, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LatestBlockDuration, dAtA[i:]) - if err != nil { - return 0, err + i -= n3 + i = encodeVarintBcm(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x22 + { + size := m.LatestAppHash.Size() + i -= size + if _, err := m.LatestAppHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBcm(dAtA, i, uint64(size)) } - i += n5 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x1a + { + size := m.LatestBlockHash.Size() + i -= size + if _, err := m.LatestBlockHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBcm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.LatestBlockHeight != 0 { + i = encodeVarintBcm(dAtA, i, uint64(m.LatestBlockHeight)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *PersistedState) 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 } @@ -282,53 +292,65 @@ func (m *PersistedState) Marshal() (dAtA []byte, err error) { } func (m *PersistedState) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PersistedState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintBcm(dAtA, i, uint64(m.AppHashAfterLastBlock.Size())) - n6, err := m.AppHashAfterLastBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 - dAtA[i] = 0x12 - i++ - i = encodeVarintBcm(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime))) - n7, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.GenesisHash.Size() + i -= size + if _, err := m.GenesisHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBcm(dAtA, i, uint64(size)) } - i += n7 + i-- + dAtA[i] = 0x22 if m.LastBlockHeight != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintBcm(dAtA, i, uint64(m.LastBlockHeight)) + i-- + dAtA[i] = 0x18 } - dAtA[i] = 0x22 - i++ - i = encodeVarintBcm(dAtA, i, uint64(m.GenesisHash.Size())) - n8, err := m.GenesisHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) + if err4 != nil { + return 0, err4 } - i += n8 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= n4 + i = encodeVarintBcm(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x12 + { + size := m.AppHashAfterLastBlock.Size() + i -= size + if _, err := m.AppHashAfterLastBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBcm(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func encodeVarintBcm(dAtA []byte, offset int, v uint64) int { + offset -= sovBcm(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 (m *SyncInfo) Size() (n int) { if m == nil { @@ -377,14 +399,7 @@ func (m *PersistedState) Size() (n int) { } func sovBcm(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozBcm(x uint64) (n int) { return sovBcm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -608,10 +623,7 @@ func (m *SyncInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthBcm - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthBcm } if (iNdEx + skippy) > l { @@ -780,10 +792,7 @@ func (m *PersistedState) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthBcm - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthBcm } if (iNdEx + skippy) > l { @@ -802,6 +811,7 @@ func (m *PersistedState) Unmarshal(dAtA []byte) error { func skipBcm(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -833,10 +843,8 @@ func skipBcm(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -857,55 +865,30 @@ func skipBcm(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthBcm } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthBcm - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowBcm - } - 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 := skipBcm(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthBcm - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBcm + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthBcm + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthBcm = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowBcm = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthBcm = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBcm = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBcm = fmt.Errorf("proto: unexpected end of group") ) diff --git a/bcm/block_store.go b/bcm/block_store.go index b0781fec8..db98df025 100644 --- a/bcm/block_store.go +++ b/bcm/block_store.go @@ -13,18 +13,22 @@ import ( type BlockStore struct { txDecoder txs.Decoder - state.BlockStoreRPC + state.BlockStore } -func NewBlockStore(blockStore state.BlockStoreRPC) *BlockStore { +func NewBlockStore(blockStore state.BlockStore) *BlockStore { return &BlockStore{ - txDecoder: txs.NewProtobufCodec(), - BlockStoreRPC: blockStore, + txDecoder: txs.NewProtobufCodec(), + BlockStore: blockStore, } } -func NewBlockExplorer(dbBackendType dbm.DBBackendType, dbDir string) *BlockStore { - return NewBlockStore(store.NewBlockStore(dbm.NewDB("blockstore", dbBackendType, dbDir))) +func NewBlockExplorer(dbBackendType dbm.BackendType, dbDir string) (*BlockStore, error) { + db, err := dbm.NewDB("blockstore", dbBackendType, dbDir) + if err != nil { + return nil, fmt.Errorf("could not create BlockExplorer: %w", err) + } + return NewBlockStore(store.NewBlockStore(db)), nil } func (bs *BlockStore) Block(height int64) (_ *Block, err error) { diff --git a/bcm/blockchain.go b/bcm/blockchain.go index 79df4727a..6d210cd7a 100644 --- a/bcm/blockchain.go +++ b/bcm/blockchain.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package bcm @@ -40,10 +29,12 @@ type BlockchainInfo interface { LastCommitDuration() time.Duration LastBlockHash() []byte AppHashAfterLastBlock() []byte - // Gets the BlockHash at a height (or nil if no BlockStore mounted or block could not be found) - BlockHash(height uint64) []byte - // GetBlockHash returns hash of the specific block + // BlockHash gets the hash at a height (or nil if no BlockStore mounted or block could not be found) + BlockHash(height uint64) ([]byte, error) + // GetBlockHeader returns the header at the specified height GetBlockHeader(blockNumber uint64) (*types.Header, error) + // GetNumTxs returns the number of transactions included in a particular block + GetNumTxs(blockNumber uint64) (int, error) } type Blockchain struct { @@ -114,8 +105,10 @@ func GetSyncInfo(blockchain BlockchainInfo) *SyncInfo { } func loadBlockchain(db dbm.DB, genesisDoc *genesis.GenesisDoc) (*Blockchain, error) { - buf := db.Get(stateKey) - if len(buf) == 0 { + buf, err := db.Get(stateKey) + if err != nil { + return nil, err + } else if len(buf) == 0 { return nil, nil } bc, err := decodeBlockchain(buf, genesisDoc) @@ -163,7 +156,10 @@ func (bc *Blockchain) save() error { if err != nil { return err } - bc.db.SetSync(stateKey, encodedState) + err = bc.db.SetSync(stateKey, encodedState) + if err != nil { + return err + } } return nil } @@ -190,7 +186,7 @@ func (bc *Blockchain) GenesisDoc() genesis.GenesisDoc { } func (bc *Blockchain) ChainID() string { - return bc.genesisDoc.ChainID() + return bc.genesisDoc.GetChainID() } func (bc *Blockchain) LastBlockHeight() uint64 { @@ -238,23 +234,39 @@ func (bc *Blockchain) SetBlockStore(bs *BlockStore) { bc.blockStore = bs } -func (bc *Blockchain) BlockHash(height uint64) []byte { +func (bc *Blockchain) BlockHash(height uint64) ([]byte, error) { header, err := bc.GetBlockHeader(height) if err != nil { - return nil + return nil, err } - return header.Hash() + return header.Hash(), nil } -func (bc *Blockchain) GetBlockHeader(height uint64) (*types.Header, error) { - const errHeader = "GetBlockHeader():" +func (bc *Blockchain) getBlockMeta(height uint64) (*types.BlockMeta, error) { + const errHeader = "getBlockMeta():" if bc == nil { return nil, fmt.Errorf("%s could not get block hash because Blockchain has not been given access to "+ "tendermint BlockStore", errHeader) } - blockMeta, err := bc.blockStore.BlockMeta(int64(height)) + return bc.blockStore.BlockMeta(int64(height)) +} + +// GetBlockHeader returns the block header at any given height +func (bc *Blockchain) GetBlockHeader(height uint64) (*types.Header, error) { + const errHeader = "GetBlockHeader():" + blockMeta, err := bc.getBlockMeta(height) if err != nil { return nil, fmt.Errorf("%s could not get BlockMeta: %v", errHeader, err) } return &blockMeta.Header, nil } + +// GetNumTxs returns the number of transactions included in a block +func (bc *Blockchain) GetNumTxs(height uint64) (int, error) { + const errHeader = "GetNumTxs():" + blockMeta, err := bc.getBlockMeta(height) + if err != nil { + return 0, fmt.Errorf("%s could not get BlockMeta: %v", errHeader, err) + } + return blockMeta.NumTxs, nil +} diff --git a/bcm/blockchain_test.go b/bcm/blockchain_test.go index 501b26bbf..fdf10cf71 100644 --- a/bcm/blockchain_test.go +++ b/bcm/blockchain_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/hyperledger/burrow/crypto/sha3" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/logging" "github.com/stretchr/testify/assert" @@ -21,20 +21,20 @@ func TestLoadOrNewBlockchain(t *testing.T) { assert.False(t, exists) assert.Equal(t, genesisDoc.GenesisTime, blockchain.LastBlockTime()) assert.Equal(t, uint64(0), blockchain.LastBlockHeight()) - assert.Equal(t, genesisDoc.Hash(), blockchain.AppHashAfterLastBlock()) + assert.Equal(t, genesisDoc.Hash().Bytes(), blockchain.AppHashAfterLastBlock()) // First block blockTime1 := genesisDoc.GenesisTime.Add(time.Second * 10) - blockHash1 := sha3.Sha3([]byte("blockHash")) - appHash1 := sha3.Sha3([]byte("appHash")) + blockHash1 := crypto.Keccak256([]byte("blockHash")) + appHash1 := crypto.Keccak256([]byte("appHash")) err = blockchain.CommitBlock(blockTime1, blockHash1, appHash1) require.NoError(t, err) assertState(t, blockchain, 1, blockTime1, appHash1) // Second block blockTime2a := blockTime1.Add(time.Second * 30) - blockHash2a := sha3.Sha3(append(blockHash1, 2)) - appHash2a := sha3.Sha3(append(appHash1, 2)) + blockHash2a := crypto.Keccak256(append(blockHash1, 2)) + appHash2a := crypto.Keccak256(append(appHash1, 2)) err = blockchain.CommitBlock(blockTime2a, blockHash2a, appHash2a) require.NoError(t, err) assertState(t, blockchain, 2, blockTime2a, appHash2a) @@ -48,16 +48,16 @@ func TestLoadOrNewBlockchain(t *testing.T) { // Commit (overwriting previous block 2 pointer blockTime2b := blockTime1.Add(time.Second * 30) - blockHash2b := sha3.Sha3(append(blockHash1, 2)) - appHash2b := sha3.Sha3(append(appHash1, 2)) + blockHash2b := crypto.Keccak256(append(blockHash1, 2)) + appHash2b := crypto.Keccak256(append(appHash1, 2)) err = blockchain.CommitBlock(blockTime2b, blockHash2b, appHash2b) require.NoError(t, err) assertState(t, blockchain, 2, blockTime2b, appHash2b) // Commit again to check things are okay blockTime3 := blockTime2b.Add(time.Second * 30) - blockHash3 := sha3.Sha3(append(blockHash2b, 2)) - appHash3 := sha3.Sha3(append(appHash2b, 2)) + blockHash3 := crypto.Keccak256(append(blockHash2b, 2)) + appHash3 := crypto.Keccak256(append(appHash2b, 2)) err = blockchain.CommitBlock(blockTime3, blockHash3, appHash3) require.NoError(t, err) assertState(t, blockchain, 3, blockTime3, appHash3) diff --git a/binary/byteslice.go b/binary/byteslice.go index 286280b32..3824f50d9 100644 --- a/binary/byteslice.go +++ b/binary/byteslice.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package binary diff --git a/binary/integer.go b/binary/integer.go index f2d7b65a9..443ac59a7 100644 --- a/binary/integer.go +++ b/binary/integer.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package binary @@ -21,9 +10,6 @@ import ( var big1 = big.NewInt(1) var Big256 = big.NewInt(256) -var tt256 = new(big.Int).Lsh(big1, 256) -var tt256m1 = new(big.Int).Sub(new(big.Int).Lsh(big1, 256), big1) -var tt255 = new(big.Int).Lsh(big1, 255) // Returns whether a + b would be a uint64 overflow func IsUint64SumOverflow(a, b uint64) bool { @@ -33,29 +19,43 @@ func IsUint64SumOverflow(a, b uint64) bool { // Converts a possibly negative big int x into a positive big int encoding a twos complement representation of x // truncated to 32 bytes func U256(x *big.Int) *big.Int { - // Note that the And operation induces big.Int to hold a positive representation of a negative number - return new(big.Int).And(x, tt256m1) + return ToTwosComplement(x, Word256Bits) } // Interprets a positive big.Int as a 256-bit two's complement signed integer func S256(x *big.Int) *big.Int { - // Sign bit not set, value is its positive self - if x.Cmp(tt255) < 0 { + return FromTwosComplement(x, Word256Bits) +} + +// Convert a possibly negative big.Int x to a positive big.Int encoded in two's complement +func ToTwosComplement(x *big.Int, n uint) *big.Int { + // And treats negative arguments a if they were twos complement encoded so we end up with a positive number here + // with the twos complement bit pattern + return new(big.Int).And(x, andMask(n)) +} + +// Interprets a positive big.Int as a n-bit two's complement signed integer +func FromTwosComplement(x *big.Int, n uint) *big.Int { + signBit := int(n) - 1 + if x.Bit(signBit) == 0 { + // Sign bit not set => value (v) is positive + // x = |v| = v return x } else { - // negative value is represented - return new(big.Int).Sub(x, tt256) + // Sign bit set => value (v) is negative + // x = 2^n - |v| + b := new(big.Int).Lsh(big1, n) + // v = -|v| = x - 2^n + return new(big.Int).Sub(x, b) } } -// Treats the positive big int x as if it contains an embedded a back + 1 byte signed integer in its least significant +// Treats the positive big int x as if it contains an embedded n bit signed integer in its least significant // bits and extends that sign -func SignExtend(back uint64, x *big.Int) *big.Int { - // we assume x contains a signed integer of back + 1 bytes width - // most significant bit of the back'th byte, - signBit := back*8 + 7 +func SignExtend(x *big.Int, n uint) *big.Int { + signBit := n - 1 // single bit set at sign bit position - mask := new(big.Int).Lsh(big1, uint(signBit)) + mask := new(big.Int).Lsh(big1, signBit) // all bits below sign bit set to 1 all above (including sign bit) set to 0 mask.Sub(mask, big1) if x.Bit(int(signBit)) == 1 { @@ -66,3 +66,26 @@ func SignExtend(back uint64, x *big.Int) *big.Int { return x.And(x, mask) } } + +// Reverse bytes in-place +func reverse(bs []byte) []byte { + n := len(bs) - 1 + for i := 0; i < len(bs)/2; i++ { + bs[i], bs[n-i] = bs[n-i], bs[i] + } + return bs +} + +// Note: this function destructively reverses its input slice - pass a copy if the original is used elsewhere +func BigIntFromLittleEndianBytes(bs []byte) *big.Int { + return new(big.Int).SetBytes(reverse(bs)) +} + +func BigIntToLittleEndianBytes(x *big.Int) []byte { + return reverse(x.Bytes()) +} + +func andMask(n uint) *big.Int { + x := new(big.Int) + return x.Sub(x.Lsh(big1, n), big1) +} diff --git a/binary/integer_test.go b/binary/integer_test.go index c0c1533fe..2655ff381 100644 --- a/binary/integer_test.go +++ b/binary/integer_test.go @@ -31,7 +31,6 @@ func zero() *big.Int { var big2E255 = zero().Lsh(big1, 255) var big2E256 = zero().Lsh(big1, 256) -var big2E257 = zero().Lsh(big1, 257) func TestU256(t *testing.T) { expected := big2E255 @@ -90,62 +89,63 @@ func TestS256(t *testing.T) { expected = zero() signed = S256(expected) assertBigIntEqual(t, expected, signed, "Twos complement of zero is fixed poount") - - // Technically undefined but let's not let that stop us - expected = zero().Sub(big2E257, big2E256) - signed = S256(big2E257) - assertBigIntEqual(t, expected, signed, "Out of twos complement bounds") } func TestSignExtend(t *testing.T) { - assertSignExtend(t, 16, 0, + assertSignExtend(t, 16, 8, "0000 0000 1001 0000", "1111 1111 1001 0000") - assertSignExtend(t, 16, 1, + assertSignExtend(t, 16, 16, "1001 0000", "1001 0000") - assertSignExtend(t, 32, 2, + assertSignExtend(t, 32, 24, "0000 0000 1000 0000 1101 0011 1001 0000", "1111 1111 1000 0000 1101 0011 1001 0000") - assertSignExtend(t, 32, 2, + assertSignExtend(t, 32, 24, "0000 0000 0000 0000 1101 0011 1001 0000", "0000 0000 0000 0000 1101 0011 1001 0000") // Here we have a stray bit set in the 4th most significant byte that gets wiped out - assertSignExtend(t, 32, 2, + assertSignExtend(t, 32, 24, "0001 0000 0000 0000 1101 0011 1001 0000", "0000 0000 0000 0000 1101 0011 1001 0000") - assertSignExtend(t, 32, 2, + assertSignExtend(t, 32, 24, "0001 0000 1000 0000 1101 0011 1001 0000", "1111 1111 1000 0000 1101 0011 1001 0000") - assertSignExtend(t, 32, 3, + assertSignExtend(t, 32, 32, "0001 0000 1000 0000 1101 0011 1001 0000", "0001 0000 1000 0000 1101 0011 1001 0000") - assertSignExtend(t, 32, 3, + assertSignExtend(t, 32, 32, "1001 0000 1000 0000 1101 0011 1001 0000", "1001 0000 1000 0000 1101 0011 1001 0000") - assertSignExtend(t, 64, 3, + assertSignExtend(t, 64, 32, "0000 0000 0000 0000 0000 0000 0000 0000 1001 0000 1000 0000 1101 0011 1001 0000", "1111 1111 1111 1111 1111 1111 1111 1111 1001 0000 1000 0000 1101 0011 1001 0000") - assertSignExtend(t, 64, 3, + assertSignExtend(t, 64, 32, "0000 0000 0000 0000 0000 0000 0000 0000 0001 0000 1000 0000 1101 0011 1001 0000", "0000 0000 0000 0000 0000 0000 0000 0000 0001 0000 1000 0000 1101 0011 1001 0000") } -func assertSignExtend(t *testing.T, bitSize int, bytesBack uint64, inputString, expectedString string) bool { - input := intFromString(t, bitSize, inputString) - expected := intFromString(t, bitSize, expectedString) - //actual := SignExtend(big.NewInt(bytesBack), big.NewInt(int64(input))) - actual := SignExtend(bytesBack, big.NewInt(int64(input))) +func TestLittleEndian(t *testing.T) { + x, ok := new(big.Int).SetString("234890234579042368982348972347234789897", 10) + require.True(t, ok) + y := BigIntFromLittleEndianBytes(BigIntToLittleEndianBytes(x)) + require.Equal(t, x.Cmp(y), 0) +} + +func assertSignExtend(t *testing.T, extendedBits int, embeddedBits uint, inputString, expectedString string) bool { + input := intFromString(t, extendedBits, inputString) + expected := intFromString(t, extendedBits, expectedString) + actual := SignExtend(big.NewInt(int64(input)), embeddedBits) var ret bool - switch bitSize { + switch extendedBits { case 8: ret = assert.Equal(t, uint8(expected), uint8(actual.Int64())) case 16: @@ -155,7 +155,7 @@ func assertSignExtend(t *testing.T, bitSize int, bytesBack uint64, inputString, case 64: ret = assert.Equal(t, uint64(expected), uint64(actual.Int64())) default: - t.Fatalf("Cannot test SignExtend for non-Go-native bit size %v", bitSize) + t.Fatalf("Cannot test SignExtend for non-Go-native bit size %v", extendedBits) return false } if !ret { diff --git a/binary/word256.go b/binary/word256.go index 00716ba43..11b5a7bd2 100644 --- a/binary/word256.go +++ b/binary/word256.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package binary @@ -21,7 +10,7 @@ import ( "math/big" "sort" - hex "github.com/tmthrgd/go-hex" + "github.com/tmthrgd/go-hex" ) var ( @@ -29,13 +18,14 @@ var ( One256 = LeftPadWord256([]byte{1}) ) -const Word256Length = 32 +const Word256Bytes = 32 +const Word256Bits = Word256Bytes * 8 -var BigWord256Length = big.NewInt(Word256Length) +var BigWord256Bytes = big.NewInt(Word256Bytes) var trimCutSet = string([]byte{0}) -type Word256 [Word256Length]byte +type Word256 [Word256Bytes]byte func (w *Word256) UnmarshalText(hexBytes []byte) error { bs, err := hex.DecodeString(string(hexBytes)) @@ -109,9 +99,9 @@ func (w *Word256) Unmarshal(data []byte) error { if len(data) == 0 { return nil } - if len(data) != Word256Length { + if len(data) != Word256Bytes { return fmt.Errorf("error unmarshallling Word256 '%X' from bytes: %d bytes but should have %d bytes", - data, len(data), Word256Length) + data, len(data), Word256Bytes) } copy(w[:], data) return nil @@ -125,7 +115,7 @@ func (w *Word256) MarshalTo(data []byte) (int, error) { } func (w Word256) Size() int { - return Word256Length + return Word256Bytes } func Uint64ToWord256(i uint64) (word Word256) { @@ -133,9 +123,24 @@ func Uint64ToWord256(i uint64) (word Word256) { return } -func Int64ToWord256(i int64) (word Word256) { - binary.BigEndian.PutUint64(word[24:], uint64(i)) - return +func Uint64FromWord256(word Word256) uint64 { + return binary.BigEndian.Uint64(word.Postfix(8)) +} + +func Int64ToWord256(i int64) Word256 { + return BigIntToWord256(SignExtend(big.NewInt(i), Word256Bits)) +} + +func Int64FromWord256(word Word256) int64 { + return BigIntFromWord256(word).Int64() +} + +func BigIntToWord256(x *big.Int) Word256 { + return LeftPadWord256(U256(x).Bytes()) +} + +func BigIntFromWord256(word Word256) *big.Int { + return S256(new(big.Int).SetBytes(word[:])) } func RightPadWord256(bz []byte) (word Word256) { @@ -148,14 +153,6 @@ func LeftPadWord256(bz []byte) (word Word256) { return } -func Uint64FromWord256(word Word256) uint64 { - return binary.BigEndian.Uint64(word.Postfix(8)) -} - -func Int64FromWord256(word Word256) int64 { - return int64(Uint64FromWord256(word)) -} - //------------------------------------- type Words256 []Word256 diff --git a/binary/word256_test.go b/binary/word256_test.go index ee0460bfb..7e8bf1e75 100644 --- a/binary/word256_test.go +++ b/binary/word256_test.go @@ -1,12 +1,13 @@ package binary import ( - "testing" - "encoding/json" + "math/big" + "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/tmthrgd/go-hex" ) func TestWord256_UnpadLeft(t *testing.T) { @@ -41,6 +42,21 @@ func TestLeftPadWord256(t *testing.T) { LeftPadWord256([]byte{1, 2, 3})) } +func TestTwosComplement(t *testing.T) { + v := Int64ToWord256(-10) + require.Equal(t, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6", + hex.EncodeUpperToString(v[:])) + + upper, ok := new(big.Int).SetString("32423973453453434237423", 10) + require.True(t, ok) + inc, ok := new(big.Int).SetString("3242397345345343421", 10) + require.True(t, ok) + for i := new(big.Int).Neg(upper); i.Cmp(upper) == -1; i.Add(i, inc) { + v := BigIntFromWord256(BigIntToWord256(i)) + require.True(t, i.Cmp(v) == 0, "expected %d == %d", i, v) + } +} + func TestOne256(t *testing.T) { assert.Equal(t, Int64ToWord256(1), One256) } diff --git a/cmd/burrow/commands/abi.go b/cmd/burrow/commands/abi.go index 4f18c939d..16bd54f58 100644 --- a/cmd/burrow/commands/abi.go +++ b/cmd/burrow/commands/abi.go @@ -26,8 +26,8 @@ func Abi(output Output) func(cmd *cli.Cmd) { for id, e := range spec.EventsByID { fmt.Printf("event %s: %s\n", id, e.String()) } - for name, f := range spec.Functions { - fmt.Printf("func %x: %s\n", f.FunctionID, f.String(name)) + for _, f := range spec.Functions { + fmt.Printf("func %x: %s\n", f.FunctionID, f.String()) } } } diff --git a/cmd/burrow/commands/accounts.go b/cmd/burrow/commands/accounts.go index 4b34fb008..6c30a0228 100644 --- a/cmd/burrow/commands/accounts.go +++ b/cmd/burrow/commands/accounts.go @@ -5,11 +5,12 @@ import ( "encoding/json" "time" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/deploy/compile" "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/rpc/rpcquery" cli "github.com/jawher/mow.cli" - "google.golang.org/grpc" ) // Accounts lists all the accounts in a chain, alongside with any metadata like contract name and ABI @@ -26,9 +27,7 @@ func Accounts(output Output) func(cmd *cli.Cmd) { } defer cancel() - var opts []grpc.DialOption - opts = append(opts, grpc.WithInsecure()) - conn, err := grpc.DialContext(ctx, *chainURLOpt, opts...) + conn, err := encoding.GRPCDialContext(ctx, *chainURLOpt) if err != nil { output.Fatalf("failed to connect: %v", err) } @@ -44,7 +43,8 @@ func Accounts(output Output) func(cmd *cli.Cmd) { output.Printf("Account: %s\n Sequence: %d", acc.Address.String(), acc.Sequence) - if len(acc.PublicKey.PublicKey) > 0 { + publicKey := acc.GetPublicKey() + if publicKey != nil && len(publicKey.PublicKey) > 0 { output.Printf(" Public Key: %s\n", acc.PublicKey.String()) } if acc.WASMCode != nil && len(acc.WASMCode) > 0 { @@ -76,8 +76,8 @@ func Accounts(output Output) func(cmd *cli.Cmd) { if len(spec.Functions) > 0 { output.Printf(" Functions:") - for name, f := range spec.Functions { - output.Printf(" %s", f.String(name)) + for _, f := range spec.Functions { + output.Printf(" %s", f.String()) } } diff --git a/cmd/burrow/commands/compile.go b/cmd/burrow/commands/compile.go new file mode 100644 index 000000000..a66ffecee --- /dev/null +++ b/cmd/burrow/commands/compile.go @@ -0,0 +1,71 @@ +package commands + +import ( + "fmt" + "os" + "path" + + "github.com/hyperledger/burrow/deploy/compile" + "github.com/hyperledger/burrow/logging" + cli "github.com/jawher/mow.cli" +) + +// Currently this just compiles to Go fixtures - it might make sense to extend it to take a text template for output +// if it is convenient to expose our compiler wrappers outside of burrow deploy +func Compile(output Output) func(cmd *cli.Cmd) { + return func(cmd *cli.Cmd) { + wasmOpt := cmd.BoolOpt("w wasm", false, "Use solang rather than solc") + sourceArg := cmd.StringsArg("SOURCE", nil, "Solidity source files to compile") + cmd.Spec = "[--wasm] SOURCE..." + + cmd.Action = func() { + for _, solfile := range *sourceArg { + var resp *compile.Response + var err error + + if *wasmOpt { + resp, err = compile.WASM(solfile, "", logging.NewNoopLogger()) + if err != nil { + output.Fatalf("failed compile solidity to wasm: %v\n", err) + } + } else { + resp, err = compile.EVM(solfile, false, "", nil, logging.NewNoopLogger()) + if err != nil { + output.Fatalf("failed compile solidity: %v\n", err) + } + } + + if resp.Error != "" { + output.Fatalf(resp.Error) + } + + if resp.Warning != "" { + output.Printf(resp.Warning) + } + + f, err := os.Create(solfile + ".go") + if err != nil { + output.Fatalf("failed to create go file: %v\n", err) + } + + f.WriteString(fmt.Sprintf("package %s\n\n", path.Base(path.Dir(solfile)))) + f.WriteString("import hex \"github.com/tmthrgd/go-hex\"\n\n") + + for _, c := range resp.Objects { + code := c.Contract.Evm.Bytecode.Object + if code == "" { + code = c.Contract.EWasm.Wasm + } + f.WriteString(fmt.Sprintf("var Bytecode_%s = hex.MustDecodeString(\"%s\")\n", + c.Objectname, code)) + if c.Contract.Evm.DeployedBytecode.Object != "" { + f.WriteString(fmt.Sprintf("var DeployedBytecode_%s = hex.MustDecodeString(\"%s\")\n", + c.Objectname, c.Contract.Evm.DeployedBytecode.Object)) + } + f.WriteString(fmt.Sprintf("var Abi_%s = []byte(`%s`)\n", + c.Objectname, c.Contract.Abi)) + } + } + } + } +} diff --git a/cmd/burrow/commands/config_options.go b/cmd/burrow/commands/config_options.go index 31a30d713..5171c9cd4 100644 --- a/cmd/burrow/commands/config_options.go +++ b/cmd/burrow/commands/config_options.go @@ -2,6 +2,7 @@ package commands import ( "fmt" + "net" "strings" "github.com/hyperledger/burrow/config" @@ -18,6 +19,7 @@ type configOptions struct { initPassphraseOpt *string initMonikerOpt *string externalAddressOpt *string + grpcAddressOpt *string } const configFileSpec = "[--config=]" @@ -43,6 +45,7 @@ func addConfigOptions(cmd *cli.Cmd) *configOptions { "|--address=
] " + "[--passphrase=] " + "[--external-address=] " + + "[--grpc-address=] " + configFileSpec + " " + genesisFileSpec cmd.Spec = strings.Join([]string{cmd.Spec, spec}, " ") @@ -85,6 +88,12 @@ func addConfigOptions(cmd *cli.Cmd) *configOptions { EnvVar: "BURROW_EXTERNAL_ADDRESS", }), + grpcAddressOpt: cmd.String(cli.StringOpt{ + Name: "grpc-address", + Desc: "GRPC listen address", + EnvVar: "BURROW_GRPC_ADDRESS", + }), + configFileOpt: cmd.String(configFileOption), genesisFileOpt: cmd.String(genesisFileOption), @@ -97,7 +106,7 @@ func (opts *configOptions) obtainBurrowConfig() (*config.BurrowConfig, error) { return nil, err } // Which account am I? - conf.Address, err = accountAddress(conf, *opts.initAddressOpt, *opts.accountIndexOpt, *opts.validatorIndexOpt) + conf.ValidatorAddress, err = accountAddress(conf, *opts.initAddressOpt, *opts.accountIndexOpt, *opts.validatorIndexOpt) if err != nil { return nil, err } @@ -106,12 +115,12 @@ func (opts *configOptions) obtainBurrowConfig() (*config.BurrowConfig, error) { } if *opts.initMonikerOpt == "" { chainIDHeader := "" - if conf.GenesisDoc != nil && conf.GenesisDoc.ChainID() != "" { - chainIDHeader = conf.GenesisDoc.ChainID() + "_" + if conf.GenesisDoc != nil && conf.GenesisDoc.GetChainID() != "" { + chainIDHeader = conf.GenesisDoc.GetChainID() + "_" } - if conf.Address != nil { + if conf.ValidatorAddress != nil { // Set a default moniker... since we can at this stage of config completion and it is required for start - conf.Tendermint.Moniker = fmt.Sprintf("%sNode_%s", chainIDHeader, conf.Address) + conf.Tendermint.Moniker = fmt.Sprintf("%sNode_%s", chainIDHeader, conf.ValidatorAddress) } } else { conf.Tendermint.Moniker = *opts.initMonikerOpt @@ -119,6 +128,14 @@ func (opts *configOptions) obtainBurrowConfig() (*config.BurrowConfig, error) { if *opts.externalAddressOpt != "" { conf.Tendermint.ExternalAddress = *opts.externalAddressOpt } + if *opts.grpcAddressOpt != "" { + host, port, err := net.SplitHostPort(*opts.grpcAddressOpt) + if err != nil { + return nil, fmt.Errorf("could not parse GRPC listen addres: %w", err) + } + conf.RPC.GRPC.ListenHost = host + conf.RPC.GRPC.ListenPort = port + } return conf, nil } @@ -155,8 +172,8 @@ func accountAddress(conf *config.BurrowConfig, addressIn string, accIndex, valIn valIndex, len(conf.GenesisDoc.Validators)) } return &conf.GenesisDoc.Validators[valIndex].Address, nil - } else if conf.Address != nil { - return conf.Address, nil + } else if conf.ValidatorAddress != nil { + return conf.ValidatorAddress, nil } else if conf.GenesisDoc != nil && len(conf.GenesisDoc.Validators) == 1 { return &conf.GenesisDoc.Validators[0].Address, nil } diff --git a/cmd/burrow/commands/configure.go b/cmd/burrow/commands/configure.go index 4c24e2dd4..4bda6a660 100644 --- a/cmd/burrow/commands/configure.go +++ b/cmd/burrow/commands/configure.go @@ -20,8 +20,7 @@ import ( "github.com/hyperledger/burrow/logging/logconfig/presets" "github.com/hyperledger/burrow/rpc" cli "github.com/jawher/mow.cli" - "github.com/tendermint/go-amino" - cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino" + tmjson "github.com/tendermint/tendermint/libs/json" dbm "github.com/tendermint/tm-db" ) @@ -40,6 +39,8 @@ func Configure(output Output) func(cmd *cli.Cmd) { keysDir := cmd.StringOpt("keys-dir", "", "Directory where keys are stored") + curveType := cmd.StringOpt("curve-type", crypto.CurveTypeEd25519.String(), "Curve type for realising keys") + configTemplateIn := cmd.StringsOpt("config-template-in", nil, "Go text/template input filename to generate config file specified with --config-out") @@ -69,7 +70,7 @@ func Configure(output Output) func(cmd *cli.Cmd) { pool := cmd.BoolOpt("pool", false, "Write config files for all the validators called burrowNNN.toml") - cmd.Spec = "[--keys-url= | --keys-dir=] " + + cmd.Spec = "[--keys-url= | --keys-dir=] [--curve-type=]" + "[ --config-template-in= --config-out=]... " + "[--genesis-spec=] [--separate-genesis-doc=] " + "[--chain-name=] [--restore-dump=] [--json] [--debug] [--pool] " + @@ -107,6 +108,11 @@ func Configure(output Output) func(cmd *cli.Cmd) { pkg := deployment.Config{Keys: make(map[crypto.Address]deployment.Key)} + ct, err := crypto.CurveTypeFromString(*curveType) + if err != nil { + output.Fatalf("could not realise curve type: %v", err) + } + // Genesis Spec if *genesisSpecOpt != "" { genesisSpec := new(spec.GenesisSpec) @@ -119,10 +125,10 @@ func Configure(output Output) func(cmd *cli.Cmd) { if *keysDir != "" { dir = *keysDir } - keyStore := keys.NewKeyStore(dir, conf.Keys.AllowBadFilePermissions) + keyStore := keys.NewFilesystemKeyStore(dir, conf.Keys.AllowBadFilePermissions) keyClient := keys.NewLocalKeyClient(keyStore, logging.NewNoopLogger()) - conf.GenesisDoc, err = genesisSpec.GenesisDoc(keyClient) + conf.GenesisDoc, err = genesisSpec.GenesisDoc(keyClient, ct) if err != nil { output.Fatalf("could not generate GenesisDoc from GenesisSpec using MockKeyClient: %v", err) } @@ -152,7 +158,7 @@ func Configure(output Output) func(cmd *cli.Cmd) { if err != nil { output.Fatalf("could not create remote key client: %v", err) } - conf.GenesisDoc, err = genesisSpec.GenesisDoc(keyClient) + conf.GenesisDoc, err = genesisSpec.GenesisDoc(keyClient, ct) if err != nil { output.Fatalf("could not realise GenesisSpec: %v", err) } @@ -219,18 +225,15 @@ func Configure(output Output) func(cmd *cli.Cmd) { peers := make([]string, 0) if conf.GenesisDoc != nil { - // NOTE: amino is needed here to add type metadata to JSON envelope for deserialisation to work - cdc := amino.NewCodec() - cryptoAmino.RegisterAmino(cdc) pkg.GenesisDoc = conf.GenesisDoc for _, val := range conf.GenesisDoc.Validators { nodeKey := tendermint.NewNodeKey() nodeAddress, _ := crypto.AddressFromHexString(string(nodeKey.ID())) - bs, err := cdc.MarshalJSON(nodeKey) + bs, err := tmjson.Marshal(nodeKey) if err != nil { - output.Fatalf("go-amino failed to json marshal private key: %v", err) + output.Fatalf("failed to json marshal private key: %v", err) } pkg.Keys[nodeAddress] = deployment.Key{Name: val.Name, Address: nodeAddress, KeyJSON: bs} @@ -282,13 +285,15 @@ func Configure(output Output) func(cmd *cli.Cmd) { } for i, acc := range genesisDoc.Accounts { // set stuff - conf.Address = &acc.Address + conf.ValidatorAddress = &acc.Address conf.Tendermint.PersistentPeers = strings.Join(peers, ",") conf.BurrowDir = fmt.Sprintf(".burrow%03d", i) conf.Tendermint.ListenHost = rpc.LocalHost conf.Tendermint.ListenPort = fmt.Sprint(26656 + i) conf.RPC.Info.ListenHost = rpc.LocalHost conf.RPC.Info.ListenPort = fmt.Sprint(26758 + i) + conf.RPC.Web3.ListenHost = rpc.LocalHost + conf.RPC.Web3.ListenPort = fmt.Sprint(26860 + i) conf.RPC.GRPC.ListenHost = rpc.LocalHost conf.RPC.GRPC.ListenPort = fmt.Sprint(10997 + i) conf.RPC.Metrics.ListenHost = rpc.LocalHost diff --git a/cmd/burrow/commands/deploy.go b/cmd/burrow/commands/deploy.go index fa34a6269..309c74db7 100644 --- a/cmd/burrow/commands/deploy.go +++ b/cmd/burrow/commands/deploy.go @@ -11,6 +11,7 @@ import ( "github.com/hyperledger/burrow/deploy/def" "github.com/hyperledger/burrow/deploy/proposals" "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/logging/loggers" cli "github.com/jawher/mow.cli" ) @@ -34,9 +35,6 @@ func Deploy(output Output) func(cmd *cli.Cmd) { defaultOutputOpt := cmd.StringOpt("o output", def.DefaultOutputFile, "filename for playbook output file. by default, this name will reflect the playbook passed") - playbooksOpt := cmd.StringsArg("FILE", []string{}, - "path to playbook file which deploy should run. if also using the --dir flag, give the relative path to playbooks file, which should be in the same directory") - defaultSetsOpt := cmd.StringsOpt("e set", []string{}, "default sets to use; operates the same way as the [set] jobs, only before the jobs file is ran (and after default address") @@ -52,9 +50,9 @@ func Deploy(output Output) func(cmd *cli.Cmd) { addressOpt := cmd.StringOpt("a address", "", "default address (or account name) to use; operates the same way as the [account] job, only before the deploy file is ran") - defaultFeeOpt := cmd.StringOpt("n fee", "9999", "default fee to use") + defaultFeeOpt := cmd.StringOpt("n fee", "99", "default fee to use") - defaultAmountOpt := cmd.StringOpt("m amount", "9999", + defaultAmountOpt := cmd.StringOpt("m amount", "99", "default amount to use") verboseOpt := cmd.BoolOpt("v verbose", false, "verbose output") @@ -75,6 +73,9 @@ func Deploy(output Output) func(cmd *cli.Cmd) { proposalList := cmd.StringOpt("list-proposals state", "", "List proposals, either all, executed, expired, or current") + playbooksArg := cmd.StringsArg("FILE", []string{}, + "path to playbook file which deploy should run. if also using the --dir flag, give the relative path to playbooks file, which should be in the same directory") + cmd.Spec = "[--chain=] [--keys=] [--mempool-signing] [--dir=] " + "[--output=] [--wasm] [--set=]... [--bin-path=] [--gas=] " + "[--jobs=] [--address=
] [--fee=] [--amount=] [--local-abi] " + @@ -115,8 +116,11 @@ func Deploy(output Output) func(cmd *cli.Cmd) { args.ProposeVerify = *proposalVerify args.ProposeVote = *proposalVote args.ProposeCreate = *proposalCreate - stderrLogger := log.NewLogfmtLogger(os.Stderr) - logger := logging.NewLogger(stderrLogger) + stdoutLogger, err := loggers.NewStreamLogger(os.Stdout, loggers.TerminalFormat) + if err != nil { + output.Fatalf("Could not make logger: %v", err) + } + logger := logging.NewLogger(stdoutLogger) handleTerm() if !*debugOpt { @@ -133,10 +137,10 @@ func Deploy(output Output) func(cmd *cli.Cmd) { output.Fatalf(err.Error()) } } else { - if len(*playbooksOpt) == 0 { + if len(*playbooksArg) == 0 { output.Fatalf("incorrect usage: missing deployment yaml file(s)") } - failures, err := pkgs.RunPlaybooks(args, *playbooksOpt, logger) + failures, err := pkgs.RunPlaybooks(args, *playbooksArg, logger) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) diff --git a/cmd/burrow/commands/dump.go b/cmd/burrow/commands/dump.go index f7fcf208d..087fcb46d 100644 --- a/cmd/burrow/commands/dump.go +++ b/cmd/burrow/commands/dump.go @@ -6,13 +6,14 @@ import ( "os" "time" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/core" "github.com/hyperledger/burrow/dump" "github.com/hyperledger/burrow/logging/logconfig" "github.com/hyperledger/burrow/rpc/rpcdump" "github.com/hyperledger/burrow/rpc/rpcquery" cli "github.com/jawher/mow.cli" - "google.golang.org/grpc" ) type dumpOptions struct { @@ -21,24 +22,33 @@ type dumpOptions struct { useBinaryEncoding *bool } +func maybeOutput(verbose *bool, output Output, format string, args ...interface{}) { + if verbose != nil && *verbose { + output.Logf(format, args) + } +} + func addDumpOptions(cmd *cli.Cmd, specOptions ...string) *dumpOptions { cmd.Spec += "[--height=] [--binary]" for _, spec := range specOptions { cmd.Spec += " " + spec } - cmd.Spec += " FILE" + cmd.Spec += "[FILE]" return &dumpOptions{ height: cmd.IntOpt("h height", 0, "Block height to dump to, defaults to latest block height"), useBinaryEncoding: cmd.BoolOpt("b binary", false, "Output in binary encoding (default is JSON)"), - filename: cmd.StringArg("FILE", "", "Save dump here"), + filename: cmd.StringArg("FILE", "", "Location to output dump, if no argument is given then this streams to STDOUT"), } } // Dump saves the state from a remote chain func Dump(output Output) func(cmd *cli.Cmd) { return func(cmd *cli.Cmd) { + verbose := cmd.BoolOpt("v verbose", false, "Verbose debug information") + cmd.Spec += "[--verbose]" + cmd.Command("local", "create a dump from local Burrow directory", func(cmd *cli.Cmd) { - output.Logf("dumping from local Burrow dir") + maybeOutput(verbose, output, "dumping from local Burrow dir") configFileOpt := cmd.String(configFileOption) genesisFileOpt := cmd.String(genesisFileOption) @@ -61,7 +71,7 @@ func Dump(output Output) func(cmd *cli.Cmd) { } // Include all logging by default - logger, err := logconfig.New().NewLogger() + logger, err := logconfig.New().Logger() if err != nil { output.Fatalf("could not make logger: %v", err) } @@ -73,18 +83,17 @@ func Dump(output Output) func(cmd *cli.Cmd) { if err != nil { output.Fatalf("could not dump to file %s': %v", *dumpOpts.filename, err) } - output.Logf("dump successfully written to '%s'", *dumpOpts.filename) + maybeOutput(verbose, output, "dump successfully written to '%s'", *dumpOpts.filename) } }) cmd.Command("remote", "pull a dump from a remote Burrow node", func(cmd *cli.Cmd) { chainURLOpt := cmd.StringOpt("c chain", "127.0.0.1:10997", "chain to be used in IP:PORT format") timeoutOpt := cmd.IntOpt("t timeout", 0, "Timeout in seconds") - dumpOpts := addDumpOptions(cmd, "[--chain=]", - "[--timeout=]") + dumpOpts := addDumpOptions(cmd, "[--chain=]", "[--timeout=]") cmd.Action = func() { - output.Logf("dumping from remote chain at %s", *chainURLOpt) + maybeOutput(verbose, output, "dumping from remote chain at %s", *chainURLOpt) ctx, cancel := context.WithCancel(context.Background()) if *timeoutOpt != 0 { @@ -93,9 +102,7 @@ func Dump(output Output) func(cmd *cli.Cmd) { } defer cancel() - var opts []grpc.DialOption - opts = append(opts, grpc.WithInsecure()) - conn, err := grpc.DialContext(ctx, *chainURLOpt, opts...) + conn, err := encoding.GRPCDialContext(ctx, *chainURLOpt) if err != nil { output.Fatalf("failed to connect: %v", err) } @@ -109,7 +116,7 @@ func Dump(output Output) func(cmd *cli.Cmd) { if err != nil { output.Logf("failed to marshal: %v", err) } - output.Logf("dumping from chain: %s", string(stat)) + maybeOutput(verbose, output, "dumping from chain: %s", string(stat)) dc := rpcdump.NewDumpClient(conn) receiver, err := dc.GetDump(ctx, &rpcdump.GetDumpParam{Height: uint64(*dumpOpts.height)}) @@ -121,26 +128,32 @@ func Dump(output Output) func(cmd *cli.Cmd) { if err != nil { output.Fatalf("could not dump to file %s': %v", *dumpOpts.filename, err) } - output.Logf("dump successfully written to '%s'", *dumpOpts.filename) + maybeOutput(verbose, output, "dump successfully written to '%s'", *dumpOpts.filename) } }) } } func dumpToFile(filename string, source dump.Source, useBinaryEncoding bool) error { - f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) - if err != nil { - return err + var file *os.File + var err error + if filename == "" { + file = os.Stdout + } else { + file, err = os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) + if err != nil { + return err + } } // Receive - err = dump.Write(f, source, useBinaryEncoding, dump.All) + err = dump.Write(file, source, useBinaryEncoding, dump.All) if err != nil { return err } - err = f.Close() + err = file.Close() if err != nil { return err } diff --git a/cmd/burrow/commands/explore.go b/cmd/burrow/commands/explore.go index 0b1152f77..ce239ab1b 100644 --- a/cmd/burrow/commands/explore.go +++ b/cmd/burrow/commands/explore.go @@ -37,7 +37,10 @@ func Explore(output Output) func(cmd *cli.Cmd) { output.Fatalf("genesis doc is required") } - explorer = bcm.NewBlockExplorer(dbm.DBBackendType(tmConf.DBBackend), tmConf.DBDir()) + explorer, err = bcm.NewBlockExplorer(dbm.BackendType(tmConf.DBBackend), tmConf.DBDir()) + if err != nil { + output.Fatalf("could not create BlockExplorer: %w", err) + } } cmd.Command("dump", "pretty print the state tree at the given height", func(cmd *cli.Cmd) { @@ -52,7 +55,7 @@ func Explore(output Output) func(cmd *cli.Cmd) { } cmd.Action = func() { - replay := forensics.NewReplayFromDir(conf.GenesisDoc, *stateDir) + replay := forensics.NewSourceFromDir(conf.GenesisDoc, *stateDir) height := uint64(*heightOpt) if height == 0 { height, err = replay.LatestHeight() @@ -85,14 +88,20 @@ func Explore(output Output) func(cmd *cli.Cmd) { } cmd.Action = func() { - replay1 := forensics.NewReplayFromDir(conf.GenesisDoc, *goodDir) - replay2 := forensics.NewReplayFromDir(conf.GenesisDoc, *badDir) - - h1, err := replay1.LatestHeight() + replay1 := forensics.NewReplay( + forensics.NewSourceFromDir(conf.GenesisDoc, *goodDir), + forensics.NewSourceFromGenesis(conf.GenesisDoc), + ) + replay2 := forensics.NewReplay( + forensics.NewSourceFromDir(conf.GenesisDoc, *badDir), + forensics.NewSourceFromGenesis(conf.GenesisDoc), + ) + + h1, err := replay1.Src.LatestHeight() if err != nil { output.Fatalf("could not get height for first replay: %v", err) } - h2, err := replay2.LatestHeight() + h2, err := replay2.Src.LatestHeight() if err != nil { output.Fatalf("could not get height for second replay: %v", err) } @@ -120,7 +129,7 @@ func Explore(output Output) func(cmd *cli.Cmd) { if height, err := forensics.CompareCaptures(recap1, recap2); err != nil { output.Printf("difference in capture: %v", err) // TODO: compare at every height? - if err := forensics.CompareStateAtHeight(replay1.State, replay2.State, height); err != nil { + if err := forensics.CompareStateAtHeight(replay1.Dst.State, replay2.Dst.State, height); err != nil { output.Fatalf("difference in state: %v", err) } } diff --git a/cmd/burrow/commands/keys.go b/cmd/burrow/commands/keys.go index 12d03641b..1cc1ec4d8 100644 --- a/cmd/burrow/commands/keys.go +++ b/cmd/burrow/commands/keys.go @@ -10,13 +10,14 @@ import ( "os" "time" + "github.com/hyperledger/burrow/encoding" + "github.com/howeyc/gopass" "github.com/hyperledger/burrow/config" "github.com/hyperledger/burrow/config/deployment" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/keys" cli "github.com/jawher/mow.cli" - "google.golang.org/grpc" ) // Keys runs as either client or server @@ -37,9 +38,7 @@ func Keys(output Output) func(cmd *cli.Cmd) { }) grpcKeysClient := func(output Output) keys.KeysClient { - var opts []grpc.DialOption - opts = append(opts, grpc.WithInsecure()) - conn, err := grpc.Dial(*keysHost+":"+*keysPort, opts...) + conn, err := encoding.GRPCDial(*keysHost + ":" + *keysPort) if err != nil { output.Fatalf("Failed to connect to grpc server: %v", err) } @@ -49,7 +48,7 @@ func Keys(output Output) func(cmd *cli.Cmd) { cmd.Command("server", "run keys server", func(cmd *cli.Cmd) { keysDir := cmd.StringOpt("dir", "", "specify the location of the directory containing key files") badPerm := cmd.BoolOpt("allow-bad-perm", false, "Allow unix key file permissions to be readable other than user") - configOpt := cmd.StringOpt("c config", "", "Use the a specified burrow config file") + configOpt := cmd.StringOpt("c config", "", "Use the specified burrow config file") var conf *config.BurrowConfig diff --git a/cmd/burrow/commands/natives.go b/cmd/burrow/commands/natives.go new file mode 100644 index 000000000..89dd8fbb8 --- /dev/null +++ b/cmd/burrow/commands/natives.go @@ -0,0 +1,57 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package commands + +import ( + "fmt" + + "github.com/hyperledger/burrow/execution/native" + cli "github.com/jawher/mow.cli" + + "github.com/hyperledger/burrow/util/natives/templates" +) + +// Dump native contracts +func Natives(output Output) func(cmd *cli.Cmd) { + return func(cmd *cli.Cmd) { + contractsOpt := cmd.StringsOpt("c contracts", nil, "Contracts to generate") + cmd.Action = func() { + callables := native.MustDefaultNatives().Callables() + // Index of next contract + i := 1 + for _, callable := range callables { + contract, ok := callable.(*native.Contract) + if !ok { + // For now we will omit loose functions (i.e. precompiles) + // They can't be called via Solidity interface contract anyway. + continue + } + if len(*contractsOpt) > 0 { + found := false + for _, c := range *contractsOpt { + if c == contract.Name { + found = true + break + } + } + if !found { + continue + } + } + solidity, err := templates.NewSolidityContract(contract).Solidity() + if err != nil { + fmt.Printf("Error generating solidity for contract %s: %s\n", + contract.Name, err) + } + fmt.Println(solidity) + if i < len(callables) { + // Two new lines between contracts as per Solidity style guide + // (the template gives us 1 trailing new line) + fmt.Println() + } + i++ + } + } + } +} diff --git a/cmd/burrow/commands/restore.go b/cmd/burrow/commands/restore.go index c89127e12..728f1d7f0 100644 --- a/cmd/burrow/commands/restore.go +++ b/cmd/burrow/commands/restore.go @@ -23,19 +23,19 @@ func Restore(output Output) func(cmd *cli.Cmd) { output.Fatalf("cannot continue with config: %v", err) } - output.Logf("Using validator address: %s", *conf.Address) + output.Logf("Using validator address: %s", *conf.ValidatorAddress) kern, err := core.NewKernel(conf.BurrowDir) if err != nil { - output.Fatalf("could not create Burrow kernel: %v", err) + output.Fatalf("could not create Burrow kernel: %w", err) } if err = kern.LoadLoggerFromConfig(conf.Logging); err != nil { - output.Fatalf("could not create Burrow kernel: %v", err) + output.Fatalf("could not load logger: %w", err) } if err = kern.LoadDump(conf.GenesisDoc, *filename, *silentOpt); err != nil { - output.Fatalf("could not create Burrow kernel: %v", err) + output.Fatalf("could not load dump: %v", err) } kern.ShutdownAndExit() diff --git a/cmd/burrow/commands/snatives.go b/cmd/burrow/commands/snatives.go deleted file mode 100644 index c607353e3..000000000 --- a/cmd/burrow/commands/snatives.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package commands - -import ( - "fmt" - - cli "github.com/jawher/mow.cli" - - "github.com/hyperledger/burrow/execution/evm" - "github.com/hyperledger/burrow/util/snatives/templates" -) - -// Dump SNative contracts -func Snatives(output Output) func(cmd *cli.Cmd) { - return func(cmd *cli.Cmd) { - contractsOpt := cmd.StringsOpt("c contracts", nil, "Contracts to generate") - cmd.Action = func() { - contracts := evm.SNativeContracts() - // Index of next contract - i := 1 - for _, contract := range contracts { - if len(*contractsOpt) > 0 { - found := false - for _, c := range *contractsOpt { - if c == contract.Name { - found = true - break - } - } - if !found { - continue - } - } - solidity, err := templates.NewSolidityContract(contract).Solidity() - if err != nil { - fmt.Printf("Error generating solidity for contract %s: %s\n", - contract.Name, err) - } - fmt.Println(solidity) - if i < len(contracts) { - // Two new lines between contracts as per Solidity style guide - // (the template gives us 1 trailing new line) - fmt.Println() - } - i++ - } - } - } -} diff --git a/cmd/burrow/commands/start.go b/cmd/burrow/commands/start.go index 5ba0e1b98..b9db24c2d 100644 --- a/cmd/burrow/commands/start.go +++ b/cmd/burrow/commands/start.go @@ -20,7 +20,7 @@ func Start(output Output) func(cmd *cli.Cmd) { output.Fatalf("cannot continue with config: %v", err) } - output.Logf("Using validator address: %s", *conf.Address) + output.Logf("Using validator address: %s", *conf.ValidatorAddress) kern, err := core.LoadKernelFromConfig(conf) if err != nil { diff --git a/cmd/burrow/commands/tx.go b/cmd/burrow/commands/tx.go index 144921a5b..0695d1afe 100644 --- a/cmd/burrow/commands/tx.go +++ b/cmd/burrow/commands/tx.go @@ -3,7 +3,6 @@ package commands import ( "encoding/json" "errors" - "fmt" "io/ioutil" "os" "time" @@ -11,7 +10,6 @@ import ( "github.com/hyperledger/burrow/config/source" "github.com/hyperledger/burrow/deploy/def" "github.com/hyperledger/burrow/deploy/jobs" - "github.com/hyperledger/burrow/deploy/util" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/txs/payload" cli "github.com/jawher/mow.cli" @@ -37,10 +35,10 @@ func Tx(output Output) func(cmd *cli.Cmd) { output.Fatalf("cannot continue with config: %v", err) } - chainHost := jobs.FirstOf(*chainOpt, fmt.Sprintf("%s:%s", conf.RPC.GRPC.ListenHost, conf.RPC.GRPC.ListenPort)) + chainHost := jobs.FirstOf(*chainOpt, conf.RPC.GRPC.ListenAddress()) client := def.NewClient(chainHost, conf.Keys.RemoteAddress, true, time.Duration(*timeoutOpt)*time.Second) logger := logging.NewNoopLogger() - address := conf.Address.String() + address := conf.ValidatorAddress.String() cmd.Command("send", "send value to another account", func(cmd *cli.Cmd) { sourceOpt := cmd.StringOpt("s source", "", "Address to send from, if not set config is used") @@ -121,6 +119,42 @@ func Tx(output Output) func(cmd *cli.Cmd) { })) } }) + + cmd.Command("identify", "associate a validator with a node address", func(cmd *cli.Cmd) { + sourceOpt := cmd.StringOpt("source", "", "Address to send from, if not set config is used") + nodeKeyOpt := cmd.StringOpt("node-key", "", "File containing the nodeKey to use, default config") + networkOpt := cmd.StringOpt("network", "", "Publically reachable host IP") + monikerOpt := cmd.StringOpt("moniker", "", "Human readable node ID") + cmd.Spec += "[--source=
] [--node-key=] [--network=
] [--moniker=]" + + cmd.Action = func() { + + tmConf, err := conf.TendermintConfig() + if err != nil { + output.Fatalf("could not construct tendermint config: %v", err) + } + + id := &def.Identify{ + Source: jobs.FirstOf(*sourceOpt, address), + NodeKey: jobs.FirstOf(*nodeKeyOpt, tmConf.NodeKeyFile()), + Moniker: *monikerOpt, + NetAddress: jobs.FirstOf(*networkOpt, conf.Tendermint.ListenHost), + } + + if err := id.Validate(); err != nil { + output.Fatalf("could not validate IdentifyTx: %v", err) + } + + tx, err := jobs.FormulateIdentifyJob(id, address, client, logger) + if err != nil { + output.Fatalf("could not formulate IdentifyTx: %v", err) + } + + output.Printf("%s", source.JSONString(payload.Any{ + IdentifyTx: tx, + })) + } + }) }) cmd.Command("commit", "read and send a tx to mempool", func(cmd *cli.Cmd) { @@ -136,7 +170,7 @@ func Tx(output Output) func(cmd *cli.Cmd) { output.Fatalf("can't continue with config: %v", err) } - chainHost := jobs.FirstOf(*chainOpt, fmt.Sprintf("%s:%s", conf.RPC.GRPC.ListenHost, conf.RPC.GRPC.ListenPort)) + chainHost := jobs.FirstOf(*chainOpt, conf.RPC.GRPC.ListenAddress()) client := def.NewClient(chainHost, conf.Keys.RemoteAddress, true, time.Duration(*timeoutOpt)*time.Second) var rawTx payload.Any @@ -159,6 +193,8 @@ func Tx(output Output) func(cmd *cli.Cmd) { hash, err = makeTx(client, tx) case *payload.UnbondTx: hash, err = makeTx(client, tx) + case *payload.IdentifyTx: + hash, err = makeTx(client, tx) default: output.Fatalf("payload type not recognized") } @@ -180,7 +216,7 @@ func makeTx(client *def.Client, tx payload.Payload) (string, error) { return "", err } - util.ReadTxSignAndBroadcast(txe, err, logger) + jobs.LogTxExecution(txe, logger) if err != nil { return "", err } diff --git a/cmd/burrow/commands/vent.go b/cmd/burrow/commands/vent.go index 9e1ca819b..bb2dbbcb4 100644 --- a/cmd/burrow/commands/vent.go +++ b/cmd/burrow/commands/vent.go @@ -5,11 +5,14 @@ import ( "io/ioutil" "os" "os/signal" + "strconv" + "strings" "sync" "syscall" "time" "github.com/hyperledger/burrow/config/source" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/logging/logconfig" "github.com/hyperledger/burrow/vent/config" @@ -20,6 +23,26 @@ import ( cli "github.com/jawher/mow.cli" ) +type LogLevel string + +const ( + LogLevelNone LogLevel = "none" + LogLevelInfo LogLevel = "info" + LogLevelTrace LogLevel = "trace" +) + +func logConfig(level LogLevel) *logconfig.LoggingConfig { + logConf := logconfig.New() + switch level { + case LogLevelNone: + return logConf.None() + case LogLevelTrace: + return logConf.WithTrace() + default: + return logConf + } +} + // Vent consumes EVM events and commits to a DB func Vent(output Output) func(cmd *cli.Cmd) { return func(cmd *cli.Cmd) { @@ -29,9 +52,17 @@ func Vent(output Output) func(cmd *cli.Cmd) { cfg := config.DefaultVentConfig() dbOpts := sqlDBOpts(cmd, cfg) - grpcAddrOpt := cmd.StringOpt("grpc-addr", cfg.GRPCAddr, "Address to connect to the Hyperledger Burrow gRPC server") - httpAddrOpt := cmd.StringOpt("http-addr", cfg.HTTPAddr, "Address to bind the HTTP server") - logLevelOpt := cmd.StringOpt("log-level", cfg.LogLevel, "Logging level (error, warn, info, debug)") + grpcAddrOpt := cmd.StringOpt("chain-addr", cfg.ChainAddress, "Address to connect to the Hyperledger Burrow gRPC server") + httpAddrOpt := cmd.StringOpt("http-addr", cfg.HTTPListenAddress, "Address to bind the HTTP server") + logLevelOpt := cmd.StringOpt("log-level", string(LogLevelInfo), "Logging level (none, info, trace)") + watchAddressesOpt := cmd.StringsOpt("watch", nil, "Add contract address to global watch filter") + minimumHeightOpt := cmd.IntOpt("minimum-height", 0, "Only process block greater than or equal to height passed") + maxRetriesOpt := cmd.IntOpt("max-retries", int(cfg.BlockConsumerConfig.MaxRetries), "Maximum number of retries when consuming blocks") + maxRequestRateOpt := cmd.StringOpt("max-request-rate", "", "Maximum request rate given as (number of requests)/(time base), e.g. 1000/24h for 1000 requests per day") + backoffDurationOpt := cmd.StringOpt("backoff", "", + "The minimum duration to wait before asking for new blocks - increases exponentially when errors occur. Values like 200ms, 1s, 2m") + batchSizeOpt := cmd.IntOpt("batch-size", int(cfg.BlockConsumerConfig.MaxBlockBatchSize), + "The maximum number of blocks from which to request events in a single call - will reduce logarithmically to 1 when errors occur.") abiFileOpt := cmd.StringsOpt("abi", cfg.AbiFileOrDirs, "EVM Contract ABI file or folder") specFileOrDirOpt := cmd.StringsOpt("spec", cfg.SpecFileOrDirs, "SQLSol specification file or folder") dbBlockOpt := cmd.BoolOpt("blocks", false, "Create block tables and persist related data") @@ -40,13 +71,31 @@ func Vent(output Output) func(cmd *cli.Cmd) { announceEveryOpt := cmd.StringOpt("announce-every", "5s", "Announce vent status every period as a Go duration, e.g. 1ms, 3s, 1h") cmd.Before = func() { + var err error // Rather annoying boilerplate here... but there is no way to pass mow.cli a pointer for it to fill you value cfg.DBAdapter = *dbOpts.adapter cfg.DBURL = *dbOpts.url cfg.DBSchema = *dbOpts.schema - cfg.GRPCAddr = *grpcAddrOpt - cfg.HTTPAddr = *httpAddrOpt - cfg.LogLevel = *logLevelOpt + cfg.ChainAddress = *grpcAddrOpt + cfg.HTTPListenAddress = *httpAddrOpt + cfg.WatchAddresses = make([]crypto.Address, len(*watchAddressesOpt)) + cfg.MinimumHeight = uint64(*minimumHeightOpt) + cfg.BlockConsumerConfig.MaxRequests, cfg.BlockConsumerConfig.TimeBase, err = parseRequestRate(*maxRequestRateOpt) + if err != nil { + output.Fatalf("Could not parse max request rate: %w", err) + } + cfg.BlockConsumerConfig.MaxRetries = uint64(*maxRetriesOpt) + cfg.BlockConsumerConfig.BaseBackoffDuration, err = parseDuration(*backoffDurationOpt) + if err != nil { + output.Fatalf("could not parse backoff duration: %w", err) + } + cfg.BlockConsumerConfig.MaxBlockBatchSize = uint64(*batchSizeOpt) + for i, wa := range *watchAddressesOpt { + cfg.WatchAddresses[i], err = crypto.AddressFromHexString(wa) + if err != nil { + output.Fatalf("could not parse watch address: %w", err) + } + } cfg.AbiFileOrDirs = *abiFileOpt cfg.SpecFileOrDirs = *specFileOrDirOpt if *dbBlockOpt { @@ -56,27 +105,31 @@ func Vent(output Output) func(cmd *cli.Cmd) { cfg.SpecOpt |= sqlsol.Tx } - if *announceEveryOpt != "" { - var err error - cfg.AnnounceEvery, err = time.ParseDuration(*announceEveryOpt) - if err != nil { - output.Fatalf("could not parse announce-every duration %s: %v", *announceEveryOpt, err) - } + cfg.AnnounceEvery, err = parseDuration(*announceEveryOpt) + if err != nil { + output.Fatalf("could not parse announce-every duration %s: %v", *announceEveryOpt, err) } } - cmd.Spec = "--spec= [--abi=] [--db-adapter] [--db-url] [--db-schema] " + - "[--blocks] [--txs] [--grpc-addr] [--http-addr] [--log-level] [--announce-every=]" + cmd.Spec = "--spec=... [--abi=...] " + + "[--watch=...] [--minimum-height=] " + + "[--max-retries=] [--backoff=] " + + "[--max-request-rate=] [--batch-size=] " + + "[--db-adapter] [--db-url] [--db-schema] [--blocks] [--txs] [--chain-addr] [--http-addr] " + + "[--log-level] [--announce-every=]" cmd.Action = func() { - log, err := logconfig.New().NewLogger() + logger, err := logConfig(LogLevel(*logLevelOpt)).Logger() if err != nil { output.Fatalf("failed to load logger: %v", err) } - log = log.With("service", "vent") - consumer := service.NewConsumer(cfg, log, make(chan types.EventData)) - server := service.NewServer(cfg, log, consumer) + logger = logger.With("service", "vent") + consumer := service.NewConsumer(cfg, logger, make(chan types.EventData)) + if err != nil { + output.Fatalf("Could not create Vent Consumer: %v", err) + } + server := service.NewServer(cfg, logger, consumer) projection, err := sqlsol.SpecLoader(cfg.SpecFileOrDirs, cfg.SpecOpt) if err != nil { @@ -180,7 +233,7 @@ func Vent(output Output) func(cmd *cli.Cmd) { } cmd.Action = func() { - log, err := logconfig.New().NewLogger() + log, err := logconfig.New().Logger() if err != nil { output.Fatalf("failed to load logger: %v", err) } @@ -216,6 +269,32 @@ func Vent(output Output) func(cmd *cli.Cmd) { } } +func parseDuration(duration string) (time.Duration, error) { + if duration == "" { + return 0, nil + } + return time.ParseDuration(duration) +} + +func parseRequestRate(rate string) (int, time.Duration, error) { + if rate == "" { + return 0, 0, nil + } + ratio := strings.Split(rate, "/") + if len(ratio) != 2 { + return 0, 0, fmt.Errorf("expected a ratio string separated by a '/' but got %s", rate) + } + requests, err := strconv.ParseInt(ratio[0], 10, 0) + if err != nil { + return 0, 0, fmt.Errorf("could not parse max requests as base 10 integer: %w", err) + } + timeBase, err := time.ParseDuration(ratio[1]) + if err != nil { + return 0, 0, fmt.Errorf("could not parse time base: %w", err) + } + return int(requests), timeBase, nil +} + type dbOpts struct { adapter *string url *string diff --git a/cmd/burrow/commands/vent_test.go b/cmd/burrow/commands/vent_test.go new file mode 100644 index 000000000..10dd5105b --- /dev/null +++ b/cmd/burrow/commands/vent_test.go @@ -0,0 +1,21 @@ +package commands + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestParseRequestRate(t *testing.T) { + requests, base, err := parseRequestRate("2334223/24h") + require.NoError(t, err) + assert.Equal(t, 2334223, requests) + assert.Equal(t, time.Hour*24, base) + + requests, base, err = parseRequestRate("99990/24h") + require.NoError(t, err) + assert.Equal(t, 99_990, requests) + assert.Equal(t, time.Hour*24, base) +} diff --git a/cmd/burrow/main.go b/cmd/burrow/main.go index c235eda8b..3185ec495 100644 --- a/cmd/burrow/main.go +++ b/cmd/burrow/main.go @@ -63,8 +63,8 @@ func burrow(output commands.Output) *cli.Cli { app.Command("deploy", "Deploy and test contracts", commands.Deploy(output)) - app.Command("snatives", "Dump Solidity interface contracts for SNatives", - commands.Snatives(output)) + app.Command("natives", "Dump Solidity interface contracts for Burrow native contracts", + commands.Natives(output)) app.Command("vent", "Start the Vent EVM event and blocks consumer service to populated databases from smart contracts", commands.Vent(output)) @@ -84,6 +84,9 @@ func burrow(output commands.Output) *cli.Cli { app.Command("abi", "List, decode and encode using ABI", commands.Abi(output)) + app.Command("compile", "Compile solidity files embedding the compilation results as a fixture in a Go file", + commands.Compile(output)) + return app } diff --git a/config/config.go b/config/config.go index 4e503f6aa..421a8f75e 100644 --- a/config/config.go +++ b/config/config.go @@ -3,6 +3,7 @@ package config import ( "fmt" + "github.com/alecthomas/jsonschema" "github.com/hyperledger/burrow/config/source" "github.com/hyperledger/burrow/consensus/tendermint" "github.com/hyperledger/burrow/crypto" @@ -20,8 +21,8 @@ const DefaultGenesisDocJSONFileName = "genesis.json" type BurrowConfig struct { // Set on startup - Address *crypto.Address `json:",omitempty" toml:",omitempty"` - Passphrase *string `json:",omitempty" toml:",omitempty"` + ValidatorAddress *crypto.Address `json:",omitempty" toml:",omitempty"` + Passphrase *string `json:",omitempty" toml:",omitempty"` // From config file BurrowDir string GenesisDoc *genesis.GenesisDoc `json:",omitempty" toml:",omitempty"` @@ -32,6 +33,8 @@ type BurrowConfig struct { Logging *logconfig.LoggingConfig `json:",omitempty" toml:",omitempty"` } +var burrowConfigSchema = jsonschema.Reflect(&BurrowConfig{}) + func DefaultBurrowConfig() *BurrowConfig { return &BurrowConfig{ BurrowDir: ".burrow", @@ -44,7 +47,7 @@ func DefaultBurrowConfig() *BurrowConfig { } func (conf *BurrowConfig) Verify() error { - if conf.Address == nil { + if conf.ValidatorAddress == nil { return fmt.Errorf("could not finalise address - please provide one in config or via --account-address") } return nil diff --git a/config/config_test.go b/config/config_test.go index 16a2d9f0a..2569f9a72 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -1,10 +1,11 @@ package config import ( - "fmt" "testing" + "github.com/hyperledger/burrow/config/source" "github.com/hyperledger/burrow/genesis" + "github.com/stretchr/testify/require" ) func TestBurrowConfigSerialise(t *testing.T) { @@ -13,5 +14,9 @@ func TestBurrowConfigSerialise(t *testing.T) { ChainName: "Foo", }, } - fmt.Println(conf.JSONString()) + confOut := new(BurrowConfig) + jsonString := conf.JSONString() + err := source.FromJSONString(jsonString, confOut) + require.NoError(t, err) + require.Equal(t, jsonString, confOut.JSONString()) } diff --git a/consensus/abci/app.go b/consensus/abci/app.go index 4397bc8f4..ebbdc1037 100644 --- a/consensus/abci/app.go +++ b/consensus/abci/app.go @@ -17,6 +17,7 @@ import ( "github.com/hyperledger/burrow/project" "github.com/hyperledger/burrow/txs" "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/encoding" ) type Validators interface { @@ -29,13 +30,15 @@ const ( ) type App struct { + // Provides a no-op implementation for all methods (in particular snapshots for now will abort) + types.BaseApplication // Node information to return in Info nodeInfo string // State - blockchain *bcm.Blockchain - validators Validators - mempoolLocker sync.Locker - authorizedPeersProvider PeersFilterProvider + blockchain *bcm.Blockchain + validators Validators + mempoolLocker sync.Locker + authorizedPeers AuthorizedPeers // We need to cache these from BeginBlock for when we need actually need it in Commit block *types.RequestBeginBlock // Function to use to fail gracefully from panic rather than letting Tendermint make us a zombie @@ -46,23 +49,20 @@ type App struct { logger *logging.Logger } -// PeersFilterProvider provides current authorized nodes id and/or addresses -type PeersFilterProvider func() (authorizedPeersID []string, authorizedPeersAddress []string) - var _ types.Application = &App{} func NewApp(nodeInfo string, blockchain *bcm.Blockchain, validators Validators, checker execution.BatchExecutor, - committer execution.BatchCommitter, txDecoder txs.Decoder, authorizedPeersProvider PeersFilterProvider, + committer execution.BatchCommitter, txDecoder txs.Decoder, authorizedPeers AuthorizedPeers, panicFunc func(error), logger *logging.Logger) *App { return &App{ - nodeInfo: nodeInfo, - blockchain: blockchain, - validators: validators, - checker: checker, - committer: committer, - txDecoder: txDecoder, - authorizedPeersProvider: authorizedPeersProvider, - panicFunc: panicFunc, + nodeInfo: nodeInfo, + blockchain: blockchain, + validators: validators, + checker: checker, + committer: committer, + txDecoder: txDecoder, + authorizedPeers: authorizedPeers, + panicFunc: panicFunc, logger: logger.WithScope("abci.NewApp").With(structure.ComponentKey, "ABCI_App", "node_info", nodeInfo), } @@ -106,7 +106,7 @@ func (app *App) Query(reqQuery types.RequestQuery) (respQuery types.ResponseQuer return } -func (app *App) InitChain(chain types.RequestInitChain) (respInitChain types.ResponseInitChain) { +func (app *App) InitChain(chain types.RequestInitChain) types.ResponseInitChain { defer func() { if r := recover(); r != nil { app.panicFunc(fmt.Errorf("panic occurred in abci.App/InitChain: %v\n%s", r, debug.Stack())) @@ -122,17 +122,19 @@ func (app *App) InitChain(chain types.RequestInitChain) (respInitChain types.Res len(chain.Validators), currentSet.Size())) } for _, v := range chain.Validators { - pk, err := crypto.PublicKeyFromABCIPubKey(v.GetPubKey()) + pk, err := encoding.PubKeyFromProto(v.GetPubKey()) if err != nil { panic(err) } - err = app.checkValidatorMatches(currentSet, types.Validator{Address: pk.GetAddress().Bytes(), Power: v.Power}) + err = app.checkValidatorMatches(currentSet, types.Validator{Address: pk.Address().Bytes(), Power: v.Power}) if err != nil { panic(err) } } app.logger.InfoMsg("Initial validator set matches") - return + return types.ResponseInitChain{ + AppHash: app.blockchain.AppHashAfterLastBlock(), + } } func (app *App) BeginBlock(block types.RequestBeginBlock) (respBeginBlock types.ResponseBeginBlock) { @@ -238,8 +240,12 @@ func (app *App) EndBlock(reqEndBlock types.RequestEndBlock) types.ResponseEndBlo err := app.validators.ValidatorChanges(BurrowValidatorDelayInBlocks).IterateValidators(func(id crypto.Addressable, power *big.Int) error { app.logger.InfoMsg("Updating validator power", "validator_address", id.GetAddress(), "new_power", power) + pk, err := encoding.PubKeyToProto(id.GetPublicKey().TendermintPubKey()) + if err != nil { + panic(err) + } validatorUpdates = append(validatorUpdates, types.ValidatorUpdate{ - PubKey: id.GetPublicKey().ABCIPubKey(), + PubKey: pk, // Must ensure power fits in an int64 during execution Power: power.Int64(), }) @@ -265,7 +271,6 @@ func (app *App) Commit() types.ResponseCommit { structure.ScopeKey, "Commit()", "height", app.block.Header.Height, "hash", app.block.Hash, - "txs", app.block.Header.NumTxs, "block_time", blockTime, "last_block_time", app.blockchain.LastBlockTime(), "last_block_duration", app.blockchain.LastCommitDuration(), diff --git a/consensus/abci/execute_tx.go b/consensus/abci/execute_tx.go index 1d641e57d..da5d1b3f8 100644 --- a/consensus/abci/execute_tx.go +++ b/consensus/abci/execute_tx.go @@ -11,7 +11,6 @@ import ( "github.com/hyperledger/burrow/logging/structure" "github.com/hyperledger/burrow/txs" "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/common" ) // Attempt to execute a transaction using ABCI conventions and codes @@ -36,9 +35,9 @@ func ExecuteTx(logHeader string, executor execution.Executor, txDecoder txs.Deco } } - tags := []common.KVPair{{Key: []byte(structure.TxHashKey), Value: []byte(txEnv.Tx.Hash().String())}} + tags := []types.EventAttribute{{Key: []byte(structure.TxHashKey), Value: []byte(txEnv.Tx.Hash().String())}} if txe.Receipt.CreatesContract { - tags = append(tags, common.KVPair{ + tags = append(tags, types.EventAttribute{ Key: []byte("created_contract_address"), Value: []byte(txe.Receipt.ContractAddress.String()), }) diff --git a/consensus/abci/execute_tx_test.go b/consensus/abci/execute_tx_test.go index 5358a90e0..f995f6920 100644 --- a/consensus/abci/execute_tx_test.go +++ b/consensus/abci/execute_tx_test.go @@ -8,14 +8,13 @@ import ( "github.com/hyperledger/burrow/logging" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/common" ) func TestWithEvents(t *testing.T) { var buf bytes.Buffer logger := logging.NewLogger(log.NewLogfmtLogger(&buf)) - kvp := common.KVPair{Key: []byte("foo"), Value: []byte("bar")} - event := types.Event{Type: "event", Attributes: []common.KVPair{kvp}} + kvp := types.EventAttribute{Key: []byte("foo"), Value: []byte("bar")} + event := types.Event{Type: "event", Attributes: []types.EventAttribute{kvp}} events := []types.Event{event} logger = WithEvents(logger, events) logger.InfoMsg("hello, world") diff --git a/consensus/abci/peers_filter.go b/consensus/abci/peers_filter.go index 06d432238..9f51e75b2 100644 --- a/consensus/abci/peers_filter.go +++ b/consensus/abci/peers_filter.go @@ -16,6 +16,39 @@ func isPeersFilterQuery(query *abciTypes.RequestQuery) bool { return strings.HasPrefix(query.Path, peersFilterQueryPath) } +// AuthorizedPeers provides current authorized nodes id and/or addresses +type AuthorizedPeers interface { + NumPeers() int + QueryPeerByID(id string) bool + QueryPeerByAddress(id string) bool +} + +type PeerLists struct { + IDs map[string]struct{} + Addresses map[string]struct{} +} + +func NewPeerLists() *PeerLists { + return &PeerLists{ + IDs: make(map[string]struct{}), + Addresses: make(map[string]struct{}), + } +} + +func (p PeerLists) QueryPeerByID(id string) bool { + _, ok := p.IDs[id] + return ok +} + +func (p PeerLists) QueryPeerByAddress(id string) bool { + _, ok := p.Addresses[id] + return ok +} + +func (p PeerLists) NumPeers() int { + return len(p.IDs) +} + func (app *App) peersFilter(reqQuery *abciTypes.RequestQuery, respQuery *abciTypes.ResponseQuery) { app.logger.TraceMsg("abci.App/Query peers filter query", "query_path", reqQuery.Path) path := strings.Split(reqQuery.Path, "/") @@ -26,25 +59,20 @@ func (app *App) peersFilter(reqQuery *abciTypes.RequestQuery, respQuery *abciTyp filterType := path[3] peer := path[4] - authorizedPeersID, authorizedPeersAddress := app.authorizedPeersProvider() - var authorizedPeers []string + peerAuthorized := app.authorizedPeers.NumPeers() == 0 switch filterType { case "id": - authorizedPeers = authorizedPeersID + if ok := app.authorizedPeers.QueryPeerByID(peer); ok { + peerAuthorized = ok + } case "addr": - authorizedPeers = authorizedPeersAddress + if ok := app.authorizedPeers.QueryPeerByAddress(peer); ok { + peerAuthorized = ok + } default: panic(fmt.Errorf("invalid peers filter query type %v", reqQuery.Path)) } - peerAuthorized := len(authorizedPeers) == 0 - for _, authorizedPeer := range authorizedPeers { - if authorizedPeer == peer { - peerAuthorized = true - break - } - } - if peerAuthorized { app.logger.TraceMsg("Peer sync authorized", "peer", peer) respQuery.Code = codes.PeerFilterAuthorizedCode diff --git a/consensus/abci/peers_filter_test.go b/consensus/abci/peers_filter_test.go index 7f79110d6..edb2c0123 100644 --- a/consensus/abci/peers_filter_test.go +++ b/consensus/abci/peers_filter_test.go @@ -23,11 +23,9 @@ func TestApp_QueryAuthorizedPeers(t *testing.T) { panicFunc: func(e error) { panicked = true }, - // Given no authorized node defined - authorizedPeersProvider: func() ([]string, []string) { - return []string{}, []string{} - }, logger: logging.NewNoopLogger(), + // Given no authorized node defined + authorizedPeers: &PeerLists{}, } // When authorized node query is raised with any node id @@ -38,8 +36,9 @@ func TestApp_QueryAuthorizedPeers(t *testing.T) { assert.Equal(t, codes.PeerFilterAuthorizedCode, resp.Code) // Given authorized nodes defined - app.authorizedPeersProvider = func() ([]string, []string) { - return []string{aNodeId}, []string{aNodeAddress} + app.authorizedPeers = &PeerLists{ + IDs: map[string]struct{}{aNodeId: {}}, + Addresses: map[string]struct{}{aNodeAddress: {}}, } // When authorized node query is raised for an authorized node by id @@ -72,9 +71,7 @@ func TestApp_QueryAuthorizedPeers(t *testing.T) { // Given a provider which panics assert.False(t, panicked) - app.authorizedPeersProvider = func() ([]string, []string) { - panic("ouch") - } + app.authorizedPeers = new(panicker) // When authorized node query is raised resp = app.Query(*makeTestFilterQuery("addr", "hackMe")) @@ -85,6 +82,21 @@ func TestApp_QueryAuthorizedPeers(t *testing.T) { assert.Equal(t, codes.UnsupportedRequestCode, resp.Code) } +type panicker struct { +} + +func (p panicker) QueryPeerByID(id string) bool { + panic("id") +} + +func (p panicker) QueryPeerByAddress(id string) bool { + panic("address") +} + +func (p panicker) NumPeers() int { + panic("peers") +} + func TestIsPeersFilterQuery(t *testing.T) { assert.True(t, isPeersFilterQuery(makeTestFilterQuery("id", aNodeId))) assert.True(t, isPeersFilterQuery(makeTestFilterQuery("addr", aNodeAddress))) diff --git a/consensus/abci/process.go b/consensus/abci/process.go index 23d06b82e..08068dc32 100644 --- a/consensus/abci/process.go +++ b/consensus/abci/process.go @@ -12,6 +12,7 @@ import ( "github.com/hyperledger/burrow/execution" "github.com/hyperledger/burrow/txs" "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/mempool" tmTypes "github.com/tendermint/tendermint/types" ) @@ -47,7 +48,7 @@ func NewProcess(committer execution.BatchCommitter, blockchain *bcm.Blockchain, return p } -func (p *Process) CheckTx(tx tmTypes.Tx, cb func(*types.Response)) error { +func (p *Process) CheckTx(tx tmTypes.Tx, cb func(*types.Response), txInfo mempool.TxInfo) error { const header = "DeliverTx" p.committer.Lock() defer p.committer.Unlock() diff --git a/consensus/tendermint/amino.go b/consensus/tendermint/amino.go deleted file mode 100644 index d2f96f648..000000000 --- a/consensus/tendermint/amino.go +++ /dev/null @@ -1,12 +0,0 @@ -package tendermint - -import ( - amino "github.com/tendermint/go-amino" - cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino" -) - -var cdc = amino.NewCodec() - -func init() { - cryptoAmino.RegisterAmino(cdc) -} diff --git a/consensus/tendermint/config.go b/consensus/tendermint/config.go index a6e07713e..6b0264f23 100644 --- a/consensus/tendermint/config.go +++ b/consensus/tendermint/config.go @@ -3,6 +3,7 @@ package tendermint import ( "fmt" "math" + "net" "net/url" "strings" "time" @@ -35,6 +36,8 @@ type BurrowTendermintConfig struct { // Set false for private or local networks AddrBookStrict bool Moniker string + // Only accept connections from registered peers + IdentifyPeers bool // Peers ID or address this node is authorize to sync with AuthorizedPeers string // EmptyBlocks mode and possible interval between empty blocks in seconds, one of: @@ -103,7 +106,7 @@ func (btc *BurrowTendermintConfig) Config(rootDir string, timeoutFactor float64) conf.P2P.Seeds = btc.Seeds conf.P2P.SeedMode = btc.SeedMode conf.P2P.PersistentPeers = btc.PersistentPeers - conf.P2P.ListenAddress = fmt.Sprintf("%s:%s", btc.ListenHost, btc.ListenPort) + conf.P2P.ListenAddress = btc.ListenAddress() conf.P2P.ExternalAddress = btc.ExternalAddress conf.P2P.AddrBookStrict = btc.AddrBookStrict // We use this in tests and I am not aware of a strong reason to reject nodes on the same IP with different ports @@ -111,30 +114,29 @@ func (btc *BurrowTendermintConfig) Config(rootDir string, timeoutFactor float64) // Unfortunately this stops metrics from being used at all conf.Instrumentation.Prometheus = false - conf.FilterPeers = btc.AuthorizedPeers != "" + + conf.FilterPeers = btc.IdentifyPeers || btc.AuthorizedPeers != "" } // Disable Tendermint RPC conf.RPC.ListenAddress = "" return conf, nil } -func (btc *BurrowTendermintConfig) DefaultAuthorizedPeersProvider() abci.PeersFilterProvider { - var authorizedPeersID, authorizedPeersAddress []string +func (btc *BurrowTendermintConfig) DefaultAuthorizedPeersProvider() abci.AuthorizedPeers { + authorizedPeers := abci.NewPeerLists() authorizedPeersAddrOrID := strings.Split(btc.AuthorizedPeers, ",") for _, authorizedPeerAddrOrID := range authorizedPeersAddrOrID { _, err := url.Parse(authorizedPeerAddrOrID) isNodeAddress := err != nil if isNodeAddress { - authorizedPeersAddress = append(authorizedPeersAddress, authorizedPeerAddrOrID) + authorizedPeers.Addresses[authorizedPeerAddrOrID] = struct{}{} } else { - authorizedPeersID = append(authorizedPeersID, authorizedPeerAddrOrID) + authorizedPeers.IDs[authorizedPeerAddrOrID] = struct{}{} } } - return func() ([]string, []string) { - return authorizedPeersID, authorizedPeersAddress - } + return authorizedPeers } func scaleTimeout(factor float64, timeout time.Duration) time.Duration { @@ -143,3 +145,7 @@ func scaleTimeout(factor float64, timeout time.Duration) time.Duration { } return time.Duration(math.Round(factor * float64(timeout))) } + +func (btc *BurrowTendermintConfig) ListenAddress() string { + return net.JoinHostPort(btc.ListenHost, btc.ListenPort) +} diff --git a/consensus/tendermint/config_test.go b/consensus/tendermint/config_test.go index 5b7ec6412..517db070c 100644 --- a/consensus/tendermint/config_test.go +++ b/consensus/tendermint/config_test.go @@ -4,17 +4,16 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestDefaultBurrowTendermintConfig(t *testing.T) { btc := DefaultBurrowTendermintConfig() btc.AuthorizedPeers = "127.0.0.1:26656,836AB8674A33416718E5A19557A25ED826B2BDD3" - authorizedPeersID, authorizedPeersAddress := btc.DefaultAuthorizedPeersProvider()() - assert.Equal(t, []string{"127.0.0.1:26656"}, authorizedPeersAddress) - assert.Equal(t, []string{"836AB8674A33416718E5A19557A25ED826B2BDD3"}, authorizedPeersID) + authorizedPeers := btc.DefaultAuthorizedPeersProvider() + assert.True(t, authorizedPeers.QueryPeerByAddress("127.0.0.1:26656")) + assert.True(t, authorizedPeers.QueryPeerByID("836AB8674A33416718E5A19557A25ED826B2BDD3")) tmConf, err := btc.Config(".burrow", 0.33) require.NoError(t, err) @@ -44,4 +43,10 @@ func TestDefaultBurrowTendermintConfig(t *testing.T) { require.NoError(t, err) assert.Equal(t, time.Duration(0), tmConf.Consensus.CreateEmptyBlocksInterval) assert.True(t, tmConf.Consensus.CreateEmptyBlocks) + + btc.AuthorizedPeers = "" + btc.IdentifyPeers = true + tmConf, err = btc.Config(".burrow", 0.33) + require.NoError(t, err) + assert.Equal(t, true, tmConf.FilterPeers) } diff --git a/consensus/tendermint/node_view.go b/consensus/tendermint/node_view.go index 9c4c8185c..81884ba27 100644 --- a/consensus/tendermint/node_view.go +++ b/consensus/tendermint/node_view.go @@ -15,13 +15,17 @@ import ( type NodeView struct { tmNode *Node - publicKey crypto.PublicKey + publicKey *crypto.PublicKey txDecoder txs.Decoder runID simpleuuid.UUID } func NewNodeView(tmNode *Node, txDecoder txs.Decoder, runID simpleuuid.UUID) (*NodeView, error) { - publicKey, err := crypto.PublicKeyFromTendermintPubKey(tmNode.PrivValidator().GetPubKey()) + pk, err := tmNode.PrivValidator().GetPubKey() + if err != nil { + return nil, err + } + publicKey, err := crypto.PublicKeyFromTendermintPubKey(pk) if err != nil { return nil, err } @@ -34,9 +38,9 @@ func NewNodeView(tmNode *Node, txDecoder txs.Decoder, runID simpleuuid.UUID) (*N }, nil } -func (nv *NodeView) ValidatorPublicKey() crypto.PublicKey { +func (nv *NodeView) ValidatorPublicKey() *crypto.PublicKey { if nv == nil { - return crypto.PublicKey{} + return nil } return nv.publicKey } @@ -59,18 +63,18 @@ func (nv *NodeView) NodeInfo() *NodeInfo { return &NodeInfo{} } -func (nv *NodeView) IsFastSyncing() bool { +func (nv *NodeView) IsSyncing() bool { if nv == nil { return true } - return nv.tmNode.ConsensusReactor().FastSync() + return nv.tmNode.ConsensusReactor().WaitSync() } func (nv *NodeView) Peers() p2p.IPeerSet { return nv.tmNode.Switch().Peers() } -func (nv *NodeView) BlockStore() state.BlockStoreRPC { +func (nv *NodeView) BlockStore() state.BlockStore { return nv.tmNode.BlockStore() } diff --git a/consensus/tendermint/priv_validator_from_tendermint.go.BK b/consensus/tendermint/priv_validator_from_tendermint.go.BK new file mode 100644 index 000000000..9d500c635 --- /dev/null +++ b/consensus/tendermint/priv_validator_from_tendermint.go.BK @@ -0,0 +1,449 @@ +package tendermint + +import ( +"bytes" +"errors" +"fmt" +"io/ioutil" +"time" + +"github.com/gogo/protobuf/proto" + +"github.com/tendermint/tendermint/crypto" +"github.com/tendermint/tendermint/crypto/ed25519" +"github.com/tendermint/tendermint/crypto/secp256k1" +tmbytes "github.com/tendermint/tendermint/libs/bytes" +tmjson "github.com/tendermint/tendermint/libs/json" +tmos "github.com/tendermint/tendermint/libs/os" +"github.com/tendermint/tendermint/libs/protoio" +"github.com/tendermint/tendermint/libs/tempfile" +tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +"github.com/tendermint/tendermint/types" +tmtime "github.com/tendermint/tendermint/types/time" +) + +// TODO: type ? +const ( + stepNone int8 = 0 // Used to distinguish the initial state + stepPropose int8 = 1 + stepPrevote int8 = 2 + stepPrecommit int8 = 3 +) + +// A vote is either stepPrevote or stepPrecommit. +func voteToStep(vote *tmproto.Vote) int8 { + switch vote.Type { + case tmproto.PrevoteType: + return stepPrevote + case tmproto.PrecommitType: + return stepPrecommit + default: + panic(fmt.Sprintf("Unknown vote type: %v", vote.Type)) + } +} + +//------------------------------------------------------------------------------- + +// FilePVKey stores the immutable part of PrivValidator. +type FilePVKey struct { + Address types.Address `json:"address"` + PubKey crypto.PubKey `json:"pub_key"` + PrivKey crypto.PrivKey `json:"priv_key"` + + filePath string +} + +// Save persists the FilePVKey to its filePath. +func (pvKey FilePVKey) Save() { + outFile := pvKey.filePath + if outFile == "" { + panic("cannot save PrivValidator key: filePath not set") + } + + jsonBytes, err := tmjson.MarshalIndent(pvKey, "", " ") + if err != nil { + panic(err) + } + err = tempfile.WriteFileAtomic(outFile, jsonBytes, 0600) + if err != nil { + panic(err) + } + +} + +//------------------------------------------------------------------------------- + +// FilePVLastSignState stores the mutable part of PrivValidator. +type FilePVLastSignState struct { + Height int64 `json:"height"` + Round int32 `json:"round"` + Step int8 `json:"step"` + Signature []byte `json:"signature,omitempty"` + SignBytes tmbytes.HexBytes `json:"signbytes,omitempty"` + + filePath string +} + +// CheckHRS checks the given height, round, step (HRS) against that of the +// FilePVLastSignState. It returns an error if the arguments constitute a regression, +// or if they match but the SignBytes are empty. +// The returned boolean indicates whether the last Signature should be reused - +// it returns true if the HRS matches the arguments and the SignBytes are not empty (indicating +// we have already signed for this HRS, and can reuse the existing signature). +// It panics if the HRS matches the arguments, there's a SignBytes, but no Signature. +func (lss *FilePVLastSignState) CheckHRS(height int64, round int32, step int8) (bool, error) { + + if lss.Height > height { + return false, fmt.Errorf("height regression. Got %v, last height %v", height, lss.Height) + } + + if lss.Height == height { + if lss.Round > round { + return false, fmt.Errorf("round regression at height %v. Got %v, last round %v", height, round, lss.Round) + } + + if lss.Round == round { + if lss.Step > step { + return false, fmt.Errorf( + "step regression at height %v round %v. Got %v, last step %v", + height, + round, + step, + lss.Step, + ) + } else if lss.Step == step { + if lss.SignBytes != nil { + if lss.Signature == nil { + panic("pv: Signature is nil but SignBytes is not!") + } + return true, nil + } + return false, errors.New("no SignBytes found") + } + } + } + return false, nil +} + +// Save persists the FilePvLastSignState to its filePath. +func (lss *FilePVLastSignState) Save() { + outFile := lss.filePath + if outFile == "" { + panic("cannot save FilePVLastSignState: filePath not set") + } + jsonBytes, err := tmjson.MarshalIndent(lss, "", " ") + if err != nil { + panic(err) + } + err = tempfile.WriteFileAtomic(outFile, jsonBytes, 0600) + if err != nil { + panic(err) + } +} + +//------------------------------------------------------------------------------- + +// FilePV implements PrivValidator using data persisted to disk +// to prevent double signing. +// NOTE: the directories containing pv.Key.filePath and pv.LastSignState.filePath must already exist. +// It includes the LastSignature and LastSignBytes so we don't lose the signature +// if the process crashes after signing but before the resulting consensus message is processed. +type FilePV struct { + Key FilePVKey + LastSignState FilePVLastSignState +} + +// NewFilePV generates a new validator from the given key and paths. +func NewFilePV(privKey crypto.PrivKey, keyFilePath, stateFilePath string) *FilePV { + return &FilePV{ + Key: FilePVKey{ + Address: privKey.PubKey().Address(), + PubKey: privKey.PubKey(), + PrivKey: privKey, + filePath: keyFilePath, + }, + LastSignState: FilePVLastSignState{ + Step: stepNone, + filePath: stateFilePath, + }, + } +} + +// GenFilePV generates a new validator with randomly generated private key +// and sets the filePaths, but does not call Save(). +func GenFilePV(keyFilePath, stateFilePath, keyType string) (*FilePV, error) { + switch keyType { + case types.ABCIPubKeyTypeSecp256k1: + return NewFilePV(secp256k1.GenPrivKey(), keyFilePath, stateFilePath), nil + case "", types.ABCIPubKeyTypeEd25519: + return NewFilePV(ed25519.GenPrivKey(), keyFilePath, stateFilePath), nil + default: + return nil, fmt.Errorf("key type: %s is not supported", keyType) + } +} + +// LoadFilePV loads a FilePV from the filePaths. The FilePV handles double +// signing prevention by persisting data to the stateFilePath. If either file path +// does not exist, the program will exit. +func LoadFilePV(keyFilePath, stateFilePath string) *FilePV { + return loadFilePV(keyFilePath, stateFilePath, true) +} + +// LoadFilePVEmptyState loads a FilePV from the given keyFilePath, with an empty LastSignState. +// If the keyFilePath does not exist, the program will exit. +func LoadFilePVEmptyState(keyFilePath, stateFilePath string) *FilePV { + return loadFilePV(keyFilePath, stateFilePath, false) +} + +// If loadState is true, we load from the stateFilePath. Otherwise, we use an empty LastSignState. +func loadFilePV(keyFilePath, stateFilePath string, loadState bool) *FilePV { + keyJSONBytes, err := ioutil.ReadFile(keyFilePath) + if err != nil { + tmos.Exit(err.Error()) + } + pvKey := FilePVKey{} + err = tmjson.Unmarshal(keyJSONBytes, &pvKey) + if err != nil { + tmos.Exit(fmt.Sprintf("Error reading PrivValidator key from %v: %v\n", keyFilePath, err)) + } + + // overwrite pubkey and address for convenience + pvKey.PubKey = pvKey.PrivKey.PubKey() + pvKey.Address = pvKey.PubKey.Address() + pvKey.filePath = keyFilePath + + pvState := FilePVLastSignState{} + + if loadState { + stateJSONBytes, err := ioutil.ReadFile(stateFilePath) + if err != nil { + tmos.Exit(err.Error()) + } + err = tmjson.Unmarshal(stateJSONBytes, &pvState) + if err != nil { + tmos.Exit(fmt.Sprintf("Error reading PrivValidator state from %v: %v\n", stateFilePath, err)) + } + } + + pvState.filePath = stateFilePath + + return &FilePV{ + Key: pvKey, + LastSignState: pvState, + } +} + +// LoadOrGenFilePV loads a FilePV from the given filePaths +// or else generates a new one and saves it to the filePaths. +func LoadOrGenFilePV(keyFilePath, stateFilePath string) (*FilePV, error) { + var ( + pv *FilePV + err error + ) + if tmos.FileExists(keyFilePath) { + pv = LoadFilePV(keyFilePath, stateFilePath) + } else { + pv, err = GenFilePV(keyFilePath, stateFilePath, "") + pv.Save() + } + return pv, err +} + +// GetAddress returns the address of the validator. +// Implements PrivValidator. +func (pv *FilePV) GetAddress() types.Address { + return pv.Key.Address +} + +// GetPubKey returns the public key of the validator. +// Implements PrivValidator. +func (pv *FilePV) GetPubKey() (crypto.PubKey, error) { + return pv.Key.PubKey, nil +} + +// SignVote signs a canonical representation of the vote, along with the +// chainID. Implements PrivValidator. +func (pv *FilePV) SignVote(chainID string, vote *tmproto.Vote) error { + if err := pv.signVote(chainID, vote); err != nil { + return fmt.Errorf("error signing vote: %v", err) + } + return nil +} + +// SignProposal signs a canonical representation of the proposal, along with +// the chainID. Implements PrivValidator. +func (pv *FilePV) SignProposal(chainID string, proposal *tmproto.Proposal) error { + if err := pv.signProposal(chainID, proposal); err != nil { + return fmt.Errorf("error signing proposal: %v", err) + } + return nil +} + +// Save persists the FilePV to disk. +func (pv *FilePV) Save() { + pv.Key.Save() + pv.LastSignState.Save() +} + +// Reset resets all fields in the FilePV. +// NOTE: Unsafe! +func (pv *FilePV) Reset() { + var sig []byte + pv.LastSignState.Height = 0 + pv.LastSignState.Round = 0 + pv.LastSignState.Step = 0 + pv.LastSignState.Signature = sig + pv.LastSignState.SignBytes = nil + pv.Save() +} + +// String returns a string representation of the FilePV. +func (pv *FilePV) String() string { + return fmt.Sprintf( + "PrivValidator{%v LH:%v, LR:%v, LS:%v}", + pv.GetAddress(), + pv.LastSignState.Height, + pv.LastSignState.Round, + pv.LastSignState.Step, + ) +} + +//------------------------------------------------------------------------------------ + +// signVote checks if the vote is good to sign and sets the vote signature. +// It may need to set the timestamp as well if the vote is otherwise the same as +// a previously signed vote (ie. we crashed after signing but before the vote hit the WAL). +func (pv *FilePV) signVote(chainID string, vote *tmproto.Vote) error { + height, round, step := vote.Height, vote.Round, voteToStep(vote) + + lss := pv.LastSignState + + sameHRS, err := lss.CheckHRS(height, round, step) + if err != nil { + return err + } + + signBytes := types.VoteSignBytes(chainID, vote) + + // We might crash before writing to the wal, + // causing us to try to re-sign for the same HRS. + // If signbytes are the same, use the last signature. + // If they only differ by timestamp, use last timestamp and signature + // Otherwise, return error + if sameHRS { + if bytes.Equal(signBytes, lss.SignBytes) { + vote.Signature = lss.Signature + } else if timestamp, ok := checkVotesOnlyDifferByTimestamp(lss.SignBytes, signBytes); ok { + vote.Timestamp = timestamp + vote.Signature = lss.Signature + } else { + err = fmt.Errorf("conflicting data") + } + return err + } + + // It passed the checks. Sign the vote + sig, err := pv.Key.PrivKey.Sign(signBytes) + if err != nil { + return err + } + pv.saveSigned(height, round, step, signBytes, sig) + vote.Signature = sig + return nil +} + +// signProposal checks if the proposal is good to sign and sets the proposal signature. +// It may need to set the timestamp as well if the proposal is otherwise the same as +// a previously signed proposal ie. we crashed after signing but before the proposal hit the WAL). +func (pv *FilePV) signProposal(chainID string, proposal *tmproto.Proposal) error { + height, round, step := proposal.Height, proposal.Round, stepPropose + + lss := pv.LastSignState + + sameHRS, err := lss.CheckHRS(height, round, step) + if err != nil { + return err + } + + signBytes := types.ProposalSignBytes(chainID, proposal) + + // We might crash before writing to the wal, + // causing us to try to re-sign for the same HRS. + // If signbytes are the same, use the last signature. + // If they only differ by timestamp, use last timestamp and signature + // Otherwise, return error + if sameHRS { + if bytes.Equal(signBytes, lss.SignBytes) { + proposal.Signature = lss.Signature + } else if timestamp, ok := checkProposalsOnlyDifferByTimestamp(lss.SignBytes, signBytes); ok { + proposal.Timestamp = timestamp + proposal.Signature = lss.Signature + } else { + err = fmt.Errorf("conflicting data") + } + return err + } + + // It passed the checks. Sign the proposal + sig, err := pv.Key.PrivKey.Sign(signBytes) + if err != nil { + return err + } + pv.saveSigned(height, round, step, signBytes, sig) + proposal.Signature = sig + return nil +} + +// Persist height/round/step and signature +func (pv *FilePV) saveSigned(height int64, round int32, step int8, + signBytes []byte, sig []byte) { + + pv.LastSignState.Height = height + pv.LastSignState.Round = round + pv.LastSignState.Step = step + pv.LastSignState.Signature = sig + pv.LastSignState.SignBytes = signBytes + pv.LastSignState.Save() +} + +//----------------------------------------------------------------------------------------- + +// returns the timestamp from the lastSignBytes. +// returns true if the only difference in the votes is their timestamp. +func checkVotesOnlyDifferByTimestamp(lastSignBytes, newSignBytes []byte) (time.Time, bool) { + var lastVote, newVote tmproto.CanonicalVote + if err := protoio.UnmarshalDelimited(lastSignBytes, &lastVote); err != nil { + panic(fmt.Sprintf("LastSignBytes cannot be unmarshalled into vote: %v", err)) + } + if err := protoio.UnmarshalDelimited(newSignBytes, &newVote); err != nil { + panic(fmt.Sprintf("signBytes cannot be unmarshalled into vote: %v", err)) + } + + lastTime := lastVote.Timestamp + // set the times to the same value and check equality + now := tmtime.Now() + lastVote.Timestamp = now + newVote.Timestamp = now + + return lastTime, proto.Equal(&newVote, &lastVote) +} + +// returns the timestamp from the lastSignBytes. +// returns true if the only difference in the proposals is their timestamp +func checkProposalsOnlyDifferByTimestamp(lastSignBytes, newSignBytes []byte) (time.Time, bool) { + var lastProposal, newProposal tmproto.CanonicalProposal + if err := protoio.UnmarshalDelimited(lastSignBytes, &lastProposal); err != nil { + panic(fmt.Sprintf("LastSignBytes cannot be unmarshalled into proposal: %v", err)) + } + if err := protoio.UnmarshalDelimited(newSignBytes, &newProposal); err != nil { + panic(fmt.Sprintf("signBytes cannot be unmarshalled into proposal: %v", err)) + } + + lastTime := lastProposal.Timestamp + // set the times to the same value and check equality + now := tmtime.Now() + lastProposal.Timestamp = now + newProposal.Timestamp = now + + return lastTime, proto.Equal(&newProposal, &lastProposal) +} diff --git a/consensus/tendermint/priv_validator_memory.go b/consensus/tendermint/priv_validator_memory.go index ba87f2def..3715fbf1c 100644 --- a/consensus/tendermint/priv_validator_memory.go +++ b/consensus/tendermint/priv_validator_memory.go @@ -3,7 +3,8 @@ package tendermint import ( "github.com/hyperledger/burrow/crypto" tmCrypto "github.com/tendermint/tendermint/crypto" - tmTypes "github.com/tendermint/tendermint/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tendermint/tendermint/types" ) type privValidatorMemory struct { @@ -12,7 +13,7 @@ type privValidatorMemory struct { lastSignedInfo *LastSignedInfo } -var _ tmTypes.PrivValidator = &privValidatorMemory{} +var _ types.PrivValidator = &privValidatorMemory{} // Create a PrivValidator with in-memory state that takes an addressable representing the validator identity // and a signer providing private signing for that identity. @@ -34,19 +35,19 @@ func asTendermintSigner(signer crypto.Signer) func(msg []byte) []byte { } } -func (pvm *privValidatorMemory) GetAddress() tmTypes.Address { +func (pvm *privValidatorMemory) GetAddress() types.Address { return pvm.Addressable.GetAddress().Bytes() } -func (pvm *privValidatorMemory) GetPubKey() tmCrypto.PubKey { - return pvm.GetPublicKey().TendermintPubKey() +func (pvm *privValidatorMemory) GetPubKey() (tmCrypto.PubKey, error) { + return pvm.GetPublicKey().TendermintPubKey(), nil } // TODO: consider persistence to disk/database to avoid double signing after a crash -func (pvm *privValidatorMemory) SignVote(chainID string, vote *tmTypes.Vote) error { +func (pvm *privValidatorMemory) SignVote(chainID string, vote *tmproto.Vote) error { return pvm.lastSignedInfo.SignVote(pvm.signer, chainID, vote) } -func (pvm *privValidatorMemory) SignProposal(chainID string, proposal *tmTypes.Proposal) error { +func (pvm *privValidatorMemory) SignProposal(chainID string, proposal *tmproto.Proposal) error { return pvm.lastSignedInfo.SignProposal(pvm.signer, chainID, proposal) } diff --git a/consensus/tendermint/sign_info.go b/consensus/tendermint/sign_info.go index 105293bc8..1683150de 100644 --- a/consensus/tendermint/sign_info.go +++ b/consensus/tendermint/sign_info.go @@ -7,7 +7,10 @@ import ( "sync" "time" + "github.com/gogo/protobuf/proto" "github.com/hyperledger/burrow/binary" + "github.com/tendermint/tendermint/libs/protoio" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" tmtime "github.com/tendermint/tendermint/types/time" ) @@ -20,15 +23,15 @@ const ( stepPrecommit int8 = 3 ) -func voteToStep(vote *types.Vote) int8 { +// A vote is either stepPrevote or stepPrecommit. +func voteToStep(vote *tmproto.Vote) int8 { switch vote.Type { - case types.PrevoteType: + case tmproto.PrevoteType: return stepPrevote - case types.PrecommitType: + case tmproto.PrecommitType: return stepPrecommit default: - panic("Unknown vote type") - return 0 + panic(fmt.Sprintf("Unknown vote type: %v", vote.Type)) } } @@ -37,10 +40,10 @@ func voteToStep(vote *types.Vote) int8 { type LastSignedInfo struct { sync.Mutex Height int64 `json:"height"` - Round int `json:"round"` + Round int32 `json:"round"` Step int8 `json:"step"` - Signature []byte `json:"signature,omitempty"` // so we dont lose signatures - SignBytes binary.HexBytes `json:"signbytes,omitempty"` // so we dont lose signatures + Signature []byte `json:"signature,omitempty"` // so we don't lose signatures + SignBytes binary.HexBytes `json:"signbytes,omitempty"` // so we don't lose signatures } func NewLastSignedInfo() *LastSignedInfo { @@ -53,7 +56,7 @@ type tmCryptoSigner func(msg []byte) []byte // SignVote signs a canonical representation of the vote, along with the // chainID. Implements PrivValidator. -func (lsi *LastSignedInfo) SignVote(sign tmCryptoSigner, chainID string, vote *types.Vote) error { +func (lsi *LastSignedInfo) SignVote(sign tmCryptoSigner, chainID string, vote *tmproto.Vote) error { lsi.Lock() defer lsi.Unlock() if err := lsi.signVote(sign, chainID, vote); err != nil { @@ -64,7 +67,7 @@ func (lsi *LastSignedInfo) SignVote(sign tmCryptoSigner, chainID string, vote *t // SignProposal signs a canonical representation of the proposal, along with // the chainID. Implements PrivValidator. -func (lsi *LastSignedInfo) SignProposal(sign tmCryptoSigner, chainID string, proposal *types.Proposal) error { +func (lsi *LastSignedInfo) SignProposal(sign tmCryptoSigner, chainID string, proposal *tmproto.Proposal) error { lsi.Lock() defer lsi.Unlock() if err := lsi.signProposal(sign, chainID, proposal); err != nil { @@ -74,7 +77,7 @@ func (lsi *LastSignedInfo) SignProposal(sign tmCryptoSigner, chainID string, pro } // returns error if HRS regression or no SignBytes. returns true if HRS is unchanged -func (lsi *LastSignedInfo) checkHRS(height int64, round int, step int8) (bool, error) { +func (lsi *LastSignedInfo) checkHRS(height int64, round int32, step int8) (bool, error) { if lsi.Height > height { return false, errors.New("height regression") } @@ -104,15 +107,15 @@ func (lsi *LastSignedInfo) checkHRS(height int64, round int, step int8) (bool, e // signVote checks if the vote is good to sign and sets the vote signature. // It may need to set the timestamp as well if the vote is otherwise the same as // a previously signed vote (ie. we crashed after signing but before the vote hit the WAL). -func (lsi *LastSignedInfo) signVote(sign tmCryptoSigner, chainID string, vote *types.Vote) error { +func (lsi *LastSignedInfo) signVote(sign tmCryptoSigner, chainID string, vote *tmproto.Vote) error { height, round, step := vote.Height, vote.Round, voteToStep(vote) - signBytes := vote.SignBytes(chainID) sameHRS, err := lsi.checkHRS(height, round, step) if err != nil { return err } + signBytes := types.VoteSignBytes(chainID, vote) // We might crash before writing to the wal, // causing us to try to re-sign for the same HRS. // If signbytes are the same, use the last signature. @@ -140,15 +143,16 @@ func (lsi *LastSignedInfo) signVote(sign tmCryptoSigner, chainID string, vote *t // signProposal checks if the proposal is good to sign and sets the proposal signature. // It may need to set the timestamp as well if the proposal is otherwise the same as // a previously signed proposal ie. we crashed after signing but before the proposal hit the WAL). -func (lsi *LastSignedInfo) signProposal(sign tmCryptoSigner, chainID string, proposal *types.Proposal) error { +func (lsi *LastSignedInfo) signProposal(sign tmCryptoSigner, chainID string, proposal *tmproto.Proposal) error { height, round, step := proposal.Height, proposal.Round, stepPropose - signBytes := proposal.SignBytes(chainID) sameHRS, err := lsi.checkHRS(height, round, step) if err != nil { return err } + signBytes := types.ProposalSignBytes(chainID, proposal) + // We might crash before writing to the wal, // causing us to try to re-sign for the same HRS. // If signbytes are the same, use the last signature. @@ -174,7 +178,7 @@ func (lsi *LastSignedInfo) signProposal(sign tmCryptoSigner, chainID string, pro } // Persist height/round/step and signature -func (lsi *LastSignedInfo) saveSigned(height int64, round int, step int8, +func (lsi *LastSignedInfo) saveSigned(height int64, round int32, step int8, signBytes []byte, sig []byte) { lsi.Height = height @@ -194,11 +198,11 @@ func (lsi *LastSignedInfo) String() string { // returns the timestamp from the lastSignBytes. // returns true if the only difference in the votes is their timestamp. func checkVotesOnlyDifferByTimestamp(lastSignBytes, newSignBytes []byte) (time.Time, bool) { - var lastVote, newVote types.CanonicalVote - if err := cdc.UnmarshalBinaryLengthPrefixed(lastSignBytes, &lastVote); err != nil { + var lastVote, newVote tmproto.CanonicalVote + if err := protoio.UnmarshalDelimited(lastSignBytes, &lastVote); err != nil { panic(fmt.Sprintf("LastSignBytes cannot be unmarshalled into vote: %v", err)) } - if err := cdc.UnmarshalBinaryLengthPrefixed(newSignBytes, &newVote); err != nil { + if err := protoio.UnmarshalDelimited(newSignBytes, &newVote); err != nil { panic(fmt.Sprintf("signBytes cannot be unmarshalled into vote: %v", err)) } @@ -208,20 +212,18 @@ func checkVotesOnlyDifferByTimestamp(lastSignBytes, newSignBytes []byte) (time.T now := tmtime.Now() lastVote.Timestamp = now newVote.Timestamp = now - lastVoteBytes, _ := cdc.MarshalJSON(lastVote) - newVoteBytes, _ := cdc.MarshalJSON(newVote) - return lastTime, bytes.Equal(newVoteBytes, lastVoteBytes) + return lastTime, proto.Equal(&newVote, &lastVote) } // returns the timestamp from the lastSignBytes. // returns true if the only difference in the proposals is their timestamp func checkProposalsOnlyDifferByTimestamp(lastSignBytes, newSignBytes []byte) (time.Time, bool) { - var lastProposal, newProposal types.CanonicalProposal - if err := cdc.UnmarshalBinaryLengthPrefixed(lastSignBytes, &lastProposal); err != nil { + var lastProposal, newProposal tmproto.CanonicalProposal + if err := protoio.UnmarshalDelimited(lastSignBytes, &lastProposal); err != nil { panic(fmt.Sprintf("LastSignBytes cannot be unmarshalled into proposal: %v", err)) } - if err := cdc.UnmarshalBinaryLengthPrefixed(newSignBytes, &newProposal); err != nil { + if err := protoio.UnmarshalDelimited(newSignBytes, &newProposal); err != nil { panic(fmt.Sprintf("signBytes cannot be unmarshalled into proposal: %v", err)) } @@ -230,8 +232,6 @@ func checkProposalsOnlyDifferByTimestamp(lastSignBytes, newSignBytes []byte) (ti now := tmtime.Now() lastProposal.Timestamp = now newProposal.Timestamp = now - lastProposalBytes, _ := cdc.MarshalBinaryLengthPrefixed(lastProposal) - newProposalBytes, _ := cdc.MarshalBinaryLengthPrefixed(newProposal) - return lastTime, bytes.Equal(newProposalBytes, lastProposalBytes) + return lastTime, proto.Equal(&newProposal, &lastProposal) } diff --git a/consensus/tendermint/sign_info.go.bk b/consensus/tendermint/sign_info.go.bk new file mode 100644 index 000000000..88c5c088d --- /dev/null +++ b/consensus/tendermint/sign_info.go.bk @@ -0,0 +1,237 @@ +package tendermint + +import ( + "bytes" + "errors" + "fmt" + "sync" + "time" + + "github.com/hyperledger/burrow/binary" + "github.com/tendermint/tendermint/types" + tmtime "github.com/tendermint/tendermint/types/time" +) + +// TODO: type ? +const ( + stepNone int8 = 0 // Used to distinguish the initial state + stepPropose int8 = 1 + stepPrevote int8 = 2 + stepPrecommit int8 = 3 +) + +func voteToStep(vote *types.Vote) int8 { + switch vote.Type { + case types.PrevoteType: + return stepPrevote + case types.PrecommitType: + return stepPrecommit + default: + panic("Unknown vote type") + return 0 + } +} + +// LastSignedInfo contains information about the latest +// data signed by a validator to help prevent double signing. +type LastSignedInfo struct { + sync.Mutex + Height int64 `json:"height"` + Round int `json:"round"` + Step int8 `json:"step"` + Signature []byte `json:"signature,omitempty"` // so we don't lose signatures + SignBytes binary.HexBytes `json:"signbytes,omitempty"` // so we don't lose signatures +} + +func NewLastSignedInfo() *LastSignedInfo { + return &LastSignedInfo{ + Step: stepNone, + } +} + +type tmCryptoSigner func(msg []byte) []byte + +// SignVote signs a canonical representation of the vote, along with the +// chainID. Implements PrivValidator. +func (lsi *LastSignedInfo) SignVote(sign tmCryptoSigner, chainID string, vote *types.Vote) error { + lsi.Lock() + defer lsi.Unlock() + if err := lsi.signVote(sign, chainID, vote); err != nil { + return fmt.Errorf("error signing vote: %v", err) + } + return nil +} + +// SignProposal signs a canonical representation of the proposal, along with +// the chainID. Implements PrivValidator. +func (lsi *LastSignedInfo) SignProposal(sign tmCryptoSigner, chainID string, proposal *types.Proposal) error { + lsi.Lock() + defer lsi.Unlock() + if err := lsi.signProposal(sign, chainID, proposal); err != nil { + return fmt.Errorf("error signing proposal: %v", err) + } + return nil +} + +// returns error if HRS regression or no SignBytes. returns true if HRS is unchanged +func (lsi *LastSignedInfo) checkHRS(height int64, round int, step int8) (bool, error) { + if lsi.Height > height { + return false, errors.New("height regression") + } + + if lsi.Height == height { + if lsi.Round > round { + return false, errors.New("round regression") + } + + if lsi.Round == round { + if lsi.Step > step { + return false, errors.New("step regression") + } else if lsi.Step == step { + if lsi.SignBytes != nil { + if lsi.Signature == nil { + panic("pv: Signature is nil but SignBytes is not!") + } + return true, nil + } + return false, errors.New("no Signature found") + } + } + } + return false, nil +} + +// signVote checks if the vote is good to sign and sets the vote signature. +// It may need to set the timestamp as well if the vote is otherwise the same as +// a previously signed vote (ie. we crashed after signing but before the vote hit the WAL). +func (lsi *LastSignedInfo) signVote(sign tmCryptoSigner, chainID string, vote *types.Vote) error { + height, round, step := vote.Height, vote.Round, voteToStep(vote) + signBytes := vote.SignBytes(chainID) + + sameHRS, err := lsi.checkHRS(height, round, step) + if err != nil { + return err + } + + // We might crash before writing to the wal, + // causing us to try to re-sign for the same HRS. + // If signbytes are the same, use the last signature. + // If they only differ by timestamp, use last timestamp and signature + // Otherwise, return error + if sameHRS { + if bytes.Equal(signBytes, lsi.SignBytes) { + vote.Signature = lsi.Signature + } else if timestamp, ok := checkVotesOnlyDifferByTimestamp(lsi.SignBytes, signBytes); ok { + vote.Timestamp = timestamp + vote.Signature = lsi.Signature + } else { + err = fmt.Errorf("conflicting data") + } + return err + } + + // It passed the checks. Sign the vote + sig := sign(signBytes) + lsi.saveSigned(height, round, step, signBytes, sig) + vote.Signature = sig + return nil +} + +// signProposal checks if the proposal is good to sign and sets the proposal signature. +// It may need to set the timestamp as well if the proposal is otherwise the same as +// a previously signed proposal ie. we crashed after signing but before the proposal hit the WAL). +func (lsi *LastSignedInfo) signProposal(sign tmCryptoSigner, chainID string, proposal *types.Proposal) error { + height, round, step := proposal.Height, proposal.Round, stepPropose + signBytes := proposal.SignBytes(chainID) + + sameHRS, err := lsi.checkHRS(height, round, step) + if err != nil { + return err + } + + // We might crash before writing to the wal, + // causing us to try to re-sign for the same HRS. + // If signbytes are the same, use the last signature. + // If they only differ by timestamp, use last timestamp and signature + // Otherwise, return error + if sameHRS { + if bytes.Equal(signBytes, lsi.SignBytes) { + proposal.Signature = lsi.Signature + } else if timestamp, ok := checkProposalsOnlyDifferByTimestamp(lsi.SignBytes, signBytes); ok { + proposal.Timestamp = timestamp + proposal.Signature = lsi.Signature + } else { + err = fmt.Errorf("conflicting data") + } + return err + } + + // It passed the checks. Sign the proposal + sig := sign(signBytes) + lsi.saveSigned(height, round, step, signBytes, sig) + proposal.Signature = sig + return nil +} + +// Persist height/round/step and signature +func (lsi *LastSignedInfo) saveSigned(height int64, round int, step int8, + signBytes []byte, sig []byte) { + + lsi.Height = height + lsi.Round = round + lsi.Step = step + lsi.Signature = sig + lsi.SignBytes = signBytes +} + +// String returns a string representation of the LastSignedInfo. +func (lsi *LastSignedInfo) String() string { + return fmt.Sprintf("PrivValidator{LH:%v, LR:%v, LS:%v}", lsi.Height, lsi.Round, lsi.Step) +} + +//------------------------------------- + +// returns the timestamp from the lastSignBytes. +// returns true if the only difference in the votes is their timestamp. +func checkVotesOnlyDifferByTimestamp(lastSignBytes, newSignBytes []byte) (time.Time, bool) { + var lastVote, newVote types.CanonicalVote + if err := cdc.UnmarshalBinaryLengthPrefixed(lastSignBytes, &lastVote); err != nil { + panic(fmt.Sprintf("LastSignBytes cannot be unmarshalled into vote: %v", err)) + } + if err := cdc.UnmarshalBinaryLengthPrefixed(newSignBytes, &newVote); err != nil { + panic(fmt.Sprintf("signBytes cannot be unmarshalled into vote: %v", err)) + } + + lastTime := lastVote.Timestamp + + // set the times to the same value and check equality + now := tmtime.Now() + lastVote.Timestamp = now + newVote.Timestamp = now + lastVoteBytes, _ := cdc.MarshalJSON(lastVote) + newVoteBytes, _ := cdc.MarshalJSON(newVote) + + return lastTime, bytes.Equal(newVoteBytes, lastVoteBytes) +} + +// returns the timestamp from the lastSignBytes. +// returns true if the only difference in the proposals is their timestamp +func checkProposalsOnlyDifferByTimestamp(lastSignBytes, newSignBytes []byte) (time.Time, bool) { + var lastProposal, newProposal types.CanonicalProposal + if err := cdc.UnmarshalBinaryLengthPrefixed(lastSignBytes, &lastProposal); err != nil { + panic(fmt.Sprintf("LastSignBytes cannot be unmarshalled into proposal: %v", err)) + } + if err := cdc.UnmarshalBinaryLengthPrefixed(newSignBytes, &newProposal); err != nil { + panic(fmt.Sprintf("signBytes cannot be unmarshalled into proposal: %v", err)) + } + + lastTime := lastProposal.Timestamp + // set the times to the same value and check equality + now := tmtime.Now() + lastProposal.Timestamp = now + newProposal.Timestamp = now + lastProposalBytes, _ := cdc.MarshalBinaryLengthPrefixed(lastProposal) + newProposalBytes, _ := cdc.MarshalBinaryLengthPrefixed(newProposal) + + return lastTime, bytes.Equal(newProposalBytes, lastProposalBytes) +} diff --git a/consensus/tendermint/tendermint.go b/consensus/tendermint/tendermint.go index 405b8b07c..350a01f36 100644 --- a/consensus/tendermint/tendermint.go +++ b/consensus/tendermint/tendermint.go @@ -6,6 +6,8 @@ import ( "os" "path" + "github.com/tendermint/tendermint/version" + "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/consensus/abci" "github.com/hyperledger/burrow/crypto" @@ -21,21 +23,29 @@ import ( dbm "github.com/tendermint/tm-db" ) +func init() { + // Tendermint now sets this dynamically in it's build... we could also automate setting it + version.TMCoreSemVer = "0.34.3" +} + // Serves as a wrapper around the Tendermint node's closeable resources (database connections) type Node struct { *node.Node closers []interface { - Close() + Close() error } } -func DBProvider(ID string, backendType dbm.DBBackendType, dbDir string) dbm.DB { +func DBProvider(ID string, backendType dbm.BackendType, dbDir string) (dbm.DB, error) { return dbm.NewDB(ID, backendType, dbDir) } // Since Tendermint doesn't close its DB connections func (n *Node) DBProvider(ctx *node.DBContext) (dbm.DB, error) { - db := DBProvider(ctx.ID, dbm.DBBackendType(ctx.Config.DBBackend), ctx.Config.DBDir()) + db, err := DBProvider(ctx.ID, dbm.BackendType(ctx.Config.DBBackend), ctx.Config.DBDir()) + if err != nil { + return nil, err + } n.closers = append(n.closers, db) return db, nil } @@ -80,9 +90,10 @@ func DeriveGenesisDoc(burrowGenesisDoc *genesis.GenesisDoc, appHash []byte) *tmT validators := make([]tmTypes.GenesisValidator, len(burrowGenesisDoc.Validators)) for i, validator := range burrowGenesisDoc.Validators { validators[i] = tmTypes.GenesisValidator{ - PubKey: validator.PublicKey.TendermintPubKey(), - Name: validator.Name, - Power: int64(validator.Amount), + Address: validator.PublicKey.TendermintAddress(), + PubKey: validator.PublicKey.TendermintPubKey(), + Name: validator.Name, + Power: int64(validator.Amount), } } consensusParams := tmTypes.DefaultConsensusParams() @@ -92,11 +103,12 @@ func DeriveGenesisDoc(burrowGenesisDoc *genesis.GenesisDoc, appHash []byte) *tmT consensusParams.Block.TimeIotaMs = 1 return &tmTypes.GenesisDoc{ - ChainID: burrowGenesisDoc.ChainID(), + ChainID: burrowGenesisDoc.GetChainID(), GenesisTime: burrowGenesisDoc.GenesisTime, Validators: validators, AppHash: appHash, ConsensusParams: consensusParams, + InitialHeight: 1, } } diff --git a/consensus/tendermint/tendermint.pb.go b/consensus/tendermint/tendermint.pb.go index a79c3aedb..1bf67d54d 100644 --- a/consensus/tendermint/tendermint.pb.go +++ b/consensus/tendermint/tendermint.pb.go @@ -5,7 +5,9 @@ package tendermint import ( fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -24,7 +26,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 type NodeInfo struct { ID github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"ID"` @@ -47,16 +49,21 @@ func (*NodeInfo) Descriptor() ([]byte, []int) { return fileDescriptor_04f926c8da23c367, []int{0} } func (m *NodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeInfo.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *NodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeInfo.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *NodeInfo) XXX_Merge(src proto.Message) { xxx_messageInfo_NodeInfo.Merge(m, src) } func (m *NodeInfo) XXX_Size() int { - return xxx_messageInfo_NodeInfo.Size(m) + return m.Size() } func (m *NodeInfo) XXX_DiscardUnknown() { xxx_messageInfo_NodeInfo.DiscardUnknown(m) @@ -119,29 +126,129 @@ func init() { golang_proto.RegisterFile("tendermint.proto", fileDescriptor_04f92 var fileDescriptor_04f926c8da23c367 = []byte{ // 323 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0x4f, 0x4f, 0xf2, 0x40, - 0x10, 0xc6, 0xdf, 0xed, 0xab, 0x80, 0x1b, 0x4d, 0x4c, 0x4f, 0x1b, 0x0f, 0x85, 0x18, 0x0f, 0x1c, - 0xa4, 0x4d, 0xfc, 0xf3, 0x01, 0x84, 0x1e, 0x6c, 0xa2, 0x44, 0x1b, 0xe3, 0xc1, 0x1b, 0xa5, 0x43, - 0xd9, 0x00, 0x3b, 0x64, 0x77, 0x1b, 0xe8, 0xb7, 0xf3, 0xc8, 0xd5, 0x9b, 0xf1, 0x40, 0x0c, 0x7c, - 0x11, 0xd3, 0x6d, 0x11, 0xbc, 0xe8, 0x6d, 0x7f, 0xcf, 0xb3, 0x33, 0xf3, 0xec, 0x0e, 0x3d, 0xd6, - 0x20, 0x62, 0x90, 0x13, 0x2e, 0xb4, 0x3b, 0x95, 0xa8, 0xd1, 0xa6, 0x5b, 0xe5, 0xa4, 0x95, 0x70, - 0x3d, 0x4c, 0x23, 0xb7, 0x8f, 0x13, 0x2f, 0xc1, 0x04, 0x3d, 0x73, 0x25, 0x4a, 0x07, 0x86, 0x0c, - 0x98, 0x53, 0x51, 0x7a, 0xfa, 0x66, 0xd1, 0x5a, 0x17, 0x63, 0x08, 0xc4, 0x00, 0x6d, 0x9f, 0x5a, - 0x81, 0xcf, 0x48, 0x83, 0x34, 0x0f, 0xdb, 0x57, 0x8b, 0x65, 0xfd, 0xdf, 0xc7, 0xb2, 0x7e, 0xbe, - 0xd3, 0x6f, 0x98, 0x4d, 0x41, 0x8e, 0x21, 0x4e, 0x40, 0x7a, 0x51, 0x2a, 0x25, 0xce, 0xbc, 0xbe, - 0xcc, 0xa6, 0x1a, 0xdd, 0x9b, 0x38, 0x96, 0xa0, 0x54, 0x68, 0x05, 0xbe, 0x7d, 0x46, 0x8f, 0xee, - 0xb8, 0xd2, 0x20, 0x4a, 0x91, 0x59, 0x0d, 0xd2, 0x3c, 0x08, 0x7f, 0x8a, 0x36, 0xa3, 0xd5, 0x2e, - 0xe8, 0x19, 0xca, 0x11, 0xfb, 0x6f, 0xfc, 0x0d, 0xe6, 0xce, 0x33, 0x48, 0xc5, 0x51, 0xb0, 0xbd, - 0xc2, 0x29, 0xd1, 0x7e, 0xa4, 0xb5, 0xce, 0xb0, 0x27, 0x04, 0x8c, 0x15, 0xdb, 0x37, 0x29, 0xaf, - 0xcb, 0x94, 0xad, 0xdf, 0x53, 0x46, 0x5c, 0xf4, 0x64, 0xe6, 0xde, 0xc2, 0xbc, 0x9d, 0x69, 0x50, - 0xe1, 0x77, 0x9b, 0x7c, 0xd8, 0x3d, 0x0a, 0x3e, 0x02, 0xc9, 0x2a, 0xc5, 0xb0, 0x12, 0x6d, 0x87, - 0xd2, 0xf0, 0xa1, 0xb3, 0x79, 0x43, 0xd5, 0x98, 0x3b, 0x4a, 0x5e, 0xf9, 0x34, 0x0f, 0x44, 0x0c, - 0x73, 0x56, 0x2b, 0x2a, 0x4b, 0x6c, 0xfb, 0xef, 0x2b, 0x87, 0x7c, 0xae, 0x1c, 0xf2, 0xba, 0x76, - 0xc8, 0x62, 0xed, 0x90, 0x97, 0x8b, 0x3f, 0x3e, 0x11, 0x85, 0x02, 0xa1, 0x52, 0xe5, 0x6d, 0x17, - 0x19, 0x55, 0xcc, 0x82, 0x2e, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xba, 0x9e, 0x0e, 0xac, 0xef, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0x3d, 0x4f, 0xfb, 0x30, + 0x10, 0xc6, 0xff, 0xce, 0x1f, 0xda, 0x62, 0x81, 0x84, 0x22, 0x06, 0x8b, 0xc1, 0xad, 0x10, 0x43, + 0x07, 0x48, 0x24, 0x5e, 0x3e, 0x00, 0x6d, 0x07, 0x22, 0x95, 0x0a, 0x22, 0xc4, 0xc0, 0xd6, 0x34, + 0x47, 0x6a, 0xb5, 0xf5, 0x55, 0xb6, 0xab, 0x36, 0xdf, 0x8e, 0x31, 0x23, 0x6c, 0x88, 0xa1, 0x42, + 0xe9, 0x17, 0x41, 0x79, 0x29, 0x85, 0x05, 0x36, 0x3f, 0xbf, 0xc7, 0xe7, 0x7b, 0x7c, 0x47, 0xf7, + 0x0d, 0xc8, 0x10, 0xd4, 0x44, 0x48, 0xe3, 0x4c, 0x15, 0x1a, 0xb4, 0xe9, 0x86, 0x1c, 0x1e, 0x44, + 0x18, 0x61, 0x8e, 0xdd, 0xec, 0x54, 0xdc, 0x38, 0x7a, 0xb5, 0x68, 0xad, 0x87, 0x21, 0x78, 0xf2, + 0x09, 0xed, 0x0e, 0xb5, 0xbc, 0x0e, 0x23, 0x0d, 0xd2, 0xdc, 0x6d, 0x5d, 0x24, 0xcb, 0xfa, 0xbf, + 0xf7, 0x65, 0xfd, 0x24, 0x12, 0x66, 0x38, 0x0b, 0x9c, 0x01, 0x4e, 0xdc, 0x61, 0x3c, 0x05, 0x35, + 0x86, 0x30, 0x02, 0xe5, 0x06, 0x33, 0xa5, 0x70, 0xee, 0x0e, 0x54, 0x3c, 0x35, 0xe8, 0x5c, 0x85, + 0xa1, 0x02, 0xad, 0x7d, 0xcb, 0xeb, 0xd8, 0xc7, 0x74, 0xaf, 0x2b, 0xb4, 0x01, 0x59, 0x42, 0x66, + 0x35, 0x48, 0x73, 0xc7, 0xff, 0x09, 0x6d, 0x46, 0xab, 0x3d, 0x30, 0x73, 0x54, 0x23, 0xf6, 0x3f, + 0xf7, 0xd7, 0x32, 0x73, 0x1e, 0x40, 0x69, 0x81, 0x92, 0x6d, 0x15, 0x4e, 0x29, 0xed, 0x3b, 0x5a, + 0x6b, 0x0f, 0xfb, 0x52, 0xc2, 0x58, 0xb3, 0xed, 0x3c, 0xe5, 0x65, 0x99, 0xf2, 0xf4, 0xf7, 0x94, + 0x81, 0x90, 0x7d, 0x15, 0x3b, 0xd7, 0xb0, 0x68, 0xc5, 0x06, 0xb4, 0xff, 0xf5, 0x4c, 0xd6, 0xec, + 0x06, 0xa5, 0x18, 0x81, 0x62, 0x95, 0xa2, 0x59, 0x29, 0x6d, 0x4e, 0xa9, 0x7f, 0xdb, 0x5e, 0xff, + 0xa1, 0x9a, 0x9b, 0xdf, 0x48, 0x56, 0x79, 0xbf, 0xf0, 0x64, 0x08, 0x0b, 0x56, 0x2b, 0x2a, 0x4b, + 0xd9, 0xea, 0x26, 0x29, 0x27, 0x2f, 0x29, 0x27, 0x6f, 0x29, 0x27, 0x1f, 0x29, 0x27, 0xcf, 0x2b, + 0x4e, 0x92, 0x15, 0x27, 0x8f, 0x67, 0x7f, 0x0c, 0x13, 0xa5, 0x06, 0xa9, 0x67, 0xda, 0xdd, 0xec, + 0x2d, 0xa8, 0xe4, 0x8b, 0x3a, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xa6, 0xba, 0x35, 0x49, 0xde, 0x01, 0x00, 0x00, } +func (m *NodeInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeInfo) 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.TxIndex) > 0 { + i -= len(m.TxIndex) + copy(dAtA[i:], m.TxIndex) + i = encodeVarintTendermint(dAtA, i, uint64(len(m.TxIndex))) + i-- + dAtA[i] = 0x42 + } + if len(m.RPCAddress) > 0 { + i -= len(m.RPCAddress) + copy(dAtA[i:], m.RPCAddress) + i = encodeVarintTendermint(dAtA, i, uint64(len(m.RPCAddress))) + i-- + dAtA[i] = 0x3a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintTendermint(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x32 + } + { + size := m.Channels.Size() + i -= size + if _, err := m.Channels.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTendermint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTendermint(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x22 + } + if len(m.Network) > 0 { + i -= len(m.Network) + copy(dAtA[i:], m.Network) + i = encodeVarintTendermint(dAtA, i, uint64(len(m.Network))) + i-- + dAtA[i] = 0x1a + } + if len(m.ListenAddress) > 0 { + i -= len(m.ListenAddress) + copy(dAtA[i:], m.ListenAddress) + i = encodeVarintTendermint(dAtA, i, uint64(len(m.ListenAddress))) + i-- + dAtA[i] = 0x12 + } + { + size := m.ID.Size() + i -= size + if _, err := m.ID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTendermint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTendermint(dAtA []byte, offset int, v uint64) int { + offset -= sovTendermint(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} func (m *NodeInfo) Size() (n int) { if m == nil { return 0 @@ -183,15 +290,401 @@ func (m *NodeInfo) Size() (n int) { } func sovTendermint(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTendermint(x uint64) (n int) { return sovTendermint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *NodeInfo) 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 ErrIntOverflowTendermint + } + 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 byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTendermint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTendermint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTendermint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListenAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTendermint + } + 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 ErrInvalidLengthTendermint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTendermint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ListenAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 ErrIntOverflowTendermint + } + 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 ErrInvalidLengthTendermint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTendermint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Network = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 ErrIntOverflowTendermint + } + 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 ErrInvalidLengthTendermint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTendermint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Channels", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTendermint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTendermint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTendermint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Channels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + 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 ErrIntOverflowTendermint + } + 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 ErrInvalidLengthTendermint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTendermint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RPCAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTendermint + } + 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 ErrInvalidLengthTendermint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTendermint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RPCAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTendermint + } + 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 ErrInvalidLengthTendermint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTendermint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxIndex = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTendermint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTendermint + } + 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 skipTendermint(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTendermint + } + 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, ErrIntOverflowTendermint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTendermint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTendermint + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTendermint + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTendermint + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTendermint = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTendermint = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTendermint = fmt.Errorf("proto: unexpected end of group") +) diff --git a/consensus/tendermint/tendermint_test.go b/consensus/tendermint/tendermint_test.go index 8b57efc2c..33ff78bb6 100644 --- a/consensus/tendermint/tendermint_test.go +++ b/consensus/tendermint/tendermint_test.go @@ -7,24 +7,21 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/crypto/ed25519" - cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino" + tmjson "github.com/tendermint/tendermint/libs/json" "github.com/tendermint/tendermint/p2p" ) func TestMarshalNodeKey(t *testing.T) { - cdc := amino.NewCodec() - cryptoAmino.RegisterAmino(cdc) nodeKey := NewNodeKey() - bsAmino, err := cdc.MarshalJSON(nodeKey) + tmbs, err := tmjson.Marshal(nodeKey) require.NoError(t, err) file, err := ioutil.TempFile(os.TempDir(), "nodeKey-") require.NoError(t, err) defer os.Remove(file.Name()) - _, err = file.Write(bsAmino) + _, err = file.Write(tmbs) require.NoError(t, err) nk, err := p2p.LoadNodeKey(file.Name()) require.NoError(t, err) @@ -33,8 +30,8 @@ func TestMarshalNodeKey(t *testing.T) { bs, err := json.Marshal(nodeKey) require.NoError(t, err) nk = new(p2p.NodeKey) - nk.PrivKey = new(ed25519.PrivKeyEd25519) + nk.PrivKey = new(ed25519.PrivKey) err = json.Unmarshal(bs, nk) require.NoError(t, err) - require.Equal(t, nodeKey.PrivKey, *nk.PrivKey.(*ed25519.PrivKeyEd25519)) + require.Equal(t, nodeKey.PrivKey, *nk.PrivKey.(*ed25519.PrivKey)) } diff --git a/core/config.go b/core/config.go index 225945622..aa549168b 100644 --- a/core/config.go +++ b/core/config.go @@ -8,6 +8,7 @@ import ( "github.com/hyperledger/burrow/consensus/abci" "github.com/hyperledger/burrow/consensus/tendermint" "github.com/hyperledger/burrow/execution" + "github.com/hyperledger/burrow/execution/registry" "github.com/hyperledger/burrow/keys" "github.com/hyperledger/burrow/logging/logconfig" "github.com/hyperledger/burrow/logging/structure" @@ -19,7 +20,7 @@ import ( // LoadKeysFromConfig sets the keyClient & keyStore based on the given config func (kern *Kernel) LoadKeysFromConfig(conf *keys.KeysConfig) (err error) { - kern.keyStore = keys.NewKeyStore(conf.KeysDirectory, conf.AllowBadFilePermissions) + kern.keyStore = keys.NewFilesystemKeyStore(conf.KeysDirectory, conf.AllowBadFilePermissions) if conf.RemoteAddress != "" { kern.keyClient, err = keys.NewRemoteKeyClient(conf.RemoteAddress, kern.Logger) if err != nil { @@ -33,7 +34,7 @@ func (kern *Kernel) LoadKeysFromConfig(conf *keys.KeysConfig) (err error) { // LoadLoggerFromConfig adds a logging configuration to the kernel func (kern *Kernel) LoadLoggerFromConfig(conf *logconfig.LoggingConfig) error { - logger, err := conf.NewLogger() + logger, err := conf.Logger() kern.SetLogger(logger) return err } @@ -58,10 +59,18 @@ func (kern *Kernel) LoadTendermintFromConfig(conf *config.BurrowConfig, privVal } authorizedPeersProvider := conf.Tendermint.DefaultAuthorizedPeersProvider() + if conf.Tendermint.IdentifyPeers { + authorizedPeersProvider = registry.NewNodeFilter(kern.State) + } + kern.database.Stats() + pubKey, err := privVal.GetPubKey() + if err != nil { + return err + } kern.info = fmt.Sprintf("Burrow_%s_%s_ValidatorID:%X", project.History.CurrentVersion().String(), - kern.Blockchain.ChainID(), privVal.GetPubKey().Address()) + kern.Blockchain.ChainID(), pubKey.Address()) app := abci.NewApp(kern.info, kern.Blockchain, kern.State, kern.checker, kern.committer, kern.txCodec, authorizedPeersProvider, kern.Panic, kern.Logger) @@ -112,11 +121,11 @@ func LoadKernelFromConfig(conf *config.BurrowConfig) (*Kernel, error) { return nil, fmt.Errorf("could not load state: %v", err) } - if conf.Address == nil { + if conf.ValidatorAddress == nil { return nil, fmt.Errorf("Address must be set") } - privVal, err := kern.PrivValidator(*conf.Address) + privVal, err := kern.PrivValidator(*conf.ValidatorAddress) if err != nil { return nil, fmt.Errorf("could not form PrivValidator from Address: %v", err) } diff --git a/core/kernel.go b/core/kernel.go index 4707bcde3..7b0d15476 100644 --- a/core/kernel.go +++ b/core/kernel.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package core @@ -26,12 +15,15 @@ import ( "syscall" "time" - "github.com/hyperledger/burrow/dump" - "github.com/go-kit/kit/log" "github.com/hyperledger/burrow/bcm" "github.com/hyperledger/burrow/consensus/tendermint" "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/dump" + "github.com/hyperledger/burrow/rpc/web3" + + // GRPC Codec + _ "github.com/hyperledger/burrow/encoding" "github.com/hyperledger/burrow/event" "github.com/hyperledger/burrow/execution" "github.com/hyperledger/burrow/execution/state" @@ -61,6 +53,7 @@ type Kernel struct { // Expose these public-facing interfaces to allow programmatic extension of the Kernel by other projects Emitter *event.Emitter Service *rpc.Service + EthService *web3.EthService Launchers []process.Launcher State *state.State Blockchain *bcm.Blockchain @@ -70,11 +63,11 @@ type Kernel struct { Logger *logging.Logger database dbm.DB txCodec txs.Codec - exeOptions []execution.ExecutionOption + exeOptions []execution.Option checker execution.BatchExecutor committer execution.BatchCommitter keyClient keys.KeyClient - keyStore *keys.KeyStore + keyStore *keys.FilesystemKeyStore info string processes map[string]process.Process listeners map[string]net.Listener @@ -89,6 +82,13 @@ func NewKernel(dbDir string) (*Kernel, error) { return nil, fmt.Errorf("Burrow requires a database directory") } runID, err := simpleuuid.NewTime(time.Now()) // Create a random ID based on start time + if err != nil { + return nil, fmt.Errorf("could not create runID UUID: %w", err) + } + db, err := dbm.NewDB(BurrowDBName, dbm.GoLevelDBBackend, dbDir) + if err != nil { + return nil, fmt.Errorf("could not create DB for Kernel: %w", err) + } return &Kernel{ Logger: logging.NewNoopLogger(), RunID: runID, @@ -97,7 +97,7 @@ func NewKernel(dbDir string) (*Kernel, error) { listeners: make(map[string]net.Listener), shutdownNotify: make(chan struct{}), txCodec: txs.NewProtobufCodec(), - database: dbm.NewDB(BurrowDBName, dbm.GoLevelDBBackend, dbDir), + database: db, }, err } @@ -138,7 +138,13 @@ func (kern *Kernel) LoadState(genesisDoc *genesis.GenesisDoc) (err error) { return fmt.Errorf("could not build genesis state: %v", err) } - if err = kern.State.InitialCommit(); err != nil { + err = kern.State.InitialCommit() + if err != nil { + return err + } + + err = kern.Blockchain.CommitWithAppHash(kern.State.Hash()) + if err != nil { return err } } @@ -146,8 +152,15 @@ func (kern *Kernel) LoadState(genesisDoc *genesis.GenesisDoc) (err error) { kern.Logger.InfoMsg("State loading successful") params := execution.ParamsFromGenesis(genesisDoc) - kern.checker = execution.NewBatchChecker(kern.State, params, kern.Blockchain, kern.Logger) - kern.committer = execution.NewBatchCommitter(kern.State, params, kern.Blockchain, kern.Emitter, kern.Logger, kern.exeOptions...) + kern.checker, err = execution.NewBatchChecker(kern.State, params, kern.Blockchain, kern.Logger) + if err != nil { + return fmt.Errorf("could not create BatchChecker: %w", err) + } + kern.committer, err = execution.NewBatchCommitter(kern.State, params, kern.Blockchain, kern.Emitter, kern.Logger, + kern.exeOptions...) + if err != nil { + return fmt.Errorf("could not create BatchCommitter: %w", err) + } return nil } @@ -178,21 +191,21 @@ func (kern *Kernel) LoadDump(genesisDoc *genesis.GenesisDoc, restoreFile string, reader, err := dump.NewFileReader(restoreFile) if err != nil { - return err + return fmt.Errorf("could not create dump file reader: %w", err) } err = dump.Load(reader, kern.State) if err != nil { - return err + return fmt.Errorf("could not load dump state: %w", err) } if !bytes.Equal(kern.State.Hash(), kern.Blockchain.GenesisDoc().AppHash) { - return fmt.Errorf("restore produced a different apphash expect 0x%x got 0x%x", + return fmt.Errorf("restore produced a different apphash, expected %X by actual was %X", kern.Blockchain.GenesisDoc().AppHash, kern.State.Hash()) } err = kern.Blockchain.CommitWithAppHash(kern.State.Hash()) if err != nil { - return fmt.Errorf("unable to commit %v", err) + return fmt.Errorf("unable to commit %w", err) } kern.Logger.InfoMsg("State restore successful", @@ -209,7 +222,7 @@ func (kern *Kernel) GetNodeView() (*tendermint.NodeView, error) { } // AddExecutionOptions extends our execution options -func (kern *Kernel) AddExecutionOptions(opts ...execution.ExecutionOption) { +func (kern *Kernel) AddExecutionOptions(opts ...execution.Option) { kern.exeOptions = append(kern.exeOptions, opts...) } @@ -224,7 +237,7 @@ func (kern *Kernel) SetKeyClient(client keys.KeyClient) { } // SetKeyStore explicitly sets the key store -func (kern *Kernel) SetKeyStore(store *keys.KeyStore) { +func (kern *Kernel) SetKeyStore(store *keys.FilesystemKeyStore) { kern.keyStore = store } @@ -313,7 +326,7 @@ func (kern *Kernel) supervise() { syncCh := make(chan os.Signal, 1) signal.Notify(shutdownCh, syscall.SIGINT, syscall.SIGTERM) signal.Notify(reloadCh, syscall.SIGHUP) - signal.Notify(syncCh, syscall.SIGUSR1) + signal.Notify(syncCh, syscall.SIGTRAP) for { select { case <-reloadCh: diff --git a/core/processes.go b/core/processes.go index 6a9c05a61..c262efa72 100644 --- a/core/processes.go +++ b/core/processes.go @@ -14,13 +14,16 @@ import ( "github.com/hyperledger/burrow/process" "github.com/hyperledger/burrow/project" "github.com/hyperledger/burrow/rpc" + "github.com/hyperledger/burrow/rpc/lib/server" "github.com/hyperledger/burrow/rpc/metrics" "github.com/hyperledger/burrow/rpc/rpcdump" "github.com/hyperledger/burrow/rpc/rpcevents" "github.com/hyperledger/burrow/rpc/rpcinfo" "github.com/hyperledger/burrow/rpc/rpcquery" "github.com/hyperledger/burrow/rpc/rpctransact" + "github.com/hyperledger/burrow/rpc/web3" "github.com/hyperledger/burrow/txs" + "github.com/tendermint/tendermint/p2p" "github.com/tendermint/tendermint/version" hex "github.com/tmthrgd/go-hex" ) @@ -31,6 +34,7 @@ const ( NoConsensusProcessName = "NoConsensusExecution" TendermintProcessName = "Tendermint" StartupProcessName = "StartupAnnouncer" + Web3ProcessName = "rpcConfig/web3" InfoProcessName = "rpcConfig/info" GRPCProcessName = "rpcConfig/GRPC" MetricsProcessName = "rpcConfig/metrics" @@ -44,6 +48,7 @@ func DefaultProcessLaunchers(kern *Kernel, rpcConfig *rpc.RPCConfig, keysConfig NoConsensusLauncher(kern), TendermintLauncher(kern), StartupLauncher(kern), + Web3Launcher(kern, rpcConfig.Web3), InfoLauncher(kern, rpcConfig.Info), MetricsLauncher(kern, rpcConfig.Metrics), GRPCLauncher(kern, rpcConfig.GRPC, keysConfig), @@ -56,7 +61,7 @@ func ProfileLauncher(kern *Kernel, conf *rpc.ServerConfig) process.Launcher { Enabled: conf.Enabled, Launch: func() (process.Process, error) { debugServer := &http.Server{ - Addr: fmt.Sprintf("%s:%s", conf.ListenHost, conf.ListenPort), + Addr: conf.ListenAddress(), } go func() { err := debugServer.ListenAndServe() @@ -91,7 +96,9 @@ func NoConsensusLauncher(kern *Kernel) process.Launcher { Launch: func() (process.Process, error) { accountState := kern.State nameRegState := kern.State - kern.Service = rpc.NewService(accountState, nameRegState, kern.Blockchain, kern.State, nil, kern.Logger) + nodeRegState := kern.State + validatorSet := kern.State + kern.Service = rpc.NewService(accountState, nameRegState, nodeRegState, kern.Blockchain, validatorSet, nil, kern.Logger) // TimeoutFactor scales in units of seconds blockDuration := time.Duration(kern.timeoutFactor * float64(time.Second)) //proc := abci.NewProcess(kern.checker, kern.committer, kern.Blockchain, kern.txCodec, blockDuration, kern.Panic) @@ -99,8 +106,8 @@ func NoConsensusLauncher(kern *Kernel) process.Launcher { // Provide execution accounts against backend state since we will commit immediately accounts := execution.NewAccounts(kern.committer, kern.keyClient, AccountsRingMutexCount) // Elide consensus and use a CheckTx function that immediately commits any valid transaction - kern.Transactor = execution.NewTransactor(kern.Blockchain, kern.Emitter, accounts, proc.CheckTx, kern.txCodec, - kern.Logger) + kern.Transactor = execution.NewTransactor(kern.Blockchain, + kern.Emitter, accounts, proc.CheckTx, "", kern.txCodec, kern.Logger) return proc, nil }, } @@ -117,17 +124,26 @@ func TendermintLauncher(kern *Kernel) process.Launcher { return nil, fmt.Errorf("%s cannot get NodeView %v", errHeader, err) } - accountState := kern.State - nameRegState := kern.State - kern.Service = rpc.NewService(accountState, nameRegState, kern.Blockchain, kern.State, nodeView, kern.Logger) + var id p2p.ID + if ni := nodeView.NodeInfo(); ni != nil { + id = p2p.ID(ni.ID.Bytes()) + } kern.Blockchain.SetBlockStore(bcm.NewBlockStore(nodeView.BlockStore())) // Provide execution accounts against checker state so that we can assign sequence numbers accounts := execution.NewAccounts(kern.checker, kern.keyClient, AccountsRingMutexCount) // Pass transactions to Tendermint's CheckTx function for broadcast and consensus checkTx := kern.Node.Mempool().CheckTx - kern.Transactor = execution.NewTransactor(kern.Blockchain, kern.Emitter, accounts, checkTx, kern.txCodec, - kern.Logger) + kern.Transactor = execution.NewTransactor(kern.Blockchain, + kern.Emitter, accounts, checkTx, id, kern.txCodec, kern.Logger) + + accountState := kern.State + eventsState := kern.State + nameRegState := kern.State + nodeRegState := kern.State + validatorState := kern.State + kern.Service = rpc.NewService(accountState, nameRegState, nodeRegState, kern.Blockchain, validatorState, nodeView, kern.Logger) + kern.EthService = web3.NewEthService(accountState, eventsState, kern.Blockchain, validatorState, nodeView, kern.Transactor, kern.keyStore, kern.Logger) if err := kern.Node.Start(); err != nil { return nil, fmt.Errorf("%s error starting Tendermint node: %v", errHeader, err) @@ -184,7 +200,7 @@ func StartupLauncher(kern *Kernel) process.Launcher { logger := kern.Logger.With( "launch_time", start, "burrow_version", project.FullVersion(), - "tendermint_version", version.Version, + "tendermint_version", version.TMCoreSemVer, "validator_address", nodeView.ValidatorAddress(), "node_id", string(info.ID()), "net_address", netAddress.String(), @@ -203,7 +219,7 @@ func InfoLauncher(kern *Kernel, conf *rpc.ServerConfig) process.Launcher { Name: InfoProcessName, Enabled: conf.Enabled, Launch: func() (process.Process, error) { - listener, err := process.ListenerFromAddress(fmt.Sprintf("%s:%s", conf.ListenHost, conf.ListenPort)) + listener, err := process.ListenerFromAddress(conf.ListenAddress()) if err != nil { return nil, err } @@ -220,12 +236,36 @@ func InfoLauncher(kern *Kernel, conf *rpc.ServerConfig) process.Launcher { } } +func Web3Launcher(kern *Kernel, conf *rpc.ServerConfig) process.Launcher { + return process.Launcher{ + Name: Web3ProcessName, + Enabled: conf.Enabled, + Launch: func() (process.Process, error) { + listener, err := process.ListenerFromAddress(fmt.Sprintf("%s:%s", conf.ListenHost, conf.ListenPort)) + if err != nil { + return nil, err + } + err = kern.registerListener(Web3ProcessName, listener) + if err != nil { + return nil, err + } + + srv, err := server.StartHTTPServer(listener, web3.NewServer(kern.EthService), kern.Logger) + if err != nil { + return nil, err + } + + return srv, nil + }, + } +} + func MetricsLauncher(kern *Kernel, conf *rpc.MetricsConfig) process.Launcher { return process.Launcher{ Name: MetricsProcessName, Enabled: conf.Enabled, Launch: func() (process.Process, error) { - listener, err := process.ListenerFromAddress(fmt.Sprintf("%s:%s", conf.ListenHost, conf.ListenPort)) + listener, err := process.ListenerFromAddress(conf.ListenAddress()) if err != nil { return nil, err } @@ -253,7 +293,7 @@ func GRPCLauncher(kern *Kernel, conf *rpc.ServerConfig, keyConfig *keys.KeysConf return nil, err } - listener, err := process.ListenerFromAddress(fmt.Sprintf("%s:%s", conf.ListenHost, conf.ListenPort)) + listener, err := process.ListenerFromAddress(conf.ListenAddress()) if err != nil { return nil, err } @@ -263,7 +303,7 @@ func GRPCLauncher(kern *Kernel, conf *rpc.ServerConfig, keyConfig *keys.KeysConf } grpcServer := rpc.NewGRPCServer(kern.Logger) - var ks *keys.KeyStore + var ks *keys.FilesystemKeyStore if kern.keyStore != nil { ks = kern.keyStore } @@ -271,15 +311,12 @@ func GRPCLauncher(kern *Kernel, conf *rpc.ServerConfig, keyConfig *keys.KeysConf if keyConfig.GRPCServiceEnabled { if kern.keyStore == nil { - ks = keys.NewKeyStore(keyConfig.KeysDirectory, keyConfig.AllowBadFilePermissions) + ks = keys.NewFilesystemKeyStore(keyConfig.KeysDirectory, keyConfig.AllowBadFilePermissions) } keys.RegisterKeysServer(grpcServer, ks) } - - nameRegState := kern.State - proposalRegState := kern.State - rpcquery.RegisterQueryServer(grpcServer, rpcquery.NewQueryServer(kern.State, nameRegState, proposalRegState, - kern.Blockchain, kern.State, nodeView, kern.Logger)) + rpcquery.RegisterQueryServer(grpcServer, rpcquery.NewQueryServer(kern.State, kern.Blockchain, nodeView, + kern.Logger)) txCodec := txs.NewProtobufCodec() rpctransact.RegisterTransactServer(grpcServer, diff --git a/crypto/address.go b/crypto/address.go index 631c1dcc6..db235256e 100644 --- a/crypto/address.go +++ b/crypto/address.go @@ -8,7 +8,7 @@ import ( "fmt" "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto/sha3" + hex "github.com/tmthrgd/go-hex" ) @@ -16,10 +16,10 @@ type Addressable interface { // Get the 20 byte EVM address of this account GetAddress() Address // Public key from which the Address is derived - GetPublicKey() PublicKey + GetPublicKey() *PublicKey } -func NewAddressable(publicKey PublicKey) Addressable { +func NewAddressable(publicKey *PublicKey) Addressable { return &memoizedAddressable{ address: publicKey.GetAddress(), publicKey: publicKey, @@ -27,11 +27,11 @@ func NewAddressable(publicKey PublicKey) Addressable { } type memoizedAddressable struct { - publicKey PublicKey + publicKey *PublicKey address Address } -func (a *memoizedAddressable) GetPublicKey() PublicKey { +func (a *memoizedAddressable) GetPublicKey() *PublicKey { return a.publicKey } @@ -158,7 +158,6 @@ func (address *Address) UnmarshalText(text []byte) error { func (address Address) MarshalText() ([]byte, error) { return ([]byte)(hex.EncodeUpperToString(address[:])), nil - } // Gogo proto support @@ -196,7 +195,7 @@ func Nonce(caller Address, nonce []byte) []byte { return hasher.Sum(nil) } -// Obtain a nearly unique nonce based on a montonic account sequence number +// Obtain a nearly unique nonce based on a monotonic account sequence number func SequenceNonce(address Address, sequence uint64) []byte { bs := make([]byte, 8) bin.BigEndian.PutUint64(bs, sequence) @@ -208,13 +207,13 @@ func NewContractAddress(caller Address, nonce []byte) (newAddr Address) { return } -func NewContractAddress2(caller Address, salt [binary.Word256Length]byte, initcode []byte) (newAddr Address) { +func NewContractAddress2(caller Address, salt [binary.Word256Bytes]byte, initcode []byte) (newAddr Address) { // sha3(0xff ++ caller.Address() ++ salt ++ sha3(init_code))[12:] - temp := make([]byte, 0, 1+AddressLength+2*binary.Word256Length) + temp := make([]byte, 0, 1+AddressLength+2*binary.Word256Bytes) temp = append(temp, []byte{0xFF}...) temp = append(temp, caller[:]...) temp = append(temp, salt[:]...) - temp = append(temp, sha3.Sha3(initcode)...) - copy(newAddr[:], sha3.Sha3(temp)[12:]) + temp = append(temp, Keccak256(initcode)...) + copy(newAddr[:], Keccak256(temp)[12:]) return } diff --git a/crypto/crypto.go b/crypto/crypto.go index 215b7faf4..b236849fd 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -24,6 +24,7 @@ func (k CurveType) String() string { return "unknown" } } + func (k CurveType) ABCIType() string { switch k { case CurveTypeSecp256k1: @@ -51,14 +52,14 @@ func CurveTypeFromString(s string) (CurveType, error) { case "": return CurveTypeUnset, nil default: - return CurveTypeUnset, ErrInvalidCurve(s) + return CurveTypeUnset, fmt.Errorf("invalid curve name: '%s'", s) } } -type ErrInvalidCurve string +type ErrInvalidCurve uint32 -func (err ErrInvalidCurve) Error() string { - return fmt.Sprintf("invalid curve type") +func (curveType ErrInvalidCurve) Error() string { + return fmt.Sprintf("invalid curve type: %d", curveType) } // The types in this file allow us to control serialisation of keys and signatures, as well as the interface @@ -73,3 +74,7 @@ type Signer interface { type Signable interface { SignBytes(chainID string) ([]byte, error) } + +func (pk *PrivateKey) GetAddress() Address { + return pk.GetPublicKey().GetAddress() +} diff --git a/crypto/crypto.pb.go b/crypto/crypto.pb.go index ab32f1738..91be15f3f 100644 --- a/crypto/crypto.pb.go +++ b/crypto/crypto.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -24,7 +25,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 type PublicKey struct { CurveType CurveType `protobuf:"varint,1,opt,name=CurveType,proto3,casttype=CurveType" json:"CurveType,omitempty"` @@ -44,7 +45,7 @@ func (m *PublicKey) XXX_Unmarshal(b []byte) error { } func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -93,7 +94,7 @@ func (m *PrivateKey) XXX_Unmarshal(b []byte) error { } func (m *PrivateKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -133,7 +134,7 @@ func (m *Signature) XXX_Unmarshal(b []byte) error { } func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -181,31 +182,31 @@ func init() { proto.RegisterFile("crypto.proto", fileDescriptor_527278fb02d03321 func init() { golang_proto.RegisterFile("crypto.proto", fileDescriptor_527278fb02d03321) } var fileDescriptor_527278fb02d03321 = []byte{ - // 282 bytes of a gzipped FileDescriptorProto + // 274 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x2e, 0xaa, 0x2c, - 0x28, 0xc9, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0xa4, 0x74, 0xd3, 0x33, - 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0xd2, - 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x4d, 0x66, 0xe4, 0xe2, 0x0c, - 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0xf6, 0x4e, 0xad, 0x14, 0xd2, 0xe6, 0xe2, 0x74, 0x2e, 0x2d, 0x2a, - 0x4b, 0x0d, 0xa9, 0x2c, 0x48, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x75, 0xe2, 0xfd, 0x75, 0x4f, - 0x1e, 0x21, 0x18, 0x84, 0x60, 0x0a, 0x05, 0x23, 0xe9, 0x94, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x71, - 0x32, 0x3d, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0x64, 0x47, 0x64, 0x54, 0x16, 0xa4, 0x16, - 0xe5, 0xa4, 0xa6, 0xa4, 0xa7, 0x16, 0xe9, 0x27, 0x95, 0x16, 0x15, 0xe5, 0x97, 0xeb, 0x27, 0x65, - 0xe6, 0x25, 0x16, 0x55, 0xea, 0x79, 0xa4, 0x56, 0x38, 0x55, 0x96, 0xa4, 0x16, 0x07, 0x21, 0xcc, - 0xb1, 0x62, 0x99, 0xb1, 0x40, 0x9e, 0x41, 0xa9, 0x91, 0x91, 0x8b, 0x2b, 0xa0, 0x28, 0xb3, 0x2c, - 0xb1, 0x24, 0x95, 0x64, 0x67, 0xc9, 0x60, 0x38, 0x0b, 0xc9, 0x7c, 0x21, 0x39, 0x64, 0x83, 0x25, - 0x98, 0xc1, 0xd2, 0x48, 0x22, 0x56, 0x1c, 0x1d, 0x0b, 0xe4, 0x19, 0xc0, 0x6e, 0x88, 0xe1, 0xe2, - 0x0c, 0xce, 0x4c, 0xcf, 0x4b, 0x2c, 0x29, 0x2d, 0x4a, 0x25, 0xd9, 0x05, 0x70, 0x9d, 0x30, 0x17, - 0xc0, 0x05, 0x20, 0x3e, 0x74, 0xb2, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x3c, 0xf0, 0x58, 0x8e, 0xf1, 0xc4, 0x63, 0x39, 0xc6, - 0x28, 0x15, 0xfc, 0x61, 0x07, 0x89, 0xe6, 0x24, 0x36, 0x70, 0xf4, 0x19, 0x03, 0x02, 0x00, 0x00, - 0xff, 0xff, 0x20, 0x25, 0x33, 0xe2, 0x05, 0x02, 0x00, 0x00, + 0x28, 0xc9, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0xa4, 0x44, 0xd2, 0xf3, + 0xd3, 0xf3, 0xc1, 0x42, 0xfa, 0x20, 0x16, 0x44, 0x56, 0x69, 0x32, 0x23, 0x17, 0x67, 0x40, 0x69, + 0x52, 0x4e, 0x66, 0xb2, 0x77, 0x6a, 0xa5, 0x90, 0x36, 0x17, 0xa7, 0x73, 0x69, 0x51, 0x59, 0x6a, + 0x48, 0x65, 0x41, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xaf, 0x13, 0xef, 0xaf, 0x7b, 0xf2, 0x08, + 0xc1, 0x20, 0x04, 0x53, 0x28, 0x18, 0x49, 0xa7, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x8f, 0x93, 0xe9, + 0x89, 0x7b, 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0xeb, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, + 0xe7, 0xe7, 0xea, 0x67, 0x54, 0x16, 0xa4, 0x16, 0xe5, 0xa4, 0xa6, 0xa4, 0xa7, 0x16, 0xe9, 0x27, + 0x95, 0x16, 0x15, 0xe5, 0x97, 0xeb, 0x27, 0x65, 0xe6, 0x25, 0x16, 0x55, 0xea, 0x79, 0xa4, 0x56, + 0x38, 0x55, 0x96, 0xa4, 0x16, 0x07, 0x21, 0xcc, 0xb1, 0x62, 0x99, 0xb1, 0x40, 0x9e, 0x41, 0xa9, + 0x91, 0x91, 0x8b, 0x2b, 0xa0, 0x28, 0xb3, 0x2c, 0xb1, 0x24, 0x95, 0x64, 0x67, 0xc9, 0x60, 0x38, + 0x0b, 0xc9, 0x7c, 0x21, 0x39, 0x64, 0x83, 0x25, 0x98, 0xc1, 0xd2, 0x48, 0x22, 0x56, 0x1c, 0x1d, + 0x0b, 0xe4, 0x19, 0xc0, 0x6e, 0x88, 0xe1, 0xe2, 0x0c, 0xce, 0x4c, 0xcf, 0x4b, 0x2c, 0x29, 0x2d, + 0x4a, 0x25, 0xd9, 0x05, 0x70, 0x9d, 0x30, 0x17, 0xc0, 0x05, 0x20, 0x3e, 0x74, 0xb2, 0x3b, 0xf1, + 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x3c, + 0xf0, 0x58, 0x8e, 0xf1, 0xc4, 0x63, 0x39, 0xc6, 0x28, 0x15, 0xfc, 0x61, 0x07, 0x89, 0xcd, 0x24, + 0x36, 0x70, 0xf4, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x98, 0xef, 0xb8, 0x3a, 0xec, 0x01, + 0x00, 0x00, } func (m *PublicKey) 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 } @@ -213,33 +214,41 @@ func (m *PublicKey) Marshal() (dAtA []byte, err error) { } func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.CurveType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(m.CurveType)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size := m.PublicKey.Size() + i -= size + if _, err := m.PublicKey.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCrypto(dAtA, i, uint64(size)) } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(m.PublicKey.Size())) - n1, err := m.PublicKey.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.CurveType != 0 { + i = encodeVarintCrypto(dAtA, i, uint64(m.CurveType)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *PrivateKey) 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 } @@ -247,37 +256,45 @@ func (m *PrivateKey) Marshal() (dAtA []byte, err error) { } func (m *PrivateKey) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PrivateKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.CurveType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(m.CurveType)) - } - if len(m.PublicKey) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(len(m.PublicKey))) - i += copy(dAtA[i:], m.PublicKey) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.PrivateKey) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.PrivateKey) + copy(dAtA[i:], m.PrivateKey) i = encodeVarintCrypto(dAtA, i, uint64(len(m.PrivateKey))) - i += copy(dAtA[i:], m.PrivateKey) + i-- + dAtA[i] = 0x1a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintCrypto(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0x12 } - return i, nil + if m.CurveType != 0 { + i = encodeVarintCrypto(dAtA, i, uint64(m.CurveType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *Signature) 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 } @@ -285,35 +302,44 @@ func (m *Signature) Marshal() (dAtA []byte, err error) { } func (m *Signature) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.CurveType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(m.CurveType)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Signature) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) i = encodeVarintCrypto(dAtA, i, uint64(len(m.Signature))) - i += copy(dAtA[i:], m.Signature) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.CurveType != 0 { + i = encodeVarintCrypto(dAtA, i, uint64(m.CurveType)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func encodeVarintCrypto(dAtA []byte, offset int, v uint64) int { + offset -= sovCrypto(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 (m *PublicKey) Size() (n int) { if m == nil { @@ -375,14 +401,7 @@ func (m *Signature) Size() (n int) { } func sovCrypto(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozCrypto(x uint64) (n int) { return sovCrypto(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -474,10 +493,7 @@ func (m *PublicKey) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthCrypto } if (iNdEx + skippy) > l { @@ -615,10 +631,7 @@ func (m *PrivateKey) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthCrypto } if (iNdEx + skippy) > l { @@ -722,10 +735,7 @@ func (m *Signature) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthCrypto } if (iNdEx + skippy) > l { @@ -744,6 +754,7 @@ func (m *Signature) Unmarshal(dAtA []byte) error { func skipCrypto(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -775,10 +786,8 @@ func skipCrypto(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -799,55 +808,30 @@ func skipCrypto(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthCrypto } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthCrypto - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCrypto - } - 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 := skipCrypto(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthCrypto - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCrypto + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthCrypto + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCrypto = fmt.Errorf("proto: unexpected end of group") ) diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index 45e7c897d..984462ab9 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -2,6 +2,9 @@ package crypto import ( "bytes" + "crypto/rand" + "fmt" + "math/big" "testing" "github.com/stretchr/testify/assert" @@ -26,3 +29,37 @@ func TestGeneratePrivateKey(t *testing.T) { goodKey[31] = 2 assert.Error(t, EnsureEd25519PrivateKeyCorrect(badKey)) } + +func TestSigning(t *testing.T) { + for _, ct := range []CurveType{CurveTypeSecp256k1, CurveTypeEd25519} { + t.Run(fmt.Sprintf("%v signing", ct), func(t *testing.T) { + pk, err := GeneratePrivateKey(rand.Reader, ct) + require.NoError(t, err) + msg := []byte(("Flipity flobity floo")) + sig, err := pk.Sign(msg) + require.NoError(t, err) + err = pk.GetPublicKey().Verify(msg, sig) + require.NoError(t, err) + }) + + } + + t.Run("EthSignature", func(t *testing.T) { + pk := PrivateKeyFromSecret("seee", CurveTypeSecp256k1) + msg := []byte(("Flipity flobity floo")) + sig, err := pk.Sign(msg) + require.NoError(t, err) + ethSig, err := sig.GetEthSignature(big.NewInt(12342)) + require.NoError(t, err) + parity := ethSig.RecoveryIndex() + require.True(t, parity == 0 || parity == 1) + + // Now verify signature comes out intact after serialisation + compactSig, err := ethSig.ToCompactSignature() + require.NoError(t, err) + sigOut, err := SignatureFromBytes(compactSig, CurveTypeSecp256k1) + require.NoError(t, err) + err = pk.GetPublicKey().Verify(msg, sigOut) + require.NoError(t, err) + }) +} diff --git a/crypto/doc.go b/crypto/doc.go new file mode 100644 index 000000000..e1e194257 --- /dev/null +++ b/crypto/doc.go @@ -0,0 +1,10 @@ +package crypto + +/* + Burrow supports ed25519 and secp256k1 signing. The *Signature type stores the signature scheme under CurveType + and the raw bytes of each signature type are stored in Signature.Signature. + + For secp256k1 we use the btcec compact representation including magic parity byte prefix: byte(27) or byte(28) to + represent the 0 or 1 parity for the y-coordinate of the public key. + +*/ diff --git a/crypto/hash.go b/crypto/hash.go new file mode 100644 index 000000000..ba69d5c29 --- /dev/null +++ b/crypto/hash.go @@ -0,0 +1,26 @@ +package crypto + +import ( + "crypto/sha256" + + "golang.org/x/crypto/ripemd160" + "golang.org/x/crypto/sha3" +) + +func Keccak256(data []byte) []byte { + hash := sha3.NewLegacyKeccak256() + hash.Write(data) + return hash.Sum(nil) +} + +func SHA256(data []byte) []byte { + hash := sha256.New() + hash.Write(data) + return hash.Sum(nil) +} + +func RIPEMD160(data []byte) []byte { + hash := ripemd160.New() + hash.Write(data) + return hash.Sum(nil) +} diff --git a/crypto/private_key.go b/crypto/private_key.go index 4cb200e34..994e08799 100644 --- a/crypto/private_key.go +++ b/crypto/private_key.go @@ -2,6 +2,7 @@ package crypto import ( "bytes" + "crypto/ecdsa" cryptoRand "crypto/rand" "crypto/sha256" "fmt" @@ -13,28 +14,28 @@ import ( // Currently this is a stub that reads the raw bytes returned by key_client and returns // an ed25519 public key. -func PublicKeyFromBytes(bs []byte, curveType CurveType) (PublicKey, error) { +func PublicKeyFromBytes(bs []byte, curveType CurveType) (*PublicKey, error) { switch curveType { case CurveTypeEd25519: if len(bs) != ed25519.PublicKeySize { - return PublicKey{}, fmt.Errorf("bytes passed have length %v but ed25519 public keys have %v bytes", + return nil, fmt.Errorf("bytes passed have length %v but ed25519 public keys have %v bytes", len(bs), ed25519.PublicKeySize) } case CurveTypeSecp256k1: - if len(bs) != btcec.PubKeyBytesLenCompressed { - return PublicKey{}, fmt.Errorf("bytes passed have length %v but secp256k1 public keys have %v bytes", - len(bs), btcec.PubKeyBytesLenCompressed) + if len(bs) != btcec.PubKeyBytesLenUncompressed { + return nil, fmt.Errorf("bytes passed have length %v but secp256k1 public keys have %v bytes", + len(bs), btcec.PubKeyBytesLenUncompressed) } case CurveTypeUnset: if len(bs) > 0 { - return PublicKey{}, fmt.Errorf("attempting to create an 'unset' PublicKey but passed non-empty key bytes: %X", bs) + return nil, fmt.Errorf("attempting to create an 'unset' PublicKey but passed non-empty key bytes: %X", bs) } - return PublicKey{}, nil + return nil, nil default: - return PublicKey{}, ErrInvalidCurve(curveType) + return nil, ErrInvalidCurve(curveType) } - return PublicKey{PublicKey: bs, CurveType: curveType}, nil + return &PublicKey{PublicKey: bs, CurveType: curveType}, nil } func (p PrivateKey) RawBytes() []byte { @@ -44,87 +45,66 @@ func (p PrivateKey) RawBytes() []byte { func (p PrivateKey) Sign(msg []byte) (*Signature, error) { switch p.CurveType { case CurveTypeEd25519: - if len(p.PrivateKey) != ed25519.PrivateKeySize { - return nil, fmt.Errorf("bytes passed have length %v but ed25519 private keys have %v bytes", - len(p.PrivateKey), ed25519.PrivateKeySize) - } privKey := ed25519.PrivateKey(p.PrivateKey) return &Signature{CurveType: CurveTypeEd25519, Signature: ed25519.Sign(privKey, msg)}, nil case CurveTypeSecp256k1: - if len(p.PrivateKey) != btcec.PrivKeyBytesLen { - return nil, fmt.Errorf("bytes passed have length %v but secp256k1 private keys have %v bytes", - len(p.PrivateKey), btcec.PrivKeyBytesLen) - } privKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), p.PrivateKey) - sig, err := privKey.Sign(msg) + sig, err := btcec.SignCompact(btcec.S256(), privKey, Keccak256(msg), false) if err != nil { return nil, err } - return &Signature{CurveType: CurveTypeSecp256k1, Signature: sig.Serialize()}, nil + return &Signature{CurveType: CurveTypeSecp256k1, Signature: sig}, nil default: return nil, ErrInvalidCurve(p.CurveType) } } -func (p PrivateKey) GetPublicKey() PublicKey { - return PublicKey{CurveType: p.CurveType, PublicKey: p.PublicKey} -} - -// Reinitialise after serialisation -func (p *PrivateKey) Reinitialise() error { - initP, err := PrivateKeyFromRawBytes(p.RawBytes(), p.CurveType) - if err != nil { - return err - } - *p = initP - return nil +func (p PrivateKey) GetPublicKey() *PublicKey { + return &PublicKey{CurveType: p.CurveType, PublicKey: p.PublicKey} } func (p PrivateKey) String() string { return fmt.Sprintf("PrivateKey", p.PublicKey) } -func PrivateKeyFromRawBytes(privKeyBytes []byte, curveType CurveType) (PrivateKey, error) { +func GeneratePrivateKey(random io.Reader, curveType CurveType) (PrivateKey, error) { + if random == nil { + random = cryptoRand.Reader + } switch curveType { case CurveTypeEd25519: - if len(privKeyBytes) != ed25519.PrivateKeySize { - return PrivateKey{}, fmt.Errorf("bytes passed have length %v but ed25519 private keys have %v bytes", - len(privKeyBytes), ed25519.PrivateKeySize) + _, privateKey, err := ed25519.GenerateKey(random) + if err != nil { + return PrivateKey{}, err } - return PrivateKey{PrivateKey: privKeyBytes, PublicKey: privKeyBytes[32:], CurveType: CurveTypeEd25519}, nil + return PrivateKeyFromRawBytes(privateKey, CurveTypeEd25519) case CurveTypeSecp256k1: - if len(privKeyBytes) != btcec.PrivKeyBytesLen { - return PrivateKey{}, fmt.Errorf("bytes passed have length %v but secp256k1 private keys have %v bytes", - len(privKeyBytes), btcec.PrivKeyBytesLen) - } - privKey, pubKey := btcec.PrivKeyFromBytes(btcec.S256(), privKeyBytes) - if !bytes.Equal(privKey.Serialize(), privKeyBytes) { - return PrivateKey{}, fmt.Errorf("serialisation of Secp256k1 private key bytes does not equal") + privateKey, err := ecdsa.GenerateKey(btcec.S256(), random) + if err != nil { + return PrivateKey{}, err } - return PrivateKey{PrivateKey: privKeyBytes, PublicKey: pubKey.SerializeCompressed(), CurveType: CurveTypeSecp256k1}, nil + return PrivateKeyFromRawBytes(((*btcec.PrivateKey)(privateKey)).Serialize(), CurveTypeSecp256k1) default: return PrivateKey{}, ErrInvalidCurve(curveType) } } -func GeneratePrivateKey(random io.Reader, curveType CurveType) (PrivateKey, error) { - if random == nil { - random = cryptoRand.Reader - } +func PrivateKeyFromRawBytes(privateKeyBytes []byte, curveType CurveType) (PrivateKey, error) { + const ed25519PublicKeyOffset = ed25519.PrivateKeySize - ed25519.PublicKeySize switch curveType { case CurveTypeEd25519: - _, priv, err := ed25519.GenerateKey(random) - if err != nil { - return PrivateKey{}, err + if len(privateKeyBytes) != ed25519.PrivateKeySize { + return PrivateKey{}, fmt.Errorf("bytes passed have length %v but ed25519 private keys have %v bytes", + len(privateKeyBytes), ed25519.PrivateKeySize) } - return PrivateKeyFromRawBytes(priv, CurveTypeEd25519) + return PrivateKey{PrivateKey: privateKeyBytes, PublicKey: privateKeyBytes[ed25519PublicKeyOffset:], CurveType: CurveTypeEd25519}, nil case CurveTypeSecp256k1: - privKeyBytes := make([]byte, 32) - _, err := random.Read(privKeyBytes) - if err != nil { - return PrivateKey{}, err + if len(privateKeyBytes) != btcec.PrivKeyBytesLen { + return PrivateKey{}, fmt.Errorf("bytes passed have length %v but secp256k1 private keys have %v bytes", + len(privateKeyBytes), btcec.PrivKeyBytesLen) } - return PrivateKeyFromRawBytes(privKeyBytes, CurveTypeSecp256k1) + _, publicKey := btcec.PrivKeyFromBytes(btcec.S256(), privateKeyBytes) + return PrivateKey{PrivateKey: privateKeyBytes, PublicKey: publicKey.SerializeUncompressed(), CurveType: CurveTypeSecp256k1}, nil default: return PrivateKey{}, ErrInvalidCurve(curveType) } @@ -134,7 +114,15 @@ func PrivateKeyFromSecret(secret string, curveType CurveType) PrivateKey { hasher := sha256.New() hasher.Write(([]byte)(secret)) // No error from a buffer - privateKey, _ := GeneratePrivateKey(bytes.NewBuffer(hasher.Sum(nil)), curveType) + sum := hasher.Sum(nil) + const exp = 4 + for i := 0; i < exp; i++ { + sum = append(sum, sum...) + } + privateKey, err := GeneratePrivateKey(bytes.NewBuffer(sum), curveType) + if err != nil { + panic(fmt.Errorf("PrivateKeyFromScret: unexpected error: %w", err)) + } return privateKey } diff --git a/crypto/public_key.go b/crypto/public_key.go index 817058843..a2701ede6 100644 --- a/crypto/public_key.go +++ b/crypto/public_key.go @@ -1,7 +1,6 @@ package crypto import ( - "crypto/sha256" "encoding/json" "fmt" @@ -9,12 +8,6 @@ import ( "github.com/tendermint/tendermint/crypto/tmhash" hex "github.com/tmthrgd/go-hex" "golang.org/x/crypto/ed25519" - "golang.org/x/crypto/ripemd160" -) - -const ( - MaxPublicKeyLength = btcec.PubKeyBytesLenCompressed - PublicKeyFixedWidthEncodingLength = MaxPublicKeyLength + 1 ) type PublicKeyJSON struct { @@ -28,18 +21,18 @@ func PublicKeyLength(curveType CurveType) int { case CurveTypeEd25519: return ed25519.PublicKeySize case CurveTypeSecp256k1: - return btcec.PubKeyBytesLenCompressed + return btcec.PubKeyBytesLenUncompressed default: // Other functions rely on this return 0 } } -func (p PublicKey) IsSet() bool { - return p.CurveType != CurveTypeUnset && p.IsValid() +func (p *PublicKey) IsSet() bool { + return p != nil && p.CurveType != CurveTypeUnset && p.IsValid() } -func (p PublicKey) MarshalJSON() ([]byte, error) { +func (p *PublicKey) MarshalJSON() ([]byte, error) { jStruct := PublicKeyJSON{ CurveType: p.CurveType.String(), PublicKey: hex.EncodeUpperToString(p.PublicKey), @@ -48,7 +41,7 @@ func (p PublicKey) MarshalJSON() ([]byte, error) { return txt, err } -func (p PublicKey) MarshalText() ([]byte, error) { +func (p *PublicKey) MarshalText() ([]byte, error) { return p.MarshalJSON() } @@ -75,12 +68,12 @@ func (p *PublicKey) UnmarshalText(text []byte) error { return p.UnmarshalJSON(text) } -func (p PublicKey) IsValid() bool { +func (p *PublicKey) IsValid() bool { publicKeyLength := PublicKeyLength(p.CurveType) return publicKeyLength != 0 && publicKeyLength == len(p.PublicKey) } -func (p PublicKey) Verify(msg []byte, signature *Signature) error { +func (p *PublicKey) Verify(msg []byte, signature *Signature) error { switch p.CurveType { case CurveTypeUnset: return fmt.Errorf("public key is unset") @@ -91,43 +84,35 @@ func (p PublicKey) Verify(msg []byte, signature *Signature) error { return fmt.Errorf("signature '%X' is not a valid ed25519 signature for message: %s", signature.Signature, string(msg)) case CurveTypeSecp256k1: - pub, err := btcec.ParsePubKey(p.PublicKey, btcec.S256()) - if err != nil { - return fmt.Errorf("could not parse secp256k1 public key: %v", err) - } - sig, err := btcec.ParseDERSignature(signature.Signature, btcec.S256()) + _, _, err := btcec.RecoverCompact(btcec.S256(), signature.Signature, Keccak256(msg)) if err != nil { - return fmt.Errorf("could not parse DER signature for secp256k1 key: %v", err) + return fmt.Errorf("signature verification for secp256k1 key failed: %v", err) } - if sig.Verify(msg, pub) { - return nil - } - return fmt.Errorf("signature '%X' is not a valid secp256k1 signature for message: %s", - signature.Signature, string(msg)) + return nil default: return fmt.Errorf("invalid curve type") } } -func (p PublicKey) GetAddress() Address { +func (p *PublicKey) GetAddress() Address { switch p.CurveType { case CurveTypeEd25519: addr, _ := AddressFromBytes(tmhash.Sum(p.PublicKey)) return addr case CurveTypeSecp256k1: - sha := sha256.New() - sha.Write(p.PublicKey[:]) - - hash := ripemd160.New() - hash.Write(sha.Sum(nil)) - addr, _ := AddressFromBytes(hash.Sum(nil)) + pub, err := btcec.ParsePubKey(p.PublicKey.Bytes(), btcec.S256()) + if err != nil { + return Address{} + } + hash := Keccak256(pub.SerializeUncompressed()[1:]) + addr, _ := AddressFromBytes(hash[len(hash)-AddressLength:]) return addr default: panic(fmt.Sprintf("unknown CurveType %d", p.CurveType)) } } -func (p PublicKey) AddressHashType() string { +func (p *PublicKey) AddressHashType() string { switch p.CurveType { case CurveTypeEd25519: return "go-crypto-0.5.0" @@ -138,25 +123,6 @@ func (p PublicKey) AddressHashType() string { } } -func (p PublicKey) String() string { +func (p *PublicKey) String() string { return hex.EncodeUpperToString(p.PublicKey) } - -// Produces a binary encoding of the CurveType byte plus -// the public key for padded to a fixed width on the right -func (p PublicKey) EncodeFixedWidth() []byte { - encoded := make([]byte, PublicKeyFixedWidthEncodingLength) - encoded[0] = p.CurveType.Byte() - copy(encoded[1:], p.PublicKey) - return encoded -} - -func DecodePublicKeyFixedWidth(bs []byte) (PublicKey, error) { - const errHeader = "DecodePublicKeyFixedWidth():" - if len(bs) != PublicKeyFixedWidthEncodingLength { - return PublicKey{}, fmt.Errorf("%s expected exactly %d bytes but got %d bytes", - errHeader, PublicKeyFixedWidthEncodingLength, len(bs)) - } - curveType := CurveType(bs[0]) - return PublicKeyFromBytes(bs[1:PublicKeyLength(curveType)+1], curveType) -} diff --git a/crypto/public_key_test.go b/crypto/public_key_test.go index b504570a0..e3839082e 100644 --- a/crypto/public_key_test.go +++ b/crypto/public_key_test.go @@ -4,9 +4,11 @@ import ( "encoding/json" "testing" + "github.com/btcsuite/btcd/btcec" "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + hex "github.com/tmthrgd/go-hex" ) func TestPublicKeySerialisation(t *testing.T) { @@ -17,10 +19,10 @@ func TestPublicKeySerialisation(t *testing.T) { 0xfe, 0x6c, 0xb1, 0x9f, 0x6, 0x42, 0xe8, 0xa5, 0x98, 0x98, } assert.Equal(t, expectedAddress, pub.GetAddress()) - bs, err := proto.Marshal(&pub) + bs, err := proto.Marshal(pub) require.NoError(t, err) - var pubOut PublicKey - err = proto.Unmarshal(bs, &pubOut) + pubOut := new(PublicKey) + err = proto.Unmarshal(bs, pubOut) require.NoError(t, err) assert.Equal(t, pub, pubOut) @@ -30,27 +32,16 @@ func TestPublicKeySerialisation(t *testing.T) { string(bs)) } -func TestPublicKey_EncodeFixedWidth(t *testing.T) { - privEd25519 := PrivateKeyFromSecret("foo1", CurveTypeEd25519) - assertFixedWidthEncodeRoundTrip(t, privEd25519.GetPublicKey()) +func TestGetAddress(t *testing.T) { + privBytes := hex.MustDecodeString(`35622dddb842c9191ca8c2ca2a2b35a6aac90362d095b32f29d8e8abd63d55a5`) + privKey, err := PrivateKeyFromRawBytes(privBytes, CurveTypeSecp256k1) + require.NoError(t, err) + require.Equal(t, "F97798DF751DEB4B6E39D4CF998EE7CD4DCB9ACC", privKey.GetPublicKey().GetAddress().String()) - privSecp256k1 := PrivateKeyFromSecret("foo2", CurveTypeSecp256k1) - assertFixedWidthEncodeRoundTrip(t, privSecp256k1.GetPublicKey()) + _, pub := btcec.PrivKeyFromBytes(btcec.S256(), privBytes) + pubKey, err := PublicKeyFromBytes(pub.SerializeUncompressed(), CurveTypeSecp256k1) + require.NoError(t, err) - privUnset := PrivateKeyFromSecret("foo3", CurveTypeUnset) - assertFixedWidthEncodeRoundTrip(t, privUnset.GetPublicKey()) + require.Equal(t, "F97798DF751DEB4B6E39D4CF998EE7CD4DCB9ACC", pubKey.GetAddress().String()) - // Unknown CurveType - privUnset.CurveType = CurveType(5) - bs := privUnset.GetPublicKey().EncodeFixedWidth() - _, err := DecodePublicKeyFixedWidth(bs) - assert.Error(t, err, "should not decode unset") -} - -func assertFixedWidthEncodeRoundTrip(t *testing.T, p PublicKey) { - bs := p.EncodeFixedWidth() - assert.Len(t, bs, PublicKeyFixedWidthEncodingLength) - pOut, err := DecodePublicKeyFixedWidth(bs) - require.NoError(t, err) - assert.Equal(t, p, pOut) } diff --git a/crypto/sha3/LICENSE b/crypto/sha3/LICENSE deleted file mode 100644 index 6a66aea5e..000000000 --- a/crypto/sha3/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/crypto/sha3/PATENTS b/crypto/sha3/PATENTS deleted file mode 100644 index 733099041..000000000 --- a/crypto/sha3/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/crypto/sha3/keccakf.go b/crypto/sha3/keccakf.go deleted file mode 100644 index e12792fdc..000000000 --- a/crypto/sha3/keccakf.go +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package sha3 - -// This file implements the core Keccak permutation function necessary for computing SHA3. -// This is implemented in a separate file to allow for replacement by an optimized implementation. -// Nothing in this package is exported. -// For the detailed specification, refer to the Keccak web site (http://keccak.noekeon.org/). - -// rc stores the round constants for use in the ι step. -var rc = [...]uint64{ - 0x0000000000000001, - 0x0000000000008082, - 0x800000000000808A, - 0x8000000080008000, - 0x000000000000808B, - 0x0000000080000001, - 0x8000000080008081, - 0x8000000000008009, - 0x000000000000008A, - 0x0000000000000088, - 0x0000000080008009, - 0x000000008000000A, - 0x000000008000808B, - 0x800000000000008B, - 0x8000000000008089, - 0x8000000000008003, - 0x8000000000008002, - 0x8000000000000080, - 0x000000000000800A, - 0x800000008000000A, - 0x8000000080008081, - 0x8000000000008080, - 0x0000000080000001, - 0x8000000080008008, -} - -// ro_xx represent the rotation offsets for use in the χ step. -// Defining them as const instead of in an array allows the compiler to insert constant shifts. -const ( - ro_00 = 0 // not used - ro_01 = 36 - ro_02 = 3 - ro_03 = 41 - ro_04 = 18 - ro_05 = 1 - ro_06 = 44 - ro_07 = 10 - ro_08 = 45 - ro_09 = 2 - ro_10 = 62 - ro_11 = 6 - ro_12 = 43 - ro_13 = 15 - ro_14 = 61 - ro_15 = 28 - ro_16 = 55 - ro_17 = 25 - ro_18 = 21 - ro_19 = 56 - ro_20 = 27 - ro_21 = 20 - ro_22 = 39 - ro_23 = 8 - ro_24 = 14 -) - -// keccakF computes the complete Keccak-f function consisting of 24 rounds with a different -// constant (rc) in each round. This implementation fully unrolls the round function to avoid -// inner loops, as well as pre-calculating shift offsets. -func (d *digest) keccakF() { - for _, roundConstant := range rc { - // θ step - d.c[0] = d.a[0] ^ d.a[5] ^ d.a[10] ^ d.a[15] ^ d.a[20] - d.c[1] = d.a[1] ^ d.a[6] ^ d.a[11] ^ d.a[16] ^ d.a[21] - d.c[2] = d.a[2] ^ d.a[7] ^ d.a[12] ^ d.a[17] ^ d.a[22] - d.c[3] = d.a[3] ^ d.a[8] ^ d.a[13] ^ d.a[18] ^ d.a[23] - d.c[4] = d.a[4] ^ d.a[9] ^ d.a[14] ^ d.a[19] ^ d.a[24] - - d.d[0] = d.c[4] ^ (d.c[1]<<1 ^ d.c[1]>>63) - d.d[1] = d.c[0] ^ (d.c[2]<<1 ^ d.c[2]>>63) - d.d[2] = d.c[1] ^ (d.c[3]<<1 ^ d.c[3]>>63) - d.d[3] = d.c[2] ^ (d.c[4]<<1 ^ d.c[4]>>63) - d.d[4] = d.c[3] ^ (d.c[0]<<1 ^ d.c[0]>>63) - - d.a[0] ^= d.d[0] - d.a[1] ^= d.d[1] - d.a[2] ^= d.d[2] - d.a[3] ^= d.d[3] - d.a[4] ^= d.d[4] - d.a[5] ^= d.d[0] - d.a[6] ^= d.d[1] - d.a[7] ^= d.d[2] - d.a[8] ^= d.d[3] - d.a[9] ^= d.d[4] - d.a[10] ^= d.d[0] - d.a[11] ^= d.d[1] - d.a[12] ^= d.d[2] - d.a[13] ^= d.d[3] - d.a[14] ^= d.d[4] - d.a[15] ^= d.d[0] - d.a[16] ^= d.d[1] - d.a[17] ^= d.d[2] - d.a[18] ^= d.d[3] - d.a[19] ^= d.d[4] - d.a[20] ^= d.d[0] - d.a[21] ^= d.d[1] - d.a[22] ^= d.d[2] - d.a[23] ^= d.d[3] - d.a[24] ^= d.d[4] - - // ρ and π steps - d.b[0] = d.a[0] - d.b[1] = d.a[6]<>(64-ro_06) - d.b[2] = d.a[12]<>(64-ro_12) - d.b[3] = d.a[18]<>(64-ro_18) - d.b[4] = d.a[24]<>(64-ro_24) - d.b[5] = d.a[3]<>(64-ro_15) - d.b[6] = d.a[9]<>(64-ro_21) - d.b[7] = d.a[10]<>(64-ro_02) - d.b[8] = d.a[16]<>(64-ro_08) - d.b[9] = d.a[22]<>(64-ro_14) - d.b[10] = d.a[1]<>(64-ro_05) - d.b[11] = d.a[7]<>(64-ro_11) - d.b[12] = d.a[13]<>(64-ro_17) - d.b[13] = d.a[19]<>(64-ro_23) - d.b[14] = d.a[20]<>(64-ro_04) - d.b[15] = d.a[4]<>(64-ro_20) - d.b[16] = d.a[5]<>(64-ro_01) - d.b[17] = d.a[11]<>(64-ro_07) - d.b[18] = d.a[17]<>(64-ro_13) - d.b[19] = d.a[23]<>(64-ro_19) - d.b[20] = d.a[2]<>(64-ro_10) - d.b[21] = d.a[8]<>(64-ro_16) - d.b[22] = d.a[14]<>(64-ro_22) - d.b[23] = d.a[15]<>(64-ro_03) - d.b[24] = d.a[21]<>(64-ro_09) - - // χ step - d.a[0] = d.b[0] ^ (^d.b[1] & d.b[2]) - d.a[1] = d.b[1] ^ (^d.b[2] & d.b[3]) - d.a[2] = d.b[2] ^ (^d.b[3] & d.b[4]) - d.a[3] = d.b[3] ^ (^d.b[4] & d.b[0]) - d.a[4] = d.b[4] ^ (^d.b[0] & d.b[1]) - d.a[5] = d.b[5] ^ (^d.b[6] & d.b[7]) - d.a[6] = d.b[6] ^ (^d.b[7] & d.b[8]) - d.a[7] = d.b[7] ^ (^d.b[8] & d.b[9]) - d.a[8] = d.b[8] ^ (^d.b[9] & d.b[5]) - d.a[9] = d.b[9] ^ (^d.b[5] & d.b[6]) - d.a[10] = d.b[10] ^ (^d.b[11] & d.b[12]) - d.a[11] = d.b[11] ^ (^d.b[12] & d.b[13]) - d.a[12] = d.b[12] ^ (^d.b[13] & d.b[14]) - d.a[13] = d.b[13] ^ (^d.b[14] & d.b[10]) - d.a[14] = d.b[14] ^ (^d.b[10] & d.b[11]) - d.a[15] = d.b[15] ^ (^d.b[16] & d.b[17]) - d.a[16] = d.b[16] ^ (^d.b[17] & d.b[18]) - d.a[17] = d.b[17] ^ (^d.b[18] & d.b[19]) - d.a[18] = d.b[18] ^ (^d.b[19] & d.b[15]) - d.a[19] = d.b[19] ^ (^d.b[15] & d.b[16]) - d.a[20] = d.b[20] ^ (^d.b[21] & d.b[22]) - d.a[21] = d.b[21] ^ (^d.b[22] & d.b[23]) - d.a[22] = d.b[22] ^ (^d.b[23] & d.b[24]) - d.a[23] = d.b[23] ^ (^d.b[24] & d.b[20]) - d.a[24] = d.b[24] ^ (^d.b[20] & d.b[21]) - - // ι step - d.a[0] ^= roundConstant - } -} diff --git a/crypto/sha3/sha3.go b/crypto/sha3/sha3.go deleted file mode 100644 index 6f262f217..000000000 --- a/crypto/sha3/sha3.go +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package sha3 - -// Package sha3 implements the SHA3 hash algorithm (formerly called Keccak) chosen by NIST in 2012. -// This file provides a SHA3 implementation which implements the standard hash.Hash interface. -// Writing input data, including padding, and reading output data are computed in this file. -// Note that the current implementation can compute the hash of an integral number of bytes only. -// This is a consequence of the hash interface in which a buffer of bytes is passed in. -// The internals of the Keccak-f function are computed in keccakf.go. -// For the detailed specification, refer to the Keccak web site (http://keccak.noekeon.org/). - -import ( - "encoding/binary" - "hash" -) - -// laneSize is the size in bytes of each "lane" of the internal state of SHA3 (5 * 5 * 8). -// Note that changing this size would requires using a type other than uint64 to store each lane. -const laneSize = 8 - -// sliceSize represents the dimensions of the internal state, a square matrix of -// sliceSize ** 2 lanes. This is the size of both the "rows" and "columns" dimensions in the -// terminology of the SHA3 specification. -const sliceSize = 5 - -// numLanes represents the total number of lanes in the state. -const numLanes = sliceSize * sliceSize - -// stateSize is the size in bytes of the internal state of SHA3 (5 * 5 * WSize). -const stateSize = laneSize * numLanes - -// digest represents the partial evaluation of a checksum. -// Note that capacity, and not outputSize, is the critical security parameter, as SHA3 can output -// an arbitrary number of bytes for any given capacity. The Keccak proposal recommends that -// capacity = 2*outputSize to ensure that finding a collision of size outputSize requires -// O(2^{outputSize/2}) computations (the birthday lower bound). Future standards may modify the -// capacity/outputSize ratio to allow for more output with lower cryptographic security. -type digest struct { - a [numLanes]uint64 // main state of the hash - b [numLanes]uint64 // intermediate states - c [sliceSize]uint64 // intermediate states - d [sliceSize]uint64 // intermediate states - outputSize int // desired output size in bytes - capacity int // number of bytes to leave untouched during squeeze/absorb - absorbed int // number of bytes absorbed thus far -} - -// minInt returns the lesser of two integer arguments, to simplify the absorption routine. -func minInt(v1, v2 int) int { - if v1 <= v2 { - return v1 - } - return v2 -} - -// rate returns the number of bytes of the internal state which can be absorbed or squeezed -// in between calls to the permutation function. -func (d *digest) rate() int { - return stateSize - d.capacity -} - -// Reset clears the internal state by zeroing bytes in the state buffer. -// This can be skipped for a newly-created hash state; the default zero-allocated state is correct. -func (d *digest) Reset() { - d.absorbed = 0 - for i := range d.a { - d.a[i] = 0 - } -} - -// BlockSize, required by the hash.Hash interface, does not have a standard intepretation -// for a sponge-based construction like SHA3. We return the data rate: the number of bytes which -// can be absorbed per invocation of the permutation function. For Merkle-Damgård based hashes -// (ie SHA1, SHA2, MD5) the output size of the internal compression function is returned. -// We consider this to be roughly equivalent because it represents the number of bytes of output -// produced per cryptographic operation. -func (d *digest) BlockSize() int { return d.rate() } - -// Size returns the output size of the hash function in bytes. -func (d *digest) Size() int { - return d.outputSize -} - -// unalignedAbsorb is a helper function for Write, which absorbs data that isn't aligned with an -// 8-byte lane. This requires shifting the individual bytes into position in a uint64. -func (d *digest) unalignedAbsorb(p []byte) { - var t uint64 - for i := len(p) - 1; i >= 0; i-- { - t <<= 8 - t |= uint64(p[i]) - } - offset := (d.absorbed) % d.rate() - t <<= 8 * uint(offset%laneSize) - d.a[offset/laneSize] ^= t - d.absorbed += len(p) -} - -// Write "absorbs" bytes into the state of the SHA3 hash, updating as needed when the sponge -// "fills up" with rate() bytes. Since lanes are stored internally as type uint64, this requires -// converting the incoming bytes into uint64s using a little endian interpretation. This -// implementation is optimized for large, aligned writes of multiples of 8 bytes (laneSize). -// Non-aligned or uneven numbers of bytes require shifting and are slower. -func (d *digest) Write(p []byte) (int, error) { - // An initial offset is needed if the we aren't absorbing to the first lane initially. - offset := d.absorbed % d.rate() - toWrite := len(p) - - // The first lane may need to absorb unaligned and/or incomplete data. - if (offset%laneSize != 0 || len(p) < 8) && len(p) > 0 { - toAbsorb := minInt(laneSize-(offset%laneSize), len(p)) - d.unalignedAbsorb(p[:toAbsorb]) - p = p[toAbsorb:] - offset = (d.absorbed) % d.rate() - - // For every rate() bytes absorbed, the state must be permuted via the F Function. - if (d.absorbed)%d.rate() == 0 { - d.keccakF() - } - } - - // This loop should absorb the bulk of the data into full, aligned lanes. - // It will call the update function as necessary. - for len(p) > 7 { - firstLane := offset / laneSize - lastLane := minInt(d.rate()/laneSize, firstLane+len(p)/laneSize) - - // This inner loop absorbs input bytes into the state in groups of 8, converted to uint64s. - for lane := firstLane; lane < lastLane; lane++ { - d.a[lane] ^= binary.LittleEndian.Uint64(p[:laneSize]) - p = p[laneSize:] - } - d.absorbed += (lastLane - firstLane) * laneSize - // For every rate() bytes absorbed, the state must be permuted via the F Function. - if (d.absorbed)%d.rate() == 0 { - d.keccakF() - } - - offset = 0 - } - - // If there are insufficient bytes to fill the final lane, an unaligned absorption. - // This should always start at a correct lane boundary though, or else it would be caught - // by the uneven opening lane case above. - if len(p) > 0 { - d.unalignedAbsorb(p) - } - - return toWrite, nil -} - -// pad computes the SHA3 padding scheme based on the number of bytes absorbed. -// The padding is a 1 bit, followed by an arbitrary number of 0s and then a final 1 bit, such that -// the input bits plus padding bits are a multiple of rate(). Adding the padding simply requires -// xoring an opening and closing bit into the appropriate lanes. -func (d *digest) pad() { - offset := d.absorbed % d.rate() - // The opening pad bit must be shifted into position based on the number of bytes absorbed - padOpenLane := offset / laneSize - d.a[padOpenLane] ^= 0x0000000000000001 << uint(8*(offset%laneSize)) - // The closing padding bit is always in the last position - padCloseLane := (d.rate() / laneSize) - 1 - d.a[padCloseLane] ^= 0x8000000000000000 -} - -// finalize prepares the hash to output data by padding and one final permutation of the state. -func (d *digest) finalize() { - d.pad() - d.keccakF() -} - -// squeeze outputs an arbitrary number of bytes from the hash state. -// Squeezing can require multiple calls to the F function (one per rate() bytes squeezed), -// although this is not the case for standard SHA3 parameters. This implementation only supports -// squeezing a single time, subsequent squeezes may lose alignment. Future implementations -// may wish to support multiple squeeze calls, for example to support use as a PRNG. -func (d *digest) squeeze(in []byte, toSqueeze int) []byte { - // Because we read in blocks of laneSize, we need enough room to read - // an integral number of lanes - needed := toSqueeze + (laneSize-toSqueeze%laneSize)%laneSize - if cap(in)-len(in) < needed { - newIn := make([]byte, len(in), len(in)+needed) - copy(newIn, in) - in = newIn - } - out := in[len(in) : len(in)+needed] - - for len(out) > 0 { - for i := 0; i < d.rate() && len(out) > 0; i += laneSize { - binary.LittleEndian.PutUint64(out[:], d.a[i/laneSize]) - out = out[laneSize:] - } - if len(out) > 0 { - d.keccakF() - } - } - return in[:len(in)+toSqueeze] // Re-slice in case we wrote extra data. -} - -// Sum applies padding to the hash state and then squeezes out the desired nubmer of output bytes. -func (d *digest) Sum(in []byte) []byte { - // Make a copy of the original hash so that caller can keep writing and summing. - dup := *d - dup.finalize() - return dup.squeeze(in, dup.outputSize) -} - -// The NewKeccakX constructors enable initializing a hash in any of the four recommend sizes -// from the Keccak specification, all of which set capacity=2*outputSize. Note that the final -// NIST standard for SHA3 may specify different input/output lengths. -// The output size is indicated in bits but converted into bytes internally. -func NewKeccak224() hash.Hash { return &digest{outputSize: 224 / 8, capacity: 2 * 224 / 8} } -func NewKeccak256() hash.Hash { return &digest{outputSize: 256 / 8, capacity: 2 * 256 / 8} } -func NewKeccak384() hash.Hash { return &digest{outputSize: 384 / 8, capacity: 2 * 384 / 8} } -func NewKeccak512() hash.Hash { return &digest{outputSize: 512 / 8, capacity: 2 * 512 / 8} } - -func Sha3(data ...[]byte) []byte { - d := NewKeccak256() - for _, b := range data { - d.Write(b) - } - return d.Sum(nil) -} diff --git a/crypto/signature.go b/crypto/signature.go index 5ee7e0bbf..6ef310179 100644 --- a/crypto/signature.go +++ b/crypto/signature.go @@ -2,11 +2,99 @@ package crypto import ( "fmt" + "math/big" + "github.com/btcsuite/btcd/btcec" hex "github.com/tmthrgd/go-hex" "golang.org/x/crypto/ed25519" ) +// Some big constnats +var big256 = big.NewInt(256) +var big2 = big.NewInt(2) + +// https://github.com/ethereum/EIPs/blob/b3bbee93dc8a775af6a6b2525c9ac5f70a7e5710/EIPS/eip-155.md +var ethereumRecoveryIDOffset = big.NewInt(35) + +// https://github.com/btcsuite/btcd/blob/7bbd9b0284de8492ae738ad8d722772925fa5a86/btcec/signature.go#L349 +var btcecRecoveryIDOffset = big.NewInt(27) + +type Secp256k1Signature struct { + // Magic parity byte (value varies by implementation to carry additional information) + V big.Int `json:"v"` + R big.Int `json:"r"` + S big.Int `json:"s"` +} + +// Returns either 0 or 1 for the underlying parity of the public key solution +func (s *Secp256k1Signature) RecoveryIndex() uint { + // odd V => parity = 0 + // even V => parity = 1 + return s.V.Bit(0) ^ 0x01 +} + +func (s *Secp256k1Signature) BigRecoveryIndex() *big.Int { + return new(big.Int).SetInt64(int64(s.RecoveryIndex())) +} + +type EIP155Signature struct { + Secp256k1Signature +} + +// Get btcec compact signature (our standard) +func (s *EIP155Signature) ToCompactSignature() ([]byte, error) { + v := new(big.Int) + v.Add(s.BigRecoveryIndex(), btcecRecoveryIDOffset) + compactSig := &CompactSecp256k1Signature{ + Secp256k1Signature{ + V: *v, + R: s.R, + S: s.S, + }, + } + bs, err := compactSig.Marshal() + if err != nil { + return nil, err + } + return bs, nil +} + +/** + btcec layout is: + input: [ v | r | s ] + bytes: [ 1 | 32 | 32 ] + Where: + v = 27 + recovery id (which of 4 possible x coords do we take as public key) (single byte but padded) + r = encrypted random point + s = signature proof + + Signature layout required by btcec: + sig: [ r | s | v ] + bytes: [ 32 | 32 | 1 ] +*/ +type CompactSecp256k1Signature struct { + Secp256k1Signature +} + +func (s *CompactSecp256k1Signature) Marshal() ([]byte, error) { + bs := make([]byte, btcec.PubKeyBytesLenUncompressed) + bs[0] = byte(new(big.Int).Mod(&s.V, big256).Uint64()) + copy(bs[1:33], s.R.Bytes()) + copy(bs[33:], s.S.Bytes()) + return bs, nil +} + +func (s *CompactSecp256k1Signature) Unmarshal(bs []byte) error { + if len(bs) != btcec.PubKeyBytesLenUncompressed { + return fmt.Errorf("must get uncompressed compact layout signature of %v bytes but got %v bytes", + btcec.PubKeyBytesLenUncompressed, len(bs)) + } + s.V.SetBytes(bs[0:1]) + s.R.SetBytes(bs[1:33]) + s.S.SetBytes(bs[33:]) + return nil +} + func SignatureFromBytes(bs []byte, curveType CurveType) (*Signature, error) { switch curveType { case CurveTypeEd25519: @@ -28,3 +116,31 @@ func (sig *Signature) RawBytes() []byte { func (sig *Signature) String() string { return hex.EncodeUpperToString(sig.Signature) } + +func GetEthSignatureRecoveryID(chainID *big.Int, parity *big.Int) *big.Int { + // https://github.com/ethereum/EIPs/blob/b3bbee93dc8a775af6a6b2525c9ac5f70a7e5710/EIPS/eip-155.md + v := new(big.Int) + v.Mul(chainID, big2) + v.Add(v, parity) + v.Add(v, ethereumRecoveryIDOffset) + return v +} + +func (sig *Signature) GetEthSignature(chainID *big.Int) (*EIP155Signature, error) { + if sig.CurveType != CurveTypeSecp256k1 { + return nil, fmt.Errorf("can only GetEthSignature for %v keys, but got %v", + CurveTypeSecp256k1, sig.CurveType) + } + compactSig := new(CompactSecp256k1Signature) + err := compactSig.Unmarshal(sig.Signature) + if err != nil { + return nil, fmt.Errorf("could not unmarshal compact secp256k1 signature: %w", err) + } + return &EIP155Signature{ + Secp256k1Signature{ + V: *GetEthSignatureRecoveryID(chainID, compactSig.BigRecoveryIndex()), + R: compactSig.R, + S: compactSig.S, + }, + }, nil +} diff --git a/crypto/tendermint.go b/crypto/tendermint.go index f7265ba68..8585dce2e 100644 --- a/crypto/tendermint.go +++ b/crypto/tendermint.go @@ -3,66 +3,64 @@ package crypto import ( "fmt" - abci "github.com/tendermint/tendermint/abci/types" + "github.com/btcsuite/btcd/btcec" tmCrypto "github.com/tendermint/tendermint/crypto" tmEd25519 "github.com/tendermint/tendermint/crypto/ed25519" tmSecp256k1 "github.com/tendermint/tendermint/crypto/secp256k1" ) -func PublicKeyFromTendermintPubKey(pubKey tmCrypto.PubKey) (PublicKey, error) { +func PublicKeyFromTendermintPubKey(pubKey tmCrypto.PubKey) (*PublicKey, error) { switch pk := pubKey.(type) { - case tmEd25519.PubKeyEd25519: + case tmEd25519.PubKey: return PublicKeyFromBytes(pk[:], CurveTypeEd25519) - case tmSecp256k1.PubKeySecp256k1: + case tmSecp256k1.PubKey: return PublicKeyFromBytes(pk[:], CurveTypeSecp256k1) default: - return PublicKey{}, fmt.Errorf("unrecognised tendermint public key type: %v", pk) + return nil, fmt.Errorf("unrecognised tendermint public key type: %v", pk) } - -} -func PublicKeyFromABCIPubKey(pubKey abci.PubKey) (PublicKey, error) { - switch pubKey.Type { - case CurveTypeEd25519.ABCIType(): - return PublicKey{ - CurveType: CurveTypeEd25519, - PublicKey: pubKey.Data, - }, nil - case CurveTypeSecp256k1.ABCIType(): - return PublicKey{ - CurveType: CurveTypeEd25519, - PublicKey: pubKey.Data, - }, nil - } - return PublicKey{}, fmt.Errorf("did not recognise ABCI PubKey type: %s", pubKey.Type) } // PublicKey extensions -// Return the ABCI PubKey. See Tendermint protobuf.go for the go-crypto conversion this is based on -func (p PublicKey) ABCIPubKey() abci.PubKey { - return abci.PubKey{ - Type: p.CurveType.ABCIType(), - Data: p.PublicKey, +func (p PublicKey) TendermintPubKey() tmCrypto.PubKey { + switch p.CurveType { + case CurveTypeEd25519: + return tmEd25519.PubKey(p.PublicKey) + case CurveTypeSecp256k1: + return tmSecp256k1.PubKey(p.PublicKey) + default: + return nil } } -func (p PublicKey) TendermintPubKey() tmCrypto.PubKey { +func (p PublicKey) TendermintAddress() tmCrypto.Address { switch p.CurveType { case CurveTypeEd25519: - pk := tmEd25519.PubKeyEd25519{} - copy(pk[:], p.PublicKey) - return pk + return tmCrypto.Address(p.GetAddress().Bytes()) case CurveTypeSecp256k1: - pk := tmSecp256k1.PubKeySecp256k1{} - copy(pk[:], p.PublicKey) - return pk + // Tendermint represents addresses like Bitcoin + return tmCrypto.Address(RIPEMD160(SHA256(p.PublicKey[:]))) default: - return nil + panic(fmt.Sprintf("unknown CurveType %d", p.CurveType)) } } // Signature extensions func (sig Signature) TendermintSignature() []byte { + switch sig.CurveType { + case CurveTypeSecp256k1: + sig, err := btcec.ParseDERSignature(sig.GetSignature(), btcec.S256()) + if err != nil { + return nil + } + // https://github.com/tendermint/tendermint/blob/master/crypto/secp256k1/secp256k1_nocgo.go#L62 + r := sig.R.Bytes() + s := sig.S.Bytes() + data := make([]byte, 64) + copy(data[32-len(r):32], r) + copy(data[64-len(s):64], s) + return data + } return sig.Signature } diff --git a/deploy/compile/compilers.go b/deploy/compile/compilers.go index 5772a22eb..d25e6ba0b 100644 --- a/deploy/compile/compilers.go +++ b/deploy/compile/compilers.go @@ -12,7 +12,8 @@ import ( "github.com/hyperledger/burrow/acm/acmstate" "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" + "golang.org/x/crypto/sha3" + "github.com/hyperledger/burrow/execution/evm/asm" "github.com/hyperledger/burrow/logging" hex "github.com/tmthrgd/go-hex" @@ -236,7 +237,7 @@ func EVM(file string, optimize bool, workDir string, libraries map[string]string input.Sources[file] = SolidityInputSource{Urls: []string{file}} input.Settings.Optimizer.Enabled = optimize - input.Settings.OutputSelection.File.OutputType = []string{"abi", "evm.deployedBytecode.object", "evm.bytecode.linkReferences", "metadata", "bin", "devdoc"} + input.Settings.OutputSelection.File.OutputType = []string{"abi", "evm.bytecode.object", "evm.deployedBytecode.object", "evm.bytecode.linkReferences", "metadata", "bin", "devdoc"} input.Settings.Libraries = make(map[string]map[string]string) input.Settings.Libraries[""] = make(map[string]string) @@ -323,7 +324,7 @@ func EVM(file string, optimize bool, workDir string, libraries map[string]string } func WASM(file string, workDir string, logger *logging.Logger) (*Response, error) { - shellCmd := exec.Command("solang", "--standard-json", file) + shellCmd := exec.Command("solang", "--target", "ewasm", "--standard-json", file) if workDir != "" { shellCmd.Dir = workDir } @@ -435,7 +436,7 @@ func (contract *SolidityContract) GetMetadata(logger *logging.Logger) (map[acmst return nil, err } - hash := sha3.NewKeccak256() + hash := sha3.NewLegacyKeccak256() hash.Write(runtime) var codehash acmstate.CodeHash copy(codehash[:], hash.Sum(nil)) @@ -461,7 +462,7 @@ func GetDeployCodeHash(code []byte, address crypto.Address) []byte { code = append([]byte{byte(asm.PUSH20)}, append(make([]byte, crypto.AddressLength), code[crypto.AddressLength+1:]...)...) } - hash := sha3.NewKeccak256() + hash := sha3.NewLegacyKeccak256() hash.Write(code) return hash.Sum(nil) } diff --git a/deploy/compile/compilers_test.go b/deploy/compile/compilers_test.go index a8aa6cb6c..39236ef3d 100644 --- a/deploy/compile/compilers_test.go +++ b/deploy/compile/compilers_test.go @@ -40,7 +40,7 @@ func TestLocalMulti(t *testing.T) { expectedSolcResponse := BlankSolcResponse() actualOutput, err := exec.Command("solc", "--combined-json", "bin,abi", "contractImport1.sol").CombinedOutput() if err != nil { - t.Fatal(err) + t.Fatalf("solc failed %v: %s", err, actualOutput) } warning, responseJSON := extractWarningJSON(strings.TrimSpace(string(actualOutput))) @@ -85,7 +85,7 @@ func TestLocalSingle(t *testing.T) { shellCmd := exec.Command("solc", "--combined-json", "bin,abi", "simpleContract.sol") actualOutput, err := shellCmd.CombinedOutput() if err != nil { - t.Fatal(err) + t.Fatalf("solc failed %v: %s", err, actualOutput) } warning, responseJSON := extractWarningJSON(strings.TrimSpace(string(actualOutput))) diff --git a/deploy/compile/solgo/main.go b/deploy/compile/solgo/main.go deleted file mode 100644 index d666763fa..000000000 --- a/deploy/compile/solgo/main.go +++ /dev/null @@ -1,69 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "os" - "path" - - "github.com/hyperledger/burrow/deploy/compile" - "github.com/hyperledger/burrow/logging" -) - -func main() { - wasmPtr := flag.Bool("wasm", false, "Use solang rather than solc") - flag.Parse() - - for _, solfile := range flag.Args() { - var resp *compile.Response - var err error - - if *wasmPtr { - resp, err = compile.WASM(solfile, "", logging.NewNoopLogger()) - if err != nil { - fmt.Printf("failed compile solidity to wasm: %v\n", err) - os.Exit(1) - } - } else { - resp, err = compile.EVM(solfile, false, "", nil, logging.NewNoopLogger()) - if err != nil { - fmt.Printf("failed compile solidity: %v\n", err) - os.Exit(1) - } - } - - if resp.Error != "" { - fmt.Print(resp.Error) - os.Exit(1) - } - - if resp.Warning != "" { - fmt.Print(resp.Warning) - os.Exit(1) - } - - f, err := os.Create(solfile + ".go") - if err != nil { - fmt.Printf("failed to create go file: %v\n", err) - os.Exit(1) - } - - f.WriteString(fmt.Sprintf("package %s\n\n", path.Base(path.Dir(solfile)))) - f.WriteString("import hex \"github.com/tmthrgd/go-hex\"\n\n") - - for _, c := range resp.Objects { - code := c.Contract.Evm.Bytecode.Object - if code == "" { - code = c.Contract.EWasm.Wasm - } - f.WriteString(fmt.Sprintf("var Bytecode_%s = hex.MustDecodeString(\"%s\")\n", - c.Objectname, code)) - if c.Contract.Evm.DeployedBytecode.Object != "" { - f.WriteString(fmt.Sprintf("var DeployedBytecode_%s = hex.MustDecodeString(\"%s\")\n", - c.Objectname, c.Contract.Evm.DeployedBytecode.Object)) - } - f.WriteString(fmt.Sprintf("var Abi_%s = []byte(`%s`)\n", - c.Objectname, c.Contract.Abi)) - } - } -} diff --git a/deploy/def/client.go b/deploy/def/client.go index 3f1002eb2..6a3ac1106 100644 --- a/deploy/def/client.go +++ b/deploy/def/client.go @@ -4,12 +4,12 @@ import ( "context" "fmt" "io" + "reflect" "strconv" "time" - "reflect" - - hex "github.com/tmthrgd/go-hex" + "github.com/hyperledger/burrow/encoding" + "github.com/tendermint/tendermint/p2p" "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/acm/acmstate" @@ -18,6 +18,7 @@ import ( "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/execution/names" + "github.com/hyperledger/burrow/execution/registry" "github.com/hyperledger/burrow/genesis/spec" "github.com/hyperledger/burrow/keys" "github.com/hyperledger/burrow/logging" @@ -28,7 +29,7 @@ import ( "github.com/hyperledger/burrow/rpc/rpctransact" "github.com/hyperledger/burrow/txs" "github.com/hyperledger/burrow/txs/payload" - "google.golang.org/grpc" + hex "github.com/tmthrgd/go-hex" ) type Client struct { @@ -58,7 +59,7 @@ func NewClient(chain, keysClientAddress string, mempoolSigning bool, timeout tim // Connect GRPC clients using ChainURL func (c *Client) dial(logger *logging.Logger) error { if c.transactClient == nil { - conn, err := grpc.Dial(c.ChainAddress, grpc.WithInsecure()) + conn, err := encoding.GRPCDial(c.ChainAddress) if err != nil { return err } @@ -259,25 +260,25 @@ func (c *Client) SignTx(tx payload.Payload, logger *logging.Logger) (*txs.Envelo } // Creates a keypair using attached keys service -func (c *Client) CreateKey(keyName, curveTypeString string, logger *logging.Logger) (crypto.PublicKey, error) { +func (c *Client) CreateKey(keyName, curveTypeString string, logger *logging.Logger) (*crypto.PublicKey, error) { err := c.dial(logger) if err != nil { - return crypto.PublicKey{}, err + return nil, err } if c.keyClient == nil { - return crypto.PublicKey{}, fmt.Errorf("could not create key pair since no keys service is attached, " + + return nil, fmt.Errorf("could not create key pair since no keys service is attached, " + "pass --keys flag") } curveType := crypto.CurveTypeEd25519 if curveTypeString != "" { curveType, err = crypto.CurveTypeFromString(curveTypeString) if err != nil { - return crypto.PublicKey{}, err + return nil, err } } address, err := c.keyClient.Generate(keyName, curveType) if err != nil { - return crypto.PublicKey{}, err + return nil, err } return c.keyClient.PublicKey(address) } @@ -359,7 +360,7 @@ func (c *Client) UpdateAccount(arg *GovArg, logger *logging.Logger) (*payload.Go } update := &spec.TemplateAccount{ Permissions: arg.Permissions, - Roles: arg.Permissions, + Roles: arg.Roles, } if arg.Address != "" { addr, err := c.ParseAddress(arg.Address, logger) @@ -369,11 +370,11 @@ func (c *Client) UpdateAccount(arg *GovArg, logger *logging.Logger) (*payload.Go update.Address = &addr } if arg.PublicKey != "" { - pubKey, err := publicKeyFromString(arg.PublicKey) + pubKey, err := PublicKeyFromString(arg.PublicKey) if err != nil { return nil, fmt.Errorf("could not parse publicKey: %v", err) } - update.PublicKey = &pubKey + update.PublicKey = pubKey } else { // Attempt to get public key from connected key client if arg.Address != "" { @@ -424,13 +425,13 @@ func (c *Client) PublicKeyFromAddress(address *crypto.Address) (*crypto.PublicKe if err != nil { return nil, fmt.Errorf("could not retrieve public key from keys server: %v", err) } - return &pubKey, nil + return pubKey, nil } -func publicKeyFromString(publicKey string) (crypto.PublicKey, error) { +func PublicKeyFromString(publicKey string) (*crypto.PublicKey, error) { bs, err := hex.DecodeString(publicKey) if err != nil { - return crypto.PublicKey{}, fmt.Errorf("could not parse public key string %s as hex: %v", publicKey, err) + return nil, fmt.Errorf("could not parse public key string %s as hex: %v", publicKey, err) } switch len(bs) { case crypto.PublicKeyLength(crypto.CurveTypeEd25519): @@ -438,8 +439,8 @@ func publicKeyFromString(publicKey string) (crypto.PublicKey, error) { case crypto.PublicKeyLength(crypto.CurveTypeSecp256k1): return crypto.PublicKeyFromBytes(bs, crypto.CurveTypeSecp256k1) default: - return crypto.PublicKey{}, fmt.Errorf("public key string %s has byte length %d which is not the size of either "+ - "ed25519 or compressed secp256k1 keys so cannot construct public key", publicKey, len(bs)) + return nil, fmt.Errorf("public key string %s has byte length %d which is not the size of either "+ + "ed25519 or uncompressed secp256k1 keys so cannot construct public key", publicKey, len(bs)) } } @@ -674,6 +675,55 @@ func (c *Client) Permissions(arg *PermArg, logger *logging.Logger) (*payload.Per return tx, nil } +type IdentifyArg struct { + Input string + NodeKey string + Moniker string + NetAddress string + Amount string + Sequence string +} + +func (c *Client) Identify(arg *IdentifyArg, logger *logging.Logger) (*payload.IdentifyTx, error) { + logger.InfoMsg("IdentifyTx", "name", arg) + input, err := c.TxInput(arg.Input, arg.Amount, arg.Sequence, true, logger) + if err != nil { + return nil, err + } + + address, err := crypto.AddressFromHexString(arg.Input) + if err != nil { + return nil, err + } + + signer, err := keys.AddressableSigner(c.keyClient, address) + if err != nil { + return nil, err + } + + nodeKey, err := p2p.LoadNodeKey(arg.NodeKey) + if err != nil { + return nil, err + } + + id, err := crypto.AddressFromHexString(string(nodeKey.ID())) + if err != nil { + return nil, err + } + + node := ®istry.NodeIdentity{ + Moniker: arg.Moniker, + NetworkAddress: arg.NetAddress, + TendermintNodeID: id, + ValidatorPublicKey: signer.GetPublicKey(), + } + + return &payload.IdentifyTx{ + Inputs: []*payload.TxInput{input}, + Node: node, + }, nil +} + func (c *Client) TxInput(inputString, amountString, sequenceString string, allowMempoolSigning bool, logger *logging.Logger) (*payload.TxInput, error) { var err error var inputAddress crypto.Address diff --git a/deploy/def/deploy.go b/deploy/def/deploy.go index f43eeadad..7495b2e43 100644 --- a/deploy/def/deploy.go +++ b/deploy/def/deploy.go @@ -38,19 +38,3 @@ func (args *DeployArgs) Validate() error { validation.Field(&args.DefaultGas, rule.Uint64), ) } - -type Playbook struct { - Filename string - Account string - Jobs []*Job - Path string `mapstructure:"-" json:"-" yaml:"-" toml:"-"` - BinPath string `mapstructure:"-" json:"-" yaml:"-" toml:"-"` - // If we're in a proposal or meta job, reference our parent script - Parent *Playbook `mapstructure:"-" json:"-" yaml:"-" toml:"-"` -} - -func (pkg *Playbook) Validate() error { - return validation.ValidateStruct(pkg, - validation.Field(&pkg.Jobs), - ) -} diff --git a/deploy/def/job.go b/deploy/def/job.go index 3368d5c29..6e339d674 100644 --- a/deploy/def/job.go +++ b/deploy/def/job.go @@ -45,6 +45,8 @@ type Job struct { Unbond *Unbond `mapstructure:"unbond,omitempty" json:"unbond,omitempty" yaml:"unbond,omitempty" toml:"unbond"` // Utilize monax:db's native name registry to register a name RegisterName *RegisterName `mapstructure:"register,omitempty" json:"register,omitempty" yaml:"register,omitempty" toml:"register"` + // Validator identify as node key + Identify *Identify `mapstructure:"identify,omitempty" json:"identify,omitempty" yaml:"identify,omitempty" toml:"identify"` // Sends a transaction which will update the permissions of an account. Must be sent from an account which // has root permissions on the blockchain (as set by either the genesis.json or in a subsequence transaction) Permission *Permission `mapstructure:"permission,omitempty" json:"permission,omitempty" yaml:"permission,omitempty" toml:"permission"` diff --git a/deploy/def/jobs.go b/deploy/def/jobs.go index d1652296e..77b47379e 100644 --- a/deploy/def/jobs.go +++ b/deploy/def/jobs.go @@ -1,6 +1,7 @@ package def import ( + "fmt" "regexp" validation "github.com/go-ozzo/ozzo-validation" @@ -265,6 +266,30 @@ func (job *Permission) Validate() error { ) } +type Identify struct { + // (Optional, if account job or global account set) address of the account from which to identify (the + // public key for the account must be available to burrow keys) + Source string `mapstructure:"source" json:"source" yaml:"source" toml:"source"` + // (Required) file containing the tendermint node to identify as + NodeKey string `mapstructure:"nodekey" json:"nodekey" yaml:"nodekey" toml:"nodekey"` + // (Required) publically available network address + NetAddress string `mapstructure:"netaddress" json:"netaddress" yaml:"netaddress" toml:"netaddress"` + // (Optional) publically available network moniker + Moniker string `mapstructure:"moniker" json:"moniker" yaml:"moniker" toml:"moniker"` + + // (Optional, advanced only) sequence to use when burrow keys signs the transaction (do not use unless you + // know what you're doing) + Sequence string `mapstructure:"sequence" json:"sequence" yaml:"sequence" toml:"sequence"` +} + +func (job *Identify) Validate() error { + return validation.ValidateStruct(job, + validation.Field(&job.NodeKey, validation.Required), + validation.Field(&job.NetAddress, validation.Required), + validation.Field(&job.Sequence, rule.Uint64OrPlaceholder), + ) +} + // ------------------------------------------------------------------------ // Contracts Jobs // ------------------------------------------------------------------------ @@ -292,6 +317,8 @@ type Build struct { Instance string `mapstructure:"instance" json:"instance" yaml:"instance" toml:"instance"` // (Optional) Path to store an extra copy of the bin file Store string `mapstructure:"store" json:"store" yaml:"store" toml:"store"` + // (Optional) Use solang to compile to wasm + Wasm bool `mapstructure:"wasm" json:"wasm" yaml:"wasm" toml:"wasm"` } func (job *Build) Validate() error { @@ -336,6 +363,8 @@ type Deploy struct { Variables []*abi.Variable // (Optional) Path to store an extra copy of the bin file Store string `mapstructure:"store" json:"store" yaml:"store" toml:"store"` + // (Optional) Use solang to compile to wasm + Wasm bool `mapstructure:"wasm" json:"wasm" yaml:"wasm" toml:"wasm"` } func (job *Deploy) Validate() error { @@ -381,6 +410,11 @@ type Call struct { Variables []*abi.Variable } +// TODO: maybe do for others... +func (job *Call) String() string { + return fmt.Sprintf("%#v", job) +} + func (job *Call) Validate() error { return validation.ValidateStruct(job, validation.Field(&job.Destination, validation.Required), diff --git a/deploy/def/playbook.go b/deploy/def/playbook.go new file mode 100644 index 000000000..99a79bac2 --- /dev/null +++ b/deploy/def/playbook.go @@ -0,0 +1,21 @@ +package def + +import validation "github.com/go-ozzo/ozzo-validation" + +type Playbook struct { + Filename string + Account string + // Prevent this playbook from running at the same time as other playbooks + NoParallel bool `mapstructure:"no-parallel,omitempty" json:"no-parallel,omitempty" yaml:"no-parallel,omitempty" toml:"no-parallel,omitempty"` + Jobs []*Job + Path string `mapstructure:"-" json:"-" yaml:"-" toml:"-"` + BinPath string `mapstructure:"-" json:"-" yaml:"-" toml:"-"` + // If we're in a proposal or meta job, reference our parent script + Parent *Playbook `mapstructure:"-" json:"-" yaml:"-" toml:"-"` +} + +func (pkg *Playbook) Validate() error { + return validation.ValidateStruct(pkg, + validation.Field(&pkg.Jobs), + ) +} diff --git a/deploy/jobs/job_manager.go b/deploy/jobs/job_manager.go index 5396c7317..71e6cfe90 100644 --- a/deploy/jobs/job_manager.go +++ b/deploy/jobs/job_manager.go @@ -22,6 +22,7 @@ const ( type solidityCompilerWork struct { contractName string workDir string + wasm bool } type compilerJob struct { @@ -31,33 +32,28 @@ type compilerJob struct { done chan struct{} } -func solcRunner(jobs chan *compilerJob, logger *logging.Logger) { +func solidityRunner(jobs chan *compilerJob, logger *logging.Logger) { for { job, ok := <-jobs if !ok { - break + return } - resp, err := compilers.EVM(job.work.contractName, false, job.work.workDir, nil, logger) - (*job).compilerResp = resp - (*job).err = err - close(job.done) - } -} + if job.work.wasm { + resp, err := compilers.WASM(job.work.contractName, job.work.workDir, logger) + (*job).compilerResp = resp + (*job).err = err + + } else { + resp, err := compilers.EVM(job.work.contractName, false, job.work.workDir, nil, logger) + (*job).compilerResp = resp + (*job).err = err -func solangRunner(jobs chan *compilerJob, logger *logging.Logger) { - for { - job, ok := <-jobs - if !ok { - return } - resp, err := compilers.WASM(job.work.contractName, job.work.workDir, logger) - (*job).compilerResp = resp - (*job).err = err close(job.done) } } -func queueCompilerWork(job *def.Job, playbook *def.Playbook, jobs chan *compilerJob) error { +func queueCompilerWork(job *def.Job, playbook *def.Playbook, jobs chan *compilerJob, forceWasm bool) error { payload, err := job.Payload() if err != nil { return fmt.Errorf("could not get Job payload: %v", payload) @@ -71,6 +67,7 @@ func queueCompilerWork(job *def.Job, playbook *def.Playbook, jobs chan *compiler work: solidityCompilerWork{ contractName: job.Build.Contract, workDir: playbook.Path, + wasm: job.Build.Wasm || forceWasm, }, } job.Intermediate = &intermediate @@ -82,6 +79,7 @@ func queueCompilerWork(job *def.Job, playbook *def.Playbook, jobs chan *compiler work: solidityCompilerWork{ contractName: job.Deploy.Contract, workDir: playbook.Path, + wasm: job.Deploy.Wasm || forceWasm, }, } job.Intermediate = &intermediate @@ -89,14 +87,14 @@ func queueCompilerWork(job *def.Job, playbook *def.Playbook, jobs chan *compiler } case *def.Proposal: for _, job := range job.Proposal.Jobs { - err = queueCompilerWork(job, playbook, jobs) + err = queueCompilerWork(job, playbook, jobs, forceWasm) if err != nil { return err } } case *def.Meta: for _, job := range job.Meta.Playbook.Jobs { - err = queueCompilerWork(job, playbook, jobs) + err = queueCompilerWork(job, playbook, jobs, forceWasm) if err != nil { return err } @@ -155,12 +153,12 @@ func doJobs(playbook *def.Playbook, args *def.DeployArgs, client *def.Client, lo if err != nil { return err } - err = UpdateAccountJob(job.UpdateAccount, playbook.Account, tx, client, logger) + err = UpdateAccountJob(tx, client, logger) // Util jobs case *def.Account: announce(job.Name, "Account", logger) - job.Result, err = SetAccountJob(job.Account, args, playbook, logger) + job.Result, err = SetAccountJob(job.Account, playbook, logger) case *def.Set: announce(job.Name, "Set", logger) job.Result, err = SetValJob(job.Set, args, logger) @@ -172,7 +170,7 @@ func doJobs(playbook *def.Playbook, args *def.DeployArgs, client *def.Client, lo if err != nil { return err } - job.Result, err = SendJob(job.Send, tx, playbook.Account, client, logger) + job.Result, err = SendJob(tx, client, logger) if err != nil { return err } @@ -182,7 +180,7 @@ func doJobs(playbook *def.Playbook, args *def.DeployArgs, client *def.Client, lo if err != nil { return err } - job.Result, err = BondJob(job.Bond, tx, playbook.Account, client, logger) + job.Result, err = BondJob(tx, client, logger) if err != nil { return err } @@ -192,7 +190,7 @@ func doJobs(playbook *def.Playbook, args *def.DeployArgs, client *def.Client, lo if err != nil { return err } - job.Result, err = UnbondJob(job.Unbond, tx, playbook.Account, client, logger) + job.Result, err = UnbondJob(tx, client, logger) if err != nil { return err } @@ -202,7 +200,7 @@ func doJobs(playbook *def.Playbook, args *def.DeployArgs, client *def.Client, lo if err != nil { return err } - job.Result, err = RegisterNameJob(job.RegisterName, args, playbook, txs, client, logger) + job.Result, err = RegisterNameJob(txs, client, logger) if err != nil { return err } @@ -212,7 +210,17 @@ func doJobs(playbook *def.Playbook, args *def.DeployArgs, client *def.Client, lo if err != nil { return err } - job.Result, err = PermissionJob(job.Permission, playbook.Account, tx, client, logger) + job.Result, err = PermissionJob(tx, client, logger) + if err != nil { + return err + } + case *def.Identify: + announce(job.Name, "Identify", logger) + tx, err := FormulateIdentifyJob(job.Identify, playbook.Account, client, logger) + if err != nil { + return err + } + job.Result, err = IdentifyJob(tx, client, logger) if err != nil { return err } @@ -224,7 +232,7 @@ func doJobs(playbook *def.Playbook, args *def.DeployArgs, client *def.Client, lo if ferr != nil { return ferr } - job.Result, err = DeployJob(job.Deploy, args, playbook, client, txs, contracts, logger) + job.Result, err = DeployJob(job.Deploy, playbook, client, txs, contracts, logger) case *def.Call: announce(job.Name, "Call", logger) @@ -232,7 +240,7 @@ func doJobs(playbook *def.Playbook, args *def.DeployArgs, client *def.Client, lo if ferr != nil { return ferr } - job.Result, job.Variables, err = CallJob(job.Call, CallTx, args, playbook, client, logger) + job.Result, job.Variables, err = CallJob(job.Call, CallTx, playbook, client, logger) case *def.Build: announce(job.Name, "Build", logger) var resp *compilers.Response @@ -308,15 +316,11 @@ func ExecutePlaybook(args *def.DeployArgs, playbook *def.Playbook, client *def.C defer close(jobs) for i := 0; i < concurrentSolc; i++ { - if args.Wasm { - go solangRunner(jobs, logger) - } else { - go solcRunner(jobs, logger) - } + go solidityRunner(jobs, logger) } for _, job := range playbook.Jobs { - queueCompilerWork(job, playbook, jobs) + queueCompilerWork(job, playbook, jobs, args.Wasm) } err = doJobs(playbook, args, client, logger) diff --git a/deploy/jobs/jobs_contracts.go b/deploy/jobs/jobs_contracts.go index bece7dffc..ae1d6a72d 100644 --- a/deploy/jobs/jobs_contracts.go +++ b/deploy/jobs/jobs_contracts.go @@ -7,20 +7,19 @@ import ( "strings" "github.com/hyperledger/burrow/acm/acmstate" - "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/execution/exec" - "github.com/hyperledger/burrow/logging" - "github.com/hyperledger/burrow/crypto" compilers "github.com/hyperledger/burrow/deploy/compile" "github.com/hyperledger/burrow/deploy/def" "github.com/hyperledger/burrow/deploy/util" + "github.com/hyperledger/burrow/execution/errors" "github.com/hyperledger/burrow/execution/evm/abi" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/txs/payload" hex "github.com/tmthrgd/go-hex" ) -var errCodeMissing = fmt.Errorf("error: no binary code found in contract. Contract may be abstract due to missing function body or inherited function signatures not matching.") +var errCodeMissing = fmt.Errorf("error: no binary code found in contract. Contract may be abstract due to missing function body or inherited function signatures not matching") func BuildJob(build *def.Build, deployScript *def.Playbook, resp *compilers.Response, logger *logging.Logger) (result string, err error) { // assemble contract @@ -47,10 +46,8 @@ func BuildJob(build *def.Build, deployScript *def.Playbook, resp *compilers.Resp if binP == "" { binP = deployScript.BinPath } else { - if _, err := os.Stat(binP); os.IsNotExist(err) { - if err := os.Mkdir(binP, 0775); err != nil { - return "", err - } + if err := os.MkdirAll(binP, 0775); err != nil { + return "", err } } @@ -80,10 +77,8 @@ func BuildJob(build *def.Build, deployScript *def.Playbook, resp *compilers.Resp dir := filepath.Dir(build.Store) file := filepath.Base(build.Store) - if _, err := os.Stat(dir); os.IsNotExist(err) { - if err := os.Mkdir(dir, 0775); err != nil { - return "", err - } + if err := os.MkdirAll(dir, 0775); err != nil { + return "", err } err = res.Contract.Save(dir, file) @@ -276,7 +271,7 @@ func FormulateDeployJob(deploy *def.Deploy, do *def.DeployArgs, deployScript *de return } -func DeployJob(deploy *def.Deploy, do *def.DeployArgs, script *def.Playbook, client *def.Client, txs []*payload.CallTx, contracts []*compilers.ResponseItem, logger *logging.Logger) (result string, err error) { +func DeployJob(deploy *def.Deploy, script *def.Playbook, client *def.Client, txs []*payload.CallTx, contracts []*compilers.ResponseItem, logger *logging.Logger) (result string, err error) { // saving contract // additional data may be sent along with the contract // these are naively added to the end of the contract code using standard @@ -284,9 +279,9 @@ func DeployJob(deploy *def.Deploy, do *def.DeployArgs, script *def.Playbook, cli for i, tx := range txs { // Sign, broadcast, display - contractAddress, err := deployFinalize(do, client, tx, logger) + contractAddress, err := deployFinalize(client, tx, logger) if err != nil { - return "", fmt.Errorf("Error finalizing contract deploy %s: %v", deploy.Contract, err) + return "", fmt.Errorf("error finalizing contract deploy %s: %w", deploy.Contract, err) } // saving contract/library abi at abi/address @@ -431,6 +426,7 @@ func FormulateCallJob(call *def.Call, do *def.DeployArgs, deployScript *def.Play if err != nil { return nil, err } + // Use default call.Source = FirstOf(call.Source, deployScript.Account) call.Amount = FirstOf(call.Amount, do.DefaultAmount) @@ -467,8 +463,8 @@ func FormulateCallJob(call *def.Call, do *def.DeployArgs, deployScript *def.Play packedBytes, funcSpec, err = abi.EncodeFunctionCallFromFile(call.Destination, deployScript.BinPath, call.Function, logger, callDataArray...) } if err != nil { - err = util.ABIErrorHandler(err, call, nil, logger) - return + return nil, fmt.Errorf("error in FormulateCallJob with %v: %w", + call, err) } } @@ -494,19 +490,17 @@ func FormulateCallJob(call *def.Call, do *def.DeployArgs, deployScript *def.Play }, logger) } -func CallJob(call *def.Call, tx *payload.CallTx, do *def.DeployArgs, playbook *def.Playbook, client *def.Client, logger *logging.Logger) (string, []*abi.Variable, error) { - var err error +func CallJob(call *def.Call, tx *payload.CallTx, playbook *def.Playbook, client *def.Client, logger *logging.Logger) (string, []*abi.Variable, error) { // Sign, broadcast, display txe, err := client.SignAndBroadcast(tx, logger) if err != nil { - var err = util.ChainErrorHandler(payload.InputsString(tx.GetInputs()), err, logger) - return "", nil, err + return "", nil, fmt.Errorf("error in CallJob with %v: %w", call, err) } if txe.Exception != nil { switch txe.Exception.ErrorCode() { - case errors.ErrorCodeExecutionReverted: + case errors.Codes.ExecutionReverted: message, err := abi.UnpackRevert(txe.Result.Return) if err != nil { return "", nil, err @@ -561,16 +555,14 @@ func CallJob(call *def.Call, tx *payload.CallTx, do *def.DeployArgs, playbook *d return result, call.Variables, nil } -func deployFinalize(do *def.DeployArgs, client *def.Client, tx payload.Payload, logger *logging.Logger) (*crypto.Address, error) { +func deployFinalize(client *def.Client, tx payload.Payload, logger *logging.Logger) (*crypto.Address, error) { txe, err := client.SignAndBroadcast(tx, logger) if err != nil { - return nil, util.ChainErrorHandler(payload.InputsString(tx.GetInputs()), err, logger) - } - - if err := util.ReadTxSignAndBroadcast(txe, err, logger); err != nil { return nil, err } + LogTxExecution(txe, logger) + // The contructor can generate events logEvents(txe, client, logger) @@ -582,14 +574,17 @@ func deployFinalize(do *def.DeployArgs, client *def.Client, tx payload.Payload, } func logEvents(txe *exec.TxExecution, client *def.Client, logger *logging.Logger) { - if client.AllSpecs == nil { - return - } - for _, event := range txe.Events { + print := event.GetPrint() + + if print != nil { + logger.InfoMsg("print", "address", print.Address.String(), "msg", string(print.Data)) + continue + } + eventLog := event.GetLog() - if eventLog == nil { + if eventLog == nil || client.AllSpecs == nil { continue } @@ -607,7 +602,7 @@ func logEvents(txe *exec.TxExecution, client *def.Client, logger *logging.Logger vals[i] = new(string) } - if err := abi.UnpackEvent(&evAbi, eventLog.Topics, eventLog.Data, vals...); err == nil { + if err := abi.UnpackEvent(evAbi, eventLog.Topics, eventLog.Data, vals...); err == nil { var fields []interface{} fields = append(fields, "name") fields = append(fields, evAbi.Name) diff --git a/deploy/jobs/jobs_governance.go b/deploy/jobs/jobs_governance.go index 75955677b..7cad8f003 100644 --- a/deploy/jobs/jobs_governance.go +++ b/deploy/jobs/jobs_governance.go @@ -40,6 +40,11 @@ func FormulateUpdateAccountJob(gov *def.UpdateAccount, account string, client *d arg.Address = gov.Target } else { arg.PublicKey = gov.Target + pk, err := def.PublicKeyFromString(gov.Target) + if err != nil { + panic(err) + } + arg.Address = pk.GetAddress().String() } tx, err := client.UpdateAccount(arg, logger) @@ -50,13 +55,13 @@ func FormulateUpdateAccountJob(gov *def.UpdateAccount, account string, client *d return tx, util.Variables(arg), nil } -func UpdateAccountJob(gov *def.UpdateAccount, account string, tx *payload.GovTx, client *def.Client, logger *logging.Logger) error { +func UpdateAccountJob(tx *payload.GovTx, client *def.Client, logger *logging.Logger) error { txe, err := client.SignAndBroadcast(tx, logger) if err != nil { - return util.ChainErrorHandler(account, err, logger) + return fmt.Errorf("error in UpdateAccountJob with payload %v: %w", tx, err) } - util.ReadTxSignAndBroadcast(txe, err, logger) + LogTxExecution(txe, logger) if err != nil { return err } @@ -82,14 +87,14 @@ func FormulateBondJob(bond *def.Bond, account string, client *def.Client, logger return client.Bond(arg, logger) } -func BondJob(bond *def.Bond, tx *payload.BondTx, account string, client *def.Client, logger *logging.Logger) (string, error) { +func BondJob(tx *payload.BondTx, client *def.Client, logger *logging.Logger) (string, error) { // Sign, broadcast, display txe, err := client.SignAndBroadcast(tx, logger) if err != nil { - return "", util.ChainErrorHandler(account, err, logger) + return "", fmt.Errorf("error in BondJob with payload %v: %w", tx, err) } - util.ReadTxSignAndBroadcast(txe, err, logger) + LogTxExecution(txe, logger) if err != nil { return "", err } @@ -107,20 +112,21 @@ func FormulateUnbondJob(unbond *def.Unbond, account string, client *def.Client, arg := &def.UnbondArg{ Output: unbond.Source, + Amount: unbond.Amount, Sequence: unbond.Sequence, } return client.Unbond(arg, logger) } -func UnbondJob(bond *def.Unbond, tx *payload.UnbondTx, account string, client *def.Client, logger *logging.Logger) (string, error) { +func UnbondJob(tx *payload.UnbondTx, client *def.Client, logger *logging.Logger) (string, error) { // Sign, broadcast, display txe, err := client.SignAndBroadcast(tx, logger) if err != nil { - return "", util.ChainErrorHandler(account, err, logger) + return "", fmt.Errorf("error in UnbondJob with payload %v: %w", tx, err) } - util.ReadTxSignAndBroadcast(txe, err, logger) + LogTxExecution(txe, logger) if err != nil { return "", err } diff --git a/deploy/jobs/jobs_proposal.go b/deploy/jobs/jobs_proposal.go index 35401173b..e0a936fc5 100644 --- a/deploy/jobs/jobs_proposal.go +++ b/deploy/jobs/jobs_proposal.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" + "github.com/hyperledger/burrow/execution/contexts" + "github.com/hyperledger/burrow/acm/acmstate" "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" @@ -179,7 +181,7 @@ func ProposalJob(prop *def.Proposal, do *def.DeployArgs, parentScript *def.Playb return "", err } proposal.BatchTx.Inputs = []*payload.TxInput{proposalInput} - proposalHash := proposal.Hash() + proposalHash := contexts.HashProposal(&proposal) var proposalTx *payload.ProposalTx if do.ProposeVerify { @@ -242,8 +244,7 @@ func ProposalJob(prop *def.Proposal, do *def.DeployArgs, parentScript *def.Playb txe, err := client.SignAndBroadcast(proposalTx, logger) if err != nil { - var err = util.ChainErrorHandler(proposalTx.Input.Address.String(), err, logger) - return "", err + return "", fmt.Errorf("error in ProposalJob with proposal %v: %w", prop, err) } result := fmt.Sprintf("%X", txe.Receipt.TxHash) diff --git a/deploy/jobs/jobs_test_jobs.go b/deploy/jobs/jobs_test_jobs.go index 0d028fa8c..33ead2c65 100644 --- a/deploy/jobs/jobs_test_jobs.go +++ b/deploy/jobs/jobs_test_jobs.go @@ -34,8 +34,8 @@ func QueryContractJob(query *def.QueryContract, do *def.DeployArgs, script *def. data = hex.EncodeToString(packedBytes) } if err != nil { - var err = util.ABIErrorHandler(err, nil, query, logger) - return "", nil, err + return "", nil, fmt.Errorf("error in QueryContractJob with %v: %w", + query, err) } logger.InfoMsg("Query contract", @@ -69,6 +69,8 @@ func QueryContractJob(query *def.QueryContract, do *def.DeployArgs, script *def. return "", nil, err } + logEvents(txe, client, logger) + result2 := util.GetReturnValue(query.Variables, logger) // Finalize if result2 != "" { diff --git a/deploy/jobs/jobs_transact.go b/deploy/jobs/jobs_transact.go index 0b052407c..1ebe23e30 100644 --- a/deploy/jobs/jobs_transact.go +++ b/deploy/jobs/jobs_transact.go @@ -7,11 +7,12 @@ import ( "os" "path/filepath" + "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/txs/payload" + "github.com/tmthrgd/go-hex" "github.com/hyperledger/burrow/deploy/def" - "github.com/hyperledger/burrow/deploy/util" ) func FormulateSendJob(send *def.Send, account string, client *def.Client, logger *logging.Logger) (*payload.SendTx, error) { @@ -32,14 +33,14 @@ func FormulateSendJob(send *def.Send, account string, client *def.Client, logger }, logger) } -func SendJob(send *def.Send, tx *payload.SendTx, account string, client *def.Client, logger *logging.Logger) (string, error) { +func SendJob(tx *payload.SendTx, client *def.Client, logger *logging.Logger) (string, error) { // Sign, broadcast, display txe, err := client.SignAndBroadcast(tx, logger) if err != nil { - return "", util.ChainErrorHandler(account, err, logger) + return "", fmt.Errorf("error in SendJob with payload %v: %w", tx, err) } - util.ReadTxSignAndBroadcast(txe, err, logger) + LogTxExecution(txe, logger) if err != nil { return "", err } @@ -155,17 +156,17 @@ func registerNameTx(name *def.RegisterName, do *def.DeployArgs, account string, }, logger) } -func RegisterNameJob(name *def.RegisterName, do *def.DeployArgs, script *def.Playbook, txs []*payload.NameTx, client *def.Client, logger *logging.Logger) (string, error) { +func RegisterNameJob(txs []*payload.NameTx, client *def.Client, logger *logging.Logger) (string, error) { var result string for _, tx := range txs { // Sign, broadcast, display txe, err := client.SignAndBroadcast(tx, logger) if err != nil { - return "", util.ChainErrorHandler(script.Account, err, logger) + return "", fmt.Errorf("error in RegisterNameJob with payload %v: %w", tx, err) } - util.ReadTxSignAndBroadcast(txe, err, logger) + LogTxExecution(txe, logger) if err != nil { return "", err } @@ -197,16 +198,50 @@ func FormulatePermissionJob(perm *def.Permission, account string, client *def.Cl }, logger) } -func PermissionJob(perm *def.Permission, account string, tx *payload.PermsTx, client *def.Client, logger *logging.Logger) (string, error) { +func PermissionJob(tx *payload.PermsTx, client *def.Client, logger *logging.Logger) (string, error) { logger.TraceMsg("Permissions returned in transaction: ", "args", tx.PermArgs) // Sign, broadcast, display txe, err := client.SignAndBroadcast(tx, logger) if err != nil { - return "", util.ChainErrorHandler(account, err, logger) + return "", fmt.Errorf("error in PermissionJob with payload %v: %w", tx, err) } - util.ReadTxSignAndBroadcast(txe, err, logger) + LogTxExecution(txe, logger) + if err != nil { + return "", err + } + + return txe.Receipt.TxHash.String(), nil +} + +func FormulateIdentifyJob(id *def.Identify, account string, client *def.Client, logger *logging.Logger) (*payload.IdentifyTx, error) { + // Use Default + id.Source = FirstOf(id.Source, account) + + // Formulate tx + logger.InfoMsg("Identify Transaction", + "source", id.Source, + "nodeKey", id.NodeKey, + "netAddress", id.NetAddress) + + return client.Identify(&def.IdentifyArg{ + Input: id.Source, + Moniker: id.Moniker, + NodeKey: id.NodeKey, + NetAddress: id.NetAddress, + Sequence: id.Sequence, + }, logger) +} + +func IdentifyJob(tx *payload.IdentifyTx, client *def.Client, logger *logging.Logger) (string, error) { + // Sign, broadcast, display + txe, err := client.SignAndBroadcast(tx, logger) + if err != nil { + return "", fmt.Errorf("error in IdentifyJob with payload %v: %w", tx, err) + } + + LogTxExecution(txe, logger) if err != nil { return "", err } @@ -222,3 +257,30 @@ func FirstOf(inputs ...string) string { } return "" } + +func LogTxExecution(txe *exec.TxExecution, logger *logging.Logger) { + // if there is nothing to unpack then just return. + if txe == nil { + return + } + + // Unpack and display for the user. + height := fmt.Sprintf("%d", txe.Height) + + if txe.Receipt.CreatesContract { + logger.InfoMsg("Tx Return", + "addr", txe.Receipt.ContractAddress.String(), + "Transaction Hash", hex.EncodeToString(txe.TxHash)) + } else { + logger.InfoMsg("Tx Return", + "Transaction Hash", hex.EncodeToString(txe.TxHash), + "Block Height", height) + + ret := txe.GetResult().GetReturn() + if len(ret) != 0 { + logger.InfoMsg("Return", + "Return Value", hex.EncodeUpperToString(ret), + "Exception", txe.Exception) + } + } +} diff --git a/deploy/jobs/jobs_util.go b/deploy/jobs/jobs_util.go index 0bae3f549..8bcd40818 100644 --- a/deploy/jobs/jobs_util.go +++ b/deploy/jobs/jobs_util.go @@ -5,7 +5,7 @@ import ( "github.com/hyperledger/burrow/logging" ) -func SetAccountJob(account *def.Account, do *def.DeployArgs, script *def.Playbook, logger *logging.Logger) (string, error) { +func SetAccountJob(account *def.Account, script *def.Playbook, logger *logging.Logger) (string, error) { var result string // Set the Account in the Package & Announce diff --git a/deploy/loader/load_package.go b/deploy/loader/load_package.go index 0636eacad..ccdc487ee 100644 --- a/deploy/loader/load_package.go +++ b/deploy/loader/load_package.go @@ -36,10 +36,8 @@ func loadPlaybook(fileName string, args *def.DeployArgs, parent *def.Playbook, l playbook.BinPath = args.BinPath } - if _, err := os.Stat(playbook.BinPath); os.IsNotExist(err) { - if err := os.Mkdir(playbook.BinPath, 0775); err != nil { - return nil, err - } + if err := os.MkdirAll(playbook.BinPath, 0775); err != nil { + return nil, err } // setup file diff --git a/deploy/run_deploy.go b/deploy/run_deploy.go index 7c9796112..911e23d70 100644 --- a/deploy/run_deploy.go +++ b/deploy/run_deploy.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "sync" "time" "github.com/go-kit/kit/log" @@ -27,7 +28,8 @@ type playbookResult struct { duration time.Duration } -func worker(playbooks <-chan playbookWork, results chan<- playbookResult, args *def.DeployArgs, logger *logging.Logger) { +func worker(mtx *sync.RWMutex, playbooks <-chan playbookWork, results chan<- playbookResult, args *def.DeployArgs, + logger *logging.Logger) { client := def.NewClient(args.Chain, args.KeysService, args.MempoolSign, time.Duration(args.Timeout)*time.Second) @@ -59,10 +61,15 @@ func worker(playbooks <-chan playbookWork, results chan<- playbookResult, args * // Load existing bin files to decode events var abiError error client.AllSpecs, abiError = abi.LoadPath(script.BinPath) - if err != nil { + if abiError != nil { logger.InfoMsg("failed to load ABIs for Event parsing", "path", script.BinPath, "error", abiError) } - + locker := mtx.RLocker() + if script.NoParallel { + locker = mtx + } + locker.Lock() + defer locker.Unlock() err = jobs.ExecutePlaybook(args, script, client, logger) return } @@ -96,8 +103,9 @@ func RunPlaybooks(args *def.DeployArgs, playbooks []string, logger *logging.Logg workQ := make(chan playbookWork, 100) resultQ := make(chan playbookResult, 100) + mtx := new(sync.RWMutex) for i := 1; i <= args.Jobs; i++ { - go worker(workQ, resultQ, args, logger) + go worker(mtx, workQ, resultQ, args, logger) } for i, playbook := range playbooks { @@ -112,16 +120,19 @@ func RunPlaybooks(args *def.DeployArgs, playbooks []string, logger *logging.Logg successes := 0 for range playbooks { + // Receive results as they come jobResult := <-resultQ results[jobResult.jobNo] = &jobResult + // Print them in order for results[printed] != nil { res := results[printed] - os.Stderr.Write(res.log.Bytes()) + bs := res.log.Bytes() + os.Stderr.Write(bs) if res.err != nil { - fmt.Fprintf(os.Stderr, "ERROR: %v", res.err) + fmt.Fprintf(os.Stderr, "Error in RunPlaybooks: %v\n", res.err) } res.log.Truncate(0) - if jobResult.err != nil { + if res.err != nil { failures++ } else { successes++ @@ -135,7 +146,7 @@ func RunPlaybooks(args *def.DeployArgs, playbooks []string, logger *logging.Logg close(resultQ) if successes > 0 { - logger.InfoMsg("JOBS THAT SUCCEEEDED", "count", successes) + logger.InfoMsg("JOBS THAT SUCCEEDED", "count", successes) for i, playbook := range playbooks { res := results[i] if res.err != nil { diff --git a/deploy/util/errors.go b/deploy/util/errors.go deleted file mode 100644 index fbc71c5e9..000000000 --- a/deploy/util/errors.go +++ /dev/null @@ -1,67 +0,0 @@ -package util - -import ( - "fmt" - "os" - - "github.com/hyperledger/burrow/deploy/def" - "github.com/hyperledger/burrow/logging" -) - -func Exit(err error) { - status := 0 - if err != nil { - fmt.Fprintln(os.Stderr, err) - status = 1 - } - os.Exit(status) -} - -func ChainErrorHandler(account string, err error, logger *logging.Logger) error { - logger.InfoMsg("There has been an error talking to your Burrow chain", - "defAddr", account, - "rawErr", err) - - return fmt.Errorf(` -There has been an error talking to your Burrow chain using account %s. - -%v - -`, account, err) -} - -func ABIErrorHandler(err error, call *def.Call, query *def.QueryContract, logger *logging.Logger) error { - switch { - case call != nil: - logger.InfoMsg("ABI Error", - "data", call.Data, - "bin", call.Bin, - "dest", call.Destination, - "rawErr", err) - case query != nil: - logger.InfoMsg("ABI Error", - "data", query.Data, - "bin", query.Bin, - "dest", query.Destination, - "rawErr", err) - } - - return fmt.Errorf(` -There has been an error in finding or in using your ABI. ABI's are "Application Binary -Interface" and they are what let us know how to talk to smart contracts. - -These little json files can be read by a variety of things which need to talk to smart -contracts so they are quite necessary to be able to find and use properly. - -The ABIs are saved after the deploy events. So if there was a glitch in the matrix, -we apologize in advance. - -The marmot recovery checklist is... - * ensure your chain is running and you have enough validators online - * ensure that your contracts successfully deployed - * if you used imports or have multiple contracts in one file check the instance - variable in the deploy and the abi variable in the call/query-contract - * make sure you're calling or querying the right function - * make sure you're using the correct variables for job results -`) -} diff --git a/deploy/util/readers.go b/deploy/util/readers.go deleted file mode 100644 index 0e9802936..000000000 --- a/deploy/util/readers.go +++ /dev/null @@ -1,99 +0,0 @@ -package util - -import ( - "bufio" - "fmt" - "os" - "strconv" - "strings" - - "github.com/hyperledger/burrow/execution/exec" - "github.com/hyperledger/burrow/logging" - hex "github.com/tmthrgd/go-hex" -) - -// This is a closer function which is called by most of the tx_run functions -func ReadTxSignAndBroadcast(txe *exec.TxExecution, err error, logger *logging.Logger) error { - // if there's an error just return. - if err != nil { - return err - } - - // if there is nothing to unpack then just return. - if txe == nil { - return nil - } - - // Unpack and display for the user. - height := fmt.Sprintf("%d", txe.Height) - - if txe.Receipt.CreatesContract { - logger.InfoMsg("Tx Return", - "addr", txe.Receipt.ContractAddress.String(), - "Transaction Hash", hex.EncodeToString(txe.TxHash)) - } else { - logger.InfoMsg("Tx Return", - "Transaction Hash", hex.EncodeToString(txe.TxHash), - "Block Height", height) - - ret := txe.GetResult().GetReturn() - if len(ret) != 0 { - logger.InfoMsg("Return", - "Return Value", hex.EncodeUpperToString(ret), - "Exception", txe.Exception) - } - } - - return nil -} - -func GetStringResponse(question string, defaultAnswer string, reader *os.File, logger *logging.Logger) (string, error) { - readr := bufio.NewReader(reader) - logger.InfoMsg(question) - - text, _ := readr.ReadString('\n') - text = strings.Replace(text, "\n", "", 1) - if text == "" { - return defaultAnswer, nil - } - return text, nil -} - -func GetIntResponse(question string, defaultAnswer int64, reader *os.File, logger *logging.Logger) (int64, error) { - readr := bufio.NewReader(reader) - - text, _ := readr.ReadString('\n') - text = strings.Replace(text, "\n", "", 1) - if text == "" { - return defaultAnswer, nil - } - - result, err := strconv.ParseInt(text, 10, 64) - if err != nil { - return 0, nil - } - - return result, nil -} - -// displays the question, scans for the response, if the response is an empty -// string will return default, otherwise will parseBool and return the result. -func GetBoolResponse(question string, defaultAnswer bool, reader *os.File, logger *logging.Logger) (bool, error) { - var result bool - readr := bufio.NewReader(reader) - logger.InfoMsg(question) - - text, _ := readr.ReadString('\n') - text = strings.Replace(text, "\n", "", 1) - if text == "" { - return defaultAnswer, nil - } - - if text == "Yes" || text == "YES" || text == "Y" || text == "y" { - result = true - } else { - result = false - } - - return result, nil -} diff --git a/deploy/util/variables.go b/deploy/util/variables.go index dd0f3f100..b81f32a36 100644 --- a/deploy/util/variables.go +++ b/deploy/util/variables.go @@ -195,12 +195,10 @@ func replaceBlockVariable(toReplace string, client *def.Client, logger *logging. func PreProcessInputData(function string, data interface{}, do *def.DeployArgs, script *def.Playbook, client *def.Client, constructor bool, logger *logging.Logger) (string, []interface{}, error) { var callDataArray []interface{} var callArray []string - if function == "" && !constructor { - if reflect.TypeOf(data).Kind() == reflect.Slice { - return "", []interface{}{""}, fmt.Errorf("Incorrect formatting of deploy.yaml. Please update it to include a function field.") - } - function = strings.Split(data.(string), " ")[0] - callArray = strings.Split(data.(string), " ")[1:] + if _, ok := data.(string); function == "" && !constructor && ok { + callArray = strings.Split(data.(string), " ") + function = callArray[0] + callArray = callArray[1:] for _, val := range callArray { output, _ := PreProcess(val, do, script, client, logger) callDataArray = append(callDataArray, output) diff --git a/docker-compose.yml b/docker-compose.yml index 21ed7a877..3325b049c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,13 @@ version: "3" services: db: image: postgres:11-alpine + environment: + - POSTGRES_HOST_AUTH_METHOD=trust ports: - 5432 burrow: - build: .circleci + image: ${CI_IMAGE} environment: DB_URL: "postgres://postgres@db:5432/postgres?sslmode=disable" GO111MODULE: "on" diff --git a/docs/ADRs/adr-1.md b/docs/ADRs/adr-1.md index 2cb03d408..10e2347b6 100644 --- a/docs/ADRs/adr-1.md +++ b/docs/ADRs/adr-1.md @@ -5,7 +5,7 @@ discussions-to: https://chat.hyperledger.org/channel/burrow-contributors status: Draft type: Meta author: The Burrow's marmots and others - https://github.com/hyperledger/burrow/ADRs/blob/master/ADRs/adr-1.md + https://github.com/hyperledger/burrow/ADRs/blob/main/ADRs/adr-1.md created: 2018-10-09 --- diff --git a/docs/ADRs/draft/adr-2_identify-tx.md b/docs/ADRs/adr-2_identify-tx.md similarity index 100% rename from docs/ADRs/draft/adr-2_identify-tx.md rename to docs/ADRs/adr-2_identify-tx.md diff --git a/docs/ADRs/draft/adr-3_bonding-natives.md b/docs/ADRs/adr-3_bonding-natives.md similarity index 100% rename from docs/ADRs/draft/adr-3_bonding-natives.md rename to docs/ADRs/adr-3_bonding-natives.md diff --git a/docs/INSTALL.md b/docs/INSTALL.md deleted file mode 100644 index 865f5b401..000000000 --- a/docs/INSTALL.md +++ /dev/null @@ -1,38 +0,0 @@ -# Installation - -## Binary - -Download a binary from our list of [releases](https://github.com/hyperledger/burrow/releases) -and copy it to a suitable location. - -## Source - -[Install Go](https://golang.org/doc/install) (Version >= 1.11) and set `$GOPATH`. - -``` -go get github.com/hyperledger/burrow -cd $GOPATH/src/github.com/hyperledger/burrow -make build -``` - -This will build the `burrow` binary and put it in the `bin/` directory. It can be executed from there or put wherever is convenient. - -You can also install `burrow` into `$BIN_PATH/bin` with `make install`, where `$BIN_PATH` defaults to `$HOME/go/bin` -if not set in environment. - -## Docker - -Each release is also tagged and pushed to [Docker Hub](https://hub.docker.com/r/hyperledger/burrow). -This can act as a direct replacement for the burrow binary, for example the following commands are equivalent: - -```bash -burrow spec -v4 -docker run hyperledger/burrow spec -v4 -``` - -> Ensure to mount local volumes for secrets / configurations when running a container to prevent data loss. - -## Kubernetes - -Use our official [helm charts](https://github.com/helm/charts/tree/master/stable/burrow) to configure and run -a burrow chain in your cluster. \ No newline at end of file diff --git a/docs/PROPOSALS.md b/docs/PROPOSALS.md deleted file mode 100644 index 6147e0594..000000000 --- a/docs/PROPOSALS.md +++ /dev/null @@ -1,11 +0,0 @@ -# ADRs -Architecture Decision Records (ADRs) describe standards for the Hyperledger Burrow platform, including core protocol specifications, and client APIs. - -# Contributing - - 1. Review [ADR-1](ADRs/adr-1.md). - 2. Fork the repository by clicking "Fork" in the top right. - 3. Add your ADR to your fork of the repository. There is a [template ADR here](ADRs/adr-X_template.md). - 4. Submit a Pull Request to Burrow's [ADRs repository](./ADRs/). - -If your ADR requires images, the image files should be included in a subdirectory of the `assets` folder for that ADR as follow: `assets/ADR-X` (for ADR **X**). When linking to an image in the ADR, use relative links such as `../assets/adr-X/image.png`. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 1618b605a..c35f1fbd6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,16 +1,72 @@ -# Introduction +# [Hyperledger Burrow](https://hyperledger.github.io/burrow) -Hyperledger Burrow is a permissioned Ethereum smart-contract blockchain node. It executes Ethereum EVM smart contract code (usually written in [Solidity](https://solidity.readthedocs.io)) on a permissioned virtual machine. Burrow provides transaction finality and high transaction throughput on a proof-of-stake [Tendermint](https://tendermint.com) consensus engine. +[![CI](https://github.com/hyperledger/burrow/workflows/main/badge.svg)](https://launch-editor.github.com/actions?workflowID=main&event=push&nwo=hyperledger%2Fburrow) +[![version](https://img.shields.io/github/tag/hyperledger/burrow.svg)](https://github.com/hyperledger/burrow/releases/latest) +[![GoDoc](https://godoc.org/github.com/burrow?status.png)](https://godoc.org/github.com/hyperledger/burrow) +[![license](https://img.shields.io/github/license/hyperledger/burrow.svg)](../LICENSE.md) +[![LoC](https://tokei.rs/b1/github/hyperledger/burrow?category=lines)](https://github.com/hyperledger/burrow) +[![codecov](https://codecov.io/gh/hyperledger/burrow/branch/main/graph/badge.svg)](https://codecov.io/gh/hyperledger/burrow) + +Hyperledger Burrow is a permissioned Ethereum smart-contract blockchain node. It executes Ethereum EVM and WASM smart contract code (usually written in [Solidity](https://solidity.readthedocs.io)) on a permissioned virtual machine. Burrow provides transaction finality and high transaction throughput on a proof-of-stake [Tendermint](https://tendermint.com) consensus engine. ![burrow logo](assets/burrow.png) -## What is Burrow? +## What is Burrow + +Burrow is a fully fledged blockchain node and smart contract execution engine -- a distributed database that executes code. Burrow runs Ethereum Virtual Machine (EVM) and Web Assembly (WASM) smart contracts. Burrow networks are synchronised using the [Tendermint](https://github.com/tendermint/tendermint) consensus algorithm. + +Highlights include: + +- **Tamper-resistant merkle state** - a node can detect if its state is corrupted or if a validator is dishonestly executing the protocol. +- **Proof-of-stake support** - run a private or public permissioned network. +- **On-chain governance primitives** - stakeholders may vote for autonomous smart contract upgrades. +- **Ethereum account world-view** - state and code is organised into cryptographically-addressable accounts. +- **Low-level permissioning** - code execution permissions can be set on a per-account basis. +- **Event streaming** - application state is organised in an event stream and can drive external systems. +- **[SQL mapping layer](reference/vent.md)** - map smart contract event emissions to SQL tables using a projection specification. +- **GRPC interfaces** - all RPC calls can be accessed from any language with GRPC support. Protobuf is used extensively for core objects. +- **Javascript client library** - client library uses code generation to provide access to contracts via statically Typescript objects. +- **Keys service** - provides optional delegating signing at the server or via a local proxy +- **Web3 RPC** - provides compatibility for mainnet Ethereum tooling such as Truffle and Metamask + +### What it is not + +- An Ethereum mainnet client - we do not speak devp2p and various implementation details are different. We are Ethereum-derived but exploit greater freedom than mainnet compatibility would allow. +- Just a virtual machine +- A research project - we run it in production + +### Further introductory material + +See [Burrow - the Boring Blockchain](https://wiki.hyperledger.org/display/burrow/Burrow+-+The+Boring+Blockchain) for an introduction to Burrow and its motivating vision. + +Watch the [Boring into Burrow](https://www.youtube.com/watch?v=OpbjYaGAP4k) talk from the Hyperledger Global Forum 2020 + +## JavaScript Client + +There is a [JavaScript API](https://github.com/hyperledger/burrow/tree/main/js) + +## Project Roadmap + +Project information generally updated on a quarterly basis can be found on the [Hyperledger Burrow Wiki](https://wiki.hyperledger.org/display/burrow). + +## Documentation +Burrow getting started documentation is available on the [documentation site](https://hyperledger.github.io/burrow) (source markdown files can be found in [docs]()) and programmatic API in [GoDocs](https://godoc.org/github.com/hyperledger/burrow). + +## Releases + +- **Burrow binaries**: https://github.com/hyperledger/burrow/releases +- **Burrow.js**: https://www.npmjs.com/package/@hyperledger/burrow +- **Docker**: https://hub.docker.com/repository/docker/hyperledger/burrow + +## Contribute + +We welcome any and all contributions. Read the [contributing file](../.github/CONTRIBUTING.md) for more information on making your first Pull Request to Burrow! + +You can find us on: +- [Hyperledger Chat](https://chat.hyperledger.org) +- [Hyperledger Mailing List](https://lists.hyperledger.org/mailman/listinfo) +- [here on Github](https://github.com/hyperledger/burrow/issues) -Hyperledger Burrow is a permissioned blockchain node that executes smart contract code following the Ethereum specification. Burrow is built for a multi-chain universe with application specific optimization in mind. Burrow as a node is constructed out of three main components: the consensus engine, the permissioned Ethereum virtual machine and the rpc gateway. More specifically Burrow consists of the following: +## License -- **Consensus Engine:** Transactions are ordered and finalised with the Byzantine fault-tolerant Tendermint protocol. The Tendermint protocol provides high transaction throughput over a set of known validators and prevents the blockchain from forking. -- **Application Blockchain Interface (ABCI):** The smart contract application interfaces with the consensus engine over the [ABCI](https://github.com/tendermint/tendermint/abci). The ABCI allows for the consensus engine to remain agnostic from the smart contract application. -- **Smart Contract Application:** Transactions are validated and applied to the application state in the order that the consensus engine has finalised them. The application state consists of all accounts, the validator set and the name registry. Accounts in Burrow have permissions and either contain smart contract code or correspond to a public-private key pair. A transaction that calls on the smart contract code in a given account will activate the execution of that account’s code in a permissioned virtual machine. -- **Permissioned Ethereum Virtual Machine:** This virtual machine is built to observe the Ethereum operation code specification and additionally asserts the correct permissions have been granted. Permissioning is enforced through secure native functions and underlies all smart contract code. An arbitrary but finite amount of gas is handed out for every execution to ensure a finite execution duration - “You don’t need money to play, when you have permission to play”. -- **Application Binary Interface (ABI):** Transactions need to be formulated in a binary format that can be processed by the blockchain node. Current tooling provides functionality to compile, deploy and link solidity smart contracts and formulate transactions to call smart contracts on the chain. -- **API Gateway:** Burrow exposes REST and JSON-RPC endpoints to interact with the blockchain network and the application state through broadcasting transactions, or querying the current state of the application. Websockets allow subscribing to events, which is particularly valuable as the consensus engine and smart contract application can give unambiguously finalised results to transactions within one blocktime of about one second. \ No newline at end of file +[Apache 2.0](../LICENSE.md) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 14caa2c3d..d0477db89 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,27 +1,34 @@ - Burrow - [Introduction](README.md) - - [Installation](INSTALL.md) - [Developers](developers.md) - - [JS API](js-api.md) + - [Burrow Deploy](deploy.md) + - [Burrow.js API](js-api.md) -- Transactions - - [Bond / Unbond](txs/bond.md) +- Examples + - [Basic JS API](example/basic-app/README.md) + - [Basic JS API and Website](example/basic-app-website/README.md) - Tutorials - - [Single Node](tutorials/1-run-full-node.md) - - [Send Transactions](tutorials/2-send-transactions.md) - - [Deploy Contracts](tutorials/3-deploy-contracts.md) - - [Multiple Validators](tutorials/4-multiple-validators.md) - - [Bonding](tutorials/5-bonding-validators.md) - - [Seed Nodes](tutorials/6-seed-nodes.md) + - [Basics](tutorials/1-basics.md) + - [Transactions](tutorials/2-transactions.md) + - [Contracts](tutorials/3-contracts.md) + - [Networking](tutorials/4-networking.md) + - [Bonding](tutorials/5-bonding.md) + - [Seed Nodes](tutorials/6-seeding.md) - [Dump / Restore](tutorials/7-dump-restore.md) - [Proposals](tutorials/8-proposals.md) - Reference + - [Bonding](reference/bonding.md) + - [Consensus](reference/consensus.md) + - [EVM](reference/evm.md) - [Genesis](reference/genesis.md) - - [Deploy yaml](reference/deploy-yaml.md) - [Logging](reference/logging.md) + - [Participants](reference/participants.md) - [Permissions](reference/permissions.md) - [State](reference/state.md) + - [Transactions](reference/transactions.md) + - [Vent](reference/vent.md) - [WASM](reference/wasm.md) - + - [Web3](reference/web3.md) + - [Kubernetes](reference/kubernetes.md) diff --git a/docs/reference/deploy-yaml.md b/docs/deploy.md similarity index 84% rename from docs/reference/deploy-yaml.md rename to docs/deploy.md index 451d4a560..433266fce 100644 --- a/docs/reference/deploy-yaml.md +++ b/docs/deploy.md @@ -1,6 +1,6 @@ -# Burrow deploy yaml (aka playbooks) +# Burrow Deploy (Playbooks) -burrow deploy is a tool which can do a number of things: +The Burrow deploy toolkit can do a number of things: * compile Solidity source files (using solc) and deploy to chain * call function on existing contract @@ -11,15 +11,21 @@ burrow deploy is a tool which can do a number of things: * create proposals or vote for a proposal burrow deploy needs a script to its commands. This script format bares some similarity to [ansible](https://www.ansible.com/). It -is in yaml format. The top level structure is an array of [jobs](https://github.com/hyperledger/burrow/blob/develop/deploy/def/job.go). -The different job types are [defined here](https://github.com/hyperledger/burrow/blob/develop/deploy/def/jobs.go). +is in yaml format. The top level structure is an array of [jobs](https://github.com/hyperledger/burrow/blob/main/deploy/def/job.go). +The different job types are [defined here](https://github.com/hyperledger/burrow/blob/main/deploy/def/jobs.go). -Each job has a name. This name can be used in later jobs to refer to the result of a previous job (e.g. the address of a contract +You can invoke burrow from the command line: + +```shell +burrow deploy -a CF8F9480252B70D59CF5B5F3CAAA75FEAF6A4B33 deploy.yaml +``` + +Each job in the playbook has a name. This name can be used in later jobs to refer to the result of a previous job (e.g. the address of a contract which was deployed). The jobs are executed in-order. Whenever an account needs to be specified, the key name in the burrow keys server can also be used. -## deploy job +## Deploy The deploy job compiles a solidity source file to a bin file which is then deployed to the chain. This type of job has the following parameters: @@ -33,7 +39,7 @@ parameters: * _data:_ the arguments to the contract's constructor The solidity source file is compiled using the [solidity compiler](https://github.com/ethereum/solidity) unless the `--wasm` argument was given -on the burrow deploy command line, in which case the [solang compiler](https://github.com/ethereum/solidity) is used. +on the burrow deploy command line, in which case the [solang compiler](https://github.com/hyperledger-labs/solang) is used. The contract is deployed with its metadata, so that we can retrieve the ABI when we need to call a function of this contract. For this reason, the bin file is a modified version of the [solidity output json](https://solidity.readthedocs.io/en/v0.5.11/using-the-compiler.html#output-description). @@ -44,13 +50,13 @@ file(s) is named according to the name of the contract(s). To select which contr If the _contract_ is specified as a bin file, compilation will be skipped. It can be useful to separate compilation from deployment using the build job, which is described next. -## build job +## Build The build job is used to only compile solidity and do not do any deployment. This only has one parameter: * _contract:_ the path to the solidity source -## call/query-contract job +## Call / Query-Contract The call and query contract job is for executing contract code by way of running one of the functions. The call job will create a transaction and will have to wait until the next block to retrieve the result; the query-contract job is for accessing read-only functions which do not require @@ -68,6 +74,6 @@ of previous burrow deploy job. In the latter case the name of the job must be sp If the contract was deployed without metadata (e.g. using the burrow js module or with an earlier version of burrow deploy) the abi must be specified. This must be the path to the contract bin file or abi file. -## proposal job +## Proposal -This is described in the [proposal tutorial](../tutorials/8-proposals.md). +This is described in the [proposal tutorial](tutorials/8-proposals.md). diff --git a/docs/developers.md b/docs/developers.md index f6f421dcc..9e11c8f2e 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -7,7 +7,7 @@ - [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) - [protoc](http://google.github.io/proto-lens/installing-protoc.html) (libprotoc 3.7.1) -Please also refer to our [contributing guidelines](https://github.com/hyperledger/burrow/blob/develop/.github/CONTRIBUTING.md). +Please also refer to our [contributing guidelines](https://github.com/hyperledger/burrow/blob/main/.github/CONTRIBUTING.md). ## Building @@ -25,9 +25,22 @@ Install protoc and run `make protobuf_deps`. If you make any changes to the prot ## Releasing * First of all make sure everyone is happy with doing a release now. -* Update project/history.go with the latest releases notes and version. Run `make CHANGELOG.md NOTES.md` and make sure this is merged to develop. -* On the develop branch, run `make ready_for_pull_request`. Check for any modified files. -* Using the github.com web interface, create a pull request for master <= develop (so merging latest develop into master) -* Get someone to merge it. They should check that all commits from develop are included using `git log --oneline origin/develop ^origin/master` -* Once master is update to date, switch to master locally run `make tag_release`. This will push the tag which kicks of the release build. -* Optionally send out email on hyperledger burrow mailinglist. Agreements network email should be sent out automatically. \ No newline at end of file +* Update project/history.go with the latest releases notes and version. Run `make CHANGELOG.md NOTES.md` and make sure this is merged to main. +* On the main branch, run `make ready_for_pull_request`. Check for any modified files. +* Once main is update to date, switch to main locally run `make tag_release`. This will push the tag which kicks of the release build. +* Optionally send out email on hyperledger burrow mailinglist. Agreements network email should be sent out automatically. + +## Proposals + +### Architecture Decision Records (ADRs) + +ADRs describe standards for the Hyperledger Burrow platform, including core protocol specifications, and client APIs. + +### Contributing + + 1. Review [ADR-1](ADRs/adr-1.md). + 2. Fork the repository by clicking "Fork" in the top right. + 3. Add your ADR to your fork of the repository. There is a [template ADR here](ADRs/adr-X_template.md). + 4. Submit a Pull Request to Burrow's [ADRs repository](./ADRs/). + +If your ADR requires images, the image files should be included in a subdirectory of the `assets` folder for that ADR as follow: `assets/ADR-X` (for ADR **X**). When linking to an image in the ADR, use relative links such as `../assets/adr-X/image.png`. diff --git a/example/basic-app-website/.gitignore b/docs/example/basic-app-website/.gitignore similarity index 100% rename from example/basic-app-website/.gitignore rename to docs/example/basic-app-website/.gitignore diff --git a/example/basic-app-website/Makefile b/docs/example/basic-app-website/Makefile similarity index 95% rename from example/basic-app-website/Makefile rename to docs/example/basic-app-website/Makefile index f7b94a749..2ee9dfaf0 100644 --- a/example/basic-app-website/Makefile +++ b/docs/example/basic-app-website/Makefile @@ -71,10 +71,10 @@ redeploy: | delete_deploy deploy.output.json # Running the app # -.PHONY: npm_install -npm_install: - npm install +.PHONY: yarn_install +yarn_install: + yarn install .PHONY: start_app -start_app: npm_install deploy +start_app: yarn_install deploy node app.js diff --git a/example/basic-app-website/README.md b/docs/example/basic-app-website/README.md similarity index 84% rename from example/basic-app-website/README.md rename to docs/example/basic-app-website/README.md index 54c17d431..fb3105e5f 100644 --- a/example/basic-app-website/README.md +++ b/docs/example/basic-app-website/README.md @@ -1,8 +1,8 @@ -# Example basic-app (with website) +# Example App (& Website) Note that this example is the same as the the basic-app example, apart from step 3. -This example contains an example solidity contract [simplestorage](simplestorage.sol) and a [node.js application](app.js) that interacts with the contract using [burrow](../../js/README.md). It also contains a [makefile](makefile) that will set up a single node chain, deploy the contract using `burrow deploy`. The node app configures itself to use the the single node chain my looking for [account.json](account.json) and [deploy.output.json](deploy.output.json) files that are emitted by `burrow deploy` and the makefile. +This example contains an example solidity contract [simplestorage](simplestorage.sol) and a [node.js application](app.js) that interacts with the contract using [burrow](../../../js/README.md). It also contains a [makefile](makefile) that will set up a single node chain, deploy the contract using `burrow deploy`. The node app configures itself to use the the single node chain my looking for [account.json](account.json) and [deploy.output.json](deploy.output.json) files that are emitted by `burrow deploy` and the makefile. The makefile provides some examples of using the `burrow` command line tooling and you are invited to modify it for your purposes (i.e. change from linux target to darwin) diff --git a/example/basic-app-website/app.js b/docs/example/basic-app-website/app.js similarity index 100% rename from example/basic-app-website/app.js rename to docs/example/basic-app-website/app.js diff --git a/example/basic-app-website/deploy.yaml b/docs/example/basic-app-website/deploy.yaml similarity index 100% rename from example/basic-app-website/deploy.yaml rename to docs/example/basic-app-website/deploy.yaml diff --git a/example/basic-app-website/package-lock.json b/docs/example/basic-app-website/package-lock.json similarity index 98% rename from example/basic-app-website/package-lock.json rename to docs/example/basic-app-website/package-lock.json index 00f76c4ba..273ad76ee 100644 --- a/example/basic-app-website/package-lock.json +++ b/docs/example/basic-app-website/package-lock.json @@ -352,17 +352,29 @@ "integrity": "sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q==" }, "elliptic": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.0.tgz", - "integrity": "sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + } } }, "encodeurl": { diff --git a/example/basic-app-website/package.json b/docs/example/basic-app-website/package.json similarity index 100% rename from example/basic-app-website/package.json rename to docs/example/basic-app-website/package.json diff --git a/example/basic-app-website/public/css/style.css b/docs/example/basic-app-website/public/css/style.css similarity index 100% rename from example/basic-app-website/public/css/style.css rename to docs/example/basic-app-website/public/css/style.css diff --git a/example/basic-app-website/simplestorage.sol b/docs/example/basic-app-website/simplestorage.sol similarity index 100% rename from example/basic-app-website/simplestorage.sol rename to docs/example/basic-app-website/simplestorage.sol diff --git a/example/basic-app-website/views/index.ejs b/docs/example/basic-app-website/views/index.ejs similarity index 100% rename from example/basic-app-website/views/index.ejs rename to docs/example/basic-app-website/views/index.ejs diff --git a/example/basic-app/.gitignore b/docs/example/basic-app/.gitignore similarity index 100% rename from example/basic-app/.gitignore rename to docs/example/basic-app/.gitignore diff --git a/example/basic-app/Makefile b/docs/example/basic-app/Makefile similarity index 95% rename from example/basic-app/Makefile rename to docs/example/basic-app/Makefile index f7b94a749..2ee9dfaf0 100644 --- a/example/basic-app/Makefile +++ b/docs/example/basic-app/Makefile @@ -71,10 +71,10 @@ redeploy: | delete_deploy deploy.output.json # Running the app # -.PHONY: npm_install -npm_install: - npm install +.PHONY: yarn_install +yarn_install: + yarn install .PHONY: start_app -start_app: npm_install deploy +start_app: yarn_install deploy node app.js diff --git a/example/basic-app/README.md b/docs/example/basic-app/README.md similarity index 88% rename from example/basic-app/README.md rename to docs/example/basic-app/README.md index d051fe035..3df22c547 100644 --- a/example/basic-app/README.md +++ b/docs/example/basic-app/README.md @@ -1,6 +1,6 @@ -# Example basic-app +# Example App -This example contains an example solidity contract [simplestorage](simplestorage.sol) and a [node.js application](app.js) that interacts with the contract using [burrow module](../../js/README.md). It also contains a [makefile](makefile) that will set up a single node chain, deploy the contract using `burrow deploy`. The node app configures itself to use the the single node chain my looking for [account.json](account.json) and [deploy.output.json](deploy.output.json) files that are emitted by `burrow deploy` and the makefile. +This example contains an example solidity contract [simplestorage](simplestorage.sol) and a [node.js application](app.js) that interacts with the contract using [burrow.js](../../../js/README.md). It also contains a [makefile](makefile) that will set up a single node chain, deploy the contract using `burrow deploy`. The node app configures itself to use the the single node chain my looking for [account.json](account.json) and [deploy.output.json](deploy.output.json) files that are emitted by `burrow deploy` and the makefile. The makefile provides some examples of using the `burrow` command line tooling and you are invited to modify it for your purposes (i.e. change from linux target to darwin) diff --git a/example/basic-app/app.js b/docs/example/basic-app/app.js similarity index 100% rename from example/basic-app/app.js rename to docs/example/basic-app/app.js diff --git a/example/basic-app/deploy.yaml b/docs/example/basic-app/deploy.yaml similarity index 100% rename from example/basic-app/deploy.yaml rename to docs/example/basic-app/deploy.yaml diff --git a/example/basic-app/package-lock.json b/docs/example/basic-app/package-lock.json similarity index 98% rename from example/basic-app/package-lock.json rename to docs/example/basic-app/package-lock.json index 2df08c3a3..c707e3195 100644 --- a/example/basic-app/package-lock.json +++ b/docs/example/basic-app/package-lock.json @@ -347,17 +347,29 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "elliptic": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.0.tgz", - "integrity": "sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + } } }, "encodeurl": { diff --git a/example/basic-app/package.json b/docs/example/basic-app/package.json similarity index 100% rename from example/basic-app/package.json rename to docs/example/basic-app/package.json diff --git a/example/basic-app/simplestorage.sol b/docs/example/basic-app/simplestorage.sol similarity index 100% rename from example/basic-app/simplestorage.sol rename to docs/example/basic-app/simplestorage.sol diff --git a/docs/js-api.md b/docs/js-api.md index b58083d5c..f1c5341fa 100644 --- a/docs/js-api.md +++ b/docs/js-api.md @@ -18,7 +18,7 @@ If your distribution of Linux has a version older than 6 then you can update it. ## Install ``` bash -$ npm install @monax/burrow +$ yarn install @hyperledger/burrow ``` ## Usage @@ -56,13 +56,13 @@ The table below links to the reference schema for either the protobuf files gove | Component Name | Accessor | | :----------- | :--------------- | -| Transactions | [Burrow.transact](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto) | -| Queries | [Burrow.query](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcquery.proto) | -| EventStream | [Burrow.eventStream](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto) | -| Events | [Burrow.events](https://github.com/hyperledger/burrow/blob/develop/lib/events.js) | -| NameReg | [Burrow.namereg](https://github.com/hyperledger/burrow/blob/develop/lib/namereg.js) | +| Transactions | [Burrow.transact](https://github.com/hyperledger/burrow/blob/main/protobuf/rpctransact.proto) | +| Queries | [Burrow.query](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcquery.proto) | +| EventStream | [Burrow.eventStream](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcevents.proto) | +| Events | [Burrow.events](https://github.com/hyperledger/burrow/blob/main/lib/events.js) | +| NameReg | [Burrow.namereg](https://github.com/hyperledger/burrow/blob/main/lib/namereg.js) | -| Contracts | [Burrow.contracts](https://github.com/hyperledger/burrow/blob/develop/lib/contractManager.js) | +| Contracts | [Burrow.contracts](https://github.com/hyperledger/burrow/blob/main/lib/contractManager.js) | ### GRPC Access Components @@ -117,7 +117,7 @@ burrow.transact.SendTxSync( .catch(err => console.error(err)) ``` -The return `txe` (short for `TxExecution`) logged to the console in the `then` block contains the history and fingerprint of the `SendTx` execution. You can see an example of this in [basic app](../example/basic-app/app.js). +The return `txe` (short for `TxExecution`) logged to the console in the `then` block contains the history and fingerprint of the `SendTx` execution. You can see an example of this in [basic app](example/basic-app/app.js). #### NameReg access @@ -155,43 +155,43 @@ burrow.transact.NameTxSync(setPayload, function(error, data){ | Method | Passed | Returns | | :----- | :--------- | :---- | -| burrow.transact.BroadcastTxSync | [TxEnvelopeParam](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto#L74-L79) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | -| burrow.transact.BroadcastTxASync | [TxEnvelopeParam](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto#L74-L79) | [Receipt](https://github.com/hyperledger/burrow/blob/develop/protobuf/txs.proto#L38-L47) | -| burrow.transact.SignTx | [TxEnvelopeParam](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto#L74-L79) | [TxEnvelope](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto#L70-L72) | -| burrow.transact.FormulateTx | [PayloadParam](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto#L64-L68) | [TxEnvelope](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto#L70-L72) | -| burrow.transact.CallTxSync | [CallTx](https://github.com/hyperledger/burrow/blob/develop/protobuf/payload.proto#L53-L66) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | -| burrow.transact.CallTxAsync | [CallTx](https://github.com/hyperledger/burrow/blob/develop/protobuf/payload.proto#L53-L66) | [Receipt](https://github.com/hyperledger/burrow/blob/develop/protobuf/txs.proto#L38-L47) | -| burrow.transact.CallTxSim | [CallTx](https://github.com/hyperledger/burrow/blob/develop/protobuf/payload.proto#L53-L66) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | -| burrow.transact.SendTxSync | [SendTx](https://github.com/hyperledger/burrow/blob/develop/protobuf/payload.proto#L69-L76) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | -| burrow.transact.SendTxAsync | [SendTx](https://github.com/hyperledger/burrow/blob/develop/protobuf/payload.proto#L69-L76) | [Receipt](https://github.com/hyperledger/burrow/blob/develop/protobuf/txs.proto#L38-L47) | -| burrow.transact.NameTxSync | [NameTx](https://github.com/hyperledger/burrow/blob/develop/protobuf/payload.proto#L88-L98) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | -| burrow.transact.NameTxAsync | [NameTx](https://github.com/hyperledger/burrow/blob/develop/protobuf/payload.proto#L88-L98) | [Receipt](https://github.com/hyperledger/burrow/blob/develop/protobuf/txs.proto#L38-L47) | +| burrow.transact.BroadcastTxSync | [TxEnvelopeParam](https://github.com/hyperledger/burrow/blob/main/protobuf/rpctransact.proto#L74-L79) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | +| burrow.transact.BroadcastTxASync | [TxEnvelopeParam](https://github.com/hyperledger/burrow/blob/main/protobuf/rpctransact.proto#L74-L79) | [Receipt](https://github.com/hyperledger/burrow/blob/develop/protobuf/txs.proto#L38-L47) | +| burrow.transact.SignTx | [TxEnvelopeParam](https://github.com/hyperledger/burrow/blob/main/protobuf/rpctransact.proto#L74-L79) | [TxEnvelope](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto#L70-L72) | +| burrow.transact.FormulateTx | [PayloadParam](https://github.com/hyperledger/burrow/blob/main/protobuf/rpctransact.proto#L64-L68) | [TxEnvelope](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpctransact.proto#L70-L72) | +| burrow.transact.CallTxSync | [CallTx](https://github.com/hyperledger/burrow/blob/main/protobuf/payload.proto#L53-L66) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | +| burrow.transact.CallTxAsync | [CallTx](https://github.com/hyperledger/burrow/blob/main/protobuf/payload.proto#L53-L66) | [Receipt](https://github.com/hyperledger/burrow/blob/develop/protobuf/txs.proto#L38-L47) | +| burrow.transact.CallTxSim | [CallTx](https://github.com/hyperledger/burrow/blob/main/protobuf/payload.proto#L53-L66) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | +| burrow.transact.SendTxSync | [SendTx](https://github.com/hyperledger/burrow/blob/main/protobuf/payload.proto#L69-L76) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | +| burrow.transact.SendTxAsync | [SendTx](https://github.com/hyperledger/burrow/blob/main/protobuf/payload.proto#L69-L76) | [Receipt](https://github.com/hyperledger/burrow/blob/develop/protobuf/txs.proto#L38-L47) | +| burrow.transact.NameTxSync | [NameTx](https://github.com/hyperledger/burrow/blob/main/protobuf/payload.proto#L88-L98) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | +| burrow.transact.NameTxAsync | [NameTx](https://github.com/hyperledger/burrow/blob/main/protobuf/payload.proto#L88-L98) | [Receipt](https://github.com/hyperledger/burrow/blob/develop/protobuf/txs.proto#L38-L47) | #### Queries -`Burrow.query` provides access to the burrow GRPC service `rpcquery`. As a GRPC wrapper all the endpoints take a data argument and an optional callback. The format of the data object is specified in the [protobuf files](https://github.com/hyperledger/burrow/tree/develop/js/protobuf). Note that "STREAM" functions take a callback `function(error, data)` which is mandatory and is called any time data is returned. For list Accounts the queryable tags are Address, PublicKey, Sequence, Balance, Code, Permissions (Case sensitive). As an example you can get all accounts with a balance greater than 1000 by `burrow.query.ListAccounts('Balance > 1000', callback)`. Multiple tag criteria can be combined using 'AND' and 'OR' for an example of a combined query see [here](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L87). Similarly for ListNames, the avaible tags are Name, Data, Owner and Exires (once again case sensitive) use is identical to List accounts. +`Burrow.query` provides access to the burrow GRPC service `rpcquery`. As a GRPC wrapper all the endpoints take a data argument and an optional callback. The format of the data object is specified in the [protobuf files](https://github.com/hyperledger/burrow/tree/main/js/protobuf). Note that "STREAM" functions take a callback `function(error, data)` which is mandatory and is called any time data is returned. For list Accounts the queryable tags are Address, PublicKey, Sequence, Balance, Code, Permissions (Case sensitive). As an example you can get all accounts with a balance greater than 1000 by `burrow.query.ListAccounts('Balance > 1000', callback)`. Multiple tag criteria can be combined using 'AND' and 'OR' for an example of a combined query see [here](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L87). Similarly for ListNames, the avaible tags are Name, Data, Owner and Exires (once again case sensitive) use is identical to List accounts. | Method | Passed | Returns | Notes | | :----- | :--------- | :---- | :------- | -| burrow.query.GetAccount | [GetAccountParam](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcquery.proto#L25-L27) | [ConcreteAccount](https://github.com/hyperledger/burrow/blob/develop/protobuf/acm.proto#L23-L31) | | -| burrow.query.ListAccounts | [ListAccountsParam](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcquery.proto#L29-L31) | [ConcreteAccount](https://github.com/hyperledger/burrow/blob/develop/protobuf/acm.proto#L23-L31) | STREAM | -| burrow.query.GetNameParam | [GetNameParam](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcquery.proto#L33-L35) | [Entry](https://github.com/hyperledger/burrow/blob/develop/protobuf/names.proto#L22-L32) | | -| burrow.query.ListNames | [ListNamesParam](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcquery.proto#L37-L39) | [Entry](https://github.com/hyperledger/burrow/blob/develop/protobuf/names.proto#L22-L32) | STREAM| +| burrow.query.GetAccount | [GetAccountParam](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcquery.proto#L25-L27) | [ConcreteAccount](https://github.com/hyperledger/burrow/blob/develop/protobuf/acm.proto#L23-L31) | | +| burrow.query.ListAccounts | [ListAccountsParam](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcquery.proto#L29-L31) | [ConcreteAccount](https://github.com/hyperledger/burrow/blob/develop/protobuf/acm.proto#L23-L31) | STREAM | +| burrow.query.GetNameParam | [GetNameParam](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcquery.proto#L33-L35) | [Entry](https://github.com/hyperledger/burrow/blob/develop/protobuf/names.proto#L22-L32) | | +| burrow.query.ListNames | [ListNamesParam](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcquery.proto#L37-L39) | [Entry](https://github.com/hyperledger/burrow/blob/develop/protobuf/names.proto#L22-L32) | STREAM| #### EventStream NB: When listening to contract events it is easier to use the contract interface (described below) -`Burrow.executionEvents` provides access to the burrow GRPC service `ExecutionEvents`. As a GRPC wrapper all the endpoints take a data argument and an optional callback. The format of the data object is specified in the [protobuf files](https://github.com/hyperledger/burrow/tree/develop/js/protobuf). Note that "STREAM" functions take a callback `function(error, data)` which is mandatory and is called any time data is returned. +`Burrow.executionEvents` provides access to the burrow GRPC service `ExecutionEvents`. As a GRPC wrapper all the endpoints take a data argument and an optional callback. The format of the data object is specified in the [protobuf files](https://github.com/hyperledger/burrow/tree/main/js/protobuf). Note that "STREAM" functions take a callback `function(error, data)` which is mandatory and is called any time data is returned. | Method | Passed | Returns | Notes | | :----- | :--------- | :---- | :------- | -| burrow.executionEvents.GetBlock | [GetBlockRequest](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L37-L42) | [BlockExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L20-L27) | | -| burrow.executionEvents.GetBlocks | [BlocksRequest](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L51-L89) | [BlockExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L20-L27) | STREAM | -| burrow.executionEvents.GetTx | [GetTxRequest](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L44-L49) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | | -| burrow.executionEvents.GetTxs | [BlocksRequest](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L51-L89) | [GetTxsResponse](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L96-L99) | STREAM | -| burrow.executionEvents.GetEvents | [BlocksRequest](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L51-L89) | [GetEventsResponse](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L91-L94) | STREAM | +| burrow.executionEvents.GetBlock | [GetBlockRequest](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcevents.proto#L37-L42) | [BlockExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L20-L27) | | +| burrow.executionEvents.GetBlocks | [BlocksRequest](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcevents.proto#L51-L89) | [BlockExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L20-L27) | STREAM | +| burrow.executionEvents.GetTx | [GetTxRequest](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcevents.proto#L44-L49) | [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56) | | +| burrow.executionEvents.GetTxs | [BlocksRequest](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcevents.proto#L51-L89) | [GetTxsResponse](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L96-L99) | STREAM | +| burrow.executionEvents.GetEvents | [BlocksRequest](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcevents.proto#L51-L89) | [GetEventsResponse](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L91-L94) | STREAM | *** @@ -234,7 +234,7 @@ Sets an entry in the namereg. It returns a promise if callback not provided. 3. `int` - The number of blocks to register the name for (more blocks = larger fee) 4. `function` - (optional) Function to call upon completion of form `function(error, data)`. ###### Returns -`TxExecution` - The return data object is a [TxExecution](https://github.com/hyperledger/burrow/blob/develop/protobuf/exec.proto#L34-L56). +`TxExecution` - The return data object is a [TxExecution](https://github.com/hyperledger/burrow/blob/main/protobuf/exec.proto#L34-L56). ###### Example ```javascript @@ -267,7 +267,7 @@ Listens to execution events which satisfy the filter query. 2. `Object` - Currently unused. pass `{}` 3. `function` - Signature of `function(error, data)` mandatory ###### Returns -`GetEventsResponse` - The return data object is a [GetEventsResponse](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L91-L94) +`GetEventsResponse` - The return data object is a [GetEventsResponse](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcevents.proto#L91-L94) @@ -281,7 +281,7 @@ Listens to EVM event executions from specific contract. 3. `Object` - Currently unused. pass `{}` 4. `function` - Signature of `function(error, data)` mandatory. ###### Returns -`GetEventsResponse` - The return data object is a [GetEventsResponse](https://github.com/hyperledger/burrow/blob/develop/protobuf/rpcevents.proto#L91-L94) +`GetEventsResponse` - The return data object is a [GetEventsResponse](https://github.com/hyperledger/burrow/blob/main/protobuf/rpcevents.proto#L91-L94) @@ -495,26 +495,26 @@ return Promise.all( // Deployment of two contracts ## Documentation -Generate documentation using the command `npm run doc`. +Generate documentation using the command `yarn run doc`. ## Testing To test the library against pre-recorded vectors: ``` -npm test +yarn test ``` To test the library against Burrow while recording vectors: ``` -TEST=record npm test +TEST=record yarn test ``` To test Burrow against pre-recorded vectors without exercising the library: ``` -TEST=server npm test +TEST=server yarn test ``` ## Debugging diff --git a/docs/txs/bond.md b/docs/reference/bonding.md similarity index 99% rename from docs/txs/bond.md rename to docs/reference/bonding.md index b8bf0931d..5eed60e26 100644 --- a/docs/txs/bond.md +++ b/docs/reference/bonding.md @@ -22,7 +22,6 @@ To prevent the validator pool changing too quickly over a single block whilst en majority of validators are non-byzantine after the transition, we allow up to `ceil((t)/3) - 1` to be changed where `t` is the current total validator power. - ## Future Work Currently a validator must bond or unbond themselves directly - we enforce a strict relationship diff --git a/docs/reference/consensus.md b/docs/reference/consensus.md new file mode 100644 index 000000000..e2bb22906 --- /dev/null +++ b/docs/reference/consensus.md @@ -0,0 +1,86 @@ +# Consensus + +Burrow uses the [Tendermint](https://tendermint.com/) consensus engine to provide a total ordering of all execution events. +Tendermint is a partially synchronous Byzantine Fault Tolerant (BFT) consensus algorithm in the PBFT family. It provides us with: + +- Total ordering of input transactions via the consensus algorithm itself +- Raw block storage and blockchain +- P2P layer - gossip of blocks, transactions, and votes + +## Quorum + +Tendermint requires strictly greater than 2/3 of its validator voting power to be online at all times to make progress and requires that strictly less than +1/3 of its validators are behaving arbitrarily - e.g. maliciously to maintain its safety and liveness guarantees. + +Restated, we need 2F + 1 validators in order to tolerate F byzantine faults. Which is the tight optimal lower bound on the number of validators for consensus +in the partially synchronous byzantine-fault model. + +In the context of Tendermint where we have a potentially uneven distribution of voting power amongst validators this bound still applies except we treat each +unit of voting power (which is an integral number) as 'a validator' and so provided strictly less than 1/3 of total power is in the hands of misbehaving validators +consensus will make progress and remain consistent (i.e. all correct validators will store the identical correct state). + +## How we use Tendermint + +Burrow and Tendermint have their origins in a single codebase - 'eris-db' - where they were developed in tandem. Tendermint was spun off into a separate project and company +as a modular reusable component focused exclusively on providing a consensus network layer. It consumes a network configuration and topology (described via its own genesis schema), +provides the network connectivity, and consensus algorithm state machine for performing deterministic replication of state across all nodes connected to the network. + +It does this replication by providing a stream of identically ordered transactions to each node via an protocol called the Application BlockChain Interface (ABCI). +As far as Tendermint is concerned these transactions are opaque binary blobs, it is down to the 'application' to decide how to deserialise, verify, and apply the +transactions to state. From Tendermint's perspective Burrow acts as an ABCI client. + +Tendermint is designed so it can be run as a standalone service much like a database, in this mode of operation clients send transactions to Tendermint to be included in blocks +over its RPC layer and ABCI clients receive requests over the ABCI wire protocol to validate transactions before and after they are included in blocks, with the ability to reject them. +Burrow does not use Tendermint in this way but instead uses Tendermint as an embedded library. Internally we still use the underlying interfaces of `BroadcastTx` and the ABCI interface +but we use them within the context of single Go process. This situation owes something to our shared history, but also provides a number of benefits: + +- We can be more efficient by communicating in-process rather than over RPC layers +- Users of Burrow do not need to run multiple services in order to form a network +- In being more tightly coupled to Tendermint we gain direct programmatic access to low-level aspects of its functioning like the mempool and P2P layers +- By controlling our own internal Tendermint node we can provide a consistent configuration for Burrow and Tendermint based on certain conventions and reflection +- We can provide control over validators, genesis, and network formation that would be harder to do with separate services +- We can provide a single consistent command line interface + +The upshot of all of this is that while Tendermint is a crucial part of the Burrow implementation and Burrow is intended to keep and build on its compatibility with public Tendermint +and Cosmos networks it is essentially an implementation detail of Burrow. Burrow is not intended to function as a standalone ABCI app. + + +### What we do not use from Tendermint + +There are a number of pieces of functionality you can find documented as part of 'Tendermint the blockchain' that we opt not use as part of 'Tendermint the library'. +These points of difference are not just for difference's sake but but because we can provide a more specific coherent version of them as part of Burrow which has its +own needs in each of the following areas: + +- The Tendermint HTTP RPC layers - all of our write RPC layers are GRPC-based +- The Tendermint transaction index - we have a GRPC execution events service tailored to our own [state](/docs/reference/state.md) +- Tendermint configuration - we re-expose certain configuration options from Tendermint combined with our own - some of which control multiple Tendermint parameters +- Tendermint genesis - we provide our own genesis from which we derive Tendermint's genesis doc + + +### The Burrow/Tendermint divide + +Tendermint maintains its own on-disk state consisting of: + +- Consensus state +- Write-Ahead log (WAL) +- Validator set +- Block store + +It is able to use these to recover from (in principle) crash-failures, whereby it can detect faulty data (within certain physical bounds) and recover by connecting to +other nodes on the network to 'catch up' by replaying blocks. When a node first starts it will enter 'fast sync' mode and catch up to the latest block height on the network. + +We consider the consensus state entirely the domain of Tendermint - we rely upon Tendermint to order transactions for us. We rely upon this and the WAL to give Burrow +crash-fault tolerance - Burrow maintains a checkpoint that runs one block behind, if Burrow was to crash, Tendermint should recover and reply the block overwriting any +potentially dirty writes for the block that was in-flight. + +The validator set is something that is administered by Burrow and for which Tendermint necessarily keeps its own accounting. We therefore have representations for the current +validator state stored both in Burrow's core code and in our Tendermint library code - which we ensure are synchronised. We furthermore store a complete history of previous validator sets. + +We have a similar arrangement with the block store - Tendermint is responsible for storing the raw block data which includes the full array of votes and headers relating to consensus +and the raw serialised transaction data. However Burrow also has much richer execution event data that comprises a complete trace of all execution events stored as a stream in a merkle tree. +This means that there is some redundancy of data between the Tendermint side and Burrow side storage of transactions and blocks. One way to think about this is as Tendermint providing the +low level transaction log (as a relational database might) and Burrow the application level schema and indices. We also support a mode of operation (currently just for a single node) +involving no consensus (by setting `Enabled = false` in the Tendermint section of the Burrow configuration) where our state storage is exclusive. There are future possibilities enabled +by being able to operate without Tendermint including for private state channels and alternative consensus mechanisms. + +For more details see our [state documentation](/reference/state.md). diff --git a/docs/reference/evm.md b/docs/reference/evm.md new file mode 100644 index 000000000..cf4f1f5d7 --- /dev/null +++ b/docs/reference/evm.md @@ -0,0 +1,49 @@ +# EVM + +Burrow's core execution engine is our Ethereum Virtual Machine (EVM) implementation. This is implemented to be compatible with the core of the EVM specification +and so Burrow should run all Solidity code compiled with `solc`. + +## MainNet Compatibility + +Burrow is compatible on the smart contract and web3 RPC levels but not the network protocol, consensus, or P2P level with public Ethereum mainnet. + +This affords us a great deal more flexibility and agility to support our core public permissioned side-chain use case than we would otherwise have. +We would also argue a number of our variances are technical improvements on public Ethereum for which upgrades are much more difficult. + +## EVM Version Compatibility + +We aim to provide compatibility with the latest EVM version - meaning the specific 'Instruction Set Architecture'. There is not definitive delineation of the EVM +and the Ethereum network, but in practice it is usually clear where certain changes (described in [EIP documents](https://github.com/ethereum/EIPs)) are not relevant for Burrow. +We use the following heuristic to guide the compatibility of our implementation: + +- All Solidity code compiled with the latest `solc` should run on Burrow +- All opcodes defined for the EVM should be implemented in Burrow (where the opcodes assume certain consensus or network protocol fact we try to find an analogous interpretation in Burrow) + +As new EIPs are released we incorporate them into Burrow. There is [current work](https://github.com/hyperledger/burrow/issues/1240) to close the gap on some of the newer +Ethereum precompile contracts. + +## Extensions + +We have a notion similar to precompiled contracts that we call 'natives' whereby we mount pseudo-contracts at a particular address with functions that can be called that expose +certain native functionality of Burrow. Most prominent is access to our permissioning system. SNatives can be displayed with `burrow snatives`. + +Much of the innovation that Burrow intends to offer at the smart contract level will be provided through our 'native contracts' including access to: + +- WASM contracts +- Global namn/ABI registry +- Governance primitives +- Validator staking +- Time synchronisation contracts and calendars +- Oracles +- Token economic primitives + +## Gas + +We only use gas to bound computation; we do not extract a fee for gas used, but we will terminate execution if the gas limit passed to the EVM is exceeded. +We expect to make the gas schedule configurable and to provide the ability to extract a fee for gas used as part of our token economic model. + +## Library Usage + +Burrow aims to also provide a pleasant, extensible, and liberally licensed EVM library via our `execution/evm` package. As such we try to keep the dependencies of this package minimal, +keep the public interfaces stable, and are happy to accept changes that improve our developer ergonomics. There have already been successful integrations of Burrow with +[Hyperledger Sawtooth](https://github.com/hyperledger/sawtooth-seth) and [Hyperledger Fabric](https://github.com/hyperledger/fabric-chaincode-evm). diff --git a/docs/reference/genesis.md b/docs/reference/genesis.md index f6c5e3064..0ce895568 100644 --- a/docs/reference/genesis.md +++ b/docs/reference/genesis.md @@ -1,11 +1,17 @@ # Genesis -A blockchain network stores a series of deterministically agreed upon states indexed by a sequentially increasing number called the block height. Once a block is committed at a particular height we can always discover the total state at that height by querying more than 1/3 of the chain (in Burrow's case, and we may need to query more nodes if the ones we speak to disagree). +A blockchain network stores a series of deterministically agreed upon states indexed by a sequentially increasing number called the block height. +Once a block is committed at a particular height we can always discover the total state at that height by querying more than 1/3 of the chain. -The state at block `n+1` is the result of applying the transactions accepted at height `n` on top of the state at height `n`. Following this induction backwards we therefore require some initial state. This initial state is called the 'genesis state'. Unlike all subsequent states that are arrived at by the application of consensus amongst validators this state is defined a priori and defines the identity of the chain that will be built on top of it. Producing the genesis document is a singular big bang event performed by a single party. It cannot occur under consensus because it defines who can participate in consensus in block 1. +The state at block `n+1` is the result of applying the transactions accepted at height `n` on top of the state at height `n`. Following this induction backwards +we therefore require some initial state. This initial state is called the 'genesis state'. Unlike all subsequent states that are arrived at by the application of consensus +amongst validators this state is defined a priori and defines the identity of the chain that will be built on top of it. Producing the genesis document is a singular big bang +event performed by a single party. It cannot occur under consensus because it defines who can participate in consensus at block 1. ## GenesisDoc -In burrow we define the genesis facts in a canonical JSON document called the `GenesisDoc`. The sha256 of this document (with whitespace, as it happens) forms the `GenesisHash` which acts as if it were the hash of a virtual zeroth block. + +In burrow we define the genesis facts in a canonical JSON document called the `GenesisDoc`. The sha256 of this document (with whitespace, as it happens) forms the `GenesisHash` +which acts as if it were the hash of a virtual zeroth block. | Field | Purpose | @@ -18,6 +24,7 @@ In burrow we define the genesis facts in a canonical JSON document called the `G | Validators | The initial validators on the chain that together will decide the value of the next state (see below for more detail) | Here is an example `genesis.json`: + ```json { "GenesisTime": "2019-05-17T10:33:23.476788642Z", @@ -87,19 +94,3 @@ Here is an example `genesis.json`: } ``` - -### Accounts - -Accounts are identified by an address - this is the EVM's 20-byte native identifier and is encoded in hex in the GenesisDoc - -TODO: Public key is redundant but included for reference - -TODO: Amount is native token - -### Validators -TODO - -### Genesis making - -TODO: burrow spec -TODO: burrow configure diff --git a/docs/reference/kubernetes.md b/docs/reference/kubernetes.md new file mode 100644 index 000000000..3059b60b9 --- /dev/null +++ b/docs/reference/kubernetes.md @@ -0,0 +1,9 @@ +# Kubernetes + +Burrow ships a docker image suitable for use in Kubernetes on [Docker Hub](https://hub.docker.com/r/hyperledger/burrow). This image is use by the chart below. + +## Helm chart + +A helm chart for Burrow with can be found in the main repo [here](https://github.com/hyperledger/burrow/tree/main/helm) (with further documentation). + +The helm chart allows you to bootstrap and run your own pool of validators. diff --git a/docs/reference/logging.md b/docs/reference/logging.md index c9d549518..9e84024c5 100644 --- a/docs/reference/logging.md +++ b/docs/reference/logging.md @@ -1,6 +1,7 @@ # Logging -Logging is highly configurable through the `burrow.toml` `[logging]` section. Each log line is a list of key-value pairs that flows from the root sink through possible child sinks. Each sink can have an output, a transform, and sinks that it outputs to. Below is a more involved example than the one appearing in the default generated config of what you can configure: +Logging is highly configurable through the `burrow.toml` `[logging]` section. Each log line is a list of key-value pairs that flows from the root sink through possible child sinks. +Each sink can have an output, a transform, and sinks that it outputs to. Below is a more involved example than the one appearing in the default generated config of what you can configure: ```toml # This is a top level config section within the main Burrow config diff --git a/docs/reference/participants.md b/docs/reference/participants.md new file mode 100644 index 000000000..f4756b915 --- /dev/null +++ b/docs/reference/participants.md @@ -0,0 +1,40 @@ +# Participants + +## Accounts + +Accounts are identified by an address - this is the EVM's 20-byte native identifier and is encoded in hex in the GenesisDoc. The public key is redundant but included for reference. + +The `Amount` is an initial amount of Burrow's native token. This native token can serve multiple purposes: + +- Funding an account by sending token implicitly creates that account (if it does not already exist). Only accounts that have been created by having value transferred to them (via a `SendTx` or an EVM `Call`) can themselves act as input accounts (e.g. in a `CallTx`). +- The native token can be used as a value-holding token on a Burrow sidechain in the same was that eth acts as a value token on public Ethereum. +- Native token can be be converted via a [BondTx](/docs/reference/transactions.md#bondtx) into validator voting power. + +Accounts can also hold EVM or WASM code that is initialised on account creation (and thereafter cannot be changed - except for by [GovTx](/docs/reference/transactions.md#govtx)). You can create a contract by sending a [CallTx](/reference/transactions.md#calltx) using + +## Validators + +Validators are the nodes running on the network that are permitted to participate in block proposal and voting according to the Tendermint consensus algorithm. +Each validator is identified by it public key and can also be described by a corresponding 20-byte address. A validator is assigned a `Power` that determines the relative +power of each of its votes and how often it will be rotated into position of block proposer. + +## Signing + +Burrow supports the following public-key signature systems. + +#### Ed25519 + +This is our default signing algorithm, as defined [here](https://ed25519.cr.yp.to/). We define an address to be the first 20 bytes of the sha256 hash of a public key. + +#### Secp256k1 + +Both Bitcoin and Ethereum adopt Secp256k1 elliptic curves for verification of content, but construct addresses differently: + +| System | Construction | Encoding | +| ------ | ------------ | -------- | +| Bitcoin | `RIPEMD160(SHA256(PublicKey)` | Base58Check | +| Ethereum | `KECCAK256(PublicKey)[-20:]` | Hex | + +We adopt the Ethereum style addressing system which takes the last 20 bytes of the `KECCAK256` hash of the public key. +Tendermint adopts Bitcoin's usage pattern meaning that it is not currently possible to use this signature scheme for validators, +though there are [discussions](https://github.com/tendermint/tendermint/issues/2358) to extend this interface. diff --git a/docs/reference/permissions.md b/docs/reference/permissions.md index 546c81d26..6d1604dc9 100644 --- a/docs/reference/permissions.md +++ b/docs/reference/permissions.md @@ -1,7 +1,6 @@ # Permissions -Burrow supports permissions via permission flags and string tags called 'roles'. -The flag permissions are: +Burrow supports permissions via permission flags and string tags called 'roles'. The flag permissions are: | Permission Flag | Capability | Purpose | |-----------------|------------|---------| @@ -42,4 +41,4 @@ An example `genesis.json`: } ``` -See [genesis](genesis.md) for more details on constructing accounts and setting some useful presets. +See [genesis](reference/genesis.md) for more details on constructing accounts and setting some useful presets. diff --git a/docs/reference/state.md b/docs/reference/state.md index 2128ce4aa..2fb3d46ab 100644 --- a/docs/reference/state.md +++ b/docs/reference/state.md @@ -1,7 +1,37 @@ # State -Burrow wraps its state in a 'mutable forest' which contains one 'commits' tree and an 'immutable forest'. The former implementation contains -commit IDs generated from all sub-trees in the 'immutable forest' thereby providing the state root hash. Each tree in our 'immutable forest' -is lazily loaded by prefix (i.e. initialized if it does not exist), returning a read/write tree. This contains immutable snapshots of its -history for reading, as well as a mutable tree for accumulating state. All trees ultimately wrap [IAVL](https://github.com/tendermint/iavl), -an (immutable) AVL+ library, persisted in [goleveldb](https://github.com/syndtr/goleveldb) - a key/value database. \ No newline at end of file +State is written to our EVM or WASM engines on executing bytecode provided by [`CallTx`](/reference/transactions.md#CallTx) transactions that have been +accepted into the blockchain. The state is stored through the following generic interface: + +```go +type StorageSetter interface { + // Store a 32-byte value at key for the account at address, setting to Zero256 removes the key + SetStorage(address crypto.Address, key binary.Word256, value []byte) error +} +``` + +The raw data stored according depends on a schema determined by the execution engine and contract in question, in the case of the EVM this is described by the +ABI generated when a contract is compiled. + +Burrow stores its state in an authenticated key-value data structure - a merkle tree. It has the following features: + +- We store a separate complete version of all core state at each height - this gives us the ability to rewind instantly to any height. +- We are able to provide inclusion proofs for any element of state (not currently exposed by our RPC interfaces). +- State has a single unified state root hash that almost surely guarantees identity of state by comparison between state root hashes + +## Structure + +Burrow stores its core state the `Forest` which is implemented as a merkle tree of commit objects for individual sub-trees thereby providing the state root hash. +Each tree in our forest is lazily loaded by prefix (i.e. initialized if it does not exist), returning a read/write tree. This contains immutable snapshots of its +history for reading, as well as a mutable tree for accumulating state. All trees ultimately wrap [IAVL](https://github.com/tendermint/iavl), an (immutable) AVL+ library, +persisted in [goleveldb](https://github.com/syndtr/goleveldb) - a key/value database. + +### Index and derivable data + +Alongside our core data we have additional data that can be derived from (such as indices) or is peripheral to (such as contract metadata). +Since we can generally detect if these are incorrect or regenerate them we store them in a plain non-authenticated key-value storage called the `Plain` + +### Relationship with Tendermint state + +Tendermint also uses merkle trees to store raw block and transaction data. Tendermint blocks close in our state root hash as the `AppHash` thereby creating a +merkle graph that conveys the authenticated data structure property to our application state. diff --git a/docs/reference/transactions.md b/docs/reference/transactions.md new file mode 100644 index 000000000..dd85bc1b2 --- /dev/null +++ b/docs/reference/transactions.md @@ -0,0 +1,97 @@ +# Transactions + +Burrow implements a number of transaction types. Transactions will be ordered by our consensus mechanism (Tendermint) and applied to our application state machine - +replicated across all Burrow nodes. Each transaction is applied atomically and runs deterministically. The transactions contain the arguments for an +[execution context](https://github.com/hyperledger/burrow/tree/main/execution/contexts). + +Our transactions are defined in Protobuf [here](https://github.com/hyperledger/burrow/blob/main/protobuf/payload.proto). + +Transactions can be built using our GRPC client libraries programmatically, via [burrow.js](js-api.md), or with `burrow deploy` - see our [deployment guide](deploy.md). + +## TxInput + +| Parameter | Type | Description | +| ----------|------|-------------| +| Address | Address | The address of an account issuing this transaction - the transaction envelope must also be signed by the private key associated with this address | +| Amount | uint64 | The amount of native token to transfer from the input to the output of the transaction | +| Sequence | uint64 | A counter that must match the current value of the input account's Sequence plus one - i.e. the Sequence must equal n if this is the nth transaction issued by this account | + + +## CallTx + +Our core transaction type that calls EVM code, possibly transferring value. It takes the following parameters: + +| Parameter | Type | Description | +| ----------|------|-------------| +| Input | TxInput | The external 'caller' account - will be the initial SENDER and CALLER | +| Address | *Address | The address 'callee' contract - the contract whose code will be executed. If this value is nil then the CallTx is interpreted as contract creation and will deploy the bytecode contained in Data or WASM | +| GasLimit | uint64 | The maximum number of computational steps that we will allow to run before aborted the transaction execution. Measured according to our hardcoded simplified gas schedule (one gas unit per operation). Ensure transaction termination. If 0 a default cap will be used. | +| Fee | uint64 | An optional fee to be subtracted from the input amount - currently this fee is simply burnt! In the future fees will be collected and disbursed amongst validators as part of our token economics system | +| Data | []byte | If the CallTx is a deployment (i.e. Address is nil) then this data will be executed as EVM bytecode will and the return value will be used to instatiate a new contract. If the CallTx is a plain call then the data will form the input tape for the EVM call | + +## SendTx + +Allows [native token](reference/participants.md) to be sent from multiple inputs to multiple outputs. The basic value transfer function that calls no EVM Code. + +## NameTx + +Provides access to a global name registry service that associates a particular string key with a data payload and an owner. The control of the name is guaranteed for +the period of the lease which is a determined by a fee. + +> A future revision will change the way in which leases are calculated. Currently we use a somewhat historically-rooted fixed fee, see the [`NameCostPerBlock` function](https://github.com/hyperledger/burrow/blob/main/execution/names/names.go#L83). + +## BondTx + +This allows validators nominate themselves to the validator set by placing a bond subtracted from their balance. + +For more information see the [bonding documentation](reference/bonding.md). + +## UnbondTx + +This allows validators remove themselves to the validator set returning their bond to their balance. + +## BatchTx + +Runs a set of transactions atomically in a single meta-transaction within a single block + +## GovTx + +An all-powerful transaction for modifying existing accounts. + +## ProposalTx + +A transaction type containing a batch of transactions on which a ballot is held to determine whether to execute, see the [proposals tutorial](tutorials/8-proposals.md). + +## PermsTx + +A transaction to modify the permissions of accounts. + +## IdentifyTx + +When running a closed or permissioned network, it is desirable to restrict the participants. +For example, a consortium may wish to run a shared instance over a wide-area network without +sharing the state to unknown parties. + +As Tendermint handles P2P connectivity for Burrow, it extends a concept known as the 'peer filter'. +This means that on every connection request to a particular node, our app will receive a request to +check a whitelist (if enabled, otherwise allowed by default) - if the source IP address or node key is +unknown then the connection will be rejected. The easiest way to manage this whitelist is to hard code +the respective participants in the config: + +```toml +[Tendermint] + AuthorizedPeers = "DDEF3E93BBF241C737A81E6BA085D0C77C7B51C9@127.0.0.1:26656, + A858F15CD7048F7D6C1B310E016A0B8BA1D44861@127.0.0.1:26657" +``` + +This can become difficult to manage over time, and any change would require a restart of the node. A more +scalable solution is `IdentifyTx`, which allows select participants to be associated with a particular +'node identity' - network address, node key and moniker. Once enabled in the config, a node will only allow +connection requests from entries in its registry. + +```toml +[Tendermint] + IdentifyPeers = true +``` + +For more details, see the [ADR](ADRs/adr-2_identify-tx.md). diff --git a/docs/reference/vent.md b/docs/reference/vent.md new file mode 100644 index 000000000..48f49723a --- /dev/null +++ b/docs/reference/vent.md @@ -0,0 +1,223 @@ +# Vent - SQL mapping layer + + +Vent reads specification files called 'projections', parses their contents, and maps EVM LOG event fields to corresponding SQL columns to create or alter database structures. +It listens for a stream of block events from Burrow's GRPC service then parses, unpacks, decodes event data, and builds rows to be upserted in matching event tables, rows are +upserted atomically in a single database transaction per block. + +There are two modes of operation: view mode and log mode. In view mode a primary key is used to locate the row in a table which should be updated (if exists) or inserted +(if it does not exist). If the event contains a field matching the optional `DeleteMarkerField` then the row will instead be deleted. As such in view mode Vent can map a +stream of EVM LOG events to a CRUD-style table - a view over entities as defined by the choice primary key. Alternatively if no primary keys are specified for a projection +Vent operates in log mode where all matched events are inserted - and so log mode operates as an append-only log. Note there is no explicit setting for mode - it depends on +the presence or absence of a `"Primary": true` entry in one of the `FieldMappings` of a projection (see below for an example). + +Vent writes each block of updates atomically and is guaranteed to be crash tolerant. If the Vent process is killed it will resume at the last written height. Burrow stores all +previous events in its state so even if you delete the Vent database it can be regenerated deterministically. This feature being a core feature of Vent. + +There is a [presentation on vent here](https://competent-yalow-f210f7.netlify.app). + + +## Projections +A projection is the name given to the configuration files that Vent uses to interpret EVM events as updates or deletion from SQL tables. They provide an object relational mapping +between Solidity events and SQL tables. + +Given a projection, like the following: + +```json +[ + { + "TableName" : "EventTest", + "Filter" : "Log1Text = 'I am LOG1'", + "DeleteMarkerField": "__DELETE__", + "FieldMappings" : [ + { + "Field": "key", + "ColumnName" : "testname", + "Type": "bytes32", + "Primary" : true + }, + { + "Field": "description", + "ColumnName" : "testdescription", + "Type": "bytes32", + "BytesToString": true + } + ] + } +] +``` + +And a solidity contract like: + +```solidity +pragma solidity ^0.4.25; + +contract EventEmitter { + event UpdateEvent( + // The first indexed field will appear as the the LOG1 topic - we can use it like a namespace + bytes32 indexed IAmLog1, + // Our primary key in our projection above + bytes32 key, + // Some 'mutable' text - we can update this by emitting an UpdateEvent with the same key but a new description + bytes32 description + ); + + event DeletionEvent( + bytes32 indexed IAmLog1, + bytes32 key, + // This marker field can be of any type - it is purely matched on name - if an event contains a field with the + // the specified marker field it is interpreted as an instruction to delete the row corresponding to key + bool __DELETE__ + ); + + function update() external { + // Update or inserts 'key0001' row + emit UpdateEvent("I am LOG1", "key0001", "some description"); + } + + function update2() external { + // Update or inserts 'key0001' row + emit UpdateEvent("I am LOG1", "key0001", "a different description"); + } + + function remove() external { + // Removes 'key0001' row + emit DeletionEvent("I am LOG1", "key0001", true); + } +} +``` + +We can maintain a view-mode table that feels like that of a ordinary CRUD app though it is backed by a stream of events coming from our Solidity contracts. + +Burrow can also emit a JSONSchema for the projection file format with `burrow vent schema`. You can use this to validate your projections using any of the +[JSONSchema](https://json-schema.org/) tooling. + +### Projection specification +A projection file is defined as a JSON array of `EventClass` objections. Each `EventClass` specifies a class of events that should be consumed (specified via a filter) +in order to generate a SQL table. An `EventClass` holds `FieldMappings` that specify how to map the event fields of a matched EVM event to a destination column +(identified by `ColumnName`) of the destination table (identified by `TableName`) + +#### EventClass +| Field | Type | Required? | Description | +|-------|------|-----------|-------------| +| `TableName` | String | Required | The case-sensitive name of the destination SQL table for the `EventClass`| +| `Filter` | String | Required | A filter to be applied to EVM Log events using the [available tags](../../protobuf/rpcevents.proto) written according to the event [query.peg](../../event/query/query.peg) grammar | +| `FieldMappings` | array of `FieldMapping` | Required | Mappings between EVM event fields and columns see table below | +| `DeleteMarkerField` | String | Optional | Field name of an event field that when present in a matched event indicates the event should result on a deletion of a row (matched on the primary keys of that row) rather than the default upsert action | + +#### FieldMapping +| Field | Type | Required? | Description | +|-------|------|-----------|-------------| +| `Field` | String | Required | EVM field name to match exactly when creating a SQL upsert/delete | +| `Type` | String | Required | EVM type of the field (which also dictates the SQL type that will be used for table definition) | +| `ColumnName` | String | Required | The destination SQL column for the mapped value | +| `Primary` | Boolean | Optional | Whether this SQL column should be part of the primary key | +| `BytesToString` | Boolean | Optional | When type is `bytes` (for some N) indicates that the value should be interpreted as (converted to) a string | +| `Notify` | array of String | Optional | A list of notification channels on which a payload should be sent containing the value of this column when it is updated or deleted. The payload on a particular channel will be the JSON object containing all column/value pairs for which the notification channel is a member of this notify array (see [triggers](#triggers) below) | + +Vent builds dictionary, log and event database tables for the defined tables & columns and maps input types to proper sql types. + +Database structures are created or altered on the fly based on specifications (just adding new columns is supported). + +Abi files can be generated from bin files like so: + +```bash +cat *.bin | jq '.Abi[] | select(.type == "event")' > events.abi +``` + +## Adapters: + +Adapters are database implementations, Vent can store data in different rdbms. + +In `sqldb/adapters` there's a list of supported adapters (there is also a README.md file in that folder that helps to understand how to implement a new one). + +### Notification Triggers +Notification triggers are configured with the `Notify` array of a `FieldMapping`. In a supported database (currently only postrges) they allow you to specify a set of +channels on which to notify when a column changes. By including a channel in the `Notify` the column is added to the set of columns for which that channel should receive +a notification payload. For example if we have the following spec: + +```json +[ + { + "TableName" : "UserAccounts", + "Filter" : "Log1Text = 'USERACCOUNTS'", + "FieldMappings" : [ + {"Field": "userAddress", "ColumnName" : "address", "Type": "address", "Notify": ["user", "address"]}, + {"Field": "userName", "ColumnName" : "username", "Type": "string", "Notify": ["user"]} + ] + } + ] +``` + +Then Vent will record a mapping `user -> username, address` and `address -> address` where the left hand side is the notification channel and the right hand side the columns +included in the payload on that channel. + +For each of these mappings a notification trigger function is defined and attached as a trigger for the table to run after an insert, update, or delete. This function calls +`pg_notify` (in the case of postgres, the only database for which we support notifications - this is non-standard and we may use a different mechanism in other databases if present). +These notification can be consumed by any client connected to the postgres database with `LISTEN ;`, see [Postgres NOTIFY documentation](https://www.postgresql.org/docs/11/sql-notify.html). + +## Setup PostgreSQL Database with Docker: + +```bash +# Create postgres container (only once): +docker run --name postgres-local -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=vent -p 5432:5432 -d postgres:10.4-alpine + +# Start postgres container: +docker start postgres-local + +# Stop postgres container: +docker stop postgres-local + +# Delete postgres container: +docker container rm postgres-local +``` + +## Run Unit Tests: + +```bash +# From the main repo folder: +make test_integration_vent +``` + +## Run Vent Command: + +```bash +# Install burrow (from root of repo): +make install + +# Print command help: +burrow vent --help + +# Run vent command with postgres adapter, spec & abi files path, also stores block & tx data: +burrow vent start --db-adapter="postgres" --db-url="postgres://user:pass@localhost:5432/vent?sslmode=disable" --db-schema="vent" --grpc-addr="localhost:10997" --http-addr="0.0.0.0:8080" --log-level="debug" --spec="" --abi="" --db-block=true + +# Run vent command with sqlite adapter, spec & abi directories path, does not store block & tx data: +burrow vent start --db-adapter="sqlite" --db-url="./vent.sqlite" --grpc-addr="localhost:10997" --http-addr="0.0.0.0:8080" --log-level="debug" --spec="" --abi="" +``` + +Configuration Flags: + ++ `db-adapter`: (string) Database adapter, 'postgres' or 'sqlite' are fully supported ++ `db-url`: (string) PostgreSQL database URL or SQLite db file path ++ `db-schema`: (string) PostgreSQL database schema or empty for SQLite ++ `http-addr`: (string) Address to bind the HTTP server ++ `grpc-addr`: (string) Address to listen to gRPC Hyperledger Burrow server ++ `log-level`: (string) Logging level (error, warn, info, debug) ++ `spec-file`: (string) SQLSol specification json file (full path) ++ `spec-dir`: (string) Path of a folder to look for SQLSol json specification files ++ `abi-file`: (string) Event Abi specification file full path ++ `abi-dir`: (string) Path of a folder to look for event Abi specification files ++ `db-block`: (boolean) Create block & transaction tables and persist related data (true/false) + + +NOTES: + +One of `spec-file` or `spec-dir` must be provided. +If `spec-dir` is given, vent will search for all `.json` spec files in given directory. + +Also one of `abi-file` or `abi-dir` must be provided. +If `abi-dir` is given, vent will search for all `.abi` spec files in given directory. + +if `db-block` is set to true (block explorer mode), Block and Transaction tables are created in addition to log and event tables to store block & tx raw info. + +It can be checked that vent is connected and ready sending a request to `http:///health` which will return a `200` OK response in case everything's fine. diff --git a/docs/reference/wasm.md b/docs/reference/wasm.md index 612d35d20..5977a6e8e 100644 --- a/docs/reference/wasm.md +++ b/docs/reference/wasm.md @@ -1,13 +1,14 @@ # WASM Contracts -burrow supports experimental wasm contracts. Any contract which can be compiled -using [solang](https://github.com/hyperledger-labs/solang) can be run on burrow. +Burrow supports experimental [ewasm](https://github.com/ewasm/design) contracts. +Any contract which can be compiled using [Solang](https://github.com/hyperledger-labs/solang) +can run on Burrow. ## How to use Write a simple solidity contract which is supported by solang. For example: -``` +```solidity contract foobar { uint64 foo; @@ -23,7 +24,7 @@ contract foobar { And a deploy yaml: -``` +```yaml jobs: - name: deployFoobar @@ -46,29 +47,4 @@ Now run this script using: ``` burrow deploy --wasm -a Participant_0 deploy.yaml -``` - -## Implementation details - -When using wasm, the same account model is used. The only different is that a wasm virtual machine -is used. When a contract is deployed, the wasm code is stored as the account code (this is different -from the EVM model where the constructor "returns" the deployed code). The wasm file which is deployed -must have two exported functions: - -``` -void constructor(int32*) -int32 function(int32*) -``` -When the contract is deployed, burrow calls the constructor function with the abi encoded arguments -stored in wasm memory, pointed to by the single argument. The abi encoded arguments are prefixed with -the length. - -On executing a function call, the exported function called `function` is called . This takes the abi -encoded arguments just like the constructor, and returns a pointer to the abi encoded return values. - -From the wasm code we can access contract storage via the following externals: - -``` -void set_storage32(int32 key, int32 *ptr, int32 len); -void get_storage32(int32 key, int32 *ptr, int32 len); -``` +``` \ No newline at end of file diff --git a/docs/reference/web3.md b/docs/reference/web3.md new file mode 100644 index 000000000..848cddeb4 --- /dev/null +++ b/docs/reference/web3.md @@ -0,0 +1,49 @@ +# Web3 JSON RPC + +Burrow now ships with a web3 compliant RPC server to integrate with your favorite Ethereum tooling! +We've already tried a few tools to ensure they work correctly, but if you have any problems please +consider submitting a pull request. + +## Blockscout + +[Blockscout](https://github.com/poanetwork/blockscout) is a graphical blockchain explorer for +Ethereum based networks. Before deploying the application, ensure to set the following environment +variables so it can locate your local Burrow node. + +```bash +export ETHEREUM_JSONRPC_VARIANT=ganache +export ETHEREUM_JSONRPC_HTTP_URL=http://localhost:26660 +``` + +## Metamask + +[Metamask](https://metamask.io/) is an open-source identity management application for Ethereum, +typically used as a browser extension. After creating or importing a supported `secp256k1` key pair, +you can simply add Burrow to the list of networks. + +## Remix + +[Remix](https://remix.ethereum.org/) is a web-based integrated development environment for Solidity. +To deploy and run transactions, select `Web3 Provider` as the `Environment` and enter your local RPC +address when prompted. + +## Truffle + +[Truffle](https://www.trufflesuite.com/docs/truffle/overview) makes it easy to develop smart contracts +with automatic compilation, linking and deployment. For a quick introduction, follow the official +[tutorial](https://www.trufflesuite.com/docs/truffle/quickstart) and edit the config `truffle-config.js` +to point to your local node. To ensure Truffle uses this configuration, simply suffix all commands with +the flag `--network burrow`. + +```js +module.exports = { + networks: { + burrow: { + host: "127.0.0.1", + port: 26660, + network_id: "*" + }, + } +}; +``` + diff --git a/docs/tutorials/1-basics.md b/docs/tutorials/1-basics.md new file mode 100644 index 000000000..c24fc0505 --- /dev/null +++ b/docs/tutorials/1-basics.md @@ -0,0 +1,52 @@ +# Basics + +You can spin up a single node chain with: + +```shell +burrow spec -v1 | burrow configure -s- | burrow start -c- +``` + +## Configuration + +The quick-and-dirty one-liner looks like: + +```shell +# Read spec on stdin +burrow spec -p1 -f1 | burrow configure -s- > burrow.toml +``` + +Which translates into: + +```shell +burrow spec --participant-accounts=1 --full-accounts=1 > genesis-spec.json +burrow configure --genesis-spec=genesis-spec.json > burrow.toml +``` + +> You might want to run this in a clean directory to avoid overwriting any previous spec or config. + +## Running + +Once the `burrow.toml` has been created, we run: + +``` +# To select our validator address by index in the GenesisDoc +burrow start --validator=0 +# Or to select based on address directly (substituting the example address below with your validator's): +burrow start --address=BE584820DC904A55449D7EB0C97607B40224B96E +``` + +If you would like to reset your node, you can just delete its working directory with `rm -rf .burrow`. +In the context of a multi-node chain it will resync with peers, otherwise it will restart from height 0. + +## Keys + +Burrow consumes its keys through our key signing interface that can be run as a standalone service with: + +```shell +burrow keys server +``` + +This command starts a key signing daemon capable of generating new ed25519 and secp256k1 keys, naming those keys, signing arbitrary messages, and verifying signed messages. +It also initializes a key store directory in `.keys` (by default) where private key matter is stored. + +It should be noted that the GRPC service exposed by the keys server will sign _any_ inbound requests using the keys it maintains so the machine running the keys service should only allow connections from sources that are trusted to use those keys. \ No newline at end of file diff --git a/docs/tutorials/1-run-full-node.md b/docs/tutorials/1-run-full-node.md deleted file mode 100644 index 90a8aff91..000000000 --- a/docs/tutorials/1-run-full-node.md +++ /dev/null @@ -1,34 +0,0 @@ -# Configure & Run Burrow - -## Configuration - -The quick-and-dirty one-liner looks like: - -```shell -# Read spec on stdin -burrow spec -p1 -f1 | burrow configure -s- > burrow.toml -``` - -Which translates into: - -```shell -# This is a place we can store config files and burrow's working directory '.burrow' -mkdir chain_dir && cd chain_dir -burrow spec --participant-accounts=1 --full-accounts=1 > genesis-spec.json -burrow configure --genesis-spec=genesis-spec.json > burrow.toml -``` - -## Run Burrow -Once the `burrow.toml` has been created, we run: - -``` -# To select our validator address by index in the GenesisDoc -burrow start --validator=0 -# Or to select based on address directly (substituting the example address below with your validator's): -burrow start --address=BE584820DC904A55449D7EB0C97607B40224B96E -``` - -and the logs will start streaming through. - -If you would like to reset your node, you can just delete its working directory with `rm -rf .burrow`. In the context of a -multi-node chain it will resync with peers, otherwise it will restart from height 0. \ No newline at end of file diff --git a/docs/tutorials/2-send-transactions.md b/docs/tutorials/2-send-transactions.md deleted file mode 100644 index 056915263..000000000 --- a/docs/tutorials/2-send-transactions.md +++ /dev/null @@ -1,41 +0,0 @@ -# Send transactions to a burrow network - -#### Create a deploy file _test.yaml_ -```yaml -jobs: -- name: sendTxTest1 - send: - destination: PUT_HERE_ONE_ACCOUNT_OF_YOUR_GENESIS - amount: 42 -``` - -#### Send it from a node - -```bash -SIGNING_ADDRESS=HERE_ONE_VALIDATOR_ADDRESS_OF_THE_GENESIS -burrow deploy --address $SIGNING_ADDRESS test.yaml -``` - -where you should replace the `--address` field with the `Address` at the top of your `burrow.toml`. - -if you have updated the default burrow GRPC port, parameter `-u` `--chain` is your burrow running node ip:GRPCport. - -It outputs: -``` -*****Executing Job***** - -Job Name => defaultAddr - - -*****Executing Job***** - -Job Name => sendTxTest1 - - -Transaction Hash => 41E0C13D1515F83E6FFDC5032C60682BE1F5B19A -Writing [test.output.json] to current directory -``` - -You can find lot of different transactions example in [jobs fixtures directory](../../tests/jobs_fixtures) - -You may also start to [deploy contracts](deploy-contracts.md). diff --git a/docs/tutorials/2-transactions.md b/docs/tutorials/2-transactions.md new file mode 100644 index 000000000..11563755f --- /dev/null +++ b/docs/tutorials/2-transactions.md @@ -0,0 +1,33 @@ +# Transactions + +Burrow supports a number of [transactions](reference/transactions.md) which denote a unit of computation. +The easiest way to experiment is with our `burrow tx` command, but please checkout the [deployment guide](deploy.md) +for more advanced usage. + +## Getting Started + +Let's start a chain with one validator to process blocks and two participant accounts: + +```shell +burrow spec -v1 -p2 | burrow configure -s- > burrow.toml +burrow start -v0 & +``` + +Make a note of the two participant addresses generated in the `burrow.toml`. + +## Send Token + +Let's formulate a transaction to send funds from one account to another. +Given our two addresses created above, set `$SENDER` and `$RECIPIENT` respectively. +We'll also need to designate an amount of native token available from our sender. + +```shell +burrow tx formulate send -s $SENDER -t $RECIPIENT -a $AMOUNT > tx.json +``` + +To send this transaction to your local node and subsequently the chain (if running more than one validator), +pipe the output above through the following command: + +```shell +burrow tx commit --file tx.json +``` \ No newline at end of file diff --git a/docs/tutorials/3-contracts.md b/docs/tutorials/3-contracts.md new file mode 100644 index 000000000..5b4e70bf9 --- /dev/null +++ b/docs/tutorials/3-contracts.md @@ -0,0 +1,30 @@ +# Contracts + +Burrow supports both [Solidity](https://solidity.readthedocs.io/) and [WASM](reference/wasm.md) smart contracts. You may be familiar with this former language +if you have worked previously with Ethereum. If so, you will be pleased to know that Burrow can be used with [Remix](http://remix.ethereum.org/). + +## Getting Started + +Let's start a chain with a single validator: + +```shell +burrow spec -v1 | burrow configure -s- | burrow start -c- +``` + +## Deploy Artifacts + +For this step, we need two things: one or more solidity contracts and a deploy file. Let's take a simple example, found in [this directory](https://github.com/hyperledger/burrow/tree/main/tests/jobs_fixtures/app06-deploy_basic_contract_and_different_solc_types_packed_unpacked). + +We need `deploy.yaml` and `storage.sol` in the same directory with **no other yaml or sol files**. + +> [Solc](https://solidity.readthedocs.io/en/v0.4.21/installing-solidity.html) is required to compile Solidity code. + +From inside that directory, we are ready to deploy. + +```bash +burrow deploy --address $ADDRESS deploy.yaml +``` + +Replace `$ADDRESS` with the address at the top of your `burrow.toml`. + +That's it! You've successfully deployed (and tested) a Solidity contract to a Burrow node. diff --git a/docs/tutorials/3-deploy-contracts.md b/docs/tutorials/3-deploy-contracts.md deleted file mode 100644 index fd4a11b5b..000000000 --- a/docs/tutorials/3-deploy-contracts.md +++ /dev/null @@ -1,257 +0,0 @@ -# Deploy Contracts - -Now that the [burrow node is running](single-full-node.md), we can deploy contracts. - -For this step, we need two things: one or more solidity contracts, and an `deploy.yaml`. - -Let's take a simple example, found in [this directory](../../tests/jobs_fixtures/app06-deploy_basic_contract_and_different_solc_types_packed_unpacked/). - -The `deploy.yaml` should look like: - -```yaml -jobs: - -- name: deployStorageK - deploy: - contract: storage.sol - -- name: setStorageBaseBool - set: - val: "true" - -- name: setStorageBool - call: - destination: $deployStorageK - function: setBool - data: - - $setStorageBaseBool - -- name: queryStorageBool - query-contract: - destination: $deployStorageK - function: getBool - -- name: assertStorageBool - assert: - key: $queryStorageBool - relation: eq - val: $setStorageBaseBool - -# tests string bools: #71 -- name: setStorageBool2 - call: - destination: $deployStorageK - function: setBool2 - data: - - true - -- name: queryStorageBool2 - query-contract: - destination: $deployStorageK - function: getBool2 - -- name: assertStorageBool2 - assert: - key: $queryStorageBool2 - relation: eq - val: "true" - -- name: setStorageBaseInt - set: - val: 50000 - -- name: setStorageInt - call: - destination: $deployStorageK - function: setInt - data: - - $setStorageBaseInt - -- name: queryStorageInt - query-contract: - destination: $deployStorageK - function: getInt - -- name: assertStorageInt - assert: - key: $queryStorageInt - relation: eq - val: $setStorageBaseInt - -- name: setStorageBaseUint - set: - val: 9999999 - -- name: setStorageUint - call: - destination: $deployStorageK - function: setUint - data: - - $setStorageBaseUint - -- name: queryStorageUint - query-contract: - destination: $deployStorageK - function: getUint - -- name: assertStorageUint - assert: - key: $queryStorageUint - relation: eq - val: $setStorageBaseUint - -- name: setStorageBaseAddress - set: - val: "1040E6521541DAB4E7EE57F21226DD17CE9F0FB7" - -- name: setStorageAddress - call: - destination: $deployStorageK - function: setAddress - data: - - $setStorageBaseAddress - -- name: queryStorageAddress - query-contract: - destination: $deployStorageK - function: getAddress - -- name: assertStorageAddress - assert: - key: $queryStorageAddress - relation: eq - val: $setStorageBaseAddress - -- name: setStorageBaseBytes - set: - val: marmatoshi - -- name: setStorageBytes - call: - destination: $deployStorageK - function: setBytes - data: - - $setStorageBaseBytes - -- name: queryStorageBytes - query-contract: - destination: $deployStorageK - function: getBytes - -- name: assertStorageBytes - assert: - key: $queryStorageBytes - relation: eq - val: $setStorageBaseBytes - -- name: setStorageBaseString - set: - val: nakaburrow - -- name: setStorageString - call: - destination: $deployStorageK - function: setString - data: - - $setStorageBaseString - -- name: queryStorageString - query-contract: - destination: $deployStorageK - function: getString - -- name: assertStorageString - assert: - key: $queryStorageString - relation: eq - val: $setStorageBaseString - -``` - -while our Solidity contract (`storage.sol`) looks like: - -```solidity -pragma solidity >=0.0.0; - -contract SimpleStorage { - bool storedBool; - bool storedBool2; - int storedInt; - uint storedUint; - address storedAddress; - bytes32 storedBytes; - string storedString; - - function setBool(bool x) public { - storedBool = x; - } - - function getBool() view public returns (bool retBool) { - return storedBool; - } - - function setBool2(bool x) public { - storedBool2 = x; - } - - function getBool2() view public returns (bool retBool) { - return storedBool2; - } - - function setInt(int x) public { - storedInt = x; - } - - function getInt() view public returns (int retInt) { - return storedInt; - } - - function setUint(uint x) public { - storedUint = x; - } - - function getUint() view public returns (uint retUint) { - return storedUint; - } - - function setAddress(address x) public { - storedAddress = x; - } - - function getAddress() view public returns (address retAddress) { - return storedAddress; - } - - function setBytes(bytes32 x) public { - storedBytes = x; - } - - function getBytes() view public returns (bytes32 retBytes) { - return storedBytes; - } - - function setString(string memory x) public { - storedString = x; - } - - function getString() view public returns (string memory retString) { - return storedString; - } -} -``` - -Both files (`deploy.yaml` & `storage.sol`) should be in the same directory with **no other yaml** or sol files. - -You have to install [solc binary](https://solidity.readthedocs.io/en/v0.4.21/installing-solidity.html) in order to compile Solidity code. - -From inside that directory, we are ready to deploy. - -```bash -burrow deploy --address F71831847564B7008AD30DD56336D9C42787CF63 deploy.yaml -``` - -where you should replace the `--address` field with the `Address` at the top of your `burrow.toml`. - -That's it! You've successfully deployed (and tested) a Solidity contract to a Burrow node. - -Note - that to redeploy the burrow chain later, you will need the same genesis-spec.json and burrow.toml files - so keep hold of them! diff --git a/docs/tutorials/4-multiple-validators.md b/docs/tutorials/4-multiple-validators.md deleted file mode 100644 index 313ee441b..000000000 --- a/docs/tutorials/4-multiple-validators.md +++ /dev/null @@ -1,27 +0,0 @@ -# Multiple validators - -### Configure a chain with 2 full accounts and validators -```bash - rm -rf .burrow* .keys* - burrow spec -f2 | burrow configure -s- --pool - ``` -### Start the network - -#### Start the first node -```bash -burrow start --config=burrow000.toml -``` - -You will see `Blockpool has no peers` in burrow000.log. -The node has not enough validator power in order to have quorum (2/3) on the network, so it is blocked waiting for the second validator to join. - -#### Start the second node - -```bash -burrow start --config=burrow001.toml -``` - -If the connection successed, you will see empty blocks automatically created `Sending vote message` and `Finalizing commit of block with 0 txs`, you can see consensus state: -```bash -curl -s 127.0.0.1:26758/consensus -``` \ No newline at end of file diff --git a/docs/tutorials/4-networking.md b/docs/tutorials/4-networking.md new file mode 100644 index 000000000..6dd6f97a0 --- /dev/null +++ b/docs/tutorials/4-networking.md @@ -0,0 +1,39 @@ +# Networking + +So far we have only run a single validator. What happens if it stops working or loses its data? +We're much better off running multiple nodes in parallel! + +## Getting Started + +Let's configure a local chain with two full accounts: + +```shell +burrow spec -f2 | burrow configure -s- --pool +``` + +You'll notice that Burrow has generated two config files instead of one, hold on to these. + + +## First Node + +```shell +burrow start --config=burrow000.toml +``` + +You will see `blockpool has no peers` in the logs, this means that the node has not got enough validator power in order to have +quorum (2/3) on the network, so it is blocked waiting for the second validator to join. + +## Second Node + +```shell +burrow start --config=burrow001.toml +``` + +If the connection succeeds, you will see empty blocks automatically created. +Look for logs such as `Sending vote message` or `Finalizing commit of block with 0 txs`. + +You can also query the consensus state over our RPC with: + +```shell +curl -s 127.0.0.1:26758/consensus +``` \ No newline at end of file diff --git a/docs/tutorials/5-bonding-validators.md b/docs/tutorials/5-bonding.md similarity index 78% rename from docs/tutorials/5-bonding-validators.md rename to docs/tutorials/5-bonding.md index 8ed16ca7e..9a0fd0695 100644 --- a/docs/tutorials/5-bonding-validators.md +++ b/docs/tutorials/5-bonding.md @@ -1,48 +1,57 @@ -# Bonding Validators +# Bonding + +We can't always expect our validator set to remain the same. New participants, not established at network +formation, may wish to participate at any time. + +## Getting Started We need at least one validator to start the chain, so run the following to construct a genesis of two accounts with the `Bond` permission, one of which is pre-bonded: -```bash +```shell burrow spec -v1 -r1 | burrow configure -s- --pool ``` -Let's start the both nodes: +Let's start both nodes: -```bash +```shell burrow start --config burrow000.toml & burrow start --config burrow001.toml & ``` Query the JSON RPC for all validators in the active set: -```bash +```shell curl -s "localhost:26758/validators" ``` This will return the pre-bonded validator, defined in our pool. +## Joining + To have the second node bond on and produce blocks: -```bash +```shell burrow tx --config burrow001.toml formulate bond --amount 10000 | burrow tx commit ``` Note that this will bond the current account, to bond an alternate account (which is created if it doesn't exist) simply specific the `--source=
` flag in formulation: -```bash +```shell burrow tx --config burrow001.toml formulate bond --source 8A468CC3A28A6E84ED52E433DA21D6E9ED7C1577 --amount 10000 ``` It should now be in the validator set: -```bash +```shell curl -s "localhost:26759/validators" ``` +## Leaving + To unbond this validator: -```bash +```shell burrow tx formulate unbond | burrow tx commit ``` \ No newline at end of file diff --git a/docs/tutorials/6-seed-nodes.md b/docs/tutorials/6-seeding.md similarity index 75% rename from docs/tutorials/6-seed-nodes.md rename to docs/tutorials/6-seeding.md index 53d49406c..cec38ae07 100644 --- a/docs/tutorials/6-seed-nodes.md +++ b/docs/tutorials/6-seeding.md @@ -1,4 +1,4 @@ -# Network with seed nodes +# Seed Nodes ## What is a seed node? @@ -12,8 +12,7 @@ connect to seed nodes once you have received enough addresses, so typically you only need them on the first start. The seed node will immediately disconnect from you after sending you some addresses. -### Seed mode -SeedMode can be enabled on a node. +### Seed Mode If a node is in seed mode it will accept inbound connections, share its address book, then hang up. Seeds modes will do a bit of gossip but not that usefully. @@ -23,31 +22,21 @@ These are different concepts: You do not want to have too many seeds in your network (because they just keep hanging up on other nodes once they've spread their wild oats), but they are useful for accelerating peer exchange (of addresses). -### Persistent peers +### Persistent Peers Persistent peers are peers that you want to connect of regardless of the heuristics and churn dynamics built into the p2p switch. Ordinarily you would not stay connected to a particular peer forever, and you would not indefinitely redial, but you will for a persistent peer. -## Configure network +## Configure -In this quick start, we will few create validator nodes which does not know each other from network point of view. -A seed node will crawl the network and relay everyones addresses. +In this quick start, we will create validator nodes which do not know about each other. +A seed node will crawl the network and relay addresses. -### Configure chain +### Seed Node -```bash -rm -rf .burrow* .keys* -burrow spec --full-accounts=3 | burrow configure -s- > .burrow_init.toml -``` - -### Generate one additional key in another local store for seed node -```bash +```shell burrow spec -f1 | burrow configure --keys-dir=.keys_seed -s- > /dev/null ``` -### Make 3 validator nodes and one seed node config files -From the generated `.burrow_init.toml `file, create new files for each node, and change the content, example: - -#### Seed node `.burrow_seed.toml` modified line from `.burrow_init.toml` ```toml BurrowDir = ".burrow_seed_0" @@ -78,7 +67,15 @@ BurrowDir = ".burrow_seed_0" Enabled = false ``` -#### Validator 1 node `.burrow_val0.toml` modified line from `.burrow_init.toml` +### Validators + +```shell +burrow spec --full-accounts=3 | burrow configure -s- > .burrow_init.toml +``` + +From the generated `.burrow_init.toml` file, create new files for each node, and change the content. + +#### Validator 1 ```toml BurrowDir = ".burrow_node0" @@ -114,7 +111,7 @@ BurrowDir = ".burrow_node0" Enabled = false ``` -#### Validator 2 node `.burrow_val1.toml` modified line from `.burrow_init.toml` +#### Validator 2 ```toml BurrowDir = ".burrow_node1" @@ -150,8 +147,7 @@ BurrowDir = ".burrow_node1" Enabled = false ``` - -#### Validator 3 node `.burrow_val2.toml` modified line from `.burrow_init.toml` +#### Validator 3 ```toml BurrowDir = ".burrow_node2" @@ -187,49 +183,56 @@ BurrowDir = ".burrow_node2" Enabled = false ``` -#### Start the seed node -```bash +## Start Network + +### Seed Node + +```shell burrow start --address=`basename .keys_seed/data/* .json` --config=.burrow_seed.toml > .burrow_seed.log 2>&1 & ``` -#### Find seed node external address +#### Validators + Tendermint requires strict and routable address (not loopback, local etc), you can find the listen address with this command: -```bash + +```shell SEED_URL=`curl -s 127.0.0.1:10001/network | jq -r '.result.ThisNode | [.ID, .ListenAddress] | join("@") | ascii_downcase'` echo $SEED_URL ``` -#### Configure other node to connect to seed node -Update other nodes with that seed address: -```bash +Configure the validator nodes to connect to the seed node: + +```shell sed -i s%PUT_HERE_SEED_NODE_ID@LISTEN_EXTERNAL_ADDRESS%${SEED_URL}% .burrow_val0.toml sed -i s%PUT_HERE_SEED_NODE_ID@LISTEN_EXTERNAL_ADDRESS%${SEED_URL}% .burrow_val1.toml sed -i s%PUT_HERE_SEED_NODE_ID@LISTEN_EXTERNAL_ADDRESS%${SEED_URL}% .burrow_val2.toml ``` -#### Start validator nodes -```bash +Start the network: + +```shell burrow start -v=0 --config=.burrow_val0.toml > .burrow_val0.log 2>&1 & burrow start -v=1 --config=.burrow_val1.toml > .burrow_val1.log 2>&1 & burrow start -v=2 --config=.burrow_val2.toml > .burrow_val2.log 2>&1 & ``` -Nodes will connect to seed node and request addresses, then they will connect to each other and start submitting and voting on blocks. +The nodes should connect to our seed node and request addresses, then they will connect to each other and start submitting and voting on blocks. + -Check network status, validators nodes are connected to each others: -```bash +To check the network status, and that the validator nodes are connected to each other run: + +```shell curl -s 127.0.0.1:40001/network | jq -r '.result.peers[].node_info.moniker' val_node_0 val_node_1 ``` -You can monitor consensus and current blockchain height from the node info websockets: -```bash +You can monitor consensus and current blockchain height from the node info websocket: + +```shell curl -s 127.0.0.1:20001/consensus | jq -r '.result.round_state.height' ``` -At the moment, there is an [issue](https://github.com/tendermint/tendermint/issues/2092) opened in Tendermint with seedMode. - Disable seed mode on the seed node and see how it affects the peers network: ```toml @@ -237,14 +240,16 @@ Disable seed mode on the seed node and see how it affects the peers network: SeedMode = false ``` -Clear nodes folder (Note it will restart the chain from the genesis block): -```bash +Clear nodes folder (it will restart the chain from the genesis block): + +```shell killall burrow rm -rf .burrow_node0 .burrow_node1 .burrow_node2 .burrow_seed_0 ``` Restart all nodes, then check network status (Validator 3 is now connected to all peers, included seed node): -```bash + +```shell curl -s 127.0.0.1:40001/network | jq -r '.result.peers[].node_info.moniker' seed_node_0 val_node_0 diff --git a/docs/tutorials/7-dump-restore.md b/docs/tutorials/7-dump-restore.md index a88939c97..99dc1f4b7 100644 --- a/docs/tutorials/7-dump-restore.md +++ b/docs/tutorials/7-dump-restore.md @@ -3,7 +3,7 @@ Sometimes there are breaking changes in burrow. This provides a method for dumping an old chain, and restoring a new chain with that state. -## Dumping existing state +## Dumping Existing State The `burrow dump` command connects to burrow node and retrieves the following: @@ -16,32 +16,32 @@ This can be dumped in json or go-amino format. The structure is described in (pr it saved in go-amino, but it can be saved in json format by specify `--json`. It is also possible to dump the state at a specific height using `--height`. -## Creating a new chain genesis with state +## Recreate State -So you will need the `.keys` directory of the old chain, the `genesis.json` (called genesis-original in the example below) +You will need the `.keys` directory of the old chain, the `genesis.json` (called genesis-original in the example below) from the old chain and the dump file (called `dump.json` here). -```bash +```shell burrow configure -m BurrowTestRestoreNode -n "Restored Chain" -g genesis-original.json -w genesis.json --restore-dump dump.json > burrow.toml ``` Note that the chain genesis will contain an `AppHash` specific to this restore file. -## Restart the chain with the state +## Restore Chain This will populate the `.burrow` directory with the state. -```bash +```shell burrow restore dump.json ``` This will create a block 0 with the restored state. Normally burrow chains start a height 1. -## Run the new chain +## Start Chain Simply start `burrow` as you would normally. -```bash +```shell burrow start ``` diff --git a/docs/tutorials/8-proposals.md b/docs/tutorials/8-proposals.md index 500e2c3f8..878cfd7d9 100644 --- a/docs/tutorials/8-proposals.md +++ b/docs/tutorials/8-proposals.md @@ -1,15 +1,15 @@ -# Proposals and voting +# Proposals and Voting -burrow proposals are a way of only executing some transactions if it receives enough votes. This can be +Proposals are a way of only executing some transactions if it receives enough votes. This can be useful if, for example, there are some solidity contracts which are shared between multiple parties. The proposal (the transactions) are stored on-chain and other members can verify the proposal before voting on it. Once the proposal receives enough votes, it is instantly and atomically executed. -# Set up a chain for this tutorial +## Setup We want a chain with three participants and a root account for executing proposals. So, creates this with: -``` +```shell burrow spec -v1 -r1 -p3 | burrow configure -s- -w genesis.json > burrow.toml ``` @@ -17,7 +17,7 @@ Note that in the genesis doc there is a ProposalThreshold which is set to 3. Thi needs. We will leave it at three for now. However if you set this to 1, proposals will execute instantly since a proposal already has one vote once it is created (the proposer itself). -# How to create a proposal +## Create a Proposal A proposal is a deployment yaml file, with some minor differences. The transactions which are to be proposed should be contained in a proposal job, which should have a name and a description. This proposal jobs type has a @@ -28,7 +28,7 @@ No jobs of type `Assert` or `QueryContract` are allowed in a proposal. This is our Solidity contract we are proposing: -``` +```solidity pragma solidity > 0.0.0; contract random { @@ -40,7 +40,7 @@ contract random { A standard deploy yaml for this contract would be: -``` +```yaml jobs: - name: deploy_random deploy: @@ -49,14 +49,14 @@ jobs: And it would be deployed like so: -``` +```shell burrow deploy -a Participant_0 random.yaml ``` Now we would like this to be a proposal. So, it needs to go into a proposal job and have it's source address set. The deploy yaml will look like: -``` +```yaml jobs: - name: Propose Deploying contract random proposal: @@ -71,56 +71,64 @@ jobs: Now, to create this proposal: -``` +```shell burrow deploy --proposal-create -a Participant_0 propose-random.yaml ``` The output should end with: -``` +```shell log_channel=Info message="Creating Proposal" hash=5029B2B06D42A6339FBD9A97A230F914E3F655143C66B647979ACD05A04C8451 ``` -# How to vote for a proposal +# Vote for a Proposal So Participant_0 created a proposal. Now you are Participant_1, and Participant_0 tells you he's got this proposal he would like you to vote for. So first of all you want to list the current proposals: +```shell +burrow deploy --list-proposals=PROPOSED ``` -$ burrow deploy --list-proposals=PROPOSED + +```shell log_channel=Info message=Proposal ProposalHash=5029b2b06d42a6339fbd9a97a230f914e3f655143c66b647979acd05a04c8451 Name=random.sol Description="I says we should deploy random.sol" State=PROPOSED Votes=1 ``` Now all we have is a hash. We want to know if this is really the change we are looking for. So, we can verify the proposal using the original deployment yaml and solidity files. You will need the same solidity compiler version for this to work. -``` +```shell burrow deploy -a Participant_1 --proposal-verify propose-random.yaml -... +``` + +```shell log_channel=Info message="Proposal VERIFY SUCCESSFUL" votescount=1 log_channel=Info message=Vote no=0 address=0F73E4EF45EC20BDC7CF5A12EC2F32701C642B9C ``` So the proposal is current, and matches the solidity and deployment files we have. We can now review those changes, and once we're happy with it, we can vote on it using: -``` +```shell burrow deploy -a Participant_1 --proposal-vote propose-random.yaml ``` -# Ratification and execution +# Ratification and Execution Once Participant_2 has run: -``` +```shell burrow deploy -a Participant_2 --proposal-vote propose-random.yaml ``` The contained transactions are executed. This happens in the same block as where the this vote is registered. -# Executed and expired proposals +# Executed and Expired Proposals +```shell +burrow deploy --list-proposals=ALL ``` -$ burrow deploy --list-proposals=ALL + +```shell log_channel=Info message=Proposal ProposalHash=5029b2b06d42a6339fbd9a97a230f914e3f655143c66b647979acd05a04c8451 Name=random.sol Description="I says we should deploy random.sol" State=EXECUTED Votes=3 ``` diff --git a/dump/dump.go b/dump/dump.go index 8143e28a3..3dc403428 100644 --- a/dump/dump.go +++ b/dump/dump.go @@ -14,7 +14,7 @@ import ( "github.com/hyperledger/burrow/execution/names" "github.com/hyperledger/burrow/execution/state" "github.com/hyperledger/burrow/logging" - dbm "github.com/tendermint/tm-db" + "github.com/hyperledger/burrow/storage" ) const ( @@ -165,7 +165,7 @@ func (ds *Dumper) Transmit(sink Sink, startHeight, endHeight uint64, options Opt var origin *exec.Origin // Only return events from specified start height - allows for resume - err = ds.state.IterateStreamEvents(&startHeight, &endHeight, + err = ds.state.IterateStreamEvents(&startHeight, &endHeight, storage.AscendingSort, func(ev *exec.StreamEvent) error { switch { case ev.BeginBlock != nil: @@ -225,67 +225,36 @@ func (ds *Dumper) WithLogger(logger *logging.Logger) *Dumper { // Write a dump to the Writer out by pulling rows from stream func Write(out io.Writer, source Source, useBinaryEncoding bool, options Option) error { - st := state.NewState(dbm.NewMemDB()) - _, _, err := st.Update(func(ws state.Updatable) error { - for { - resp, err := source.Recv() + for { + resp, err := source.Recv() + if err != nil { if err == io.EOF { - break - } - if err != nil { - return fmt.Errorf("failed to recv dump: %v", err) - } - - if options.Enabled(Accounts) { - // update our temporary state - if resp.Account != nil { - err := ws.UpdateAccount(resp.Account) - if err != nil { - return err - } - } - if resp.AccountStorage != nil { - for _, storage := range resp.AccountStorage.Storage { - err := ws.SetStorage(resp.AccountStorage.Address, storage.Key, storage.Value) - if err != nil { - return err - } - } - } - } - - if options.Enabled(Names) { - if resp.Name != nil { - err := ws.UpdateName(resp.Name) - if err != nil { - return err - } - } - } - - if useBinaryEncoding { - _, err := encoding.WriteMessage(out, resp) - if err != nil { - return fmt.Errorf("failed write to binary dump message: %v", err) - } return nil } - bs, err := json.Marshal(resp) + return fmt.Errorf("failed to recv dump: %v", err) + } + + if useBinaryEncoding { + _, err := encoding.WriteMessage(out, resp) if err != nil { - return fmt.Errorf("failed to marshall dump: %v", err) + return fmt.Errorf("failed write to binary dump message: %v", err) } + return nil + } - if len(bs) > 0 { - bs = append(bs, []byte("\n")...) - n, err := out.Write(bs) - if err == nil && n < len(bs) { - return fmt.Errorf("failed to write dump: %v", err) - } + bs, err := json.Marshal(resp) + if err != nil { + return fmt.Errorf("failed to marshal dump: %v", err) + } + + if len(bs) > 0 { + bs = append(bs, []byte("\n")...) + n, err := out.Write(bs) + if err == nil && n < len(bs) { + return fmt.Errorf("failed to write dump: %v", err) } } + } - return nil - }) - return err } diff --git a/dump/dump.pb.go b/dump/dump.pb.go index 9c6bb37bf..ebbd2b57d 100644 --- a/dump/dump.pb.go +++ b/dump/dump.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" time "time" _ "github.com/gogo/protobuf/gogoproto" @@ -32,7 +33,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 Storage struct { Key github_com_hyperledger_burrow_binary.Word256 `protobuf:"bytes,1,opt,name=Key,proto3,customtype=github.com/hyperledger/burrow/binary.Word256" json:"Key"` @@ -53,7 +54,7 @@ func (m *Storage) XXX_Unmarshal(b []byte) error { } func (m *Storage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -94,7 +95,7 @@ func (m *AccountStorage) XXX_Unmarshal(b []byte) error { } func (m *AccountStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -148,7 +149,7 @@ func (m *EVMEvent) XXX_Unmarshal(b []byte) error { } func (m *EVMEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -220,7 +221,7 @@ func (m *Dump) XXX_Unmarshal(b []byte) error { } func (m *Dump) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -291,44 +292,44 @@ func init() { proto.RegisterFile("dump.proto", fileDescriptor_58418148159c29a6) func init() { golang_proto.RegisterFile("dump.proto", fileDescriptor_58418148159c29a6) } var fileDescriptor_58418148159c29a6 = []byte{ - // 493 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x65, 0x5b, 0xa7, 0x69, 0x37, 0xa5, 0x87, 0x55, 0x85, 0xac, 0x1c, 0x9c, 0xc8, 0x42, 0x10, - 0x21, 0xba, 0x91, 0x02, 0x45, 0x1c, 0x7a, 0x69, 0x68, 0x50, 0xab, 0x42, 0x0f, 0x4b, 0x55, 0x24, - 0x6e, 0xfe, 0x18, 0x1c, 0x4b, 0xb1, 0xd7, 0x5a, 0xaf, 0x21, 0xfe, 0x09, 0xdc, 0x38, 0x73, 0xe0, - 0xb7, 0x70, 0xcc, 0x11, 0x71, 0x42, 0x1c, 0x0a, 0x4a, 0xff, 0x08, 0xf2, 0x7e, 0x10, 0xe8, 0x01, - 0xc1, 0x6d, 0x66, 0x9e, 0xe7, 0xcd, 0xf3, 0x7b, 0x8b, 0x71, 0x5c, 0x65, 0x05, 0x2d, 0x04, 0x97, - 0x9c, 0x38, 0x4d, 0xdd, 0xdd, 0x4b, 0x52, 0x39, 0xad, 0x42, 0x1a, 0xf1, 0x6c, 0x98, 0xf0, 0x84, - 0x0f, 0x15, 0x18, 0x56, 0xaf, 0x55, 0xa7, 0x1a, 0x55, 0xe9, 0xa5, 0x6e, 0x2f, 0xe1, 0x3c, 0x99, - 0xc1, 0xea, 0x2b, 0x99, 0x66, 0x50, 0xca, 0xc0, 0xb2, 0x76, 0xb7, 0x82, 0x28, 0x33, 0x25, 0x86, - 0x39, 0x44, 0xa6, 0xee, 0xe4, 0x41, 0x06, 0xa5, 0x6e, 0xfc, 0x8f, 0x08, 0xb7, 0x5f, 0x48, 0x2e, - 0x82, 0x04, 0xc8, 0x53, 0xbc, 0x7e, 0x0a, 0xb5, 0x8b, 0xfa, 0x68, 0xb0, 0x3d, 0x7e, 0xb8, 0xb8, - 0xec, 0xdd, 0xf8, 0x76, 0xd9, 0xbb, 0xff, 0x9b, 0xa8, 0x69, 0x5d, 0x80, 0x98, 0x41, 0x9c, 0x80, - 0x18, 0x86, 0x95, 0x10, 0xfc, 0xed, 0x30, 0x4c, 0xf3, 0x40, 0xd4, 0xf4, 0x25, 0x17, 0xf1, 0x68, - 0xff, 0x11, 0x6b, 0x08, 0xc8, 0x29, 0x6e, 0x5d, 0x04, 0xb3, 0x0a, 0xdc, 0x35, 0xc5, 0xb4, 0x6f, - 0x98, 0xf6, 0xfe, 0x89, 0xe9, 0x18, 0xe6, 0xe3, 0x5a, 0x42, 0xc9, 0x34, 0x87, 0xff, 0x0e, 0xe1, - 0x9d, 0xc3, 0x28, 0xe2, 0x55, 0x2e, 0xad, 0xce, 0x33, 0xdc, 0x3e, 0x8c, 0x63, 0x01, 0x65, 0xf9, - 0x7f, 0x5a, 0x23, 0x51, 0x17, 0x92, 0x53, 0xb3, 0xcb, 0x2c, 0x09, 0xb9, 0xfb, 0xcb, 0x02, 0x77, - 0xad, 0xbf, 0x3e, 0xe8, 0x8c, 0x6e, 0x52, 0x95, 0x8d, 0x19, 0x32, 0x8b, 0xfa, 0x1f, 0x10, 0xde, - 0x9c, 0x5c, 0x3c, 0x9f, 0xbc, 0x81, 0x5c, 0x12, 0x17, 0xb7, 0x9f, 0x4c, 0x83, 0x34, 0x3f, 0x39, - 0x52, 0x2a, 0xb6, 0x98, 0x6d, 0xc9, 0x2e, 0x6e, 0x9d, 0xe4, 0x31, 0xcc, 0x5d, 0xa7, 0x8f, 0x06, - 0x0e, 0xd3, 0x0d, 0x79, 0x8c, 0x9d, 0xf3, 0x34, 0xd3, 0xa6, 0x74, 0x46, 0x5d, 0xaa, 0xd3, 0xa3, - 0x36, 0x3d, 0x7a, 0x6e, 0xd3, 0x1b, 0x6f, 0x36, 0xbf, 0xf3, 0xfe, 0x7b, 0x0f, 0x31, 0xb5, 0x41, - 0x6e, 0xe3, 0x96, 0x3a, 0xe9, 0xae, 0xab, 0xd5, 0x1d, 0xaa, 0xc2, 0x7c, 0xc6, 0x13, 0x35, 0x65, - 0x1a, 0xf4, 0xbf, 0x20, 0xec, 0x1c, 0x55, 0x59, 0x41, 0x6e, 0xe1, 0x8d, 0x63, 0x48, 0x93, 0xa9, - 0x54, 0xba, 0x1c, 0x66, 0x3a, 0x72, 0x07, 0xb7, 0x8d, 0x91, 0x46, 0xc3, 0x36, 0x6d, 0x1e, 0x88, - 0x99, 0x31, 0x0b, 0x92, 0x83, 0xeb, 0x86, 0x9b, 0xbb, 0xbb, 0xda, 0x95, 0x3f, 0x31, 0x76, 0x3d, - 0x9c, 0x7b, 0x2b, 0x8b, 0xd4, 0xff, 0x37, 0x7a, 0xd5, 0x9e, 0x9d, 0xb2, 0x95, 0x85, 0x7d, 0xec, - 0x9c, 0x05, 0x19, 0xb8, 0x2d, 0x23, 0x47, 0x3f, 0xcc, 0x49, 0x2e, 0x45, 0xcd, 0x14, 0x32, 0x3e, - 0x58, 0x2c, 0x3d, 0xf4, 0x79, 0xe9, 0xa1, 0xaf, 0x4b, 0x0f, 0xfd, 0x58, 0x7a, 0xe8, 0xd3, 0x95, - 0x87, 0x16, 0x57, 0x1e, 0x7a, 0xe5, 0xff, 0x3d, 0xeb, 0xe6, 0x64, 0xb8, 0xa1, 0xcc, 0x7d, 0xf0, - 0x33, 0x00, 0x00, 0xff, 0xff, 0x30, 0xe1, 0x0a, 0x94, 0x6b, 0x03, 0x00, 0x00, + // 489 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x3d, 0x6f, 0x13, 0x41, + 0x10, 0x65, 0xe3, 0x73, 0x9c, 0xac, 0x43, 0x8a, 0x95, 0x85, 0x4e, 0x2e, 0xce, 0x96, 0x85, 0xc0, + 0x42, 0xb0, 0x27, 0x19, 0x82, 0x28, 0xd2, 0xc4, 0xc4, 0x28, 0x51, 0x20, 0xc5, 0x12, 0x05, 0x89, + 0xee, 0x3e, 0x86, 0xf3, 0x49, 0xbe, 0xdb, 0xd3, 0xde, 0x1e, 0xf8, 0x7e, 0x02, 0x1d, 0x35, 0x05, + 0xbf, 0x85, 0xd2, 0x25, 0xa2, 0x42, 0x14, 0x01, 0x39, 0x7f, 0x04, 0xdd, 0x7e, 0x10, 0x91, 0x02, + 0x41, 0x37, 0x33, 0x4f, 0xf3, 0xe6, 0xed, 0x7b, 0x8b, 0x71, 0x5c, 0x65, 0x05, 0x2d, 0x04, 0x97, + 0x9c, 0x38, 0x4d, 0xdd, 0xef, 0x25, 0x3c, 0xe1, 0x6a, 0xe0, 0x37, 0x95, 0xc6, 0xfa, 0x83, 0x84, + 0xf3, 0x64, 0x01, 0xbe, 0xea, 0xc2, 0xea, 0x8d, 0x2f, 0xd3, 0x0c, 0x4a, 0x19, 0xd8, 0xe5, 0xfe, + 0x76, 0x10, 0x65, 0xa6, 0xc4, 0xb0, 0x84, 0xc8, 0xd4, 0xdd, 0x3c, 0xc8, 0xa0, 0xd4, 0xcd, 0xe8, + 0x13, 0xc2, 0x9d, 0x97, 0x92, 0x8b, 0x20, 0x01, 0xf2, 0x0c, 0xb7, 0x4e, 0xa0, 0x76, 0xd1, 0x10, + 0x8d, 0x77, 0xa6, 0x8f, 0x56, 0x17, 0x83, 0x1b, 0xdf, 0x2f, 0x06, 0xf7, 0x93, 0x54, 0xce, 0xab, + 0x90, 0x46, 0x3c, 0xf3, 0xe7, 0x75, 0x01, 0x62, 0x01, 0x71, 0x02, 0xc2, 0x0f, 0x2b, 0x21, 0xf8, + 0x3b, 0x3f, 0x4c, 0xf3, 0x40, 0xd4, 0xf4, 0x15, 0x17, 0xf1, 0x64, 0xef, 0x31, 0x6b, 0x08, 0xc8, + 0x09, 0x6e, 0x9f, 0x07, 0x8b, 0x0a, 0xdc, 0x0d, 0xc5, 0xb4, 0x67, 0x98, 0x1e, 0xfc, 0x13, 0xd3, + 0x11, 0x2c, 0xa7, 0xb5, 0x84, 0x92, 0x69, 0x8e, 0xd1, 0x7b, 0x84, 0x77, 0x0f, 0xa2, 0x88, 0x57, + 0xb9, 0xb4, 0x3a, 0x4f, 0x71, 0xe7, 0x20, 0x8e, 0x05, 0x94, 0xe5, 0xff, 0x69, 0x8d, 0x44, 0x5d, + 0x48, 0x4e, 0xcd, 0x2e, 0xb3, 0x24, 0xe4, 0xee, 0x6f, 0x0b, 0xdc, 0x8d, 0x61, 0x6b, 0xdc, 0x9d, + 0xdc, 0xa4, 0x2a, 0x02, 0x33, 0x64, 0x16, 0x1d, 0x7d, 0x44, 0x78, 0x6b, 0x76, 0xfe, 0x62, 0xf6, + 0x16, 0x72, 0x49, 0x5c, 0xdc, 0x79, 0x3a, 0x0f, 0xd2, 0xfc, 0xf8, 0x50, 0xa9, 0xd8, 0x66, 0xb6, + 0x25, 0x3d, 0xdc, 0x3e, 0xce, 0x63, 0x58, 0xba, 0xce, 0x10, 0x8d, 0x1d, 0xa6, 0x1b, 0xf2, 0x04, + 0x3b, 0x67, 0x69, 0xa6, 0x4d, 0xe9, 0x4e, 0xfa, 0x54, 0xa7, 0x47, 0x6d, 0x7a, 0xf4, 0xcc, 0xa6, + 0x37, 0xdd, 0x6a, 0x9e, 0xf3, 0xe1, 0xc7, 0x00, 0x31, 0xb5, 0x41, 0x6e, 0xe3, 0xb6, 0x3a, 0xe9, + 0xb6, 0xd4, 0xea, 0x2e, 0x55, 0x61, 0x3e, 0xe7, 0x89, 0x9a, 0x32, 0x0d, 0x8e, 0xbe, 0x22, 0xec, + 0x1c, 0x56, 0x59, 0x41, 0x6e, 0xe1, 0xcd, 0x23, 0x48, 0x93, 0xb9, 0x54, 0xba, 0x1c, 0x66, 0x3a, + 0x72, 0x07, 0x77, 0x8c, 0x91, 0x46, 0xc3, 0x0e, 0x6d, 0x3e, 0x88, 0x99, 0x31, 0x0b, 0x92, 0xfd, + 0xeb, 0x86, 0x9b, 0xbb, 0x3d, 0xed, 0xca, 0x9f, 0x18, 0xbb, 0x1e, 0xce, 0xbd, 0x2b, 0x8b, 0xd4, + 0xfb, 0x1b, 0xbd, 0x6a, 0xcf, 0x4e, 0xd9, 0x95, 0x85, 0x43, 0xec, 0x9c, 0x06, 0x19, 0xb8, 0x6d, + 0x23, 0x47, 0x7f, 0xcc, 0x59, 0x2e, 0x45, 0xcd, 0x14, 0x32, 0xdd, 0x5f, 0xad, 0x3d, 0xf4, 0x65, + 0xed, 0xa1, 0x6f, 0x6b, 0x0f, 0xfd, 0x5c, 0x7b, 0xe8, 0xf3, 0xa5, 0x87, 0x56, 0x97, 0x1e, 0x7a, + 0x3d, 0xfa, 0x7b, 0xd6, 0xcd, 0xc9, 0x70, 0x53, 0x99, 0xfb, 0xf0, 0x57, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x6b, 0xbe, 0xfd, 0xc8, 0x52, 0x03, 0x00, 0x00, } func (m *Storage) 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 } @@ -336,36 +337,46 @@ func (m *Storage) Marshal() (dAtA []byte, err error) { } func (m *Storage) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Storage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintDump(dAtA, i, uint64(m.Key.Size())) - n1, err := m.Key.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 += n1 - dAtA[i] = 0x12 - i++ - i = encodeVarintDump(dAtA, i, uint64(m.Value.Size())) - n2, err := m.Value.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintDump(dAtA, i, uint64(size)) } - i += n2 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + { + size := m.Key.Size() + i -= size + if _, err := m.Key.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintDump(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *AccountStorage) 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 } @@ -373,40 +384,50 @@ func (m *AccountStorage) Marshal() (dAtA []byte, err error) { } func (m *AccountStorage) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountStorage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintDump(dAtA, i, uint64(m.Address.Size())) - n3, err := m.Address.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 += n3 if len(m.Storage) > 0 { - for _, msg := range m.Storage { - dAtA[i] = 0x12 - i++ - i = encodeVarintDump(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Storage) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Storage[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDump(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintDump(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *EVMEvent) 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 } @@ -414,49 +435,58 @@ func (m *EVMEvent) Marshal() (dAtA []byte, err error) { } func (m *EVMEvent) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EVMEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.ChainID) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintDump(dAtA, i, uint64(len(m.ChainID))) - i += copy(dAtA[i:], m.ChainID) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x12 - i++ - i = encodeVarintDump(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Time))) - n4, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i:]) - if err != nil { - return 0, err + if m.Index != 0 { + i = encodeVarintDump(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x20 } - i += n4 if m.Event != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintDump(dAtA, i, uint64(m.Event.Size())) - n5, err := m.Event.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Event.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDump(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0x1a } - if m.Index != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintDump(dAtA, i, uint64(m.Index)) + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err2 != nil { + return 0, err2 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= n2 + i = encodeVarintDump(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintDump(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Dump) 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 } @@ -464,69 +494,85 @@ func (m *Dump) Marshal() (dAtA []byte, err error) { } func (m *Dump) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Dump) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintDump(dAtA, i, uint64(m.Height)) - } - if m.Account != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintDump(dAtA, i, uint64(m.Account.Size())) - n6, err := m.Account.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.AccountStorage != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintDump(dAtA, i, uint64(m.AccountStorage.Size())) - n7, err := m.AccountStorage.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Name != nil { + { + size, err := m.Name.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDump(dAtA, i, uint64(size)) } - i += n7 + i-- + dAtA[i] = 0x2a } if m.EVMEvent != nil { + { + size, err := m.EVMEvent.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDump(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x22 - i++ - i = encodeVarintDump(dAtA, i, uint64(m.EVMEvent.Size())) - n8, err := m.EVMEvent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + if m.AccountStorage != nil { + { + size, err := m.AccountStorage.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDump(dAtA, i, uint64(size)) } - i += n8 + i-- + dAtA[i] = 0x1a } - if m.Name != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintDump(dAtA, i, uint64(m.Name.Size())) - n9, err := m.Name.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Account != nil { + { + size, err := m.Account.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDump(dAtA, i, uint64(size)) } - i += n9 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintDump(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func encodeVarintDump(dAtA []byte, offset int, v uint64) int { + offset -= sovDump(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 (m *Storage) Size() (n int) { if m == nil { @@ -621,14 +667,7 @@ func (m *Dump) Size() (n int) { } func sovDump(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozDump(x uint64) (n int) { return sovDump(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -734,10 +773,7 @@ func (m *Storage) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthDump - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDump } if (iNdEx + skippy) > l { @@ -855,10 +891,7 @@ func (m *AccountStorage) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthDump - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDump } if (iNdEx + skippy) > l { @@ -1029,10 +1062,7 @@ func (m *EVMEvent) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthDump - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDump } if (iNdEx + skippy) > l { @@ -1246,10 +1276,7 @@ func (m *Dump) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthDump - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDump } if (iNdEx + skippy) > l { @@ -1268,6 +1295,7 @@ func (m *Dump) Unmarshal(dAtA []byte) error { func skipDump(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1299,10 +1327,8 @@ func skipDump(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1323,55 +1349,30 @@ func skipDump(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthDump } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthDump - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDump - } - 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 := skipDump(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthDump - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDump + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthDump + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthDump = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDump = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthDump = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDump = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDump = fmt.Errorf("proto: unexpected end of group") ) diff --git a/dump/load.go b/dump/load.go index 531e01849..cfeb991ab 100644 --- a/dump/load.go +++ b/dump/load.go @@ -13,7 +13,8 @@ import ( "github.com/hyperledger/burrow/txs/payload" ) -// Load a dump into state +// Load a dump into state. We store all the events from the source chain in a single zeroth block with all the events +// at each height in their own pseudo transaction. func Load(source Source, st *state.State) error { _, _, err := st.Update(func(s state.Updatable) error { txs := make([]*exec.TxExecution, 0) @@ -71,8 +72,10 @@ func Load(source Source, st *state.State) error { if tx == nil { tx = &exec.TxExecution{ TxHeader: &exec.TxHeader{ - TxHash: dumpTxHash(row.EVMEvent.ChainID, row.Height), TxType: payload.TypeCall, + TxHash: dumpTxHash(row.EVMEvent.ChainID, row.Height), + Height: 0, + Index: uint64(len(txs)), Origin: &exec.Origin{ ChainID: row.EVMEvent.ChainID, Height: row.Height, diff --git a/dump/load_test.go b/dump/load_test.go index eb54979c5..f09ce0ed4 100644 --- a/dump/load_test.go +++ b/dump/load_test.go @@ -2,10 +2,15 @@ package dump import ( "fmt" + "io" "os" + "path" "testing" + "github.com/hyperledger/burrow/rpc/rpcevents" + "github.com/hyperledger/burrow/bcm" + "github.com/hyperledger/burrow/storage" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/execution/state" @@ -40,7 +45,9 @@ func testLoad(t testing.TB, mock *MockSource) *state.State { func TestLoadAndDump(t *testing.T) { st, err := state.MakeGenesisState(testDB(t), &genesis.GenesisDoc{GlobalPermissions: permission.DefaultAccountPermissions}) require.NoError(t, err) - src, err := NewFileReader(os.Getenv("GOPATH") + "/src/github.com/hyperledger/burrow/dump/test_dump.json") + dir, err := os.Getwd() + require.NoError(t, err) + src, err := NewFileReader(path.Join(dir, "test_dump.json")) require.NoError(t, err) err = Load(src, st) require.NoError(t, err) @@ -54,23 +61,43 @@ func TestLoadAndDump(t *testing.T) { err = dumper.Transmit(&sink, 0, 0, All) require.NoError(t, err) - st, err = state.MakeGenesisState(testDB(t), &genesis.GenesisDoc{GlobalPermissions: permission.DefaultAccountPermissions, ChainName: fmt.Sprintf("CHAIN #%d", i)}) + st, err = state.MakeGenesisState(testDB(t), &genesis.GenesisDoc{ + GlobalPermissions: permission.DefaultAccountPermissions, + ChainName: fmt.Sprintf("CHAIN #%d", i), + }) require.NoError(t, err) err = Load(&sink, st) require.NoError(t, err) } - err = st.IterateStreamEvents(nil, nil, func(se *exec.StreamEvent) error { - if se.BeginTx != nil { - require.Equal(t, se.BeginTx.TxHeader.Origin.Height, uint64(5)) - require.Equal(t, se.BeginTx.TxHeader.Origin.Index, uint64(2)) - require.Equal(t, se.BeginTx.TxHeader.Origin.ChainID, "BurrowChain_7DB5BD-5BCE58") + streamEvents := new(exec.StreamEvents) + eventHeight := uint64(4) + err = st.IterateStreamEvents(nil, nil, storage.AscendingSort, func(ev *exec.StreamEvent) error { + streamEvents.StreamEvents = append(streamEvents.StreamEvents, ev) + if ev.BeginTx != nil { + require.Equal(t, eventHeight, ev.BeginTx.TxHeader.Origin.Height) + require.NotZero(t, ev.BeginTx.TxHeader.Origin.Index) + require.Equal(t, ev.BeginTx.TxHeader.Origin.ChainID, "BurrowChain_7DB5BD-5BCE58") + } + if ev.Event != nil { + require.Equal(t, ev.Event.Header.Height, eventHeight) } - if se.Event != nil { - require.Equal(t, se.Event.Header.Height, uint64(5)) + if ev.EndTx != nil { + eventHeight++ } return nil }) require.NoError(t, err) + + // Now ensure that the events can be safely consumed by downstream event consumers (e.g. Vent) + err = rpcevents.ConsumeBlockExecutions(streamEvents, func(be *exec.BlockExecution) error { + // Events carry their original height in the event header + require.Equal(t, uint64(4), be.TxExecutions[0].Events[0].Header.Height) + require.Equal(t, uint64(0), be.TxExecutions[0].Index) + require.Equal(t, uint64(5), be.TxExecutions[1].Events[0].Header.Height) + require.Equal(t, uint64(1), be.TxExecutions[1].Index) + return nil + }) + require.Equal(t, io.EOF, err) } diff --git a/dump/mock.go b/dump/mock.go index 06547bbc5..90d0e3198 100644 --- a/dump/mock.go +++ b/dump/mock.go @@ -53,8 +53,6 @@ func (m *MockSource) Recv() (*Dump, error) { if m.Accounts%2 > 0 { row.Account.EVMCode = make([]byte, m.rand.Intn(10000)) m.rand.Read(row.Account.EVMCode) - } else { - row.Account.PublicKey = crypto.PublicKey{} } m.Accounts-- if m.MaxStorage > 0 { diff --git a/dump/mock_test.go b/dump/mock_test.go index 6df2a7614..041b5ad51 100644 --- a/dump/mock_test.go +++ b/dump/mock_test.go @@ -23,6 +23,5 @@ func TestMockReader(t *testing.T) { loadDumpFromJSONString(t, st, dump) dumpOut := normaliseDump(dumpToJSONString(t, st, mock)) - require.True(t, dump == dumpOut) require.Equal(t, dump, dumpOut) } diff --git a/dump/test_dump.json b/dump/test_dump.json index 32c86df6a..374525d29 100644 --- a/dump/test_dump.json +++ b/dump/test_dump.json @@ -1,5 +1,119 @@ -{"Height":6,"Account":{"Address":"0000000000000000000000000000000000000000","PublicKey":{"CurveType":"","PublicKey":""},"Balance":1337,"EVMCode":"","Permissions":{"Base":{"Perms":"send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | hasRole","SetBit":"root | send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole"}}}} -{"Height":6,"Account":{"Address":"4ABD4279D51DB2EDD2DB0BA0B07AF56ED78CDAC0","PublicKey":{"CurveType":"","PublicKey":""},"Balance":99999999999999,"EVMCode":"","Permissions":{"Base":{"Perms":"root | send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole","SetBit":"root | send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole"}}}} -{"Height":6,"Account":{"Address":"674A8125610CAF8B9969DC38AAC573691DF926EC","PublicKey":{"CurveType":"","PublicKey":""},"EVMCode":"6080604052600436106049576000357C0100000000000000000000000000000000000000000000000000000000900463FFFFFFFF1680635197C7AA14604E578063F38BD57A146082575B600080FD5B348015605957600080FD5B5060606096565B604051808263FFFFFFFF1663FFFFFFFF16815260200191505060405180910390F35B348015608D57600080FD5B50609460AF565B005B60008060009054906101000A900463FFFFFFFF16905090565B7F2B69880ACA8C98F8F8CA0C47711FEB5DBC892B1D4614F2D9A9DF8D5F6E3A960B60666040518082815260200191505060405180910390A15600A165627A7A723058205121C5ED3D588194B76A15A35AA065F79D0C22EB50FCD97A24AAA60E01E191740029","Permissions":{"Base":{"Perms":"","SetBit":""}},"ContractMeta":[{"CodeHash":"139CBA1935D25D8E42741DA38F353577EB40E0F0E5EAB38F69A4478100BF3504","MetadataHash":"","Metadata":"{\"ContractName\":\"Maker\",\"SourceFile\":\"const.sol\",\"CompilerVersion\":\"0.4.25+commit.59dbf8f1\",\"Abi\":[{\"constant\":false,\"inputs\":[],\"name\":\"getX\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"emitMaker\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"a\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MakerEvent\",\"type\":\"event\"}]}"}],"Forebear":"674A8125610CAF8B9969DC38AAC573691DF926EC"},"AccountStorage":{"Address":"674A8125610CAF8B9969DC38AAC573691DF926EC","Storage":[{"Key":"0000000000000000000000000000000000000000000000000000000000000000","Value":"0000000000000000000000000000000000000000000000000000000000000066"}]}} -{"Height":6,"Account":{"Address":"787FEB2434C96FB3D33FB6A23DA82B39FD4D466A","PublicKey":{"CurveType":"ed25519","PublicKey":"CCF9DF46B8496A96C6266A4FE29166C5F3FA020CA240D1B237BC3ABB77228357"},"Sequence":3,"Balance":9999970002,"EVMCode":"","Permissions":{"Base":{"Perms":"bond","SetBit":"bond"}}}} -{"Height":5,"EVMEvent":{"ChainID":"BurrowChain_7DB5BD-5BCE58","Index":2,"Time":"2019-07-23T07:23:41.701845678Z","Event":{"Address":"674A8125610CAF8B9969DC38AAC573691DF926EC","Data":"0000000000000000000000000000000000000000000000000000000000000066","Topics":["2B69880ACA8C98F8F8CA0C47711FEB5DBC892B1D4614F2D9A9DF8D5F6E3A960B"]}}} +{ + "Height": 6, + "Account": { + "Address": "0000000000000000000000000000000000000000", + "PublicKey": { + "CurveType": "", + "PublicKey": "" + }, + "Balance": 1337, + "EVMCode": "", + "Permissions": { + "Base": { + "Perms": "send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | hasRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + } + } +} +{ + "Height": 6, + "Account": { + "Address": "4ABD4279D51DB2EDD2DB0BA0B07AF56ED78CDAC0", + "PublicKey": { + "CurveType": "", + "PublicKey": "" + }, + "Balance": 99999999999999, + "EVMCode": "", + "Permissions": { + "Base": { + "Perms": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + } + } +} +{ + "Height": 6, + "Account": { + "Address": "674A8125610CAF8B9969DC38AAC573691DF926EC", + "PublicKey": { + "CurveType": "", + "PublicKey": "" + }, + "EVMCode": "6080604052600436106049576000357C0100000000000000000000000000000000000000000000000000000000900463FFFFFFFF1680635197C7AA14604E578063F38BD57A146082575B600080FD5B348015605957600080FD5B5060606096565B604051808263FFFFFFFF1663FFFFFFFF16815260200191505060405180910390F35B348015608D57600080FD5B50609460AF565B005B60008060009054906101000A900463FFFFFFFF16905090565B7F2B69880ACA8C98F8F8CA0C47711FEB5DBC892B1D4614F2D9A9DF8D5F6E3A960B60666040518082815260200191505060405180910390A15600A165627A7A723058205121C5ED3D588194B76A15A35AA065F79D0C22EB50FCD97A24AAA60E01E191740029", + "Permissions": { + "Base": { + "Perms": "", + "SetBit": "" + } + }, + "ContractMeta": [ + { + "CodeHash": "139CBA1935D25D8E42741DA38F353577EB40E0F0E5EAB38F69A4478100BF3504", + "MetadataHash": "", + "Metadata": "{\"ContractName\":\"Maker\",\"SourceFile\":\"const.sol\",\"CompilerVersion\":\"0.4.25+commit.59dbf8f1\",\"Abi\":[{\"constant\":false,\"inputs\":[],\"name\":\"getX\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"emitMaker\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"a\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MakerEvent\",\"type\":\"event\"}]}" + } + ], + "Forebear": "674A8125610CAF8B9969DC38AAC573691DF926EC" + }, + "AccountStorage": { + "Address": "674A8125610CAF8B9969DC38AAC573691DF926EC", + "Storage": [ + { + "Key": "0000000000000000000000000000000000000000000000000000000000000000", + "Value": "0000000000000000000000000000000000000000000000000000000000000066" + } + ] + } +} +{ + "Height": 6, + "Account": { + "Address": "787FEB2434C96FB3D33FB6A23DA82B39FD4D466A", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "CCF9DF46B8496A96C6266A4FE29166C5F3FA020CA240D1B237BC3ABB77228357" + }, + "Sequence": 3, + "Balance": 9999970002, + "EVMCode": "", + "Permissions": { + "Base": { + "Perms": "bond", + "SetBit": "bond" + } + } + } +} +{ + "Height": 4, + "EVMEvent": { + "ChainID": "BurrowChain_7DB5BD-5BCE58", + "Index": 1, + "Time": "2019-07-22T07:23:41.701845678Z", + "Event": { + "Address": "674A8125610CAF8B9969DC38AAC573691DF926EC", + "Data": "CAFE000000000000000000000000000000000000000000000000000000000066", + "Topics": [ + "2B69880ACA8C98F8F8CA0C47711FEB5DBC892B1D4614F2D9A9DF8D5F6E3A960B" + ] + } + } +} +{ + "Height": 5, + "EVMEvent": { + "ChainID": "BurrowChain_7DB5BD-5BCE58", + "Index": 2, + "Time": "2019-07-23T07:23:41.701845678Z", + "Event": { + "Address": "674A8125610CAF8B9969DC38AAC573691DF926EC", + "Data": "0000000000000000000000000000000000000000000000000000000000000066", + "Topics": [ + "2B69880ACA8C98F8F8CA0C47711FEB5DBC892B1D4614F2D9A9DF8D5F6E3A960B" + ] + } + } +} diff --git a/encoding/encoding.pb.go b/encoding/encoding.pb.go index 16a454d26..4e355d5a0 100644 --- a/encoding/encoding.pb.go +++ b/encoding/encoding.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -23,7 +24,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 // For testing type TestMessage struct { @@ -44,7 +45,7 @@ func (m *TestMessage) XXX_Unmarshal(b []byte) error { } func (m *TestMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -88,25 +89,25 @@ func init() { proto.RegisterFile("encoding.proto", fileDescriptor_ac330e3fa468db func init() { golang_proto.RegisterFile("encoding.proto", fileDescriptor_ac330e3fa468db3c) } var fileDescriptor_ac330e3fa468db3c = []byte{ - // 189 bytes of a gzipped FileDescriptorProto + // 180 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4b, 0xcd, 0x4b, 0xce, - 0x4f, 0xc9, 0xcc, 0x4b, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x74, - 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, - 0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x54, 0xb2, 0xe7, 0xe2, - 0x0e, 0x49, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x15, 0x12, 0xe2, 0x62, 0x09, - 0xa9, 0x2c, 0x48, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0d, 0x02, 0xb3, 0x85, 0xc4, 0xb8, 0xd8, - 0x1c, 0x73, 0xf3, 0x4b, 0xf3, 0x4a, 0x24, 0x98, 0x14, 0x18, 0x35, 0x58, 0x82, 0xa0, 0x3c, 0x2b, - 0x96, 0x19, 0x0b, 0xe4, 0x19, 0x9c, 0x1c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, - 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x0f, 0x3c, 0x96, 0x63, 0x3c, 0xf1, 0x58, 0x8e, - 0x31, 0x4a, 0x0d, 0xc9, 0x25, 0x19, 0x95, 0x05, 0xa9, 0x45, 0x39, 0xa9, 0x29, 0xe9, 0xa9, 0x45, - 0xfa, 0x49, 0xa5, 0x45, 0x45, 0xf9, 0xe5, 0xfa, 0x30, 0x17, 0x27, 0xb1, 0x81, 0x5d, 0x62, 0x0c, - 0x08, 0x00, 0x00, 0xff, 0xff, 0xe3, 0x76, 0xda, 0xe3, 0xd4, 0x00, 0x00, 0x00, + 0x4f, 0xc9, 0xcc, 0x4b, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x44, + 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x82, 0xfa, 0x20, 0x16, 0x44, 0x5e, 0xc9, 0x9e, 0x8b, 0x3b, 0x24, + 0xb5, 0xb8, 0xc4, 0x37, 0xb5, 0xb8, 0x38, 0x31, 0x3d, 0x55, 0x48, 0x88, 0x8b, 0x25, 0xa4, 0xb2, + 0x20, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x37, 0x08, 0xcc, 0x16, 0x12, 0xe3, 0x62, 0x73, 0xcc, + 0xcd, 0x2f, 0xcd, 0x2b, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x09, 0x82, 0xf2, 0xac, 0x58, 0x66, + 0x2c, 0x90, 0x67, 0x70, 0x72, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, 0x8f, + 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x3c, 0xf0, 0x58, 0x8e, 0xf1, 0xc4, 0x63, 0x39, 0xc6, 0x28, + 0xb5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0x8c, 0xca, 0x82, 0xd4, + 0xa2, 0x9c, 0xd4, 0x94, 0xf4, 0xd4, 0x22, 0xfd, 0xa4, 0xd2, 0xa2, 0xa2, 0xfc, 0x72, 0x7d, 0x98, + 0xc3, 0x92, 0xd8, 0xc0, 0x2e, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x38, 0x2e, 0xed, + 0xbb, 0x00, 0x00, 0x00, } func (m *TestMessage) 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 } @@ -114,34 +115,42 @@ func (m *TestMessage) Marshal() (dAtA []byte, err error) { } func (m *TestMessage) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TestMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Type != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintEncoding(dAtA, i, uint64(m.Type)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Amount != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintEncoding(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Type != 0 { + i = encodeVarintEncoding(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func encodeVarintEncoding(dAtA []byte, offset int, v uint64) int { + offset -= sovEncoding(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 (m *TestMessage) Size() (n int) { if m == nil { @@ -162,14 +171,7 @@ func (m *TestMessage) Size() (n int) { } func sovEncoding(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozEncoding(x uint64) (n int) { return sovEncoding(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -247,10 +249,7 @@ func (m *TestMessage) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthEncoding - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthEncoding } if (iNdEx + skippy) > l { @@ -269,6 +268,7 @@ func (m *TestMessage) Unmarshal(dAtA []byte) error { func skipEncoding(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -300,10 +300,8 @@ func skipEncoding(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -324,55 +322,30 @@ func skipEncoding(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthEncoding } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthEncoding - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEncoding - } - 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 := skipEncoding(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthEncoding - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEncoding + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthEncoding + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthEncoding = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEncoding = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthEncoding = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEncoding = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEncoding = fmt.Errorf("proto: unexpected end of group") ) diff --git a/encoding/ethereum.go b/encoding/ethereum.go new file mode 100644 index 000000000..0b511ff8c --- /dev/null +++ b/encoding/ethereum.go @@ -0,0 +1,28 @@ +package encoding + +import ( + "math/big" + "strings" + + "github.com/hyperledger/burrow/encoding/web3hex" +) + +// Convert Burrow's ChainID to a *big.Int so it can be used as a nonce for Ethereum signing. +// For compatibility with Ethereum tooling this function first tries to interpret the ChainID as an integer encoded +// either as an eth-style 0x-prefixed hex string or a base 10 integer, falling back to interpreting the string's +// raw bytes as a big-endian integer +func GetEthChainID(chainID string) *big.Int { + if strings.HasPrefix(chainID, "0x") { + d := new(web3hex.Decoder) + b := d.BigInt(chainID) + if d.Err() == nil { + return b + } + } + b := new(big.Int) + id, ok := b.SetString(chainID, 10) + if ok { + return id + } + return b.SetBytes([]byte(chainID)) +} diff --git a/encoding/ethereum_test.go b/encoding/ethereum_test.go new file mode 100644 index 000000000..2d28a5cf8 --- /dev/null +++ b/encoding/ethereum_test.go @@ -0,0 +1,17 @@ +package encoding + +import ( + "math/big" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGetEthChainID(t *testing.T) { + assert.Equal(t, big.NewInt(1234), GetEthChainID("1234")) + assert.Equal(t, big.NewInt(1234), GetEthChainID("0x4d2")) + chainID, ok := new(big.Int).SetString("28980219985052679991929851741845949978287371722649499714751652210", 10) + require.True(t, ok) + assert.Equal(t, chainID, GetEthChainID("FrogsEatApplesOnlyWhenClear")) +} diff --git a/encoding/grpc.go b/encoding/grpc.go new file mode 100644 index 000000000..3d0a7bd66 --- /dev/null +++ b/encoding/grpc.go @@ -0,0 +1,44 @@ +package encoding + +import ( + "context" + + "github.com/gogo/protobuf/proto" + "google.golang.org/grpc" + "google.golang.org/grpc/encoding" +) + +func init() { + encoding.RegisterCodec(&GRPCCodec{}) +} + +const GRPCCodecName = "gogo" + +type GRPCCodec struct { +} + +func (G *GRPCCodec) String() string { + return GRPCCodecName +} + +func (G *GRPCCodec) Marshal(v interface{}) ([]byte, error) { + return Encode(v.(proto.Message)) +} + +func (G *GRPCCodec) Unmarshal(data []byte, v interface{}) error { + return Decode(data, v.(proto.Message)) +} + +func (G *GRPCCodec) Name() string { + return GRPCCodecName +} + +var DefaultDialOptions = []grpc.DialOption{grpc.WithInsecure(), grpc.WithDefaultCallOptions(grpc.CallContentSubtype(GRPCCodecName))} + +func GRPCDial(grpcAddress string, additionalOpts ...grpc.DialOption) (*grpc.ClientConn, error) { + return grpc.Dial(grpcAddress, append(additionalOpts, DefaultDialOptions...)...) +} + +func GRPCDialContext(ctx context.Context, grpcAddress string, additionalOpts ...grpc.DialOption) (*grpc.ClientConn, error) { + return grpc.DialContext(ctx, grpcAddress, append(additionalOpts, DefaultDialOptions...)...) +} diff --git a/encoding/protobuf.go b/encoding/protobuf.go index 211209848..78d0d8194 100644 --- a/encoding/protobuf.go +++ b/encoding/protobuf.go @@ -5,53 +5,58 @@ import ( "fmt" "io" + gogo "github.com/gogo/protobuf/proto" "github.com/golang/protobuf/proto" ) -type Buffer struct { - *proto.Buffer -} - -// Centralise proto.Buffer constructor. gogo protobuf freaks out about deterministic -// marshalling on objects with custom marshallers so we use google protobuf here -func NewBuffer(bs []byte) *Buffer { - buf := proto.NewBuffer(bs) - buf.SetDeterministic(true) - return &Buffer{Buffer: buf} -} +// TODO(Silas): we need a sustainable path WRT our reliance on gogoproto generated types - currently we rely on gogoproto +// generated marshalling code on all types // Single shot encoding func Encode(msg proto.Message) ([]byte, error) { - buf := NewBuffer(nil) - err := buf.Marshal(msg) + m, ok := msg.(gogo.Marshaler) + if ok { + // NOTE: we have to go down this path in order to handle custom types with protobuf-go v2 + return m.Marshal() + } + buffer := new(proto.Buffer) + buffer.SetDeterministic(true) + err := buffer.Marshal(msg) if err != nil { return nil, err } - return buf.Bytes(), nil + return buffer.Bytes(), nil } // Single shot decoding func Decode(bs []byte, msg proto.Message) error { - return NewBuffer(bs).Unmarshal(msg) + m, ok := msg.(gogo.Unmarshaler) + if ok { + // NOTE: we have to go down this path in order to handle custom types with protobuf-go v2 + return m.Unmarshal(bs) + } + buffer := new(proto.Buffer) + buffer.SetDeterministic(true) + buffer.SetBuf(bs) + return buffer.Unmarshal(msg) } // Write messages with length-prefix framing to the provider Writer. Returns the number of bytes written. func WriteMessage(w io.Writer, pb proto.Message) (int, error) { const errHeader = "WriteMessage()" - buf := NewBuffer(nil) - err := buf.Marshal(pb) + buf, err := Encode(pb) if err != nil { return 0, fmt.Errorf("%s: %v", errHeader, err) } // Write length prefix bs := make([]byte, binary.MaxVarintLen64) - n := binary.PutVarint(bs, int64(len(buf.Bytes()))) + n := binary.PutVarint(bs, int64(len(buf))) written, err := w.Write(bs[:n]) if err != nil { return written, fmt.Errorf("%s: %v", errHeader, err) } // Write message - n, err = w.Write(buf.Bytes()) + n, err = w.Write(buf) written += n return written, nil } @@ -82,7 +87,7 @@ func ReadMessage(r io.Reader, pb proto.Message) (int, error) { return read, fmt.Errorf("%s: expected protobuf message of %d bytes but could only read %d bytes", errHeader, msgLength, n) } - err = proto.NewBuffer(bs).Unmarshal(pb) + err = Decode(bs, pb) if err != nil { return read, fmt.Errorf("%s: %v", errHeader, err) } diff --git a/encoding/rlp/rlp.go b/encoding/rlp/rlp.go new file mode 100644 index 000000000..953e54dc3 --- /dev/null +++ b/encoding/rlp/rlp.go @@ -0,0 +1,358 @@ +// +// See https://eth.wiki/fundamentals/rlp +// +package rlp + +import ( + "bytes" + "encoding/binary" + "fmt" + "math/big" + "math/bits" + "reflect" + + binary2 "github.com/hyperledger/burrow/binary" +) + +type magicOffset uint8 + +const ( + ShortLength = 55 + StringOffset magicOffset = 0x80 // 128 - if string length is less than or equal to 55 [inclusive] + SliceOffset magicOffset = 0xC0 // 192 - if slice length is less than or equal to 55 [inclusive] + SmallByte = 0x7f // 247 - value less than or equal is itself [inclusive +) + +type Code uint32 + +const ( + ErrUnknown Code = iota + ErrNoInput + ErrInvalid +) + +var bigIntType = reflect.TypeOf(&big.Int{}) + +func (c Code) Error() string { + switch c { + case ErrNoInput: + return "no input" + case ErrInvalid: + return "input not valid RLP encoding" + default: + return "unknown error" + } +} + +func Encode(input interface{}) ([]byte, error) { + val := reflect.ValueOf(input) + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + return encode(val) +} + +func Decode(src []byte, dst interface{}) error { + fields, err := decode(src) + if err != nil { + return err + } + + val := reflect.ValueOf(dst) + typ := reflect.TypeOf(dst) + + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + + switch val.Kind() { + case reflect.Slice: + switch typ.Elem().Kind() { + case reflect.Uint8: + out, ok := dst.([]byte) + if !ok { + return fmt.Errorf("cannot decode into type %s", val.Type()) + } + found := bytes.Join(fields, []byte("")) + if len(out) < len(found) { + return fmt.Errorf("cannot decode %d bytes into slice of size %d", len(found), len(out)) + } + for i, b := range found { + out[i] = b + } + default: + for i := 0; i < val.Len(); i++ { + elem := val.Index(i) + err = decodeField(elem, fields[i]) + if err != nil { + return err + } + } + } + case reflect.Struct: + rt := val.Type() + numExportedFields := 0 + for i := 0; i < val.NumField(); i++ { + // Skip unexported fields + if rt.Field(i).PkgPath == "" { + err := decodeField(val.Field(i), fields[numExportedFields]) + if err != nil { + return err + } + numExportedFields++ + } + } + if numExportedFields != len(fields) { + return fmt.Errorf("wrong number of fields; have %d, want %d", len(fields), numExportedFields) + } + + default: + return fmt.Errorf("cannot decode into unsupported type %v", reflect.TypeOf(dst)) + } + return nil +} + +func encodeUint8(input uint8) ([]byte, error) { + if input == 0 { + // yes this makes no sense, but it does seem to be what everyone else does, apparently 'no leading zeroes'. + // It means we cannot store []byte{0} because that is indistinguishable from byte{} + return []byte{uint8(StringOffset)}, nil + } else if input <= SmallByte { + return []byte{input}, nil + } else if input >= uint8(StringOffset) { + return []byte{0x81, input}, nil + } + return []byte{uint8(StringOffset)}, nil +} + +func encodeUint64(i uint64) ([]byte, error) { + size := bits.Len64(i)/8 + 1 + if size == 1 { + return encodeUint8(uint8(i)) + } + b := make([]byte, 8) + binary.BigEndian.PutUint64(b, uint64(i)) + return encodeString(b[8-size:]) +} + +func encodeBigInt(b *big.Int) ([]byte, error) { + if b.Sign() == -1 { + return nil, fmt.Errorf("cannot RLP encode negative number") + } + if b.IsUint64() { + return encodeUint64(b.Uint64()) + } + bs := b.Bytes() + length := encodeLength(len(bs), StringOffset) + return append(length, bs...), nil +} + +func encodeLength(n int, offset magicOffset) []byte { + // > if a string is 0-55 bytes long, the RLP encoding consists of a single byte with value 0x80 plus + // > the length of the string followed by the string. + if n <= ShortLength { + return []uint8{uint8(offset) + uint8(n)} + } + i := uint64(n) + b := make([]byte, 8) + binary.BigEndian.PutUint64(b, i) + // Byte-wise ceiling + byteLengthOfLength := (bits.Len64(i) + 7) / 8 + // > If a string is more than 55 bytes long, the RLP encoding consists of a single byte with value 0xb7 + // > plus the length in bytes of the length of the string in binary form, followed by the length of the string, + // > followed by the string + return append([]byte{uint8(offset) + ShortLength + uint8(byteLengthOfLength)}, b[8-byteLengthOfLength:]...) +} + +func encodeString(input []byte) ([]byte, error) { + if len(input) == 1 && input[0] <= SmallByte { + return encodeUint8(input[0]) + } else { + return append(encodeLength(len(input), StringOffset), input...), nil + } +} + +func encodeList(val reflect.Value) ([]byte, error) { + if val.Len() == 0 { + return []byte{uint8(SliceOffset)}, nil + } + + out := make([][]byte, 0) + for i := 0; i < val.Len(); i++ { + data, err := encode(val.Index(i)) + if err != nil { + return nil, err + } + out = append(out, data) + } + + sum := bytes.Join(out, []byte{}) + return append(encodeLength(len(sum), SliceOffset), sum...), nil +} + +func encodeStruct(val reflect.Value) ([]byte, error) { + out := make([][]byte, 0) + + rt := val.Type() + + for i := 0; i < val.NumField(); i++ { + field := val.Field(i) + // Skip unexported fields + if rt.Field(i).PkgPath == "" { + data, err := encode(field) + if err != nil { + return nil, err + } + out = append(out, data) + } + } + sum := bytes.Join(out, []byte{}) + length := encodeLength(len(sum), SliceOffset) + return append(length, sum...), nil +} + +func encode(val reflect.Value) ([]byte, error) { + if val.Kind() == reflect.Interface { + val = val.Elem() + } + + switch val.Kind() { + case reflect.Ptr: + if !val.Type().AssignableTo(bigIntType) { + return nil, fmt.Errorf("cannot encode pointer type %v", val.Type()) + } + return encodeBigInt(val.Interface().(*big.Int)) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + i := val.Int() + if i < 0 { + return nil, fmt.Errorf("cannot rlp encode negative integer") + } + return encodeUint64(uint64(i)) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return encodeUint64(val.Uint()) + case reflect.Bool: + if val.Bool() { + return []byte{0x01}, nil + } + return []byte{uint8(StringOffset)}, nil + case reflect.String: + return encodeString([]byte(val.String())) + case reflect.Slice: + switch val.Type().Elem().Kind() { + case reflect.Uint8: + i, err := encodeString(val.Bytes()) + return i, err + default: + return encodeList(val) + } + case reflect.Struct: + return encodeStruct(val) + default: + return []byte{uint8(StringOffset)}, nil + } +} + +// Split into RLP fields by reading length prefixes and consuming chunks +func decode(in []byte) ([][]byte, error) { + if len(in) == 0 { + return nil, nil + } + + offset, length, typ := decodeLength(in) + end := offset + length + + if end > uint64(len(in)) { + return nil, fmt.Errorf("read length prefix of %d but there is only %d bytes of unconsumed input", + length, uint64(len(in))-offset) + } + + suffix, err := decode(in[end:]) + if err != nil { + return nil, err + } + switch typ { + case reflect.String: + return append([][]byte{in[offset:end]}, suffix...), nil + case reflect.Slice: + prefix, err := decode(in[offset:end]) + if err != nil { + return nil, err + } + return append(prefix, suffix...), nil + } + + return suffix, nil +} + +func decodeLength(input []byte) (uint64, uint64, reflect.Kind) { + magicByte := magicOffset(input[0]) + + switch { + case magicByte <= SmallByte: + // small byte: sufficiently small single byte + return 0, 1, reflect.String + + case magicByte <= StringOffset+ShortLength: + // short string: length less than or equal to 55 bytes + length := uint64(magicByte - StringOffset) + return 1, length, reflect.String + + case magicByte < SliceOffset: + // long string: length described by magic = 0xb7 + + byteLengthOfLength := magicByte - StringOffset - ShortLength + length := getUint64(input[1:byteLengthOfLength]) + offset := uint64(byteLengthOfLength + 1) + return offset, length, reflect.String + + case magicByte <= SliceOffset+ShortLength: + // short slice: length less than or equal to 55 bytes + length := uint64(magicByte - SliceOffset) + return 1, length, reflect.Slice + + // Note this takes us all the way up to <= 255 so this switch is exhaustive + default: + // long string: length described by magic = 0xf7 + + byteLengthOfLength := magicByte - SliceOffset - ShortLength + length := getUint64(input[1:byteLengthOfLength]) + offset := uint64(byteLengthOfLength + 1) + return offset, length, reflect.Slice + } +} + +func getUint64(bs []byte) uint64 { + bs = binary2.LeftPadBytes(bs, 8) + return binary.BigEndian.Uint64(bs) +} + +func decodeField(val reflect.Value, field []byte) error { + typ := val.Type() + + switch val.Kind() { + case reflect.Ptr: + if !typ.AssignableTo(bigIntType) { + return fmt.Errorf("cannot decode into pointer type %v", typ) + } + bi := new(big.Int).SetBytes(field) + val.Set(reflect.ValueOf(bi)) + + case reflect.String: + val.SetString(string(field)) + case reflect.Uint64: + out := make([]byte, 8) + for j := range field { + out[len(out)-(len(field)-j)] = field[j] + } + val.SetUint(binary.BigEndian.Uint64(out)) + case reflect.Slice: + if typ.Elem().Kind() != reflect.Uint8 { + // skip + return nil + } + out := make([]byte, len(field)) + for i, b := range field { + out[i] = b + } + val.SetBytes(out) + } + return nil +} diff --git a/encoding/rlp/rlp_test.go b/encoding/rlp/rlp_test.go new file mode 100644 index 000000000..6564ab948 --- /dev/null +++ b/encoding/rlp/rlp_test.go @@ -0,0 +1,308 @@ +package rlp + +import ( + "math/big" + "testing" + + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding" + + "github.com/test-go/testify/require" +) + +type testCase struct { + in interface{} + enc []byte + dec interface{} +} + +type testObject struct { + Key string + Value string +} + +func TestEncoding(t *testing.T) { + + t.Run("Empty", func(t *testing.T) { + var tests = []testCase{ + { + []byte{}, + []byte{uint8(StringOffset)}, + []byte{}, + }, + { + "", + []byte{uint8(StringOffset)}, + []byte{}, + }, + { + 0, + []byte{uint8(StringOffset)}, + []byte{}, + }, + { + []string{}, + []byte{uint8(SliceOffset)}, + []byte{}, + }, + } + + trial(t, tests) + }) + + t.Run("Bool", func(t *testing.T) { + var tests = []testCase{ + { + true, + []byte{0x01}, + []byte{1}, + }, + { + false, + []byte{uint8(StringOffset)}, + []byte{0}, + }, + } + + trial(t, tests) + }) + + t.Run("String", func(t *testing.T) { + var tests = []testCase{ + { + []byte{0, 0}, + []byte{uint8(StringOffset) + 2, 0, 0}, + []byte{0, 0}, + }, + { + []byte{0x64, 0x6f, 0x67}, + []byte{0x83, 100, 111, 103}, + []byte{0x64, 0x6f, 0x67}, + }, + { + "dog", + []byte{0x83, 100, 111, 103}, + []byte("dog"), + }, + { + "hello world", + []byte{0x8b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64}, + []byte("hello world"), + }, + { + "Lorem ipsum dolor sit amet, consectetur adipisicing elit", + []byte{0xb8, 0x38, 0x4c, 0x6f, 0x72, 0x65, 0x6d, 0x20, 0x69, 0x70, 0x73, 0x75, 0x6d, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x73, 0x69, 0x74, 0x20, 0x61, 0x6d, 0x65, 0x74, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x63, 0x74, 0x65, 0x74, 0x75, 0x72, 0x20, 0x61, 0x64, 0x69, 0x70, 0x69, 0x73, 0x69, 0x63, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6c, 0x69, 0x74}, + []byte("Lorem ipsum dolor sit amet, consectetur adipisicing elit"), + }, + { + []byte{0x0f}, + []byte{0x0f}, + []byte{0x0f}, + }, + { + []byte{0x04, 0x00}, + []byte{0x82, 0x04, 0x00}, + []byte{0x04, 0x00}, + }, + } + + trial(t, tests) + }) + + t.Run("List", func(t *testing.T) { + var tests = []testCase{ + { + []string{"cat", "dog"}, + []byte{0xc8, 0x83, byte('c'), byte('a'), byte('t'), 0x83, byte('d'), byte('o'), byte('g')}, + [][]byte{[]byte("cat"), []byte("dog")}, + }, + { + [][]string{{"cat", "dog"}, {"owl"}}, + []byte{0xce, 0xc8, 0x83, byte('c'), byte('a'), byte('t'), 0x83, byte('d'), byte('o'), byte('g'), 0xc4, 0x83, byte('o'), byte('w'), byte('l')}, + [][]byte{[]byte("cat"), []byte("dog"), []byte("owl")}, + }, + } + + trial(t, tests) + }) + + t.Run("Integers", func(t *testing.T) { + var tests = []testCase{ + { + []uint64{23, 30400}, + []byte{0xc4, 0x17, 0x82, 0x76, 0xc0}, + [][]byte{{23}, {0x76, 0xc0}}, + }, + { + []*big.Int{big.NewInt(23), big.NewInt(30400)}, + []byte{0xc4, 0x17, 0x82, 0x76, 0xc0}, + [][]byte{{23}, {0x76, 0xc0}}, + }, + } + + trial(t, tests) + }) + + t.Run("Struct", func(t *testing.T) { + var tests = []testCase{ + { + testObject{"foo", "bar"}, + []byte{0xc8, 0x83, byte('f'), byte('o'), byte('o'), 0x83, byte('b'), byte('a'), byte('r')}, + &testObject{"foo", "bar"}, + }, + } + + trial(t, tests) + }) +} + +func trial(t *testing.T, tests []testCase) { + for _, tt := range tests { + enc, err := Encode(tt.in) + require.NoError(t, err) + require.Equal(t, tt.enc, enc, "encoding must match") + + var dec interface{} + + switch todo := tt.dec.(type) { + case []byte: + dec = make([]byte, len(todo)) + case [][]byte: + dec = make([][]byte, len(todo)) + case *testObject: + dec = new(testObject) + default: + require.FailNow(t, "dec type unsupported") + } + + err = Decode(enc, dec) + require.NoError(t, err) + require.Equal(t, tt.dec, dec, "decoding must match") + } +} + +type pretendTx struct { + Nonce uint64 `json:"nonce"` + GasPrice uint64 `json:"gasPrice"` + Gas uint64 `json:"gas"` + To []byte `json:"to"` + Value uint64 `json:"value"` + Input []byte `json:"input"` + + V *big.Int `json:"v"` + R []byte `json:"r"` + S []byte `json:"s"` +} + +func TestEthTransaction(t *testing.T) { + // raw := `f866068609184e72a0008303000094fa3caabc8eefec2b5e2895e5afbf79379e7268a7808025a06d35f407f418737eec80cba738c4301e683cfcecf19bac9a1aeb2316cac19d3ba002935ee46e3b6bd69168b0b07670699d71df5b32d5f66dbca5758bce2431c9e8` + // data, err := hex.DecodeString(raw) + // require.NoError(t, err) + + //input := []interface{}{ + // uint64(6), // Nonce + // uint64(10000000000000), // GasPrice + // uint64(196608), // Gas + // []byte{250, 60, 170, 188, 142, 239, 236, 43, 94, 40, 149, 229, 175, 191, 121, 55, 158, 114, 104, 167}, // To + // uint64(0), // Value + // []byte{}, // Input + // uint64(1), // V + // uint(0), // R + // uint(0), // S + //} + input := &pretendTx{ + uint64(6), // Nonce + uint64(10000000000000), // GasPrice + uint64(196608), // Gas + []byte{250, 60, 170, 188, 142, 239, 236, 43, 94, 40, 149, 229, 175, 191, 121, 55, 158, 114, 104, 167}, // To + uint64(0), // Value + []byte{}, // Input + big.NewInt(1), // V + []byte{1}, // R + []byte{1}, // S + } + data, err := Encode(input) + require.NoError(t, err) + + exp := []byte{230, 6, 134, 9, 24, 78, 114, 160, 0, 131, 3, 0, 0, 148, 250, 60, 170, 188, 142, 239, 236, 43, 94, 40, 149, 229, 175, 191, 121, 55, 158, 114, 104, 167, 128, 128, 1, 1, 1} + require.Equal(t, exp, data) + + tx := new(pretendTx) + err = Decode(data, tx) + require.NoError(t, err) + + require.Equal(t, input, tx) +} + +func TestBigInts(t *testing.T) { + type foo struct { + A *big.Int + B *big.Int + } + + biggun, ok := new(big.Int).SetString("234234238947234789234789234789234", 10) + require.True(t, ok) + input := &foo{ + A: biggun, + B: big.NewInt(34), + } + + bs, err := Encode(input) + require.NoError(t, err) + + output := new(foo) + err = Decode(bs, output) + require.NoError(t, err) + + require.Equal(t, input, output) +} + +// Order matters for serialisation +type TestRawTx struct { + Sequence uint64 `json:"nonce"` + GasPrice uint64 `json:"gasPrice"` + GasLimit uint64 `json:"gasLimit"` + dontSerialiseUnexported uint64 + To []byte `json:"to"` + Amount *big.Int `json:"value"` + Data []byte `json:"data"` + ChainID *big.Int `json:"chainID"` + + V *big.Int + R *big.Int + S *big.Int +} + +func TestEthRawTx(t *testing.T) { + bigly, ok := new(big.Int).SetString("234589034578907683457689234545678235789003476899", 10) + require.True(t, ok) + + to := crypto.Address{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} + + rawTx := &TestRawTx{ + Sequence: 1, + GasPrice: 1, + GasLimit: 1, + To: to[:], + Amount: big.NewInt(232), + Data: []byte{1, 3, 4}, + ChainID: encoding.GetEthChainID("flgoo"), + V: big.NewInt(272), + R: bigly, + S: bigly, + } + + bs, err := Encode(rawTx) + require.NoError(t, err) + + rawTxOut := new(TestRawTx) + err = Decode(bs, rawTxOut) + require.NoError(t, err) + + require.Equal(t, rawTx, rawTxOut) +} + +func TestEncodeLength(t *testing.T) { + // Ensure we have the minimal encoding (no leading zeros) + require.Equal(t, []byte{0xb8, 0xff}, encodeLength(0xff, StringOffset)) +} diff --git a/encoding/web3hex/decoder.go b/encoding/web3hex/decoder.go new file mode 100644 index 000000000..1bce7c496 --- /dev/null +++ b/encoding/web3hex/decoder.go @@ -0,0 +1,76 @@ +package web3hex + +import ( + "fmt" + "math/big" + "strings" + + "github.com/hyperledger/burrow/crypto" + "github.com/tmthrgd/go-hex" +) + +type Decoder struct { + error + must bool +} + +func (d *Decoder) Must() *Decoder { + return &Decoder{must: true} +} + +func (d *Decoder) Err() error { + return d.error +} + +func (d *Decoder) pushErr(err error) { + if d.must { + panic(err) + } + if d.error == nil { + d.error = err + } +} + +func (d *Decoder) Bytes(hs string) []byte { + hexString := strings.TrimPrefix(hs, "0x") + // Ethereum returns odd-length hexString strings when it removes leading zeros + if len(hexString)%2 == 1 { + hexString = "0" + hexString + } + bs, err := hex.DecodeString(hexString) + if err != nil { + d.pushErr(fmt.Errorf("could not decode bytes from '%s': %w", hs, err)) + } + return bs +} + +func (d *Decoder) Address(hs string) crypto.Address { + if hs == "" { + return crypto.Address{} + } + address, err := crypto.AddressFromBytes(d.Bytes(hs)) + if err != nil { + d.pushErr(fmt.Errorf("could not decode address from '%s': %w", hs, err)) + } + return address +} + +func (d *Decoder) BigInt(hs string) *big.Int { + return new(big.Int).SetBytes(d.Bytes(hs)) +} + +func (d *Decoder) Uint64(hs string) uint64 { + bi := d.BigInt(hs) + if !bi.IsUint64() { + d.pushErr(fmt.Errorf("%v is not uint64", bi)) + } + return bi.Uint64() +} + +func (d *Decoder) Int64(hs string) int64 { + bi := d.BigInt(hs) + if !bi.IsInt64() { + d.pushErr(fmt.Errorf("%v is not int64", bi)) + } + return bi.Int64() +} diff --git a/encoding/web3hex/decoder_test.go b/encoding/web3hex/decoder_test.go new file mode 100644 index 000000000..548de91e3 --- /dev/null +++ b/encoding/web3hex/decoder_test.go @@ -0,0 +1,17 @@ +package web3hex + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestDecoder_Bytes(t *testing.T) { + d := new(Decoder) + assert.Equal(t, []byte{}, d.Bytes("")) + assert.Equal(t, []byte{1}, d.Bytes("0x1")) + assert.Equal(t, []byte{1}, d.Bytes("0x01")) + assert.Equal(t, []byte{1, 0xff}, d.Bytes("0x1ff")) + require.NoError(t, d.Err()) +} diff --git a/encoding/web3hex/encoder.go b/encoding/web3hex/encoder.go new file mode 100644 index 000000000..1a479fcd2 --- /dev/null +++ b/encoding/web3hex/encoder.go @@ -0,0 +1,54 @@ +package web3hex + +import ( + bin "encoding/binary" + "math/big" + "strings" + + "github.com/hyperledger/burrow/crypto" + "github.com/tmthrgd/go-hex" +) + +type encoder struct { +} + +var Encoder = new(encoder) + +func (e *encoder) Bytes(bs []byte) string { + return "0x" + hex.EncodeToString(bs) +} + +func (e *encoder) BytesTrim(bs []byte) string { + if len(bs) == 0 { + return "" + } + str := hex.EncodeToString(bs) + // Ethereum expects leading zeros to be removed from RLP encodings (SMH) + str = strings.TrimLeft(str, "0") + if len(str) == 0 { + // Special case for zero + return "0x0" + } + return "0x" + str +} + +func (e *encoder) BigInt(x *big.Int) string { + return e.BytesTrim(x.Bytes()) +} + +func (e *encoder) Uint64OmitEmpty(x uint64) string { + if x == 0 { + return "" + } + return e.Uint64(x) +} + +func (e *encoder) Uint64(x uint64) string { + bs := make([]byte, 8) + bin.BigEndian.PutUint64(bs, x) + return e.BytesTrim(bs) +} + +func (e *encoder) Address(address crypto.Address) string { + return e.BytesTrim(address.Bytes()) +} diff --git a/encoding/web3hex/encoder_test.go b/encoding/web3hex/encoder_test.go new file mode 100644 index 000000000..c9aa054f7 --- /dev/null +++ b/encoding/web3hex/encoder_test.go @@ -0,0 +1,15 @@ +package web3hex + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestEncoder_BytesTrim(t *testing.T) { + assert.Equal(t, "", Encoder.BytesTrim(nil)) + assert.Equal(t, "", Encoder.BytesTrim([]byte{})) + assert.Equal(t, "0x0", Encoder.BytesTrim([]byte{0})) + assert.Equal(t, "0x1", Encoder.BytesTrim([]byte{1})) + assert.Equal(t, "0x1ff", Encoder.BytesTrim([]byte{1, 255})) +} diff --git a/event/emitter.go b/event/emitter.go index 52d420110..2c1057954 100644 --- a/event/emitter.go +++ b/event/emitter.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package event @@ -22,7 +11,7 @@ import ( "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" - "github.com/tendermint/tendermint/libs/common" + "github.com/tendermint/tendermint/libs/service" hex "github.com/tmthrgd/go-hex" ) @@ -33,7 +22,7 @@ const DefaultEventBufferCapacity = 2 << 10 // Emitter has methods for working with events type Emitter struct { - common.BaseService + service.BaseService pubsubServer *pubsub.Server logger *logging.Logger } @@ -41,7 +30,7 @@ type Emitter struct { // NewEmitter initializes an emitter struct with a pubsubServer func NewEmitter() *Emitter { pubsubServer := pubsub.NewServer(pubsub.BufferCapacity(DefaultEventBufferCapacity)) - pubsubServer.BaseService = *common.NewBaseService(nil, "Emitter", pubsubServer) + pubsubServer.BaseService = *service.NewBaseService(nil, "Emitter", pubsubServer) pubsubServer.Start() return &Emitter{ pubsubServer: pubsubServer, diff --git a/event/pubsub/pubsub.go b/event/pubsub/pubsub.go index 6ff16ba40..e6e2dc343 100644 --- a/event/pubsub/pubsub.go +++ b/event/pubsub/pubsub.go @@ -21,7 +21,7 @@ import ( "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" - "github.com/tendermint/tendermint/libs/common" + "github.com/tendermint/tendermint/libs/service" ) type operation int @@ -55,7 +55,7 @@ type cmd struct { // Server allows clients to subscribe/unsubscribe for messages, publishing // messages with or without tags, and manages internal state. type Server struct { - common.BaseService + service.BaseService cmds chan cmd cmdsCap int @@ -76,7 +76,7 @@ func NewServer(options ...Option) *Server { subscriptions: make(map[string]map[string]query.Query), logger: logging.NewNoopLogger(), } - s.BaseService = *common.NewBaseService(nil, "PubSub", s) + s.BaseService = *service.NewBaseService(nil, "PubSub", s) for _, option := range options { option(s) diff --git a/event/pubsub/pubsub_test.go b/event/pubsub/pubsub_test.go index 94da8c07d..e8a405462 100644 --- a/event/pubsub/pubsub_test.go +++ b/event/pubsub/pubsub_test.go @@ -194,7 +194,7 @@ func benchmarkNClients(n int, b *testing.B) { b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - s.PublishWithTags(ctx, "Gamora", query.TagMap{"abci.Account.Owner": "Ivan", "abci.Invoices.Number": string(i)}) + s.PublishWithTags(ctx, "Gamora", query.TagMap{"abci.Account.Owner": "Ivan", "abci.Invoices.Number": fmt.Sprint(i)}) } } diff --git a/event/query/builder.go b/event/query/builder.go index 7931b4964..1757e4b16 100644 --- a/event/query/builder.go +++ b/event/query/builder.go @@ -16,17 +16,19 @@ const ( // Operators equalString = "=" + notEqualString = "!=" greaterThanString = ">" lessThanString = "<" greaterOrEqualString = ">=" lessOrEqualString = "<=" containsString = "CONTAINS" andString = "AND" + orString = "OR" + notString = "NOT" // Values trueString = "true" falseString = "false" - emptyString = "empty" timeString = "TIME" dateString = "DATE" ) @@ -89,7 +91,7 @@ var conditionTemplate = template.Must(template.New("condition").Parse("{{.Tag}} // Creates a new query builder with a base query that is the conjunction of all queries passed func NewBuilder(queries ...string) *Builder { qb := new(Builder) - qb.queryString = qb.and(stringIterator(queries...)) + qb.queryString = qb.binary(stringIterator(queries...), andString) return qb } @@ -113,7 +115,21 @@ func NewOrEmpty(queryString string) (Query, error) { // Creates the conjunction of Builder and rightQuery func (qb *Builder) And(queryBuilders ...*Builder) *Builder { - return NewBuilder(qb.and(queryBuilderIterator(queryBuilders...))) + return NewBuilder(qb.binary(queryBuilderIterator(queryBuilders...), andString)) +} + +func (qb *Builder) Or(queryBuilders ...*Builder) *Builder { + return NewBuilder(qb.binary(queryBuilderIterator(queryBuilders...), orString)) +} + +func (qb *Builder) Not() *Builder { + defer qb.Buffer.Reset() + qb.Buffer.WriteString(notString) + qb.Buffer.WriteByte(' ') + qb.Buffer.WriteByte('(') + qb.Buffer.WriteString(qb.queryString) + qb.Buffer.WriteByte(')') + return NewBuilder(qb.Buffer.String()) } // Creates the conjunction of Builder and tag = operand @@ -121,52 +137,59 @@ func (qb *Builder) AndEquals(tag string, operand interface{}) *Builder { qb.condition.Tag = tag qb.condition.Op = equalString qb.condition.Operand = operandString(operand) - return NewBuilder(qb.and(stringIterator(qb.conditionString()))) + return NewBuilder(qb.binary(stringIterator(qb.conditionString()), andString)) +} + +func (qb *Builder) AndNotEquals(tag string, operand interface{}) *Builder { + qb.condition.Tag = tag + qb.condition.Op = notEqualString + qb.condition.Operand = operandString(operand) + return NewBuilder(qb.binary(stringIterator(qb.conditionString()), andString)) } func (qb *Builder) AndGreaterThanOrEqual(tag string, operand interface{}) *Builder { qb.condition.Tag = tag qb.condition.Op = greaterOrEqualString qb.condition.Operand = operandString(operand) - return NewBuilder(qb.and(stringIterator(qb.conditionString()))) + return NewBuilder(qb.binary(stringIterator(qb.conditionString()), andString)) } func (qb *Builder) AndLessThanOrEqual(tag string, operand interface{}) *Builder { qb.condition.Tag = tag qb.condition.Op = lessOrEqualString qb.condition.Operand = operandString(operand) - return NewBuilder(qb.and(stringIterator(qb.conditionString()))) + return NewBuilder(qb.binary(stringIterator(qb.conditionString()), andString)) } func (qb *Builder) AndStrictlyGreaterThan(tag string, operand interface{}) *Builder { qb.condition.Tag = tag qb.condition.Op = greaterThanString qb.condition.Operand = operandString(operand) - return NewBuilder(qb.and(stringIterator(qb.conditionString()))) + return NewBuilder(qb.binary(stringIterator(qb.conditionString()), andString)) } func (qb *Builder) AndStrictlyLessThan(tag string, operand interface{}) *Builder { qb.condition.Tag = tag qb.condition.Op = lessThanString qb.condition.Operand = operandString(operand) - return NewBuilder(qb.and(stringIterator(qb.conditionString()))) + return NewBuilder(qb.binary(stringIterator(qb.conditionString()), andString)) } func (qb *Builder) AndContains(tag string, operand interface{}) *Builder { qb.condition.Tag = tag qb.condition.Op = containsString qb.condition.Operand = operandString(operand) - return NewBuilder(qb.and(stringIterator(qb.conditionString()))) + return NewBuilder(qb.binary(stringIterator(qb.conditionString()), andString)) } -func (qb *Builder) and(queryIterator func(func(string))) string { +func (qb *Builder) binary(queryIterator func(func(string)), operator string) string { defer qb.Buffer.Reset() qb.Buffer.WriteString(qb.queryString) queryIterator(func(q string) { if !isEmpty(q) { if qb.Buffer.Len() > 0 { qb.Buffer.WriteByte(' ') - qb.Buffer.WriteString(andString) + qb.Buffer.WriteString(operator) qb.Buffer.WriteByte(' ') } qb.Buffer.WriteString(q) @@ -248,7 +271,7 @@ func (qb *Builder) conditionString() string { } func isEmpty(queryString string) bool { - return queryString == "" || queryString == emptyString + return queryString == "" } // Iterators over some strings diff --git a/event/query/builder_test.go b/event/query/builder_test.go index 15da502d0..b77c03434 100644 --- a/event/query/builder_test.go +++ b/event/query/builder_test.go @@ -12,7 +12,7 @@ func TestQueryBuilder(t *testing.T) { qb := NewBuilder() qry, err := qb.Query() require.NoError(t, err) - assert.Equal(t, emptyString, qry.String()) + assert.Equal(t, "", qry.String()) qb = qb.AndGreaterThanOrEqual("foo.size", 45) qry, err = qb.Query() @@ -41,12 +41,17 @@ func TestQueryBuilder(t *testing.T) { qry, err = qb.Query() require.NoError(t, err) assert.Equal(t, "foo = 'bar' AND frogs >= 4", qry.String()) + + qb = qb.Not() + qry, err = qb.Query() + require.NoError(t, err) + assert.Equal(t, "NOT (foo = 'bar' AND frogs >= 4)", qry.String()) } func makeTagMap(keyvals ...interface{}) TagMap { tmap := make(TagMap) for i := 0; i < len(keyvals); i += 2 { - tmap[keyvals[i].(string)] = structure.StringifyKey(keyvals[i+1]) + tmap[keyvals[i].(string)] = structure.Stringify(keyvals[i+1]) } return tmap } diff --git a/event/query/empty.go b/event/query/empty.go index 91d2195e5..c771b331a 100644 --- a/event/query/empty.go +++ b/event/query/empty.go @@ -13,7 +13,7 @@ func (Empty) Matches(tags Tagged) bool { } func (Empty) String() string { - return "empty" + return "" } func (Empty) Query() (Query, error) { diff --git a/event/query/expression.go b/event/query/expression.go index d19222261..64a88ce6a 100644 --- a/event/query/expression.go +++ b/event/query/expression.go @@ -30,6 +30,8 @@ const ( OpGreater OpEqual OpContains + OpNotEqual + OpNot ) var opNames = map[Operator]string{ @@ -41,12 +43,21 @@ var opNames = map[Operator]string{ OpGreater: ">", OpEqual: "=", OpContains: "CONTAINS", + OpNotEqual: "!=", + OpNot: "Not", } func (op Operator) String() string { return opNames[op] } +func (op Operator) Arity() int { + if op == OpNot { + return 1 + } + return 2 +} + // Instruction is a container suitable for the code tape and the stack to hold values an operations type instruction struct { op Operator @@ -93,6 +104,7 @@ func (e *Expression) Evaluate(getTagValue func(tag string) (interface{}, bool)) } var left, right *instruction stack := make([]*instruction, 0, len(e.code)) + var err error for _, in := range e.code { if in.op == OpTerminal { // just push terminals on to the stack @@ -100,13 +112,14 @@ func (e *Expression) Evaluate(getTagValue func(tag string) (interface{}, bool)) continue } - if len(stack) < 2 { - return false, fmt.Errorf("cannot pop from stack for query expression [%v] because stack has "+ - "fewer than 2 elements", e) + stack, left, right, err = pop(stack, in.op) + if err != nil { + return false, fmt.Errorf("cannot process instruction %v in expression [%v]: %w", in, e, err) } - stack, left, right = pop(stack) ins := &instruction{} switch in.op { + case OpNot: + ins.match = !right.match case OpAnd: ins.match = left.match && right.match case OpOr: @@ -147,8 +160,16 @@ func (e *Expression) explainf(fmt string, args ...interface{}) { } } -func pop(stack []*instruction) ([]*instruction, *instruction, *instruction) { - return stack[:len(stack)-2], stack[len(stack)-2], stack[len(stack)-1] +func pop(stack []*instruction, op Operator) ([]*instruction, *instruction, *instruction, error) { + arity := op.Arity() + if len(stack) < arity { + return stack, nil, nil, fmt.Errorf("cannot pop arguments for arity %d operator %v from stack "+ + "because stack has fewer than %d elements", arity, op, arity) + } + if arity == 1 { + return stack[:len(stack)-1], nil, stack[len(stack)-1], nil + } + return stack[:len(stack)-2], stack[len(stack)-2], stack[len(stack)-1], nil } func compareString(op Operator, tagValue interface{}, value string) bool { @@ -158,6 +179,8 @@ func compareString(op Operator, tagValue interface{}, value string) bool { return strings.Contains(tagString, value) case OpEqual: return tagString == value + case OpNotEqual: + return tagString != value } return false } @@ -206,6 +229,8 @@ func compareNumber(op Operator, tagValue interface{}, value *big.Float) bool { return cmp == 1 case OpEqual: return cmp == 0 + case OpNotEqual: + return cmp != 0 } return false } @@ -241,6 +266,8 @@ func compareTime(op Operator, tagValue interface{}, value time.Time) bool { return tagTime.After(value) case OpEqual: return tagTime.Equal(value) + case OpNotEqual: + return !tagTime.Equal(value) } return false } diff --git a/event/query/query.go b/event/query/query.go index e9c5b4807..eb2bdf740 100644 --- a/event/query/query.go +++ b/event/query/query.go @@ -37,6 +37,10 @@ func (m *MatchError) Error() string { return fmt.Sprintf("matching error occurred with tagged: %v", m.Cause) } +func IsEmpty(query Query) bool { + return query.String() == "" +} + // Condition represents a single condition within a query and consists of tag // (e.g. "tx.gas"), operator (e.g. "=") and operand (e.g. "7"). type Condition struct { @@ -54,11 +58,8 @@ func New(s string) (*PegQuery, error) { p.Expression.explainer = func(format string, args ...interface{}) { fmt.Printf(format, args...) } - err := p.Init() - if err != nil { - return nil, err - } - err = p.Parse() + p.Init() + err := p.Parse() if err != nil { return nil, err } diff --git a/event/query/query.peg b/event/query/query.peg index 7363a6a57..be2120322 100644 --- a/event/query/query.peg +++ b/event/query/query.peg @@ -14,13 +14,16 @@ e <- eor !. eor <- eand ( or eand { p.Operator(OpOr) })* -eand <- condition ( and condition { p.Operator(OpAnd) })* +eand <- enot ( and enot { p.Operator(OpAnd) })* + +enot <- not condition { p.Operator(OpNot) } / condition condition <- tag sp (le (number / time / date) { p.Operator(OpLessEqual) } / ge (number / time / date) { p.Operator(OpGreaterEqual) } / l (number / time / date) { p.Operator(OpLess) } / g (number / time / date) { p.Operator(OpGreater) } / equal (number / time / date / qvalue) { p.Operator(OpEqual) } + / ne (number / time / date / qvalue) { p.Operator(OpNotEqual) } / contains qvalue { p.Operator(OpContains) } ) sp / open eor close @@ -45,7 +48,9 @@ day <- ('0' / '1' / '2' / '3') digit and <- "AND" sp or <- "OR" sp +not <- "NOT" sp equal <- "=" sp +ne <- "!=" sp contains <- "CONTAINS" sp le <- "<=" sp ge <- ">=" sp diff --git a/event/query/query.peg.go b/event/query/query.peg.go index d9a83190b..49eefe9c0 100644 --- a/event/query/query.peg.go +++ b/event/query/query.peg.go @@ -1,11 +1,8 @@ package query -// Code generated by peg event/query/query.peg DO NOT EDIT. - import ( "fmt" - "io" - "os" + "math" "sort" "strconv" ) @@ -20,6 +17,7 @@ const ( rulee ruleeor ruleeand + ruleenot rulecondition ruletag ruleqvalue @@ -33,7 +31,9 @@ const ( ruleday ruleand ruleor + rulenot ruleequal + rulene rulecontains rulele rulege @@ -50,12 +50,18 @@ const ( ruleAction5 ruleAction6 ruleAction7 - rulePegText ruleAction8 ruleAction9 + rulePegText ruleAction10 ruleAction11 ruleAction12 + ruleAction13 + ruleAction14 + + rulePre + ruleIn + ruleSuf ) var rul3s = [...]string{ @@ -63,6 +69,7 @@ var rul3s = [...]string{ "e", "eor", "eand", + "enot", "condition", "tag", "qvalue", @@ -76,7 +83,9 @@ var rul3s = [...]string{ "day", "and", "or", + "not", "equal", + "ne", "contains", "le", "ge", @@ -93,21 +102,18 @@ var rul3s = [...]string{ "Action5", "Action6", "Action7", - "PegText", "Action8", "Action9", + "PegText", "Action10", "Action11", "Action12", -} + "Action13", + "Action14", -type token32 struct { - pegRule - begin, end uint32 -} - -func (t *token32) String() string { - return fmt.Sprintf("\x1B[34m%v\x1B[m %v %v", rul3s[t.pegRule], t.begin, t.end) + "Pre_", + "_In_", + "_Suf", } type node32 struct { @@ -115,43 +121,57 @@ type node32 struct { up, next *node32 } -func (node *node32) print(w io.Writer, pretty bool, buffer string) { - var print func(node *node32, depth int) - print = func(node *node32, depth int) { - for node != nil { - for c := 0; c < depth; c++ { - fmt.Fprintf(w, " ") - } - rule := rul3s[node.pegRule] - quote := strconv.Quote(string(([]rune(buffer)[node.begin:node.end]))) - if !pretty { - fmt.Fprintf(w, "%v %v\n", rule, quote) - } else { - fmt.Fprintf(w, "\x1B[34m%v\x1B[m %v\n", rule, quote) - } - if node.up != nil { - print(node.up, depth+1) - } - node = node.next +func (node *node32) print(depth int, buffer string) { + for node != nil { + for c := 0; c < depth; c++ { + fmt.Printf(" ") + } + fmt.Printf("\x1B[34m%v\x1B[m %v\n", rul3s[node.pegRule], strconv.Quote(string(([]rune(buffer)[node.begin:node.end])))) + if node.up != nil { + node.up.print(depth+1, buffer) } + node = node.next } - print(node, 0) } -func (node *node32) Print(w io.Writer, buffer string) { - node.print(w, false, buffer) +func (node *node32) Print(buffer string) { + node.print(0, buffer) +} + +type element struct { + node *node32 + down *element +} + +/* ${@} bit structure for abstract syntax tree */ +type token32 struct { + pegRule + begin, end, next uint32 +} + +func (t *token32) isZero() bool { + return t.pegRule == ruleUnknown && t.begin == 0 && t.end == 0 && t.next == 0 } -func (node *node32) PrettyPrint(w io.Writer, buffer string) { - node.print(w, true, buffer) +func (t *token32) isParentOf(u token32) bool { + return t.begin <= u.begin && t.end >= u.end && t.next > u.next +} + +func (t *token32) getToken32() token32 { + return token32{pegRule: t.pegRule, begin: uint32(t.begin), end: uint32(t.end), next: uint32(t.next)} +} + +func (t *token32) String() string { + return fmt.Sprintf("\x1B[34m%v\x1B[m %v %v %v", rul3s[t.pegRule], t.begin, t.end, t.next) } type tokens32 struct { - tree []token32 + tree []token32 + ordered [][]token32 } -func (t *tokens32) Trim(length uint32) { - t.tree = t.tree[:length] +func (t *tokens32) trim(length int) { + t.tree = t.tree[0:length] } func (t *tokens32) Print() { @@ -160,14 +180,51 @@ func (t *tokens32) Print() { } } -func (t *tokens32) AST() *node32 { - type element struct { - node *node32 - down *element +func (t *tokens32) Order() [][]token32 { + if t.ordered != nil { + return t.ordered + } + + depths := make([]int32, 1, math.MaxInt16) + for i, token := range t.tree { + if token.pegRule == ruleUnknown { + t.tree = t.tree[:i] + break + } + depth := int(token.next) + if length := len(depths); depth >= length { + depths = depths[:depth+1] + } + depths[depth]++ + } + depths = append(depths, 0) + + ordered, pool := make([][]token32, len(depths)), make([]token32, len(t.tree)+len(depths)) + for i, depth := range depths { + depth++ + ordered[i], pool, depths[i] = pool[:depth], pool[depth:], 0 + } + + for i, token := range t.tree { + depth := token.next + token.next = uint32(i) + ordered[depth][depths[depth]] = token + depths[depth]++ } + t.ordered = ordered + return ordered +} + +type state32 struct { + token32 + depths []int32 + leaf bool +} + +func (t *tokens32) AST() *node32 { tokens := t.Tokens() - var stack *element - for _, token := range tokens { + stack := &element{node: &node32{token32: <-tokens}} + for token := range tokens { if token.begin == token.end { continue } @@ -179,35 +236,168 @@ func (t *tokens32) AST() *node32 { } stack = &element{node: node, down: stack} } - if stack != nil { - return stack.node + return stack.node +} + +func (t *tokens32) PreOrder() (<-chan state32, [][]token32) { + s, ordered := make(chan state32, 6), t.Order() + go func() { + var states [8]state32 + for i := range states { + states[i].depths = make([]int32, len(ordered)) + } + depths, state, depth := make([]int32, len(ordered)), 0, 1 + write := func(t token32, leaf bool) { + S := states[state] + state, S.pegRule, S.begin, S.end, S.next, S.leaf = (state+1)%8, t.pegRule, t.begin, t.end, uint32(depth), leaf + copy(S.depths, depths) + s <- S + } + + states[state].token32 = ordered[0][0] + depths[0]++ + state++ + a, b := ordered[depth-1][depths[depth-1]-1], ordered[depth][depths[depth]] + depthFirstSearch: + for { + for { + if i := depths[depth]; i > 0 { + if c, j := ordered[depth][i-1], depths[depth-1]; a.isParentOf(c) && + (j < 2 || !ordered[depth-1][j-2].isParentOf(c)) { + if c.end != b.begin { + write(token32{pegRule: ruleIn, begin: c.end, end: b.begin}, true) + } + break + } + } + + if a.begin < b.begin { + write(token32{pegRule: rulePre, begin: a.begin, end: b.begin}, true) + } + break + } + + next := depth + 1 + if c := ordered[next][depths[next]]; c.pegRule != ruleUnknown && b.isParentOf(c) { + write(b, false) + depths[depth]++ + depth, a, b = next, b, c + continue + } + + write(b, true) + depths[depth]++ + c, parent := ordered[depth][depths[depth]], true + for { + if c.pegRule != ruleUnknown && a.isParentOf(c) { + b = c + continue depthFirstSearch + } else if parent && b.end != a.end { + write(token32{pegRule: ruleSuf, begin: b.end, end: a.end}, true) + } + + depth-- + if depth > 0 { + a, b, c = ordered[depth-1][depths[depth-1]-1], a, ordered[depth][depths[depth]] + parent = a.isParentOf(b) + continue + } + + break depthFirstSearch + } + } + + close(s) + }() + return s, ordered +} + +func (t *tokens32) PrintSyntax() { + tokens, ordered := t.PreOrder() + max := -1 + for token := range tokens { + if !token.leaf { + fmt.Printf("%v", token.begin) + for i, leaf, depths := 0, int(token.next), token.depths; i < leaf; i++ { + fmt.Printf(" \x1B[36m%v\x1B[m", rul3s[ordered[i][depths[i]-1].pegRule]) + } + fmt.Printf(" \x1B[36m%v\x1B[m\n", rul3s[token.pegRule]) + } else if token.begin == token.end { + fmt.Printf("%v", token.begin) + for i, leaf, depths := 0, int(token.next), token.depths; i < leaf; i++ { + fmt.Printf(" \x1B[31m%v\x1B[m", rul3s[ordered[i][depths[i]-1].pegRule]) + } + fmt.Printf(" \x1B[31m%v\x1B[m\n", rul3s[token.pegRule]) + } else { + for c, end := token.begin, token.end; c < end; c++ { + if i := int(c); max+1 < i { + for j := max; j < i; j++ { + fmt.Printf("skip %v %v\n", j, token.String()) + } + max = i + } else if i := int(c); i <= max { + for j := i; j <= max; j++ { + fmt.Printf("dupe %v %v\n", j, token.String()) + } + } else { + max = int(c) + } + fmt.Printf("%v", c) + for i, leaf, depths := 0, int(token.next), token.depths; i < leaf; i++ { + fmt.Printf(" \x1B[34m%v\x1B[m", rul3s[ordered[i][depths[i]-1].pegRule]) + } + fmt.Printf(" \x1B[34m%v\x1B[m\n", rul3s[token.pegRule]) + } + fmt.Printf("\n") + } } - return nil } func (t *tokens32) PrintSyntaxTree(buffer string) { - t.AST().Print(os.Stdout, buffer) + tokens, _ := t.PreOrder() + for token := range tokens { + for c := 0; c < int(token.next); c++ { + fmt.Printf(" ") + } + fmt.Printf("\x1B[34m%v\x1B[m %v\n", rul3s[token.pegRule], strconv.Quote(string(([]rune(buffer)[token.begin:token.end])))) + } } -func (t *tokens32) WriteSyntaxTree(w io.Writer, buffer string) { - t.AST().Print(w, buffer) +func (t *tokens32) Add(rule pegRule, begin, end, depth uint32, index int) { + t.tree[index] = token32{pegRule: rule, begin: uint32(begin), end: uint32(end), next: uint32(depth)} } -func (t *tokens32) PrettyPrintSyntaxTree(buffer string) { - t.AST().PrettyPrint(os.Stdout, buffer) +func (t *tokens32) Tokens() <-chan token32 { + s := make(chan token32, 16) + go func() { + for _, v := range t.tree { + s <- v.getToken32() + } + close(s) + }() + return s } -func (t *tokens32) Add(rule pegRule, begin, end, index uint32) { - tree, i := t.tree, int(index) - if i >= len(tree) { - t.tree = append(tree, token32{pegRule: rule, begin: begin, end: end}) - return +func (t *tokens32) Error() []token32 { + ordered := t.Order() + length := len(ordered) + tokens, length := make([]token32, length), length-1 + for i := range tokens { + o := ordered[length-i] + if len(o) > 1 { + tokens[i] = o[len(o)-2].getToken32() + } } - tree[i] = token32{pegRule: rule, begin: begin, end: end} + return tokens } -func (t *tokens32) Tokens() []token32 { - return t.tree +func (t *tokens32) Expand(index int) { + tree := t.tree + if index >= len(tree) { + expanded := make([]token32, 2*len(tree)) + copy(expanded, tree) + t.tree = expanded + } } type QueryParser struct { @@ -215,21 +405,13 @@ type QueryParser struct { Buffer string buffer []rune - rules [40]func() bool - parse func(rule ...int) error - reset func() + rules [45]func() bool + Parse func(rule ...int) error + Reset func() Pretty bool tokens32 } -func (p *QueryParser) Parse(rule ...int) error { - return p.parse(rule...) -} - -func (p *QueryParser) Reset() { - p.reset() -} - type textPosition struct { line, symbol int } @@ -267,7 +449,7 @@ type parseError struct { } func (e *parseError) Error() string { - tokens, err := []token32{e.max}, "\n" + tokens, error := []token32{e.max}, "\n" positions, p := make([]int, 2*len(tokens)), 0 for _, token := range tokens { positions[p], p = int(token.begin), p+1 @@ -280,31 +462,27 @@ func (e *parseError) Error() string { } for _, token := range tokens { begin, end := int(token.begin), int(token.end) - err += fmt.Sprintf(format, + error += fmt.Sprintf(format, rul3s[token.pegRule], translations[begin].line, translations[begin].symbol, translations[end].line, translations[end].symbol, strconv.Quote(string(e.p.buffer[begin:end]))) } - return err + return error } func (p *QueryParser) PrintSyntaxTree() { - if p.Pretty { - p.tokens32.PrettyPrintSyntaxTree(p.Buffer) - } else { - p.tokens32.PrintSyntaxTree(p.Buffer) - } + p.tokens32.PrintSyntaxTree(p.Buffer) } -func (p *QueryParser) WriteSyntaxTree(w io.Writer) { - p.tokens32.WriteSyntaxTree(w, p.Buffer) +func (p *QueryParser) Highlighter() { + p.PrintSyntax() } func (p *QueryParser) Execute() { buffer, _buffer, text, begin, end := p.Buffer, p.buffer, "", 0, 0 - for _, token := range p.Tokens() { + for token := range p.Tokens() { switch token.pegRule { case rulePegText: @@ -316,26 +494,30 @@ func (p *QueryParser) Execute() { case ruleAction1: p.Operator(OpAnd) case ruleAction2: - p.Operator(OpLessEqual) + p.Operator(OpNot) case ruleAction3: - p.Operator(OpGreaterEqual) + p.Operator(OpLessEqual) case ruleAction4: - p.Operator(OpLess) + p.Operator(OpGreaterEqual) case ruleAction5: - p.Operator(OpGreater) + p.Operator(OpLess) case ruleAction6: - p.Operator(OpEqual) + p.Operator(OpGreater) case ruleAction7: - p.Operator(OpContains) + p.Operator(OpEqual) case ruleAction8: - p.Tag(buffer[begin:end]) + p.Operator(OpNotEqual) case ruleAction9: - p.Value(buffer[begin:end]) + p.Operator(OpContains) case ruleAction10: - p.Number(buffer[begin:end]) + p.Tag(buffer[begin:end]) case ruleAction11: - p.Time(buffer[begin:end]) + p.Value(buffer[begin:end]) case ruleAction12: + p.Number(buffer[begin:end]) + case ruleAction13: + p.Time(buffer[begin:end]) + case ruleAction14: p.Date(buffer[begin:end]) } @@ -343,46 +525,17 @@ func (p *QueryParser) Execute() { _, _, _, _, _ = buffer, _buffer, text, begin, end } -func Pretty(pretty bool) func(*QueryParser) error { - return func(p *QueryParser) error { - p.Pretty = pretty - return nil - } -} - -func Size(size int) func(*QueryParser) error { - return func(p *QueryParser) error { - p.tokens32 = tokens32{tree: make([]token32, 0, size)} - return nil - } -} -func (p *QueryParser) Init(options ...func(*QueryParser) error) error { - var ( - max token32 - position, tokenIndex uint32 - buffer []rune - ) - for _, option := range options { - err := option(p) - if err != nil { - return err - } +func (p *QueryParser) Init() { + p.buffer = []rune(p.Buffer) + if len(p.buffer) == 0 || p.buffer[len(p.buffer)-1] != endSymbol { + p.buffer = append(p.buffer, endSymbol) } - p.reset = func() { - max = token32{} - position, tokenIndex = 0, 0 - p.buffer = []rune(p.Buffer) - if len(p.buffer) == 0 || p.buffer[len(p.buffer)-1] != endSymbol { - p.buffer = append(p.buffer, endSymbol) - } - buffer = p.buffer - } - p.reset() + tree := tokens32{tree: make([]token32, math.MaxInt16)} + var max token32 + position, depth, tokenIndex, buffer, _rules := uint32(0), uint32(0), 0, p.buffer, p.rules - _rules := p.rules - tree := p.tokens32 - p.parse = func(rule ...int) error { + p.Parse = func(rule ...int) error { r := 1 if len(rule) > 0 { r = rule[0] @@ -390,17 +543,22 @@ func (p *QueryParser) Init(options ...func(*QueryParser) error) error { matches := p.rules[r]() p.tokens32 = tree if matches { - p.Trim(tokenIndex) + p.trim(tokenIndex) return nil } return &parseError{p, max} } + p.Reset = func() { + position, tokenIndex, depth = 0, 0, 0 + } + add := func(rule pegRule, begin uint32) { - tree.Add(rule, begin, position, tokenIndex) + tree.Expand(tokenIndex) + tree.Add(rule, begin, position, depth, tokenIndex) tokenIndex++ if begin != position && position > max.end { - max = token32{rule, begin, position} + max = token32{rule, begin, position, depth} } } @@ -432,39 +590,42 @@ func (p *QueryParser) Init(options ...func(*QueryParser) error) error { nil, /* 0 e <- <(eor !.)> */ func() bool { - position0, tokenIndex0 := position, tokenIndex + position0, tokenIndex0, depth0 := position, tokenIndex, depth { position1 := position + depth++ if !_rules[ruleeor]() { goto l0 } { - position2, tokenIndex2 := position, tokenIndex + position2, tokenIndex2, depth2 := position, tokenIndex, depth if !matchDot() { goto l2 } goto l0 l2: - position, tokenIndex = position2, tokenIndex2 + position, tokenIndex, depth = position2, tokenIndex2, depth2 } + depth-- add(rulee, position1) } return true l0: - position, tokenIndex = position0, tokenIndex0 + position, tokenIndex, depth = position0, tokenIndex0, depth0 return false }, /* 1 eor <- <(eand (or eand Action0)*)> */ func() bool { - position3, tokenIndex3 := position, tokenIndex + position3, tokenIndex3, depth3 := position, tokenIndex, depth { position4 := position + depth++ if !_rules[ruleeand]() { goto l3 } l5: { - position6, tokenIndex6 := position, tokenIndex + position6, tokenIndex6, depth6 := position, tokenIndex, depth if !_rules[ruleor]() { goto l6 } @@ -476,30 +637,32 @@ func (p *QueryParser) Init(options ...func(*QueryParser) error) error { } goto l5 l6: - position, tokenIndex = position6, tokenIndex6 + position, tokenIndex, depth = position6, tokenIndex6, depth6 } + depth-- add(ruleeor, position4) } return true l3: - position, tokenIndex = position3, tokenIndex3 + position, tokenIndex, depth = position3, tokenIndex3, depth3 return false }, - /* 2 eand <- <(condition (and condition Action1)*)> */ + /* 2 eand <- <(enot (and enot Action1)*)> */ func() bool { - position7, tokenIndex7 := position, tokenIndex + position7, tokenIndex7, depth7 := position, tokenIndex, depth { position8 := position - if !_rules[rulecondition]() { + depth++ + if !_rules[ruleenot]() { goto l7 } l9: { - position10, tokenIndex10 := position, tokenIndex + position10, tokenIndex10, depth10 := position, tokenIndex, depth if !_rules[ruleand]() { goto l10 } - if !_rules[rulecondition]() { + if !_rules[ruleenot]() { goto l10 } if !_rules[ruleAction1]() { @@ -507,75 +670,82 @@ func (p *QueryParser) Init(options ...func(*QueryParser) error) error { } goto l9 l10: - position, tokenIndex = position10, tokenIndex10 + position, tokenIndex, depth = position10, tokenIndex10, depth10 } + depth-- add(ruleeand, position8) } return true l7: - position, tokenIndex = position7, tokenIndex7 + position, tokenIndex, depth = position7, tokenIndex7, depth7 return false }, - /* 3 condition <- <((tag sp ((le (number / time / date) Action2) / (ge (number / time / date) Action3) / (l (number / time / date) Action4) / (g (number / time / date) Action5) / (equal (number / time / date / qvalue) Action6) / (contains qvalue Action7)) sp) / (open eor close))> */ + /* 3 enot <- <((not condition Action2) / condition)> */ func() bool { - position11, tokenIndex11 := position, tokenIndex + position11, tokenIndex11, depth11 := position, tokenIndex, depth { position12 := position + depth++ { - position13, tokenIndex13 := position, tokenIndex - if !_rules[ruletag]() { + position13, tokenIndex13, depth13 := position, tokenIndex, depth + if !_rules[rulenot]() { goto l14 } - if !_rules[rulesp]() { + if !_rules[rulecondition]() { + goto l14 + } + if !_rules[ruleAction2]() { goto l14 } + goto l13 + l14: + position, tokenIndex, depth = position13, tokenIndex13, depth13 + if !_rules[rulecondition]() { + goto l11 + } + } + l13: + depth-- + add(ruleenot, position12) + } + return true + l11: + position, tokenIndex, depth = position11, tokenIndex11, depth11 + return false + }, + /* 4 condition <- <((tag sp ((le (number / time / date) Action3) / (ge (number / time / date) Action4) / (l (number / time / date) Action5) / (g (number / time / date) Action6) / (equal (number / time / date / qvalue) Action7) / (ne (number / time / date / qvalue) Action8) / (contains qvalue Action9)) sp) / (open eor close))> */ + func() bool { + position15, tokenIndex15, depth15 := position, tokenIndex, depth + { + position16 := position + depth++ + { + position17, tokenIndex17, depth17 := position, tokenIndex, depth + if !_rules[ruletag]() { + goto l18 + } + if !_rules[rulesp]() { + goto l18 + } { - position15, tokenIndex15 := position, tokenIndex + position19, tokenIndex19, depth19 := position, tokenIndex, depth if !_rules[rulele]() { - goto l16 - } - { - position17, tokenIndex17 := position, tokenIndex - if !_rules[rulenumber]() { - goto l18 - } - goto l17 - l18: - position, tokenIndex = position17, tokenIndex17 - if !_rules[ruletime]() { - goto l19 - } - goto l17 - l19: - position, tokenIndex = position17, tokenIndex17 - if !_rules[ruledate]() { - goto l16 - } - } - l17: - if !_rules[ruleAction2]() { - goto l16 - } - goto l15 - l16: - position, tokenIndex = position15, tokenIndex15 - if !_rules[rulege]() { goto l20 } { - position21, tokenIndex21 := position, tokenIndex + position21, tokenIndex21, depth21 := position, tokenIndex, depth if !_rules[rulenumber]() { goto l22 } goto l21 l22: - position, tokenIndex = position21, tokenIndex21 + position, tokenIndex, depth = position21, tokenIndex21, depth21 if !_rules[ruletime]() { goto l23 } goto l21 l23: - position, tokenIndex = position21, tokenIndex21 + position, tokenIndex, depth = position21, tokenIndex21, depth21 if !_rules[ruledate]() { goto l20 } @@ -584,26 +754,26 @@ func (p *QueryParser) Init(options ...func(*QueryParser) error) error { if !_rules[ruleAction3]() { goto l20 } - goto l15 + goto l19 l20: - position, tokenIndex = position15, tokenIndex15 - if !_rules[rulel]() { + position, tokenIndex, depth = position19, tokenIndex19, depth19 + if !_rules[rulege]() { goto l24 } { - position25, tokenIndex25 := position, tokenIndex + position25, tokenIndex25, depth25 := position, tokenIndex, depth if !_rules[rulenumber]() { goto l26 } goto l25 l26: - position, tokenIndex = position25, tokenIndex25 + position, tokenIndex, depth = position25, tokenIndex25, depth25 if !_rules[ruletime]() { goto l27 } goto l25 l27: - position, tokenIndex = position25, tokenIndex25 + position, tokenIndex, depth = position25, tokenIndex25, depth25 if !_rules[ruledate]() { goto l24 } @@ -612,26 +782,26 @@ func (p *QueryParser) Init(options ...func(*QueryParser) error) error { if !_rules[ruleAction4]() { goto l24 } - goto l15 + goto l19 l24: - position, tokenIndex = position15, tokenIndex15 - if !_rules[ruleg]() { + position, tokenIndex, depth = position19, tokenIndex19, depth19 + if !_rules[rulel]() { goto l28 } { - position29, tokenIndex29 := position, tokenIndex + position29, tokenIndex29, depth29 := position, tokenIndex, depth if !_rules[rulenumber]() { goto l30 } goto l29 l30: - position, tokenIndex = position29, tokenIndex29 + position, tokenIndex, depth = position29, tokenIndex29, depth29 if !_rules[ruletime]() { goto l31 } goto l29 l31: - position, tokenIndex = position29, tokenIndex29 + position, tokenIndex, depth = position29, tokenIndex29, depth29 if !_rules[ruledate]() { goto l28 } @@ -640,33 +810,27 @@ func (p *QueryParser) Init(options ...func(*QueryParser) error) error { if !_rules[ruleAction5]() { goto l28 } - goto l15 + goto l19 l28: - position, tokenIndex = position15, tokenIndex15 - if !_rules[ruleequal]() { + position, tokenIndex, depth = position19, tokenIndex19, depth19 + if !_rules[ruleg]() { goto l32 } { - position33, tokenIndex33 := position, tokenIndex + position33, tokenIndex33, depth33 := position, tokenIndex, depth if !_rules[rulenumber]() { goto l34 } goto l33 l34: - position, tokenIndex = position33, tokenIndex33 + position, tokenIndex, depth = position33, tokenIndex33, depth33 if !_rules[ruletime]() { goto l35 } goto l33 l35: - position, tokenIndex = position33, tokenIndex33 + position, tokenIndex, depth = position33, tokenIndex33, depth33 if !_rules[ruledate]() { - goto l36 - } - goto l33 - l36: - position, tokenIndex = position33, tokenIndex33 - if !_rules[ruleqvalue]() { goto l32 } } @@ -674,1304 +838,1525 @@ func (p *QueryParser) Init(options ...func(*QueryParser) error) error { if !_rules[ruleAction6]() { goto l32 } - goto l15 + goto l19 l32: - position, tokenIndex = position15, tokenIndex15 + position, tokenIndex, depth = position19, tokenIndex19, depth19 + if !_rules[ruleequal]() { + goto l36 + } + { + position37, tokenIndex37, depth37 := position, tokenIndex, depth + if !_rules[rulenumber]() { + goto l38 + } + goto l37 + l38: + position, tokenIndex, depth = position37, tokenIndex37, depth37 + if !_rules[ruletime]() { + goto l39 + } + goto l37 + l39: + position, tokenIndex, depth = position37, tokenIndex37, depth37 + if !_rules[ruledate]() { + goto l40 + } + goto l37 + l40: + position, tokenIndex, depth = position37, tokenIndex37, depth37 + if !_rules[ruleqvalue]() { + goto l36 + } + } + l37: + if !_rules[ruleAction7]() { + goto l36 + } + goto l19 + l36: + position, tokenIndex, depth = position19, tokenIndex19, depth19 + if !_rules[rulene]() { + goto l41 + } + { + position42, tokenIndex42, depth42 := position, tokenIndex, depth + if !_rules[rulenumber]() { + goto l43 + } + goto l42 + l43: + position, tokenIndex, depth = position42, tokenIndex42, depth42 + if !_rules[ruletime]() { + goto l44 + } + goto l42 + l44: + position, tokenIndex, depth = position42, tokenIndex42, depth42 + if !_rules[ruledate]() { + goto l45 + } + goto l42 + l45: + position, tokenIndex, depth = position42, tokenIndex42, depth42 + if !_rules[ruleqvalue]() { + goto l41 + } + } + l42: + if !_rules[ruleAction8]() { + goto l41 + } + goto l19 + l41: + position, tokenIndex, depth = position19, tokenIndex19, depth19 if !_rules[rulecontains]() { - goto l14 + goto l18 } if !_rules[ruleqvalue]() { - goto l14 + goto l18 } - if !_rules[ruleAction7]() { - goto l14 + if !_rules[ruleAction9]() { + goto l18 } } - l15: + l19: if !_rules[rulesp]() { - goto l14 + goto l18 } - goto l13 - l14: - position, tokenIndex = position13, tokenIndex13 + goto l17 + l18: + position, tokenIndex, depth = position17, tokenIndex17, depth17 if !_rules[ruleopen]() { - goto l11 + goto l15 } if !_rules[ruleeor]() { - goto l11 + goto l15 } if !_rules[ruleclose]() { - goto l11 + goto l15 } } - l13: - add(rulecondition, position12) + l17: + depth-- + add(rulecondition, position16) } return true - l11: - position, tokenIndex = position11, tokenIndex11 + l15: + position, tokenIndex, depth = position15, tokenIndex15, depth15 return false }, - /* 4 tag <- <(<(!(' ' / '\t' / '\n' / '\r' / '\\' / '(' / ')' / '"' / '\'' / '=' / '>' / '<') .)+> sp Action8)> */ + /* 5 tag <- <(<(!(' ' / '\t' / '\n' / '\r' / '\\' / '(' / ')' / '"' / '\'' / '=' / '>' / '<') .)+> sp Action10)> */ func() bool { - position37, tokenIndex37 := position, tokenIndex + position46, tokenIndex46, depth46 := position, tokenIndex, depth { - position38 := position + position47 := position + depth++ { - position39 := position + position48 := position + depth++ { - position42, tokenIndex42 := position, tokenIndex + position51, tokenIndex51, depth51 := position, tokenIndex, depth { - position43, tokenIndex43 := position, tokenIndex + position52, tokenIndex52, depth52 := position, tokenIndex, depth if buffer[position] != rune(' ') { - goto l44 + goto l53 } position++ - goto l43 - l44: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l53: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('\t') { - goto l45 + goto l54 } position++ - goto l43 - l45: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l54: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('\n') { - goto l46 + goto l55 } position++ - goto l43 - l46: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l55: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('\r') { - goto l47 + goto l56 } position++ - goto l43 - l47: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l56: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('\\') { - goto l48 + goto l57 } position++ - goto l43 - l48: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l57: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('(') { - goto l49 + goto l58 } position++ - goto l43 - l49: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l58: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune(')') { - goto l50 + goto l59 } position++ - goto l43 - l50: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l59: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('"') { - goto l51 + goto l60 } position++ - goto l43 - l51: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l60: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('\'') { - goto l52 + goto l61 } position++ - goto l43 - l52: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l61: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('=') { - goto l53 + goto l62 } position++ - goto l43 - l53: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l62: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('>') { - goto l54 + goto l63 } position++ - goto l43 - l54: - position, tokenIndex = position43, tokenIndex43 + goto l52 + l63: + position, tokenIndex, depth = position52, tokenIndex52, depth52 if buffer[position] != rune('<') { - goto l42 + goto l51 } position++ } - l43: - goto l37 - l42: - position, tokenIndex = position42, tokenIndex42 + l52: + goto l46 + l51: + position, tokenIndex, depth = position51, tokenIndex51, depth51 } if !matchDot() { - goto l37 + goto l46 } - l40: + l49: { - position41, tokenIndex41 := position, tokenIndex + position50, tokenIndex50, depth50 := position, tokenIndex, depth { - position55, tokenIndex55 := position, tokenIndex + position64, tokenIndex64, depth64 := position, tokenIndex, depth { - position56, tokenIndex56 := position, tokenIndex + position65, tokenIndex65, depth65 := position, tokenIndex, depth if buffer[position] != rune(' ') { - goto l57 + goto l66 } position++ - goto l56 - l57: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l66: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('\t') { - goto l58 + goto l67 } position++ - goto l56 - l58: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l67: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('\n') { - goto l59 + goto l68 } position++ - goto l56 - l59: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l68: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('\r') { - goto l60 + goto l69 } position++ - goto l56 - l60: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l69: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('\\') { - goto l61 + goto l70 } position++ - goto l56 - l61: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l70: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('(') { - goto l62 + goto l71 } position++ - goto l56 - l62: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l71: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune(')') { - goto l63 + goto l72 } position++ - goto l56 - l63: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l72: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('"') { - goto l64 + goto l73 } position++ - goto l56 - l64: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l73: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('\'') { - goto l65 + goto l74 } position++ - goto l56 - l65: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l74: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('=') { - goto l66 + goto l75 } position++ - goto l56 - l66: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l75: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('>') { - goto l67 + goto l76 } position++ - goto l56 - l67: - position, tokenIndex = position56, tokenIndex56 + goto l65 + l76: + position, tokenIndex, depth = position65, tokenIndex65, depth65 if buffer[position] != rune('<') { - goto l55 + goto l64 } position++ } - l56: - goto l41 - l55: - position, tokenIndex = position55, tokenIndex55 + l65: + goto l50 + l64: + position, tokenIndex, depth = position64, tokenIndex64, depth64 } if !matchDot() { - goto l41 + goto l50 } - goto l40 - l41: - position, tokenIndex = position41, tokenIndex41 + goto l49 + l50: + position, tokenIndex, depth = position50, tokenIndex50, depth50 } - add(rulePegText, position39) + depth-- + add(rulePegText, position48) } if !_rules[rulesp]() { - goto l37 + goto l46 } - if !_rules[ruleAction8]() { - goto l37 + if !_rules[ruleAction10]() { + goto l46 } - add(ruletag, position38) + depth-- + add(ruletag, position47) } return true - l37: - position, tokenIndex = position37, tokenIndex37 + l46: + position, tokenIndex, depth = position46, tokenIndex46, depth46 return false }, - /* 5 qvalue <- <('\'' value '\'' sp)> */ + /* 6 qvalue <- <('\'' value '\'' sp)> */ func() bool { - position68, tokenIndex68 := position, tokenIndex + position77, tokenIndex77, depth77 := position, tokenIndex, depth { - position69 := position + position78 := position + depth++ if buffer[position] != rune('\'') { - goto l68 + goto l77 } position++ if !_rules[rulevalue]() { - goto l68 + goto l77 } if buffer[position] != rune('\'') { - goto l68 + goto l77 } position++ if !_rules[rulesp]() { - goto l68 + goto l77 } - add(ruleqvalue, position69) + depth-- + add(ruleqvalue, position78) } return true - l68: - position, tokenIndex = position68, tokenIndex68 + l77: + position, tokenIndex, depth = position77, tokenIndex77, depth77 return false }, - /* 6 value <- <(<(!('"' / '\'') .)*> Action9)> */ + /* 7 value <- <(<(!('"' / '\'') .)*> Action11)> */ func() bool { - position70, tokenIndex70 := position, tokenIndex + position79, tokenIndex79, depth79 := position, tokenIndex, depth { - position71 := position + position80 := position + depth++ { - position72 := position - l73: + position81 := position + depth++ + l82: { - position74, tokenIndex74 := position, tokenIndex + position83, tokenIndex83, depth83 := position, tokenIndex, depth { - position75, tokenIndex75 := position, tokenIndex + position84, tokenIndex84, depth84 := position, tokenIndex, depth { - position76, tokenIndex76 := position, tokenIndex + position85, tokenIndex85, depth85 := position, tokenIndex, depth if buffer[position] != rune('"') { - goto l77 + goto l86 } position++ - goto l76 - l77: - position, tokenIndex = position76, tokenIndex76 + goto l85 + l86: + position, tokenIndex, depth = position85, tokenIndex85, depth85 if buffer[position] != rune('\'') { - goto l75 + goto l84 } position++ } - l76: - goto l74 - l75: - position, tokenIndex = position75, tokenIndex75 + l85: + goto l83 + l84: + position, tokenIndex, depth = position84, tokenIndex84, depth84 } if !matchDot() { - goto l74 + goto l83 } - goto l73 - l74: - position, tokenIndex = position74, tokenIndex74 + goto l82 + l83: + position, tokenIndex, depth = position83, tokenIndex83, depth83 } - add(rulePegText, position72) + depth-- + add(rulePegText, position81) } - if !_rules[ruleAction9]() { - goto l70 + if !_rules[ruleAction11]() { + goto l79 } - add(rulevalue, position71) + depth-- + add(rulevalue, position80) } return true - l70: - position, tokenIndex = position70, tokenIndex70 + l79: + position, tokenIndex, depth = position79, tokenIndex79, depth79 return false }, - /* 7 number <- <(<('0' / ([1-9] digit* ('.' digit*)?))> Action10)> */ + /* 8 number <- <(<('0' / ([1-9] digit* ('.' digit*)?))> Action12)> */ func() bool { - position78, tokenIndex78 := position, tokenIndex + position87, tokenIndex87, depth87 := position, tokenIndex, depth { - position79 := position + position88 := position + depth++ { - position80 := position + position89 := position + depth++ { - position81, tokenIndex81 := position, tokenIndex + position90, tokenIndex90, depth90 := position, tokenIndex, depth if buffer[position] != rune('0') { - goto l82 + goto l91 } position++ - goto l81 - l82: - position, tokenIndex = position81, tokenIndex81 + goto l90 + l91: + position, tokenIndex, depth = position90, tokenIndex90, depth90 if c := buffer[position]; c < rune('1') || c > rune('9') { - goto l78 + goto l87 } position++ - l83: + l92: { - position84, tokenIndex84 := position, tokenIndex + position93, tokenIndex93, depth93 := position, tokenIndex, depth if !_rules[ruledigit]() { - goto l84 + goto l93 } - goto l83 - l84: - position, tokenIndex = position84, tokenIndex84 + goto l92 + l93: + position, tokenIndex, depth = position93, tokenIndex93, depth93 } { - position85, tokenIndex85 := position, tokenIndex + position94, tokenIndex94, depth94 := position, tokenIndex, depth if buffer[position] != rune('.') { - goto l85 + goto l94 } position++ - l87: + l96: { - position88, tokenIndex88 := position, tokenIndex + position97, tokenIndex97, depth97 := position, tokenIndex, depth if !_rules[ruledigit]() { - goto l88 + goto l97 } - goto l87 - l88: - position, tokenIndex = position88, tokenIndex88 + goto l96 + l97: + position, tokenIndex, depth = position97, tokenIndex97, depth97 } - goto l86 - l85: - position, tokenIndex = position85, tokenIndex85 + goto l95 + l94: + position, tokenIndex, depth = position94, tokenIndex94, depth94 } - l86: + l95: } - l81: - add(rulePegText, position80) + l90: + depth-- + add(rulePegText, position89) } - if !_rules[ruleAction10]() { - goto l78 + if !_rules[ruleAction12]() { + goto l87 } - add(rulenumber, position79) + depth-- + add(rulenumber, position88) } return true - l78: - position, tokenIndex = position78, tokenIndex78 + l87: + position, tokenIndex, depth = position87, tokenIndex87, depth87 return false }, - /* 8 digit <- <[0-9]> */ + /* 9 digit <- <[0-9]> */ func() bool { - position89, tokenIndex89 := position, tokenIndex + position98, tokenIndex98, depth98 := position, tokenIndex, depth { - position90 := position + position99 := position + depth++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l89 + goto l98 } position++ - add(ruledigit, position90) + depth-- + add(ruledigit, position99) } return true - l89: - position, tokenIndex = position89, tokenIndex89 + l98: + position, tokenIndex, depth = position98, tokenIndex98, depth98 return false }, - /* 9 time <- <(('t' / 'T') ('i' / 'I') ('m' / 'M') ('e' / 'E') ' ' <(year '-' month '-' day 'T' digit digit ':' digit digit ':' digit digit ((('-' / '+') digit digit ':' digit digit) / 'Z'))> Action11)> */ + /* 10 time <- <(('t' / 'T') ('i' / 'I') ('m' / 'M') ('e' / 'E') ' ' <(year '-' month '-' day 'T' digit digit ':' digit digit ':' digit digit ((('-' / '+') digit digit ':' digit digit) / 'Z'))> Action13)> */ func() bool { - position91, tokenIndex91 := position, tokenIndex + position100, tokenIndex100, depth100 := position, tokenIndex, depth { - position92 := position + position101 := position + depth++ { - position93, tokenIndex93 := position, tokenIndex + position102, tokenIndex102, depth102 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l94 + goto l103 } position++ - goto l93 - l94: - position, tokenIndex = position93, tokenIndex93 + goto l102 + l103: + position, tokenIndex, depth = position102, tokenIndex102, depth102 if buffer[position] != rune('T') { - goto l91 + goto l100 } position++ } - l93: + l102: { - position95, tokenIndex95 := position, tokenIndex + position104, tokenIndex104, depth104 := position, tokenIndex, depth if buffer[position] != rune('i') { - goto l96 + goto l105 } position++ - goto l95 - l96: - position, tokenIndex = position95, tokenIndex95 + goto l104 + l105: + position, tokenIndex, depth = position104, tokenIndex104, depth104 if buffer[position] != rune('I') { - goto l91 + goto l100 } position++ } - l95: + l104: { - position97, tokenIndex97 := position, tokenIndex + position106, tokenIndex106, depth106 := position, tokenIndex, depth if buffer[position] != rune('m') { - goto l98 + goto l107 } position++ - goto l97 - l98: - position, tokenIndex = position97, tokenIndex97 + goto l106 + l107: + position, tokenIndex, depth = position106, tokenIndex106, depth106 if buffer[position] != rune('M') { - goto l91 + goto l100 } position++ } - l97: + l106: { - position99, tokenIndex99 := position, tokenIndex + position108, tokenIndex108, depth108 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l100 + goto l109 } position++ - goto l99 - l100: - position, tokenIndex = position99, tokenIndex99 + goto l108 + l109: + position, tokenIndex, depth = position108, tokenIndex108, depth108 if buffer[position] != rune('E') { - goto l91 + goto l100 } position++ } - l99: + l108: if buffer[position] != rune(' ') { - goto l91 + goto l100 } position++ { - position101 := position + position110 := position + depth++ if !_rules[ruleyear]() { - goto l91 + goto l100 } if buffer[position] != rune('-') { - goto l91 + goto l100 } position++ if !_rules[rulemonth]() { - goto l91 + goto l100 } if buffer[position] != rune('-') { - goto l91 + goto l100 } position++ if !_rules[ruleday]() { - goto l91 + goto l100 } if buffer[position] != rune('T') { - goto l91 + goto l100 } position++ if !_rules[ruledigit]() { - goto l91 + goto l100 } if !_rules[ruledigit]() { - goto l91 + goto l100 } if buffer[position] != rune(':') { - goto l91 + goto l100 } position++ if !_rules[ruledigit]() { - goto l91 + goto l100 } if !_rules[ruledigit]() { - goto l91 + goto l100 } if buffer[position] != rune(':') { - goto l91 + goto l100 } position++ if !_rules[ruledigit]() { - goto l91 + goto l100 } if !_rules[ruledigit]() { - goto l91 + goto l100 } { - position102, tokenIndex102 := position, tokenIndex + position111, tokenIndex111, depth111 := position, tokenIndex, depth { - position104, tokenIndex104 := position, tokenIndex + position113, tokenIndex113, depth113 := position, tokenIndex, depth if buffer[position] != rune('-') { - goto l105 + goto l114 } position++ - goto l104 - l105: - position, tokenIndex = position104, tokenIndex104 + goto l113 + l114: + position, tokenIndex, depth = position113, tokenIndex113, depth113 if buffer[position] != rune('+') { - goto l103 + goto l112 } position++ } - l104: + l113: if !_rules[ruledigit]() { - goto l103 + goto l112 } if !_rules[ruledigit]() { - goto l103 + goto l112 } if buffer[position] != rune(':') { - goto l103 + goto l112 } position++ if !_rules[ruledigit]() { - goto l103 + goto l112 } if !_rules[ruledigit]() { - goto l103 + goto l112 } - goto l102 - l103: - position, tokenIndex = position102, tokenIndex102 + goto l111 + l112: + position, tokenIndex, depth = position111, tokenIndex111, depth111 if buffer[position] != rune('Z') { - goto l91 + goto l100 } position++ } - l102: - add(rulePegText, position101) + l111: + depth-- + add(rulePegText, position110) } - if !_rules[ruleAction11]() { - goto l91 + if !_rules[ruleAction13]() { + goto l100 } - add(ruletime, position92) + depth-- + add(ruletime, position101) } return true - l91: - position, tokenIndex = position91, tokenIndex91 + l100: + position, tokenIndex, depth = position100, tokenIndex100, depth100 return false }, - /* 10 date <- <(('d' / 'D') ('a' / 'A') ('t' / 'T') ('e' / 'E') ' ' <(year '-' month '-' day)> Action12)> */ + /* 11 date <- <(('d' / 'D') ('a' / 'A') ('t' / 'T') ('e' / 'E') ' ' <(year '-' month '-' day)> Action14)> */ func() bool { - position106, tokenIndex106 := position, tokenIndex + position115, tokenIndex115, depth115 := position, tokenIndex, depth { - position107 := position + position116 := position + depth++ { - position108, tokenIndex108 := position, tokenIndex + position117, tokenIndex117, depth117 := position, tokenIndex, depth if buffer[position] != rune('d') { - goto l109 + goto l118 } position++ - goto l108 - l109: - position, tokenIndex = position108, tokenIndex108 + goto l117 + l118: + position, tokenIndex, depth = position117, tokenIndex117, depth117 if buffer[position] != rune('D') { - goto l106 + goto l115 } position++ } - l108: + l117: { - position110, tokenIndex110 := position, tokenIndex + position119, tokenIndex119, depth119 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l111 + goto l120 } position++ - goto l110 - l111: - position, tokenIndex = position110, tokenIndex110 + goto l119 + l120: + position, tokenIndex, depth = position119, tokenIndex119, depth119 if buffer[position] != rune('A') { - goto l106 + goto l115 } position++ } - l110: + l119: { - position112, tokenIndex112 := position, tokenIndex + position121, tokenIndex121, depth121 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l113 + goto l122 } position++ - goto l112 - l113: - position, tokenIndex = position112, tokenIndex112 + goto l121 + l122: + position, tokenIndex, depth = position121, tokenIndex121, depth121 if buffer[position] != rune('T') { - goto l106 + goto l115 } position++ } - l112: + l121: { - position114, tokenIndex114 := position, tokenIndex + position123, tokenIndex123, depth123 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l115 + goto l124 } position++ - goto l114 - l115: - position, tokenIndex = position114, tokenIndex114 + goto l123 + l124: + position, tokenIndex, depth = position123, tokenIndex123, depth123 if buffer[position] != rune('E') { - goto l106 + goto l115 } position++ } - l114: + l123: if buffer[position] != rune(' ') { - goto l106 + goto l115 } position++ { - position116 := position + position125 := position + depth++ if !_rules[ruleyear]() { - goto l106 + goto l115 } if buffer[position] != rune('-') { - goto l106 + goto l115 } position++ if !_rules[rulemonth]() { - goto l106 + goto l115 } if buffer[position] != rune('-') { - goto l106 + goto l115 } position++ if !_rules[ruleday]() { - goto l106 + goto l115 } - add(rulePegText, position116) + depth-- + add(rulePegText, position125) } - if !_rules[ruleAction12]() { - goto l106 + if !_rules[ruleAction14]() { + goto l115 } - add(ruledate, position107) + depth-- + add(ruledate, position116) } return true - l106: - position, tokenIndex = position106, tokenIndex106 + l115: + position, tokenIndex, depth = position115, tokenIndex115, depth115 return false }, - /* 11 year <- <(('1' / '2') digit digit digit)> */ + /* 12 year <- <(('1' / '2') digit digit digit)> */ func() bool { - position117, tokenIndex117 := position, tokenIndex + position126, tokenIndex126, depth126 := position, tokenIndex, depth { - position118 := position + position127 := position + depth++ { - position119, tokenIndex119 := position, tokenIndex + position128, tokenIndex128, depth128 := position, tokenIndex, depth if buffer[position] != rune('1') { - goto l120 + goto l129 } position++ - goto l119 - l120: - position, tokenIndex = position119, tokenIndex119 + goto l128 + l129: + position, tokenIndex, depth = position128, tokenIndex128, depth128 if buffer[position] != rune('2') { - goto l117 + goto l126 } position++ } - l119: + l128: if !_rules[ruledigit]() { - goto l117 + goto l126 } if !_rules[ruledigit]() { - goto l117 + goto l126 } if !_rules[ruledigit]() { - goto l117 + goto l126 } - add(ruleyear, position118) + depth-- + add(ruleyear, position127) } return true - l117: - position, tokenIndex = position117, tokenIndex117 + l126: + position, tokenIndex, depth = position126, tokenIndex126, depth126 return false }, - /* 12 month <- <(('0' / '1') digit)> */ + /* 13 month <- <(('0' / '1') digit)> */ func() bool { - position121, tokenIndex121 := position, tokenIndex + position130, tokenIndex130, depth130 := position, tokenIndex, depth { - position122 := position + position131 := position + depth++ { - position123, tokenIndex123 := position, tokenIndex + position132, tokenIndex132, depth132 := position, tokenIndex, depth if buffer[position] != rune('0') { - goto l124 + goto l133 } position++ - goto l123 - l124: - position, tokenIndex = position123, tokenIndex123 + goto l132 + l133: + position, tokenIndex, depth = position132, tokenIndex132, depth132 if buffer[position] != rune('1') { - goto l121 + goto l130 } position++ } - l123: + l132: if !_rules[ruledigit]() { - goto l121 + goto l130 } - add(rulemonth, position122) + depth-- + add(rulemonth, position131) } return true - l121: - position, tokenIndex = position121, tokenIndex121 + l130: + position, tokenIndex, depth = position130, tokenIndex130, depth130 return false }, - /* 13 day <- <(('0' / '1' / '2' / '3') digit)> */ + /* 14 day <- <(('0' / '1' / '2' / '3') digit)> */ func() bool { - position125, tokenIndex125 := position, tokenIndex + position134, tokenIndex134, depth134 := position, tokenIndex, depth { - position126 := position + position135 := position + depth++ { - position127, tokenIndex127 := position, tokenIndex + position136, tokenIndex136, depth136 := position, tokenIndex, depth if buffer[position] != rune('0') { - goto l128 + goto l137 } position++ - goto l127 - l128: - position, tokenIndex = position127, tokenIndex127 + goto l136 + l137: + position, tokenIndex, depth = position136, tokenIndex136, depth136 if buffer[position] != rune('1') { - goto l129 + goto l138 } position++ - goto l127 - l129: - position, tokenIndex = position127, tokenIndex127 + goto l136 + l138: + position, tokenIndex, depth = position136, tokenIndex136, depth136 if buffer[position] != rune('2') { - goto l130 + goto l139 } position++ - goto l127 - l130: - position, tokenIndex = position127, tokenIndex127 + goto l136 + l139: + position, tokenIndex, depth = position136, tokenIndex136, depth136 if buffer[position] != rune('3') { - goto l125 + goto l134 } position++ } - l127: + l136: if !_rules[ruledigit]() { - goto l125 + goto l134 } - add(ruleday, position126) + depth-- + add(ruleday, position135) } return true - l125: - position, tokenIndex = position125, tokenIndex125 + l134: + position, tokenIndex, depth = position134, tokenIndex134, depth134 return false }, - /* 14 and <- <(('a' / 'A') ('n' / 'N') ('d' / 'D') sp)> */ + /* 15 and <- <(('a' / 'A') ('n' / 'N') ('d' / 'D') sp)> */ func() bool { - position131, tokenIndex131 := position, tokenIndex + position140, tokenIndex140, depth140 := position, tokenIndex, depth { - position132 := position + position141 := position + depth++ { - position133, tokenIndex133 := position, tokenIndex + position142, tokenIndex142, depth142 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l134 + goto l143 } position++ - goto l133 - l134: - position, tokenIndex = position133, tokenIndex133 + goto l142 + l143: + position, tokenIndex, depth = position142, tokenIndex142, depth142 if buffer[position] != rune('A') { - goto l131 + goto l140 } position++ } - l133: + l142: { - position135, tokenIndex135 := position, tokenIndex + position144, tokenIndex144, depth144 := position, tokenIndex, depth if buffer[position] != rune('n') { - goto l136 + goto l145 } position++ - goto l135 - l136: - position, tokenIndex = position135, tokenIndex135 + goto l144 + l145: + position, tokenIndex, depth = position144, tokenIndex144, depth144 if buffer[position] != rune('N') { - goto l131 + goto l140 } position++ } - l135: + l144: { - position137, tokenIndex137 := position, tokenIndex + position146, tokenIndex146, depth146 := position, tokenIndex, depth if buffer[position] != rune('d') { - goto l138 + goto l147 } position++ - goto l137 - l138: - position, tokenIndex = position137, tokenIndex137 + goto l146 + l147: + position, tokenIndex, depth = position146, tokenIndex146, depth146 if buffer[position] != rune('D') { - goto l131 + goto l140 } position++ } - l137: + l146: if !_rules[rulesp]() { - goto l131 + goto l140 } - add(ruleand, position132) + depth-- + add(ruleand, position141) } return true - l131: - position, tokenIndex = position131, tokenIndex131 + l140: + position, tokenIndex, depth = position140, tokenIndex140, depth140 return false }, - /* 15 or <- <(('o' / 'O') ('r' / 'R') sp)> */ + /* 16 or <- <(('o' / 'O') ('r' / 'R') sp)> */ func() bool { - position139, tokenIndex139 := position, tokenIndex + position148, tokenIndex148, depth148 := position, tokenIndex, depth { - position140 := position + position149 := position + depth++ { - position141, tokenIndex141 := position, tokenIndex + position150, tokenIndex150, depth150 := position, tokenIndex, depth if buffer[position] != rune('o') { - goto l142 + goto l151 } position++ - goto l141 - l142: - position, tokenIndex = position141, tokenIndex141 + goto l150 + l151: + position, tokenIndex, depth = position150, tokenIndex150, depth150 if buffer[position] != rune('O') { - goto l139 + goto l148 } position++ } - l141: + l150: { - position143, tokenIndex143 := position, tokenIndex + position152, tokenIndex152, depth152 := position, tokenIndex, depth if buffer[position] != rune('r') { - goto l144 + goto l153 } position++ - goto l143 - l144: - position, tokenIndex = position143, tokenIndex143 + goto l152 + l153: + position, tokenIndex, depth = position152, tokenIndex152, depth152 if buffer[position] != rune('R') { - goto l139 + goto l148 + } + position++ + } + l152: + if !_rules[rulesp]() { + goto l148 + } + depth-- + add(ruleor, position149) + } + return true + l148: + position, tokenIndex, depth = position148, tokenIndex148, depth148 + return false + }, + /* 17 not <- <(('n' / 'N') ('o' / 'O') ('t' / 'T') sp)> */ + func() bool { + position154, tokenIndex154, depth154 := position, tokenIndex, depth + { + position155 := position + depth++ + { + position156, tokenIndex156, depth156 := position, tokenIndex, depth + if buffer[position] != rune('n') { + goto l157 + } + position++ + goto l156 + l157: + position, tokenIndex, depth = position156, tokenIndex156, depth156 + if buffer[position] != rune('N') { + goto l154 + } + position++ + } + l156: + { + position158, tokenIndex158, depth158 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l159 + } + position++ + goto l158 + l159: + position, tokenIndex, depth = position158, tokenIndex158, depth158 + if buffer[position] != rune('O') { + goto l154 } position++ } - l143: + l158: + { + position160, tokenIndex160, depth160 := position, tokenIndex, depth + if buffer[position] != rune('t') { + goto l161 + } + position++ + goto l160 + l161: + position, tokenIndex, depth = position160, tokenIndex160, depth160 + if buffer[position] != rune('T') { + goto l154 + } + position++ + } + l160: + if !_rules[rulesp]() { + goto l154 + } + depth-- + add(rulenot, position155) + } + return true + l154: + position, tokenIndex, depth = position154, tokenIndex154, depth154 + return false + }, + /* 18 equal <- <('=' sp)> */ + func() bool { + position162, tokenIndex162, depth162 := position, tokenIndex, depth + { + position163 := position + depth++ + if buffer[position] != rune('=') { + goto l162 + } + position++ if !_rules[rulesp]() { - goto l139 + goto l162 } - add(ruleor, position140) + depth-- + add(ruleequal, position163) } return true - l139: - position, tokenIndex = position139, tokenIndex139 + l162: + position, tokenIndex, depth = position162, tokenIndex162, depth162 return false }, - /* 16 equal <- <('=' sp)> */ + /* 19 ne <- <('!' '=' sp)> */ func() bool { - position145, tokenIndex145 := position, tokenIndex + position164, tokenIndex164, depth164 := position, tokenIndex, depth { - position146 := position + position165 := position + depth++ + if buffer[position] != rune('!') { + goto l164 + } + position++ if buffer[position] != rune('=') { - goto l145 + goto l164 } position++ if !_rules[rulesp]() { - goto l145 + goto l164 } - add(ruleequal, position146) + depth-- + add(rulene, position165) } return true - l145: - position, tokenIndex = position145, tokenIndex145 + l164: + position, tokenIndex, depth = position164, tokenIndex164, depth164 return false }, - /* 17 contains <- <(('c' / 'C') ('o' / 'O') ('n' / 'N') ('t' / 'T') ('a' / 'A') ('i' / 'I') ('n' / 'N') ('s' / 'S') sp)> */ + /* 20 contains <- <(('c' / 'C') ('o' / 'O') ('n' / 'N') ('t' / 'T') ('a' / 'A') ('i' / 'I') ('n' / 'N') ('s' / 'S') sp)> */ func() bool { - position147, tokenIndex147 := position, tokenIndex + position166, tokenIndex166, depth166 := position, tokenIndex, depth { - position148 := position + position167 := position + depth++ { - position149, tokenIndex149 := position, tokenIndex + position168, tokenIndex168, depth168 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l150 + goto l169 } position++ - goto l149 - l150: - position, tokenIndex = position149, tokenIndex149 + goto l168 + l169: + position, tokenIndex, depth = position168, tokenIndex168, depth168 if buffer[position] != rune('C') { - goto l147 + goto l166 } position++ } - l149: + l168: { - position151, tokenIndex151 := position, tokenIndex + position170, tokenIndex170, depth170 := position, tokenIndex, depth if buffer[position] != rune('o') { - goto l152 + goto l171 } position++ - goto l151 - l152: - position, tokenIndex = position151, tokenIndex151 + goto l170 + l171: + position, tokenIndex, depth = position170, tokenIndex170, depth170 if buffer[position] != rune('O') { - goto l147 + goto l166 } position++ } - l151: + l170: { - position153, tokenIndex153 := position, tokenIndex + position172, tokenIndex172, depth172 := position, tokenIndex, depth if buffer[position] != rune('n') { - goto l154 + goto l173 } position++ - goto l153 - l154: - position, tokenIndex = position153, tokenIndex153 + goto l172 + l173: + position, tokenIndex, depth = position172, tokenIndex172, depth172 if buffer[position] != rune('N') { - goto l147 + goto l166 } position++ } - l153: + l172: { - position155, tokenIndex155 := position, tokenIndex + position174, tokenIndex174, depth174 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l156 + goto l175 } position++ - goto l155 - l156: - position, tokenIndex = position155, tokenIndex155 + goto l174 + l175: + position, tokenIndex, depth = position174, tokenIndex174, depth174 if buffer[position] != rune('T') { - goto l147 + goto l166 } position++ } - l155: + l174: { - position157, tokenIndex157 := position, tokenIndex + position176, tokenIndex176, depth176 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l158 + goto l177 } position++ - goto l157 - l158: - position, tokenIndex = position157, tokenIndex157 + goto l176 + l177: + position, tokenIndex, depth = position176, tokenIndex176, depth176 if buffer[position] != rune('A') { - goto l147 + goto l166 } position++ } - l157: + l176: { - position159, tokenIndex159 := position, tokenIndex + position178, tokenIndex178, depth178 := position, tokenIndex, depth if buffer[position] != rune('i') { - goto l160 + goto l179 } position++ - goto l159 - l160: - position, tokenIndex = position159, tokenIndex159 + goto l178 + l179: + position, tokenIndex, depth = position178, tokenIndex178, depth178 if buffer[position] != rune('I') { - goto l147 + goto l166 } position++ } - l159: + l178: { - position161, tokenIndex161 := position, tokenIndex + position180, tokenIndex180, depth180 := position, tokenIndex, depth if buffer[position] != rune('n') { - goto l162 + goto l181 } position++ - goto l161 - l162: - position, tokenIndex = position161, tokenIndex161 + goto l180 + l181: + position, tokenIndex, depth = position180, tokenIndex180, depth180 if buffer[position] != rune('N') { - goto l147 + goto l166 } position++ } - l161: + l180: { - position163, tokenIndex163 := position, tokenIndex + position182, tokenIndex182, depth182 := position, tokenIndex, depth if buffer[position] != rune('s') { - goto l164 + goto l183 } position++ - goto l163 - l164: - position, tokenIndex = position163, tokenIndex163 + goto l182 + l183: + position, tokenIndex, depth = position182, tokenIndex182, depth182 if buffer[position] != rune('S') { - goto l147 + goto l166 } position++ } - l163: + l182: if !_rules[rulesp]() { - goto l147 + goto l166 } - add(rulecontains, position148) + depth-- + add(rulecontains, position167) } return true - l147: - position, tokenIndex = position147, tokenIndex147 + l166: + position, tokenIndex, depth = position166, tokenIndex166, depth166 return false }, - /* 18 le <- <('<' '=' sp)> */ + /* 21 le <- <('<' '=' sp)> */ func() bool { - position165, tokenIndex165 := position, tokenIndex + position184, tokenIndex184, depth184 := position, tokenIndex, depth { - position166 := position + position185 := position + depth++ if buffer[position] != rune('<') { - goto l165 + goto l184 } position++ if buffer[position] != rune('=') { - goto l165 + goto l184 } position++ if !_rules[rulesp]() { - goto l165 + goto l184 } - add(rulele, position166) + depth-- + add(rulele, position185) } return true - l165: - position, tokenIndex = position165, tokenIndex165 + l184: + position, tokenIndex, depth = position184, tokenIndex184, depth184 return false }, - /* 19 ge <- <('>' '=' sp)> */ + /* 22 ge <- <('>' '=' sp)> */ func() bool { - position167, tokenIndex167 := position, tokenIndex + position186, tokenIndex186, depth186 := position, tokenIndex, depth { - position168 := position + position187 := position + depth++ if buffer[position] != rune('>') { - goto l167 + goto l186 } position++ if buffer[position] != rune('=') { - goto l167 + goto l186 } position++ if !_rules[rulesp]() { - goto l167 + goto l186 } - add(rulege, position168) + depth-- + add(rulege, position187) } return true - l167: - position, tokenIndex = position167, tokenIndex167 + l186: + position, tokenIndex, depth = position186, tokenIndex186, depth186 return false }, - /* 20 l <- <('<' sp)> */ + /* 23 l <- <('<' sp)> */ func() bool { - position169, tokenIndex169 := position, tokenIndex + position188, tokenIndex188, depth188 := position, tokenIndex, depth { - position170 := position + position189 := position + depth++ if buffer[position] != rune('<') { - goto l169 + goto l188 } position++ if !_rules[rulesp]() { - goto l169 + goto l188 } - add(rulel, position170) + depth-- + add(rulel, position189) } return true - l169: - position, tokenIndex = position169, tokenIndex169 + l188: + position, tokenIndex, depth = position188, tokenIndex188, depth188 return false }, - /* 21 g <- <('>' sp)> */ + /* 24 g <- <('>' sp)> */ func() bool { - position171, tokenIndex171 := position, tokenIndex + position190, tokenIndex190, depth190 := position, tokenIndex, depth { - position172 := position + position191 := position + depth++ if buffer[position] != rune('>') { - goto l171 + goto l190 } position++ if !_rules[rulesp]() { - goto l171 + goto l190 } - add(ruleg, position172) + depth-- + add(ruleg, position191) } return true - l171: - position, tokenIndex = position171, tokenIndex171 + l190: + position, tokenIndex, depth = position190, tokenIndex190, depth190 return false }, - /* 22 open <- <('(' sp)> */ + /* 25 open <- <('(' sp)> */ func() bool { - position173, tokenIndex173 := position, tokenIndex + position192, tokenIndex192, depth192 := position, tokenIndex, depth { - position174 := position + position193 := position + depth++ if buffer[position] != rune('(') { - goto l173 + goto l192 } position++ if !_rules[rulesp]() { - goto l173 + goto l192 } - add(ruleopen, position174) + depth-- + add(ruleopen, position193) } return true - l173: - position, tokenIndex = position173, tokenIndex173 + l192: + position, tokenIndex, depth = position192, tokenIndex192, depth192 return false }, - /* 23 close <- <(')' sp)> */ + /* 26 close <- <(')' sp)> */ func() bool { - position175, tokenIndex175 := position, tokenIndex + position194, tokenIndex194, depth194 := position, tokenIndex, depth { - position176 := position + position195 := position + depth++ if buffer[position] != rune(')') { - goto l175 + goto l194 } position++ if !_rules[rulesp]() { - goto l175 + goto l194 } - add(ruleclose, position176) + depth-- + add(ruleclose, position195) } return true - l175: - position, tokenIndex = position175, tokenIndex175 + l194: + position, tokenIndex, depth = position194, tokenIndex194, depth194 return false }, - /* 24 sp <- <(' ' / '\t')*> */ + /* 27 sp <- <(' ' / '\t')*> */ func() bool { { - position178 := position - l179: + position197 := position + depth++ + l198: { - position180, tokenIndex180 := position, tokenIndex + position199, tokenIndex199, depth199 := position, tokenIndex, depth { - position181, tokenIndex181 := position, tokenIndex + position200, tokenIndex200, depth200 := position, tokenIndex, depth if buffer[position] != rune(' ') { - goto l182 + goto l201 } position++ - goto l181 - l182: - position, tokenIndex = position181, tokenIndex181 + goto l200 + l201: + position, tokenIndex, depth = position200, tokenIndex200, depth200 if buffer[position] != rune('\t') { - goto l180 + goto l199 } position++ } - l181: - goto l179 - l180: - position, tokenIndex = position180, tokenIndex180 + l200: + goto l198 + l199: + position, tokenIndex, depth = position199, tokenIndex199, depth199 } - add(rulesp, position178) + depth-- + add(rulesp, position197) } return true }, - /* 26 Action0 <- <{ p.Operator(OpOr) }> */ + /* 29 Action0 <- <{ p.Operator(OpOr) }> */ func() bool { { add(ruleAction0, position) } return true }, - /* 27 Action1 <- <{ p.Operator(OpAnd) }> */ + /* 30 Action1 <- <{ p.Operator(OpAnd) }> */ func() bool { { add(ruleAction1, position) } return true }, - /* 28 Action2 <- <{ p.Operator(OpLessEqual) }> */ + /* 31 Action2 <- <{ p.Operator(OpNot) }> */ func() bool { { add(ruleAction2, position) } return true }, - /* 29 Action3 <- <{ p.Operator(OpGreaterEqual) }> */ + /* 32 Action3 <- <{ p.Operator(OpLessEqual) }> */ func() bool { { add(ruleAction3, position) } return true }, - /* 30 Action4 <- <{ p.Operator(OpLess) }> */ + /* 33 Action4 <- <{ p.Operator(OpGreaterEqual) }> */ func() bool { { add(ruleAction4, position) } return true }, - /* 31 Action5 <- <{ p.Operator(OpGreater) }> */ + /* 34 Action5 <- <{ p.Operator(OpLess) }> */ func() bool { { add(ruleAction5, position) } return true }, - /* 32 Action6 <- <{ p.Operator(OpEqual) }> */ + /* 35 Action6 <- <{ p.Operator(OpGreater) }> */ func() bool { { add(ruleAction6, position) } return true }, - /* 33 Action7 <- <{ p.Operator(OpContains) }> */ + /* 36 Action7 <- <{ p.Operator(OpEqual) }> */ func() bool { { add(ruleAction7, position) } return true }, - nil, - /* 35 Action8 <- <{ p.Tag(buffer[begin:end]) }> */ + /* 37 Action8 <- <{ p.Operator(OpNotEqual) }> */ func() bool { { add(ruleAction8, position) } return true }, - /* 36 Action9 <- <{ p.Value(buffer[begin:end]) }> */ + /* 38 Action9 <- <{ p.Operator(OpContains) }> */ func() bool { { add(ruleAction9, position) } return true }, - /* 37 Action10 <- <{ p.Number(buffer[begin:end]) }> */ + nil, + /* 40 Action10 <- <{ p.Tag(buffer[begin:end]) }> */ func() bool { { add(ruleAction10, position) } return true }, - /* 38 Action11 <- <{ p.Time(buffer[begin:end]) }> */ + /* 41 Action11 <- <{ p.Value(buffer[begin:end]) }> */ func() bool { { add(ruleAction11, position) } return true }, - /* 39 Action12 <- <{ p.Date(buffer[begin:end]) }> */ + /* 42 Action12 <- <{ p.Number(buffer[begin:end]) }> */ func() bool { { add(ruleAction12, position) } return true }, + /* 43 Action13 <- <{ p.Time(buffer[begin:end]) }> */ + func() bool { + { + add(ruleAction13, position) + } + return true + }, + /* 44 Action14 <- <{ p.Date(buffer[begin:end]) }> */ + func() bool { + { + add(ruleAction14, position) + } + return true + }, } p.rules = _rules - return nil } diff --git a/event/query/query_test.go b/event/query/query_test.go index b91344e52..86b195b09 100644 --- a/event/query/query_test.go +++ b/event/query/query_test.go @@ -23,6 +23,15 @@ func TestMatches(t *testing.T) { err bool matches bool }{ + // This one is debatable, we could match != 1, but it's likely to be a mistake so we will have nil matches nothing for now + {"Address = '12345' OR Height != 1", map[string]interface{}{"Height": nil, "Address": "54321"}, false, false}, + {"Address = '12345' OR Height != 1", map[string]interface{}{"Height": 1, "Address": "54321"}, false, false}, + {"Address = '12345' OR Height != 1", map[string]interface{}{"Height": 2, "Address": "54321"}, false, true}, + {"Address = '12345' OR Height != 1", map[string]interface{}{"Height": 1, "Address": "12345"}, false, true}, + {"(NOT (Height < 4)) OR Height = 1", map[string]interface{}{"Height": 1}, false, true}, + {"(NOT (Height < 4)) OR Height = 1", map[string]interface{}{"Height": 3}, false, false}, + {"NOT (Height = 4)", map[string]interface{}{"Height": 3}, false, true}, + {"Height != 4", map[string]interface{}{"Height": 3}, false, true}, {"Height CONTAINS '2'", map[string]interface{}{"Height": uint64(12)}, false, true}, {"Height CONTAINS '2'", map[string]interface{}{"Height": uint64(11)}, false, false}, {"foo > 10", map[string]interface{}{"foo": 11}, false, true}, diff --git a/execution/config.go b/execution/config.go index e828745ea..d62dee83e 100644 --- a/execution/config.go +++ b/execution/config.go @@ -3,6 +3,8 @@ package execution import ( "fmt" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/evm" ) @@ -34,28 +36,32 @@ func DefaultExecutionConfig() *ExecutionConfig { } } -type ExecutionOption func(*executor) +type Option func(*executor) -func VMOptions(vmOptions ...func(*evm.VM)) func(*executor) { +func VMOptions(vmOptions engine.Options) func(*executor) { return func(exe *executor) { exe.vmOptions = vmOptions } } -func (ec *ExecutionConfig) ExecutionOptions() ([]ExecutionOption, error) { - var exeOptions []ExecutionOption - var vmOptions []func(*evm.VM) +func (ec *ExecutionConfig) ExecutionOptions() ([]Option, error) { + var exeOptions []Option + vmOptions := engine.Options{ + MemoryProvider: engine.DefaultDynamicMemoryProvider, + CallStackMaxDepth: ec.CallStackMaxDepth, + DataStackInitialCapacity: ec.DataStackInitialCapacity, + DataStackMaxDepth: ec.DataStackMaxDepth, + } for _, option := range ec.VMOptions { switch option { case DebugOpcodes: - vmOptions = append(vmOptions, evm.DebugOpcodes) + vmOptions.DebugOpcodes = true case DumpTokens: - vmOptions = append(vmOptions, evm.DumpTokens) + vmOptions.DumpTokens = true default: return nil, fmt.Errorf("VM option '%s' not recognised", option) } } - vmOptions = append(vmOptions, evm.StackOptions(ec.CallStackMaxDepth, ec.DataStackInitialCapacity, ec.DataStackMaxDepth)) - exeOptions = append(exeOptions, VMOptions(vmOptions...)) + exeOptions = append(exeOptions, VMOptions(vmOptions)) return exeOptions, nil } diff --git a/execution/contexts/blockchain.go b/execution/contexts/blockchain.go deleted file mode 100644 index e8884889c..000000000 --- a/execution/contexts/blockchain.go +++ /dev/null @@ -1,14 +0,0 @@ -package contexts - -import "time" - -// Execution's sufficient view of blockchain -type Blockchain interface { - BlockHash(height uint64) []byte - LastBlockTime() time.Time - BlockchainHeight -} - -type BlockchainHeight interface { - LastBlockHeight() uint64 -} diff --git a/execution/contexts/bond_context.go b/execution/contexts/bond_context.go index b7d31da27..c79c3e169 100644 --- a/execution/contexts/bond_context.go +++ b/execution/contexts/bond_context.go @@ -6,13 +6,14 @@ import ( "github.com/hyperledger/burrow/acm/acmstate" "github.com/hyperledger/burrow/acm/validator" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/txs/payload" ) type BondContext struct { - StateWriter acmstate.ReaderWriter + State acmstate.ReaderWriter ValidatorSet validator.ReaderWriter Logger *logging.Logger tx *payload.BondTx @@ -28,13 +29,18 @@ func (ctx *BondContext) Execute(txe *exec.TxExecution, p payload.Payload) error // the account initiating the bond power := new(big.Int).SetUint64(ctx.tx.Input.GetAmount()) - account, err := ctx.StateWriter.GetAccount(ctx.tx.Input.Address) + account, err := ctx.State.GetAccount(ctx.tx.Input.Address) if err != nil { return err } + ct := account.PublicKey.GetCurveType() + if ct == crypto.CurveTypeSecp256k1 { + return fmt.Errorf("secp256k1 not supported") + } + // can the account bond? - if !hasBondPermission(ctx.StateWriter, account, ctx.Logger) { + if !hasBondPermission(ctx.State, account, ctx.Logger) { return fmt.Errorf("account '%s' lacks bond permission", account.Address) } @@ -59,5 +65,5 @@ func (ctx *BondContext) Execute(txe *exec.TxExecution, p payload.Payload) error return err } - return ctx.StateWriter.UpdateAccount(account) + return ctx.State.UpdateAccount(account) } diff --git a/execution/contexts/bond_context_test.go b/execution/contexts/bond_context_test.go new file mode 100644 index 000000000..d0d437e9f --- /dev/null +++ b/execution/contexts/bond_context_test.go @@ -0,0 +1,44 @@ +package contexts + +import ( + "testing" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/acm/validator" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/txs/payload" + "github.com/stretchr/testify/require" +) + +func TestBondContext(t *testing.T) { + t.Run("CurveType", func(t *testing.T) { + privKey, err := crypto.GeneratePrivateKey(nil, crypto.CurveTypeSecp256k1) + require.NoError(t, err) + pubKey := privKey.GetPublicKey() + address := pubKey.GetAddress() + + accountState := acmstate.NewMemoryState() + accountState.Accounts[address] = &acm.Account{ + Address: address, + PublicKey: pubKey, + Balance: 1337, + } + + bondContext := &BondContext{ + State: accountState, + ValidatorSet: validator.NewSet(), + Logger: logging.NewNoopLogger(), + } + + err = bondContext.Execute(&exec.TxExecution{}, &payload.BondTx{ + Input: &payload.TxInput{ + Address: address, + Amount: 1337, + }, + }) + require.Error(t, err) + }) +} diff --git a/execution/contexts/call_context.go b/execution/contexts/call_context.go index 8fb38193a..b18d7d39e 100644 --- a/execution/contexts/call_context.go +++ b/execution/contexts/call_context.go @@ -2,15 +2,16 @@ package contexts import ( "fmt" + "math/big" - "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/vms" "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/engine" "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/execution/evm" "github.com/hyperledger/burrow/execution/exec" - "github.com/hyperledger/burrow/execution/wasm" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" "github.com/hyperledger/burrow/txs/payload" @@ -20,13 +21,14 @@ import ( const GasLimit = uint64(1000000) type CallContext struct { - StateWriter acmstate.ReaderWriter - RunCall bool - Blockchain Blockchain - VMOptions []func(*evm.VM) - Logger *logging.Logger - tx *payload.CallTx - txe *exec.TxExecution + VMS *vms.VirtualMachines + State acmstate.ReaderWriter + MetadataState acmstate.MetadataReaderWriter + Blockchain engine.Blockchain + RunCall bool + Logger *logging.Logger + tx *payload.CallTx + txe *exec.TxExecution } func (ctx *CallContext) Execute(txe *exec.TxExecution, p payload.Payload) error { @@ -52,58 +54,51 @@ func (ctx *CallContext) Execute(txe *exec.TxExecution, p payload.Payload) error func (ctx *CallContext) Precheck() (*acm.Account, *acm.Account, error) { var outAcc *acm.Account // Validate input - inAcc, err := ctx.StateWriter.GetAccount(ctx.tx.Input.Address) + inAcc, err := ctx.State.GetAccount(ctx.tx.Input.Address) if err != nil { return nil, nil, err } if inAcc == nil { - return nil, nil, errors.ErrorCodef(errors.ErrorCodeInvalidAddress, + return nil, nil, errors.Errorf(errors.Codes.InvalidAddress, "Cannot find input account: %v", ctx.tx.Input) } if ctx.tx.Input.Amount < ctx.tx.Fee { - return nil, nil, errors.ErrorCodef(errors.ErrorCodeInsufficientFunds, + return nil, nil, errors.Errorf(errors.Codes.InsufficientFunds, "Send did not send enough to cover the fee: %v", ctx.tx.Input) } // Fees are handle by the CallContext, values transfers (i.e. balances) are handled in the VM (or in Check()) err = inAcc.SubtractFromBalance(ctx.tx.Fee) if err != nil { - return nil, nil, errors.ErrorCodef(errors.ErrorCodeInsufficientFunds, - "Input account does not have sufficient balance to cover input amount: %v", ctx.tx.Input) + return nil, nil, errors.Errorf(errors.Codes.InsufficientFunds, + "Input account %v (balance: %d) does not have sufficient balance to cover input amount: %v", + inAcc.Address, inAcc.Balance, ctx.tx.Input) } // Calling a nil destination is defined as requesting contract creation createContract := ctx.tx.Address == nil if createContract { - if !hasCreateContractPermission(ctx.StateWriter, inAcc, ctx.Logger) { + if !hasCreateContractPermission(ctx.State, inAcc, ctx.Logger) { return nil, nil, fmt.Errorf("account %s does not have CreateContract permission", ctx.tx.Input.Address) } } else { - if !hasCallPermission(ctx.StateWriter, inAcc, ctx.Logger) { + if !hasCallPermission(ctx.State, inAcc, ctx.Logger) { return nil, nil, fmt.Errorf("account %s does not have Call permission", ctx.tx.Input.Address) } - // check if its a native contract - if evm.IsRegisteredNativeContract(*ctx.tx.Address) { - return nil, nil, errors.ErrorCodef(errors.ErrorCodeReservedAddress, - "attempt to call a native contract at %s, "+ - "but native contracts cannot be called using CallTx. Use a "+ - "contract that calls the native contract or the appropriate tx "+ - "type (eg. PermsTx, NameTx)", ctx.tx.Address) - } // Output account may be nil if we are still in mempool and contract was created in same block as this tx // but that's fine, because the account will be created properly when the create tx runs in the block // and then this won't return nil. otherwise, we take their fee // Note: ctx.tx.Address == nil iff createContract so dereference is okay - outAcc, err = ctx.StateWriter.GetAccount(*ctx.tx.Address) + outAcc, err = ctx.State.GetAccount(*ctx.tx.Address) if err != nil { return nil, nil, err } } - err = ctx.StateWriter.UpdateAccount(inAcc) + err = ctx.State.UpdateAccount(inAcc) if err != nil { return nil, nil, err } @@ -116,7 +111,7 @@ func (ctx *CallContext) Check(inAcc *acm.Account, value uint64) error { if err != nil { return err } - err = ctx.StateWriter.UpdateAccount(inAcc) + err = ctx.State.UpdateAccount(inAcc) if err != nil { return err } @@ -124,22 +119,15 @@ func (ctx *CallContext) Check(inAcc *acm.Account, value uint64) error { } func (ctx *CallContext) Deliver(inAcc, outAcc *acm.Account, value uint64) error { - createContract := ctx.tx.Address == nil // VM call variables - var ( - gas uint64 = ctx.tx.GasLimit - caller crypto.Address = inAcc.Address - callee crypto.Address = crypto.ZeroAddress // initialized below - code []byte = nil - wcode []byte = nil - ret []byte = nil - txCache = evm.NewState(ctx.StateWriter, ctx.Blockchain.BlockHash, acmstate.Named("TxCache")) - params = evm.Params{ - BlockHeight: ctx.Blockchain.LastBlockHeight() + 1, - BlockTime: ctx.Blockchain.LastBlockTime().Unix(), - GasLimit: GasLimit, - } - ) + createContract := ctx.tx.Address == nil + caller := inAcc.Address + txCache := acmstate.NewCache(ctx.State, acmstate.Named("TxCache")) + metaCache := acmstate.NewMetadataCache(ctx.MetadataState) + + var callee crypto.Address + var code []byte + var wcode []byte // get or create callee if createContract { @@ -147,27 +135,21 @@ func (ctx *CallContext) Deliver(inAcc, outAcc *acm.Account, value uint64) error callee = crypto.NewContractAddress(caller, ctx.txe.TxHash) code = ctx.tx.Data wcode = ctx.tx.WASM - txCache.CreateAccount(callee) + err := engine.CreateAccount(txCache, callee) + if err != nil { + return err + } ctx.Logger.TraceMsg("Creating new contract", "contract_address", callee, "init_code", code) // store abis - if len(ctx.tx.ContractMeta) > 0 { - metamap := make([]*acm.ContractMeta, len(ctx.tx.ContractMeta)) - for i, abi := range ctx.tx.ContractMeta { - metahash := acmstate.GetMetadataHash(abi.Meta) - metamap[i] = &acm.ContractMeta{ - MetadataHash: metahash[:], - CodeHash: abi.CodeHash, - } - txCache.SetMetadata(metahash, abi.Meta) - } - - txCache.UpdateMetaMap(callee, metamap) + err = engine.UpdateContractMeta(txCache, metaCache, callee, ctx.tx.ContractMeta) + if err != nil { + return err } } else { - if outAcc == nil || (len(outAcc.EVMCode) == 0 && len(outAcc.WASMCode) == 0) { + if outAcc == nil { // if you call an account that doesn't exist // or an account with no code then we take fees (sorry pal) // NOTE: it's fine to create a contract and call it within one @@ -175,88 +157,104 @@ func (ctx *CallContext) Deliver(inAcc, outAcc *acm.Account, value uint64) error // but to create with one contract and call with another // you have to wait a block to avoid a re-ordering attack // that will take your fees - var exception *errors.Exception - if outAcc == nil { - exception = errors.ErrorCodef(errors.ErrorCodeInvalidAddress, - "CallTx to an address (%v) that does not exist", ctx.tx.Address) - ctx.Logger.Info.Log(structure.ErrorKey, exception, - "caller_address", inAcc.GetAddress(), - "callee_address", ctx.tx.Address) - } else { - exception = errors.ErrorCodef(errors.ErrorCodeInvalidAddress, - "CallTx to an address (%v) that holds no code", ctx.tx.Address) - ctx.Logger.Info.Log(exception, - "caller_address", inAcc.GetAddress(), - "callee_address", ctx.tx.Address) - } + exception := errors.Errorf(errors.Codes.InvalidAddress, + "CallTx to an address (%v) that does not exist", ctx.tx.Address) + ctx.Logger.Info.Log(structure.ErrorKey, exception, + "caller_address", inAcc.GetAddress(), + "callee_address", ctx.tx.Address) ctx.txe.PushError(exception) ctx.CallEvents(exception) return nil } callee = outAcc.Address - code = txCache.GetEVMCode(callee) - wcode = txCache.GetWASMCode(callee) + acc, err := txCache.GetAccount(callee) + if err != nil { + return err + } + code = acc.EVMCode + wcode = acc.WASMCode ctx.Logger.TraceMsg("Calling existing contract", "contract_address", callee, "input", ctx.tx.Data, - "contract_code", code) + "evm_code", code, + "wasm_code", wcode) } ctx.Logger.Trace.Log("callee", callee) + var ret []byte + var err error txHash := ctx.txe.Envelope.Tx.Hash() - logger := ctx.Logger.With(structure.TxHashKey, txHash) - var exception errors.CodedError + gas := new(big.Int).SetUint64(ctx.tx.GasLimit) + + params := engine.CallParams{ + Origin: caller, + Caller: caller, + Callee: callee, + Input: ctx.tx.Data, + Value: *new(big.Int).SetUint64(value), + Gas: gas, + } + if len(wcode) != 0 { - if createContract { - txCache.InitWASMCode(callee, wcode) - } - ret, exception = wasm.RunWASM(txCache, callee, createContract, wcode, ctx.tx.Data) - if exception != nil { + // TODO: accept options + ret, err = ctx.VMS.WVM.Execute(txCache, ctx.Blockchain, ctx.txe, params, wcode) + if err != nil { // Failure. Charge the gas fee. The 'value' was otherwise not transferred. ctx.Logger.InfoMsg("Error on WASM execution", - structure.ErrorKey, exception) + structure.ErrorKey, err) - ctx.txe.PushError(errors.ErrorCodef(exception.ErrorCode(), "call error: %s\n", - exception.String())) + ctx.txe.PushError(errors.Wrap(err, "call error")) } else { ctx.Logger.TraceMsg("Successful execution") - err := txCache.Sync() + if createContract { + err := engine.InitWASMCode(txCache, callee, ret) + if err != nil { + return err + } + } + err = ctx.Sync(txCache, metaCache) if err != nil { return err } } - ctx.txe.Return(ret, ctx.tx.GasLimit-gas) } else { // EVM - vmach := evm.NewVM(params, caller, txHash, logger, ctx.VMOptions...) - ret, exception = vmach.Call(txCache, ctx.txe, caller, callee, code, ctx.tx.Data, value, &gas) - if exception != nil { + ctx.VMS.EVM.SetNonce(txHash) + ctx.VMS.EVM.SetLogger(ctx.Logger.With(structure.TxHashKey, txHash)) + + ret, err = ctx.VMS.EVM.Execute(txCache, ctx.Blockchain, ctx.txe, params, code) + + if err != nil { // Failure. Charge the gas fee. The 'value' was otherwise not transferred. ctx.Logger.InfoMsg("Error on EVM execution", - structure.ErrorKey, exception) + structure.ErrorKey, err) - ctx.txe.PushError(errors.ErrorCodef(exception.ErrorCode(), "call error: %s\nEVM call trace: %s", - exception.String(), ctx.txe.CallTrace())) + ctx.txe.PushError(errors.Wrapf(err, "call error: %v\nEVM call trace: %s", + err, ctx.txe.CallTrace())) } else { ctx.Logger.TraceMsg("Successful execution") if createContract { - txCache.InitCode(callee, ret) + err := engine.InitEVMCode(txCache, callee, ret) + if err != nil { + return err + } } - err := txCache.Sync() + err = ctx.Sync(txCache, metaCache) if err != nil { return err } } - ctx.CallEvents(exception) - ctx.txe.Return(ret, ctx.tx.GasLimit-gas) + ctx.CallEvents(err) } - + // Gas starts life as a uint64 and should only been reduced (used up) over a transaction so .Uint64() is safe + ctx.txe.Return(ret, ctx.tx.GasLimit-gas.Uint64()) // Create a receipt from the ret and whether it erred. - ctx.Logger.TraceMsg("VM call complete", + ctx.Logger.TraceMsg("VM Call complete", "caller", caller, "callee", callee, "return", ret, - structure.ErrorKey, exception) + structure.ErrorKey, err) + return nil } @@ -267,3 +265,11 @@ func (ctx *CallContext) CallEvents(err error) { ctx.txe.Input(*ctx.tx.Address, errors.AsException(err)) } } + +func (ctx *CallContext) Sync(cache *acmstate.Cache, metaCache *acmstate.MetadataCache) error { + err := cache.Sync(ctx.State) + if err != nil { + return err + } + return metaCache.Sync(ctx.MetadataState) +} diff --git a/execution/contexts/governance_context.go b/execution/contexts/governance_context.go index fde105578..940d49dbc 100644 --- a/execution/contexts/governance_context.go +++ b/execution/contexts/governance_context.go @@ -17,7 +17,7 @@ import ( ) type GovernanceContext struct { - StateWriter acmstate.ReaderWriter + State acmstate.ReaderWriter ValidatorSet validator.ReaderWriter Logger *logging.Logger tx *payload.GovTx @@ -34,13 +34,13 @@ func (ctx *GovernanceContext) Execute(txe *exec.TxExecution, p payload.Payload) return fmt.Errorf("payload must be NameTx, but is: %v", txe.Envelope.Tx.Payload) } // Nothing down with any incoming funds at this point - accounts, _, err := getInputs(ctx.StateWriter, ctx.tx.Inputs) + accounts, _, err := getInputs(ctx.State, ctx.tx.Inputs) if err != nil { return err } // ensure all inputs have root permissions - err = allHavePermission(ctx.StateWriter, permission.Root, accounts, ctx.Logger) + err = allHavePermission(ctx.State, permission.Root, accounts, ctx.Logger) if err != nil { return errors.Wrap(err, "at least one input lacks permission for GovTx") } @@ -50,11 +50,11 @@ func (ctx *GovernanceContext) Execute(txe *exec.TxExecution, p payload.Payload) } for _, update := range ctx.tx.AccountUpdates { - err := VerifyIdentity(ctx.StateWriter, update) + err := VerifyIdentity(ctx.State, update) if err != nil { return fmt.Errorf("GovTx: %v", err) } - account, err := getOrMakeOutput(ctx.StateWriter, accounts, *update.Address, ctx.Logger) + account, err := getOrMakeOutput(ctx.State, accounts, *update.Address, ctx.Logger) if err != nil { return err } @@ -82,7 +82,7 @@ func (ctx *GovernanceContext) UpdateAccount(account *acm.Account, update *spec.T return } power := new(big.Int).SetUint64(update.Balances().GetPower(0)) - _, err := ctx.ValidatorSet.SetPower(*update.PublicKey, power) + _, err := ctx.ValidatorSet.SetPower(update.PublicKey, power) if err != nil { return ev, err } @@ -107,7 +107,7 @@ func (ctx *GovernanceContext) UpdateAccount(account *acm.Account, update *spec.T if err != nil { return } - err = ctx.StateWriter.UpdateAccount(account) + err = ctx.State.UpdateAccount(account) return } @@ -146,7 +146,7 @@ func MaybeGetPublicKey(sw acmstate.ReaderWriter, address crypto.Address) (*crypt } if acc != nil && acc.PublicKey.IsSet() { publicKey := acc.PublicKey - return &publicKey, nil + return publicKey, nil } return nil, nil } diff --git a/execution/contexts/identify_context.go b/execution/contexts/identify_context.go new file mode 100644 index 000000000..d5d4c5509 --- /dev/null +++ b/execution/contexts/identify_context.go @@ -0,0 +1,49 @@ +package contexts + +import ( + "fmt" + + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/execution/registry" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/permission" + "github.com/hyperledger/burrow/txs/payload" +) + +type IdentifyContext struct { + NodeWriter registry.ReaderWriter + StateReader acmstate.Reader + Logger *logging.Logger + tx *payload.IdentifyTx +} + +func (ctx *IdentifyContext) Execute(txe *exec.TxExecution, p payload.Payload) error { + var ok bool + ctx.tx, ok = p.(*payload.IdentifyTx) + if !ok { + return fmt.Errorf("payload must be IdentifyTx, but is: %v", txe.Envelope.Tx.Payload) + } + + inputs, _, err := getInputs(ctx.StateReader, ctx.tx.Inputs) + if err != nil { + return err + } + + // One of our inputs must have identify permissions + err = oneHasPermission(ctx.StateReader, permission.Identify, inputs, ctx.Logger) + if err != nil { + return errors.Wrap(err, "at least one input lacks permission for IdentifyTx") + } + + // Registry updates must be consensual and binding so we requires signatures + // from the validator key of the node being added + validatorAddress := ctx.tx.Node.ValidatorPublicKey.GetAddress() + if _, ok := inputs[validatorAddress]; !ok { + return fmt.Errorf("IdentifyTx must be signed by node's validator key, but missing %v in inputs", + validatorAddress) + } + + return ctx.NodeWriter.UpdateNode(ctx.tx.Node.TendermintNodeID, ctx.tx.Node) +} diff --git a/execution/contexts/name_context.go b/execution/contexts/name_context.go index 398c9e875..c7f8d3dfe 100644 --- a/execution/contexts/name_context.go +++ b/execution/contexts/name_context.go @@ -6,6 +6,7 @@ import ( "regexp" "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/execution/engine" "github.com/hyperledger/burrow/execution/errors" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/execution/names" @@ -19,11 +20,11 @@ var regexpAlphaNum = regexp.MustCompile("^[a-zA-Z0-9._/-@]*$") var regexpJSON = regexp.MustCompile(`^[a-zA-Z0-9_/ \-+"':,\n\t.{}()\[\]]*$`) type NameContext struct { - Blockchain BlockchainHeight - StateWriter acmstate.ReaderWriter - NameReg names.ReaderWriter - Logger *logging.Logger - tx *payload.NameTx + Blockchain engine.Blockchain + State acmstate.ReaderWriter + NameReg names.ReaderWriter + Logger *logging.Logger + tx *payload.NameTx } func (ctx *NameContext) Execute(txe *exec.TxExecution, p payload.Payload) error { @@ -33,23 +34,23 @@ func (ctx *NameContext) Execute(txe *exec.TxExecution, p payload.Payload) error return fmt.Errorf("payload must be NameTx, but is: %v", txe.Envelope.Tx.Payload) } // Validate input - inAcc, err := ctx.StateWriter.GetAccount(ctx.tx.Input.Address) + inAcc, err := ctx.State.GetAccount(ctx.tx.Input.Address) if err != nil { return err } if inAcc == nil { ctx.Logger.InfoMsg("Cannot find input account", "tx_input", ctx.tx.Input) - return errors.ErrorCodeInvalidAddress + return errors.Codes.InvalidAddress } // check permission - if !hasNamePermission(ctx.StateWriter, inAcc, ctx.Logger) { + if !hasNamePermission(ctx.State, inAcc, ctx.Logger) { return fmt.Errorf("account %s does not have Name permission", ctx.tx.Input.Address) } if ctx.tx.Input.Amount < ctx.tx.Fee { ctx.Logger.InfoMsg("Sender did not send enough to cover the fee", "tx_input", ctx.tx.Input) - return errors.ErrorCodeInsufficientFunds + return errors.Codes.InsufficientFunds } // validate the input strings @@ -167,15 +168,15 @@ func (ctx *NameContext) Execute(txe *exec.TxExecution, p payload.Payload) error err = inAcc.SubtractFromBalance(value) if err != nil { - return errors.ErrorCodef(errors.ErrorCodeInsufficientFunds, + return errors.Errorf(errors.Codes.InsufficientFunds, "Input account does not have sufficient balance to cover input amount: %v", ctx.tx.Input) } - err = ctx.StateWriter.UpdateAccount(inAcc) + err = ctx.State.UpdateAccount(inAcc) if err != nil { return err } - // TODO: maybe we want to take funds on error and allow txs in that don't do anythingi? + // TODO: maybe we want to take funds on error and allow txs in that don't do anything? txe.Input(ctx.tx.Input.Address, nil) txe.Name(entry) @@ -184,22 +185,22 @@ func (ctx *NameContext) Execute(txe *exec.TxExecution, p payload.Payload) error func validateStrings(tx *payload.NameTx) error { if len(tx.Name) == 0 { - return errors.ErrorCodef(errors.ErrorCodeInvalidString, "name must not be empty") + return errors.Errorf(errors.Codes.InvalidString, "name must not be empty") } if len(tx.Name) > names.MaxNameLength { - return errors.ErrorCodef(errors.ErrorCodeInvalidString, "Name is too long. Max %d bytes", names.MaxNameLength) + return errors.Errorf(errors.Codes.InvalidString, "Name is too long. Max %d bytes", names.MaxNameLength) } if len(tx.Data) > names.MaxDataLength { - return errors.ErrorCodef(errors.ErrorCodeInvalidString, "Data is too long. Max %d bytes", names.MaxDataLength) + return errors.Errorf(errors.Codes.InvalidString, "Data is too long. Max %d bytes", names.MaxDataLength) } if !validateNameRegEntryName(tx.Name) { - return errors.ErrorCodef(errors.ErrorCodeInvalidString, + return errors.Errorf(errors.Codes.InvalidString, "Invalid characters found in NameTx.Name (%s). Only alphanumeric, underscores, dashes, forward slashes, and @ are allowed", tx.Name) } if !validateNameRegEntryData(tx.Data) { - return errors.ErrorCodef(errors.ErrorCodeInvalidString, + return errors.Errorf(errors.Codes.InvalidString, "Invalid characters found in NameTx.Data (%s). Only the kind of things found in a JSON file are allowed", tx.Data) } diff --git a/execution/contexts/name_context_test.go b/execution/contexts/name_context_test.go new file mode 100644 index 000000000..88d84f143 --- /dev/null +++ b/execution/contexts/name_context_test.go @@ -0,0 +1,111 @@ +package contexts + +import ( + "strings" + "testing" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/bcm" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/execution/names" + "github.com/hyperledger/burrow/execution/state" + "github.com/hyperledger/burrow/genesis" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/txs" + "github.com/hyperledger/burrow/txs/payload" + "github.com/stretchr/testify/require" + dbm "github.com/tendermint/tm-db" +) + +func TestNameContext(t *testing.T) { + accountState := acmstate.NewMemoryState() + + privKey := newPrivKey(t) + account := newAccountFromPrivKey(privKey) + + db := dbm.NewMemDB() + genesisDoc, _, _ := genesis.NewDeterministicGenesis(3450976).GenesisDoc(23, 10) + blockchain := bcm.NewBlockchain(db, genesisDoc) + state := state.NewState(db) + + ctx := &NameContext{ + State: accountState, + Logger: logging.NewNoopLogger(), + Blockchain: blockchain, + NameReg: names.NewCache(state), + } + + callTx := &payload.CallTx{} + err := ctx.Execute(execFromTx(callTx), callTx) + require.Error(t, err, "should not continue with incorrect payload") + + nameTx := &payload.NameTx{ + Input: &payload.TxInput{ + Address: account.Address, + }, + } + + err = ctx.Execute(execFromTx(nameTx), nameTx) + require.Error(t, err, "account should not exist") + + accountState.Accounts[account.Address] = account + nameTx.Name = "foobar" + + err = ctx.Execute(execFromTx(nameTx), nameTx) + require.Error(t, err, "insufficient amount") + + costPerBlock := names.NameCostPerBlock(names.NameBaseCost(ctx.tx.Name, ctx.tx.Data)) + nameTx.Input.Amount = names.MinNameRegistrationPeriod * costPerBlock + + err = ctx.Execute(execFromTx(nameTx), nameTx) + require.NoError(t, err, "should successfully set namereg") +} + +func TestValidateStrings(t *testing.T) { + nameTx := &payload.NameTx{} + err := validateStrings(nameTx) + require.Error(t, err, "should fail on empty name") + + nameTx.Name = strings.Repeat("A", names.MaxNameLength+1) + err = validateStrings(nameTx) + require.Error(t, err, "should fail because name is too long") + + nameTx.Name = "foo" + + nameTx.Data = strings.Repeat("A", names.MaxDataLength+1) + err = validateStrings(nameTx) + require.Error(t, err, "should fail because data is too long") + + nameTx.Data = "bar" + err = validateStrings(nameTx) + require.NoError(t, err, "name reg entry should be valid") +} + +func newPrivKey(t *testing.T) crypto.PrivateKey { + privKey, err := crypto.GeneratePrivateKey(nil, crypto.CurveTypeEd25519) + require.NoError(t, err) + return privKey +} + +func newAccountFromPrivKey(privKey crypto.PrivateKey) *acm.Account { + pubKey := privKey.GetPublicKey() + address := pubKey.GetAddress() + + return &acm.Account{ + Address: address, + PublicKey: pubKey, + Balance: 1337, + } +} + +func execFromTx(payl payload.Payload) *exec.TxExecution { + return &exec.TxExecution{ + Envelope: &txs.Envelope{ + Tx: &txs.Tx{ + Payload: payl, + }, + }, + } +} diff --git a/execution/contexts/permissions_context.go b/execution/contexts/permissions_context.go index a11752e78..771e9cea1 100644 --- a/execution/contexts/permissions_context.go +++ b/execution/contexts/permissions_context.go @@ -14,9 +14,9 @@ import ( ) type PermissionsContext struct { - StateWriter acmstate.ReaderWriter - Logger *logging.Logger - tx *payload.PermsTx + State acmstate.ReaderWriter + Logger *logging.Logger + tx *payload.PermsTx } func (ctx *PermissionsContext) Execute(txe *exec.TxExecution, p payload.Payload) error { @@ -26,14 +26,14 @@ func (ctx *PermissionsContext) Execute(txe *exec.TxExecution, p payload.Payload) return fmt.Errorf("payload must be PermsTx, but is: %v", txe.Envelope.Tx.Payload) } // Validate input - inAcc, err := ctx.StateWriter.GetAccount(ctx.tx.Input.Address) + inAcc, err := ctx.State.GetAccount(ctx.tx.Input.Address) if err != nil { return err } if inAcc == nil { ctx.Logger.InfoMsg("Cannot find input account", "tx_input", ctx.tx.Input) - return errors.ErrorCodeInvalidAddress + return errors.Codes.InvalidAddress } err = ctx.tx.PermArgs.EnsureValid() @@ -43,7 +43,7 @@ func (ctx *PermissionsContext) Execute(txe *exec.TxExecution, p payload.Payload) permFlag := ctx.tx.PermArgs.Action // check permission - if !HasPermission(ctx.StateWriter, inAcc, permFlag, ctx.Logger) { + if !HasPermission(ctx.State, inAcc, permFlag, ctx.Logger) { return fmt.Errorf("account %s does not have moderator permission %s (%b)", ctx.tx.Input.Address, permFlag.String(), permFlag) } @@ -59,24 +59,24 @@ func (ctx *PermissionsContext) Execute(txe *exec.TxExecution, p payload.Payload) // this one doesn't make sense from txs return fmt.Errorf("HasBase is for contracts, not humans. Just look at the blockchain") case permission.SetBase: - permAcc, err = mutatePermissions(ctx.StateWriter, *ctx.tx.PermArgs.Target, + permAcc, err = mutatePermissions(ctx.State, *ctx.tx.PermArgs.Target, func(perms *permission.AccountPermissions) error { return perms.Base.Set(*ctx.tx.PermArgs.Permission, *ctx.tx.PermArgs.Value) }) case permission.UnsetBase: - permAcc, err = mutatePermissions(ctx.StateWriter, *ctx.tx.PermArgs.Target, + permAcc, err = mutatePermissions(ctx.State, *ctx.tx.PermArgs.Target, func(perms *permission.AccountPermissions) error { return perms.Base.Unset(*ctx.tx.PermArgs.Permission) }) case permission.SetGlobal: - permAcc, err = mutatePermissions(ctx.StateWriter, acm.GlobalPermissionsAddress, + permAcc, err = mutatePermissions(ctx.State, acm.GlobalPermissionsAddress, func(perms *permission.AccountPermissions) error { return perms.Base.Set(*ctx.tx.PermArgs.Permission, *ctx.tx.PermArgs.Value) }) case permission.HasRole: return fmt.Errorf("HasRole is for contracts, not humans. Just look at the blockchain") case permission.AddRole: - permAcc, err = mutatePermissions(ctx.StateWriter, *ctx.tx.PermArgs.Target, + permAcc, err = mutatePermissions(ctx.State, *ctx.tx.PermArgs.Target, func(perms *permission.AccountPermissions) error { if !perms.AddRole(*ctx.tx.PermArgs.Role) { return fmt.Errorf("role (%s) already exists for account %s", @@ -85,7 +85,7 @@ func (ctx *PermissionsContext) Execute(txe *exec.TxExecution, p payload.Payload) return nil }) case permission.RemoveRole: - permAcc, err = mutatePermissions(ctx.StateWriter, *ctx.tx.PermArgs.Target, + permAcc, err = mutatePermissions(ctx.State, *ctx.tx.PermArgs.Target, func(perms *permission.AccountPermissions) error { if !perms.RemoveRole(*ctx.tx.PermArgs.Role) { return fmt.Errorf("role (%s) does not exist for account %s", @@ -106,15 +106,15 @@ func (ctx *PermissionsContext) Execute(txe *exec.TxExecution, p payload.Payload) inAcc.Balance -= value err = inAcc.SubtractFromBalance(value) if err != nil { - return errors.ErrorCodef(errors.ErrorCodeInsufficientFunds, + return errors.Errorf(errors.Codes.InsufficientFunds, "Input account does not have sufficient balance to cover input amount: %v", ctx.tx.Input) } - err = ctx.StateWriter.UpdateAccount(inAcc) + err = ctx.State.UpdateAccount(inAcc) if err != nil { return err } if permAcc != nil { - err = ctx.StateWriter.UpdateAccount(permAcc) + err = ctx.State.UpdateAccount(permAcc) if err != nil { return err } diff --git a/execution/contexts/permissions_context_test.go b/execution/contexts/permissions_context_test.go new file mode 100644 index 000000000..b6f128fdc --- /dev/null +++ b/execution/contexts/permissions_context_test.go @@ -0,0 +1,139 @@ +package contexts + +import ( + "testing" + + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/permission" + "github.com/hyperledger/burrow/txs/payload" + "github.com/stretchr/testify/require" +) + +func TestPermissionsContext(t *testing.T) { + accountState := acmstate.NewMemoryState() + + originPrivKey := newPrivKey(t) + originAccount := newAccountFromPrivKey(originPrivKey) + originAccount.Permissions.Base = permission.AllAccountPermissions.GetBase() + + targetPrivKey := newPrivKey(t) + targetAccount := newAccountFromPrivKey(targetPrivKey) + + ctx := &PermissionsContext{ + State: accountState, + Logger: logging.NewNoopLogger(), + } + + callTx := &payload.CallTx{} + err := ctx.Execute(execFromTx(callTx), callTx) + require.Error(t, err, "should not continue with incorrect payload") + + permsTx := &payload.PermsTx{ + Input: &payload.TxInput{ + Address: originAccount.Address, + }, + } + + err = ctx.Execute(execFromTx(permsTx), permsTx) + require.Error(t, err, "account should not exist") + + accountState.Accounts[originAccount.Address] = originAccount + accountState.Accounts[targetAccount.Address] = targetAccount + + value := true + tests := []struct { + args permission.PermArgs + exp func(t *testing.T, err error) + }{ + { + args: permission.PermArgs{ + Action: 1337, + Target: &targetAccount.Address, + Permission: ptrPermFlag(permission.SetBase), + Value: &value, + }, + exp: errCallback(func(t *testing.T, err error) { + require.Error(t, err, "should error with unknown action") + }), + }, + { + args: permission.PermArgs{ + Action: permission.SetBase, + Target: &targetAccount.Address, + Permission: ptrPermFlag(permission.SetBase), + Value: &value, + }, + exp: errCallback(func(t *testing.T, err error) { + require.NoError(t, err) + }), + }, + { + args: permission.PermArgs{ + Action: permission.UnsetBase, + Target: &targetAccount.Address, + Permission: ptrPermFlag(permission.UnsetBase), + Value: &value, + }, + exp: errCallback(func(t *testing.T, err error) { + require.NoError(t, err) + }), + }, + { + args: permission.PermArgs{ + Action: permission.AddRole, + Target: &targetAccount.Address, + Permission: ptrPermFlag(permission.AddRole), + Value: &value, + Role: ptrRoleString(permission.BondString), + }, + exp: errCallback(func(t *testing.T, err error) { + require.NoError(t, err) + }), + }, + { + args: permission.PermArgs{ + Action: permission.RemoveRole, + Target: &targetAccount.Address, + Permission: ptrPermFlag(permission.RemoveRole), + Value: &value, + Role: ptrRoleString(permission.BondString), + }, + exp: errCallback(func(t *testing.T, err error) { + require.NoError(t, err) + }), + }, + { + args: permission.PermArgs{ + Action: permission.RemoveRole, + Target: &targetAccount.Address, + Permission: ptrPermFlag(permission.RemoveRole), + Value: &value, + Role: ptrRoleString(permission.BondString), + }, + exp: errCallback(func(t *testing.T, err error) { + require.Error(t, err, "can't remove role that isn't set") + }), + }, + } + + for _, tt := range tests { + permsTx.PermArgs = tt.args + err = ctx.Execute(execFromTx(permsTx), permsTx) + tt.exp(t, err) + } +} + +func ptrPermFlag(flag permission.PermFlag) *permission.PermFlag { + return &flag +} + +func ptrRoleString(role string) *string { + return &role +} + +func errCallback(condition func(t *testing.T, err error)) func(t *testing.T, err error) { + return func(t *testing.T, err error) { + condition(t, err) + } +} diff --git a/execution/contexts/proposal_context.go b/execution/contexts/proposal_context.go index 9698c9913..9be2d8d9d 100644 --- a/execution/contexts/proposal_context.go +++ b/execution/contexts/proposal_context.go @@ -6,6 +6,8 @@ import ( "runtime/debug" "unicode" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/acm/acmstate" "github.com/hyperledger/burrow/acm/validator" "github.com/hyperledger/burrow/crypto" @@ -21,7 +23,7 @@ import ( type ProposalContext struct { ChainID string ProposalThreshold uint64 - StateWriter acmstate.ReaderWriter + State acmstate.ReaderWriter ValidatorSet validator.Writer ProposalReg proposal.ReaderWriter Logger *logging.Logger @@ -29,6 +31,17 @@ type ProposalContext struct { Contexts map[payload.Type]Context } +func HashProposal(p *payload.Proposal) []byte { + bs, err := encoding.Encode(p) + if err != nil { + panic("failed to encode Proposal") + } + + hash := sha256.Sum256(bs) + + return hash[:] +} + func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) error { var ok bool ctx.tx, ok = p.(*payload.ProposalTx) @@ -36,7 +49,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er return fmt.Errorf("payload must be ProposalTx, but is: %v", txe.Envelope.Tx.Payload) } // Validate input - inAcc, err := ctx.StateWriter.GetAccount(ctx.tx.Input.Address) + inAcc, err := ctx.State.GetAccount(ctx.tx.Input.Address) if err != nil { return err } @@ -44,11 +57,11 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er if inAcc == nil { ctx.Logger.InfoMsg("Cannot find input account", "tx_input", ctx.tx.Input) - return errors.ErrorCodeInvalidAddress + return errors.Codes.InvalidAddress } // check permission - if !hasProposalPermission(ctx.StateWriter, inAcc, ctx.Logger) { + if !hasProposalPermission(ctx.State, inAcc, ctx.Logger) { return fmt.Errorf("account %s does not have Proposal permission", ctx.tx.Input.Address) } @@ -58,7 +71,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er if ctx.tx.Proposal == nil { // voting for existing proposal if ctx.tx.ProposalHash == nil || ctx.tx.ProposalHash.Size() != sha256.Size { - return errors.ErrorCodeInvalidProposal + return errors.Codes.InvalidProposal } proposalHash = ctx.tx.ProposalHash.Bytes() @@ -69,7 +82,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er } else { if ctx.tx.ProposalHash != nil || ctx.tx.Proposal.BatchTx == nil || len(ctx.tx.Proposal.BatchTx.Txs) == 0 || len(ctx.tx.Proposal.BatchTx.GetInputs()) == 0 { - return errors.ErrorCodeInvalidProposal + return errors.Codes.InvalidProposal } // validate the input strings @@ -77,7 +90,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er return err } - proposalHash = ctx.tx.Proposal.Hash() + proposalHash = HashProposal(ctx.tx.Proposal) ballot, err = ctx.ProposalReg.GetProposal(proposalHash) if err != nil { @@ -98,7 +111,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er for _, vote := range ballot.Votes { for _, i := range ctx.tx.GetInputs() { if i.Address == vote.Address { - return errors.ErrorCodeAlreadyVoted + return errors.Codes.AlreadyVoted } } } @@ -111,12 +124,12 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er } for _, v := range ballot.Votes { - acc, err := ctx.StateWriter.GetAccount(v.Address) + acc, err := ctx.State.GetAccount(v.Address) if err != nil { return err } // Belt and braces, should have already been checked - if !hasProposalPermission(ctx.StateWriter, acc, ctx.Logger) { + if !hasProposalPermission(ctx.State, acc, ctx.Logger) { return fmt.Errorf("account %s does not have Proposal permission", ctx.tx.Input.Address) } votes[v.Address] = v.VotingWeight @@ -124,7 +137,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er for _, i := range ballot.Proposal.BatchTx.GetInputs() { // Validate input - proposeAcc, err := ctx.StateWriter.GetAccount(i.Address) + proposeAcc, err := ctx.State.GetAccount(i.Address) if err != nil { return err } @@ -132,10 +145,10 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er if proposeAcc == nil { ctx.Logger.InfoMsg("Cannot find input account", "tx_input", ctx.tx.Input) - return errors.ErrorCodeInvalidAddress + return errors.Codes.InvalidAddress } - if !hasBatchPermission(ctx.StateWriter, proposeAcc, ctx.Logger) { + if !hasBatchPermission(ctx.State, proposeAcc, ctx.Logger) { return fmt.Errorf("account %s does not have batch permission", i.Address) } @@ -161,7 +174,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er } } - stateCache := acmstate.NewCache(ctx.StateWriter) + stateCache := acmstate.NewCache(ctx.State) for i, step := range ballot.Proposal.BatchTx.Txs { txEnv := txs.EnvelopeFromAny(ctx.ChainID, step) @@ -203,7 +216,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er }() for _, input := range txEnv.Tx.GetInputs() { - acc, err := ctx.StateWriter.GetAccount(input.Address) + acc, err := ctx.State.GetAccount(input.Address) if err != nil { return err } @@ -219,7 +232,7 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er return fmt.Errorf("proposal expired, sequence number %d for account %s wrong at step %d", input.Sequence, input.Address, i+1) } - ctx.StateWriter.UpdateAccount(acc) + ctx.State.UpdateAccount(acc) } if txExecutor, ok := ctx.Contexts[txEnv.Tx.Type()]; ok { @@ -245,16 +258,16 @@ func (ctx *ProposalContext) Execute(txe *exec.TxExecution, p payload.Payload) er func validateProposalStrings(proposal *payload.Proposal) error { if len(proposal.Name) == 0 { - return errors.ErrorCodef(errors.ErrorCodeInvalidString, "name must not be empty") + return errors.Errorf(errors.Codes.InvalidString, "name must not be empty") } if !validateNameRegEntryName(proposal.Name) { - return errors.ErrorCodef(errors.ErrorCodeInvalidString, + return errors.Errorf(errors.Codes.InvalidString, "Invalid characters found in Proposal.Name (%s). Only alphanumeric, underscores, dashes, forward slashes, and @ are allowed", proposal.Name) } if !validateStringPrintable(proposal.Description) { - return errors.ErrorCodef(errors.ErrorCodeInvalidString, + return errors.Errorf(errors.Codes.InvalidString, "Invalid characters found in Proposal.Description (%s). Only printable characters are allowed", proposal.Description) } diff --git a/execution/contexts/send_context.go b/execution/contexts/send_context.go index 84fb546ac..45275fd37 100644 --- a/execution/contexts/send_context.go +++ b/execution/contexts/send_context.go @@ -12,31 +12,31 @@ import ( ) type SendContext struct { - StateWriter acmstate.ReaderWriter - Logger *logging.Logger - tx *payload.SendTx + State acmstate.ReaderWriter + Logger *logging.Logger + tx *payload.SendTx } func (ctx *SendContext) Execute(txe *exec.TxExecution, p payload.Payload) error { var ok bool ctx.tx, ok = p.(*payload.SendTx) if !ok { - return fmt.Errorf("payload must be NameTx, but is: %v", txe.Envelope.Tx.Payload) + return fmt.Errorf("payload must be SendTx, but is: %v", txe.Envelope.Tx.Payload) } - accounts, inTotal, err := getInputs(ctx.StateWriter, ctx.tx.Inputs) + accounts, inTotal, err := getInputs(ctx.State, ctx.tx.Inputs) if err != nil { return err } // ensure all inputs have send permissions - err = allHavePermission(ctx.StateWriter, permission.Send, accounts, ctx.Logger) + err = allHavePermission(ctx.State, permission.Send, accounts, ctx.Logger) if err != nil { return errors.Wrap(err, "at least one input lacks permission for SendTx") } // add outputs to accounts map // if any outputs don't exist, all inputs must have CreateAccount perm - accounts, err = getOrMakeOutputs(ctx.StateWriter, accounts, ctx.tx.Outputs, ctx.Logger) + accounts, err = getOrMakeOutputs(ctx.State, accounts, ctx.tx.Outputs, ctx.Logger) if err != nil { return err } @@ -46,13 +46,13 @@ func (ctx *SendContext) Execute(txe *exec.TxExecution, p payload.Payload) error return err } if outTotal > inTotal { - return errors.ErrorCodeInsufficientFunds + return errors.Codes.InsufficientFunds } if outTotal < inTotal { - return errors.ErrorCodeOverpayment + return errors.Codes.Overpayment } if outTotal == 0 { - return errors.ErrorCodeZeroPayment + return errors.Codes.ZeroPayment } // Good! Adjust accounts @@ -67,7 +67,7 @@ func (ctx *SendContext) Execute(txe *exec.TxExecution, p payload.Payload) error } for _, acc := range accounts { - err = ctx.StateWriter.UpdateAccount(acc) + err = ctx.State.UpdateAccount(acc) if err != nil { return err } diff --git a/execution/contexts/send_context_test.go b/execution/contexts/send_context_test.go new file mode 100644 index 000000000..9cfa12636 --- /dev/null +++ b/execution/contexts/send_context_test.go @@ -0,0 +1,125 @@ +package contexts + +import ( + "testing" + + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/txs/payload" + "github.com/stretchr/testify/require" +) + +func TestSendContext(t *testing.T) { + accountState := acmstate.NewMemoryState() + + originPrivKey := newPrivKey(t) + originAccount := newAccountFromPrivKey(originPrivKey) + + targetPrivKey := newPrivKey(t) + targetAccount := newAccountFromPrivKey(targetPrivKey) + + ctx := &SendContext{ + State: accountState, + Logger: logging.NewNoopLogger(), + } + + callTx := &payload.CallTx{} + err := ctx.Execute(execFromTx(callTx), callTx) + require.Error(t, err, "should not continue with incorrect payload") + + accountState.Accounts[originAccount.Address] = originAccount + accountState.Accounts[targetAccount.Address] = targetAccount + + tests := []struct { + tx *payload.SendTx + exp func(t *testing.T, err error) + }{ + { + tx: &payload.SendTx{ + Inputs: []*payload.TxInput{ + &payload.TxInput{ + Address: originAccount.Address, + }, + }, + }, + exp: errCallback(func(t *testing.T, err error) { + require.Error(t, err, "should not allow zero payment") + }), + }, + { + tx: &payload.SendTx{ + Inputs: []*payload.TxInput{ + &payload.TxInput{ + Address: originAccount.Address, + Amount: 100, + }, + }, + }, + exp: errCallback(func(t *testing.T, err error) { + require.Error(t, err, "should not allow overpayment (i.e. inputs > outputs)") + }), + }, + { + tx: &payload.SendTx{ + Inputs: []*payload.TxInput{ + &payload.TxInput{ + Address: originAccount.Address, + Amount: 100, + }, + }, + Outputs: []*payload.TxOutput{ + &payload.TxOutput{ + Address: originAccount.Address, + Amount: 100, + }, + }, + }, + exp: errCallback(func(t *testing.T, err error) { + require.Error(t, err, "should not allow self payment") + }), + }, + { + tx: &payload.SendTx{ + Inputs: []*payload.TxInput{ + &payload.TxInput{ + Address: originAccount.Address, + Amount: 100, + }, + }, + Outputs: []*payload.TxOutput{ + &payload.TxOutput{ + Address: targetAccount.Address, + Amount: 100, + }, + }, + }, + exp: errCallback(func(t *testing.T, err error) { + require.NoError(t, err, "should allow payment") + }), + }, + { + tx: &payload.SendTx{ + Inputs: []*payload.TxInput{ + &payload.TxInput{ + Address: originAccount.Address, + Amount: 10000, + }, + }, + Outputs: []*payload.TxOutput{ + &payload.TxOutput{ + Address: targetAccount.Address, + Amount: 10000, + }, + }, + }, + exp: errCallback(func(t *testing.T, err error) { + require.Error(t, err, "should not allow send with insufficient funds") + }), + }, + } + + for _, tt := range tests { + err = ctx.Execute(execFromTx(tt.tx), tt.tx) + tt.exp(t, err) + } +} diff --git a/execution/contexts/shared.go b/execution/contexts/shared.go index 84959a3f8..4cdc36e43 100644 --- a/execution/contexts/shared.go +++ b/execution/contexts/shared.go @@ -28,14 +28,14 @@ func getInputs(accountGetter acmstate.AccountGetter, ins []*payload.TxInput) (ma for _, in := range ins { // Account shouldn't be duplicated if _, ok := accounts[in.Address]; ok { - return nil, total, errors.ErrorCodeDuplicateAddress + return nil, total, errors.Codes.DuplicateAddress } acc, err := accountGetter.GetAccount(in.Address) if err != nil { return nil, total, err } if acc == nil { - return nil, total, errors.ErrorCodeInvalidAddress + return nil, total, errors.Codes.InvalidAddress } accounts[in.Address] = acc total += in.Amount @@ -64,7 +64,7 @@ func getOrMakeOutput(accountGetter acmstate.AccountGetter, accs map[crypto.Addre // Account shouldn't be duplicated if _, ok := accs[outputAddress]; ok { - return nil, errors.ErrorCodeDuplicateAddress + return nil, errors.Codes.DuplicateAddress } acc, err := accountGetter.GetAccount(outputAddress) if err != nil { @@ -142,11 +142,19 @@ func HasPermission(accountGetter acmstate.AccountGetter, acc *acm.Account, perm return false } - v, err := acc.Permissions.Base.Compose(acmstate.GlobalAccountPermissions(accountGetter).Base).Get(perm) + globalPerms, err := acmstate.GlobalAccountPermissions(accountGetter) if err != nil { logger.TraceMsg("Error obtaining permission value (will default to false/deny)", "perm_flag", perm.String(), structure.ErrorKey, err) + return false + } + v, err := acc.Permissions.Base.Compose(globalPerms.Base).Get(perm) + if err != nil { + logger.TraceMsg("Error obtaining permission value (will default to false/deny)", + "perm_flag", perm.String(), + structure.ErrorKey, err) + return false } if v { @@ -174,6 +182,18 @@ func allHavePermission(accountGetter acmstate.AccountGetter, perm permission.Per return nil } +func oneHasPermission(accountGetter acmstate.AccountGetter, perm permission.PermFlag, + accs map[crypto.Address]*acm.Account, logger *logging.Logger) error { + for _, acc := range accs { + if HasPermission(accountGetter, acc, perm, logger) { + return nil + } + } + return errors.PermissionDenied{ + Perm: perm, + } +} + func hasProposalPermission(accountGetter acmstate.AccountGetter, acc *acm.Account, logger *logging.Logger) bool { return HasPermission(accountGetter, acc, permission.Proposal, logger) diff --git a/execution/contexts/unbond_context.go b/execution/contexts/unbond_context.go index 04f91223f..31d551903 100644 --- a/execution/contexts/unbond_context.go +++ b/execution/contexts/unbond_context.go @@ -12,7 +12,7 @@ import ( ) type UnbondContext struct { - StateWriter acmstate.ReaderWriter + State acmstate.ReaderWriter ValidatorSet validator.ReaderWriter Logger *logging.Logger tx *payload.UnbondTx @@ -31,7 +31,7 @@ func (ctx *UnbondContext) Execute(txe *exec.TxExecution, p payload.Payload) erro } power := new(big.Int).SetUint64(ctx.tx.Output.GetAmount()) - account, err := ctx.StateWriter.GetAccount(ctx.tx.Input.Address) + account, err := ctx.State.GetAccount(ctx.tx.Input.Address) if err != nil { return err } @@ -46,5 +46,5 @@ func (ctx *UnbondContext) Execute(txe *exec.TxExecution, p payload.Payload) erro return err } - return ctx.StateWriter.UpdateAccount(account) + return ctx.State.UpdateAccount(account) } diff --git a/execution/defaults/options.go b/execution/defaults/options.go new file mode 100644 index 000000000..71782bf80 --- /dev/null +++ b/execution/defaults/options.go @@ -0,0 +1,21 @@ +package defaults + +import ( + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/native" + "github.com/hyperledger/burrow/logging" +) + +func CompleteOptions(options engine.Options) engine.Options { + // Set defaults + if options.MemoryProvider == nil { + options.MemoryProvider = engine.DefaultDynamicMemoryProvider + } + if options.Logger == nil { + options.Logger = logging.NewNoopLogger() + } + if options.Natives == nil { + options.Natives = native.MustDefaultNatives() + } + return options +} diff --git a/execution/engine/account.go b/execution/engine/account.go new file mode 100644 index 000000000..31ffd5905 --- /dev/null +++ b/execution/engine/account.go @@ -0,0 +1,206 @@ +package engine + +import ( + "bytes" + "math/big" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/deploy/compile" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/txs/payload" + "golang.org/x/crypto/sha3" +) + +func InitEVMCode(st acmstate.ReaderWriter, address crypto.Address, code []byte) error { + return initEVMCode(st, address, nil, code) +} + +func InitChildCode(st acmstate.ReaderWriter, address crypto.Address, parent crypto.Address, code []byte) error { + return initEVMCode(st, address, &parent, code) +} + +func initEVMCode(st acmstate.ReaderWriter, address crypto.Address, parent *crypto.Address, code []byte) error { + acc, err := MustAccount(st, address) + if err != nil { + return err + } + if acc.EVMCode != nil || acc.WASMCode != nil { + return errors.Errorf(errors.Codes.IllegalWrite, + "tried to initialise code for a contract that already has code: %v", address) + } + + acc.EVMCode = code + + // keccak256 hash of a contract's code + hash := sha3.NewLegacyKeccak256() + hash.Write(code) + codehash := hash.Sum(nil) + + forebear := &address + metamap := acc.ContractMeta + if parent != nil { + // find our ancestor, i.e. the initial contract that was deployed, from which this contract descends + ancestor, err := st.GetAccount(*parent) + if err != nil { + return err + } + if ancestor == nil { + return errors.Errorf(errors.Codes.NonExistentAccount, + "parent %v of account %v does not exist", *parent, address) + } + if ancestor.Forebear != nil { + ancestor, err = st.GetAccount(*ancestor.Forebear) + if err != nil { + return err + } + if ancestor == nil { + return errors.Errorf(errors.Codes.NonExistentAccount, + "forebear %v of account %v does not exist", *ancestor.Forebear, *parent) + } + forebear = ancestor.Forebear + } else { + forebear = parent + } + metamap = ancestor.ContractMeta + } + + // If we have a list of ABIs for this contract, we also know what contract code it is allowed to create + // For compatibility with older contracts, allow any contract to be created if we have no mappings + if metamap != nil && len(metamap) > 0 { + found := codehashPermitted(codehash, metamap) + + // Libraries lie about their deployed bytecode + if !found { + deployCodehash := compile.GetDeployCodeHash(code, address) + found = codehashPermitted(deployCodehash, metamap) + } + + if !found { + return errors.Errorf(errors.Codes.InvalidContractCode, + "could not find code with code hash: %X", codehash) + } + } + + acc.CodeHash = codehash + acc.Forebear = forebear + + return st.UpdateAccount(acc) +} + +func codehashPermitted(codehash []byte, metamap []*acm.ContractMeta) bool { + for _, m := range metamap { + if bytes.Equal(codehash, m.CodeHash) { + return true + } + } + + return false +} + +func InitWASMCode(st acmstate.ReaderWriter, address crypto.Address, code []byte) error { + acc, err := MustAccount(st, address) + if err != nil { + return err + } + if acc.EVMCode != nil || acc.WASMCode != nil { + return errors.Errorf(errors.Codes.IllegalWrite, + "tried to re-initialise code for contract %v", address) + } + + acc.WASMCode = code + // keccak256 hash of a contract's code + hash := sha3.NewLegacyKeccak256() + hash.Write(code) + acc.CodeHash = hash.Sum(nil) + return st.UpdateAccount(acc) +} + +// TODO: consider pushing big.Int usage all the way to account balance +func Transfer(st acmstate.ReaderWriter, from, to crypto.Address, amount *big.Int) error { + if !amount.IsInt64() { + return errors.Errorf(errors.Codes.IntegerOverflow, "transfer amount %v overflows int64", amount) + } + if amount.Sign() == 0 { + return nil + } + acc, err := MustAccount(st, from) + if err != nil { + return err + } + if new(big.Int).SetUint64(acc.Balance).Cmp(amount) < 0 { + return errors.Codes.InsufficientBalance + } + err = UpdateAccount(st, from, func(account *acm.Account) error { + return account.SubtractFromBalance(amount.Uint64()) + }) + if err != nil { + return err + } + return UpdateAccount(st, to, func(account *acm.Account) error { + return account.AddToBalance(amount.Uint64()) + }) +} + +func UpdateContractMeta(st acmstate.ReaderWriter, metaSt acmstate.MetadataWriter, address crypto.Address, payloadMeta []*payload.ContractMeta) error { + if len(payloadMeta) == 0 { + return nil + } + acc, err := MustAccount(st, address) + if err != nil { + return err + } + + contractMeta := make([]*acm.ContractMeta, len(payloadMeta)) + for i, abi := range payloadMeta { + metahash := acmstate.GetMetadataHash(abi.Meta) + contractMeta[i] = &acm.ContractMeta{ + MetadataHash: metahash[:], + CodeHash: abi.CodeHash, + } + err = metaSt.SetMetadata(metahash, abi.Meta) + if err != nil { + return errors.Errorf(errors.Codes.IllegalWrite, + "cannot update metadata for %v: %v", address, err) + } + } + acc.ContractMeta = contractMeta + return st.UpdateAccount(acc) +} + +func RemoveAccount(st acmstate.ReaderWriter, address crypto.Address) error { + acc, err := st.GetAccount(address) + if err != nil { + return err + } + if acc == nil { + return errors.Errorf(errors.Codes.DuplicateAddress, + "tried to remove an account at an address that does not exist: %v", address) + } + return st.RemoveAccount(address) +} + +func UpdateAccount(st acmstate.ReaderWriter, address crypto.Address, updater func(acc *acm.Account) error) error { + acc, err := MustAccount(st, address) + if err != nil { + return err + } + err = updater(acc) + if err != nil { + return err + } + return st.UpdateAccount(acc) +} + +func MustAccount(st acmstate.Reader, address crypto.Address) (*acm.Account, error) { + acc, err := st.GetAccount(address) + if err != nil { + return nil, err + } + if acc == nil { + return nil, errors.Errorf(errors.Codes.NonExistentAccount, + "account %v does not exist", address) + } + return acc, nil +} diff --git a/execution/engine/account_test.go b/execution/engine/account_test.go new file mode 100644 index 000000000..5e28cbb36 --- /dev/null +++ b/execution/engine/account_test.go @@ -0,0 +1,86 @@ +package engine + +import ( + "testing" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestState_CreateAccount(t *testing.T) { + st := acmstate.NewMemoryState() + address := AddressFromName("frogs") + err := CreateAccount(st, address) + require.NoError(t, err) + err = CreateAccount(st, address) + require.Error(t, err) + require.Equal(t, errors.Codes.DuplicateAddress, errors.GetCode(err)) + + st = acmstate.NewMemoryState() + err = CreateAccount(st, address) + require.NoError(t, err) + err = InitEVMCode(st, address, []byte{1, 2, 3}) + require.NoError(t, err) +} + +func TestState_Sync(t *testing.T) { + backend := acmstate.NewCache(acmstate.NewMemoryState()) + st := NewCallFrame(backend) + address := AddressFromName("frogs") + + err := CreateAccount(st, address) + require.NoError(t, err) + amt := uint64(1232) + addToBalance(t, st, address, amt) + err = st.Sync() + require.NoError(t, err) + + acc, err := backend.GetAccount(address) + require.NoError(t, err) + assert.Equal(t, acc.Balance, amt) +} + +func TestState_NewCache(t *testing.T) { + st := NewCallFrame(acmstate.NewMemoryState()) + address := AddressFromName("frogs") + + cache, err := st.NewFrame() + require.NoError(t, err) + err = CreateAccount(cache, address) + require.NoError(t, err) + amt := uint64(1232) + addToBalance(t, cache, address, amt) + + acc, err := st.GetAccount(address) + require.NoError(t, err) + require.Nil(t, acc) + + // Sync through to cache + err = cache.Sync() + require.NoError(t, err) + + acc, err = MustAccount(cache, address) + require.NoError(t, err) + assert.Equal(t, amt, acc.Balance) + + cache, err = cache.NewFrame(acmstate.ReadOnly) + require.NoError(t, err) + cache, err = cache.NewFrame() + require.NoError(t, err) + err = UpdateAccount(cache, address, func(account *acm.Account) error { + return account.AddToBalance(amt) + }) + require.Error(t, err) + require.Equal(t, errors.Codes.IllegalWrite, errors.GetCode(err)) +} + +func addToBalance(t testing.TB, st acmstate.ReaderWriter, address crypto.Address, amt uint64) { + err := UpdateAccount(st, address, func(account *acm.Account) error { + return account.AddToBalance(amt) + }) + require.NoError(t, err) +} diff --git a/execution/engine/accounts.go b/execution/engine/accounts.go new file mode 100644 index 000000000..6faeee0d5 --- /dev/null +++ b/execution/engine/accounts.go @@ -0,0 +1,98 @@ +package engine + +import ( + "fmt" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/permission" +) + +type Maybe interface { + PushError(err error) bool + Error() error +} + +func GetAccount(st acmstate.Reader, m Maybe, address crypto.Address) *acm.Account { + acc, err := st.GetAccount(address) + if err != nil { + m.PushError(err) + return nil + } + return acc +} + +// Guaranteed to return a non-nil account, if the account does not exist returns a pointer to the zero-value of Account +// and pushes an error. +func MustGetAccount(st acmstate.Reader, m Maybe, address crypto.Address) *acm.Account { + acc := GetAccount(st, m, address) + if acc == nil { + m.PushError(errors.Errorf(errors.Codes.NonExistentAccount, "account %v does not exist", address)) + return &acm.Account{} + } + return acc +} + +func EnsurePermission(callFrame *CallFrame, address crypto.Address, perm permission.PermFlag) error { + hasPermission, err := HasPermission(callFrame, address, perm) + if err != nil { + return err + } else if !hasPermission { + return errors.PermissionDenied{ + Address: address, + Perm: perm, + } + } + return nil +} + +// CONTRACT: it is the duty of the contract writer to call known permissions +// we do not convey if a permission is not set +// (unlike in state/execution, where we guarantee HasPermission is called +// on known permissions and panics else) +// If the perm is not defined in the acc nor set by default in GlobalPermissions, +// this function returns false. +func HasPermission(st acmstate.Reader, address crypto.Address, perm permission.PermFlag) (bool, error) { + acc, err := st.GetAccount(address) + if err != nil { + return false, err + } + if acc == nil { + return false, fmt.Errorf("account %v does not exist", address) + } + globalPerms, err := acmstate.GlobalAccountPermissions(st) + if err != nil { + return false, err + } + perms := acc.Permissions.Base.Compose(globalPerms.Base) + value, err := perms.Get(perm) + if err != nil { + return false, err + } + return value, nil +} + +func CreateAccount(st acmstate.ReaderWriter, address crypto.Address) error { + acc, err := st.GetAccount(address) + if err != nil { + return err + } + if acc != nil { + if acc.NativeName != "" { + return errors.Errorf(errors.Codes.ReservedAddress, + "cannot create account at %v because that address is reserved for a native contract '%s'", + address, acc.NativeName) + } + return errors.Errorf(errors.Codes.DuplicateAddress, + "tried to create an account at an address that already exists: %v", address) + } + return st.UpdateAccount(&acm.Account{Address: address}) +} + +func AddressFromName(name string) (address crypto.Address) { + hash := crypto.Keccak256([]byte(name)) + copy(address[:], hash[len(hash)-crypto.AddressLength:]) + return +} diff --git a/execution/engine/blockchain.go b/execution/engine/blockchain.go new file mode 100644 index 000000000..fd59d8d81 --- /dev/null +++ b/execution/engine/blockchain.go @@ -0,0 +1,36 @@ +package engine + +import ( + "encoding/binary" + "time" + + "github.com/hyperledger/burrow/execution/errors" +) + +type TestBlockchain struct { + BlockHeight uint64 + BlockTime time.Time +} + +var _ Blockchain = (*TestBlockchain)(nil) + +func (b *TestBlockchain) LastBlockHeight() uint64 { + return b.BlockHeight +} + +func (b *TestBlockchain) LastBlockTime() time.Time { + return b.BlockTime +} + +func (b *TestBlockchain) BlockHash(height uint64) ([]byte, error) { + if height > b.BlockHeight { + return nil, errors.Codes.InvalidBlockNumber + } + bs := make([]byte, 32) + binary.BigEndian.PutUint64(bs[24:], height) + return bs, nil +} + +func (V *TestBlockchain) ChainID() string { + return "TestChain" +} diff --git a/execution/engine/call.go b/execution/engine/call.go new file mode 100644 index 000000000..1b1a3e850 --- /dev/null +++ b/execution/engine/call.go @@ -0,0 +1,161 @@ +package engine + +import ( + "math/big" + + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/permission" +) + +var big64 = big.NewInt(64) + +// Call provides a standard wrapper for implementing Callable.Call with appropriate error handling and event firing. +func Call(state State, params CallParams, execute func(State, CallParams) ([]byte, error)) ([]byte, error) { + maybe := new(errors.Maybe) + if params.CallType == exec.CallTypeCall || params.CallType == exec.CallTypeCode { + // NOTE: Delegate and Static CallTypes do not transfer the value to the callee. + maybe.PushError(Transfer(state.CallFrame, params.Caller, params.Callee, ¶ms.Value)) + } + + output := maybe.Bytes(execute(state, params)) + // fire the post call event (including exception if applicable) and make sure we return the accumulated call error + maybe.PushError(FireCallEvent(state.CallFrame, maybe.Error(), state.EventSink, output, params)) + return output, maybe.Error() +} + +func FireCallEvent(callFrame *CallFrame, callErr error, eventSink exec.EventSink, output []byte, + params CallParams) error { + // fire the post call event (including exception if applicable) + return eventSink.Call(&exec.CallEvent{ + CallType: params.CallType, + CallData: &exec.CallData{ + Caller: params.Caller, + Callee: params.Callee, + Data: params.Input, + Value: params.Value.Bytes(), + Gas: params.Gas.Bytes(), + }, + Origin: params.Origin, + StackDepth: callFrame.CallStackDepth(), + Return: output, + }, errors.AsException(callErr)) +} + +func CallFromSite(st State, dispatcher Dispatcher, site CallParams, target CallParams) ([]byte, error) { + err := EnsurePermission(st.CallFrame, site.Callee, permission.Call) + if err != nil { + return nil, err + } + // Get the arguments from the memory + // EVM contract + err = UseGasNegative(site.Gas, GasGetAccount) + if err != nil { + return nil, err + } + // since CALL is used also for sending funds, + // acc may not exist yet. This is an errors.CodedError for + // CALLCODE, but not for CALL, though I don't think + // ethereum actually cares + acc, err := st.CallFrame.GetAccount(target.Callee) + if err != nil { + return nil, err + } + if acc == nil { + if target.CallType != exec.CallTypeCall { + return nil, errors.Codes.UnknownAddress + } + // We're sending funds to a new account so we must create it first + err := st.CallFrame.CreateAccount(site.Callee, target.Callee) + if err != nil { + return nil, err + } + acc, err = st.CallFrame.GetAccount(target.Callee) + if err != nil { + return nil, err + } + } + + // Establish a stack frame and perform the call + childCallFrame, err := st.CallFrame.NewFrame() + if err != nil { + return nil, err + } + childState := State{ + CallFrame: childCallFrame, + Blockchain: st.Blockchain, + EventSink: st.EventSink, + } + // Ensure that gasLimit is reasonable + if site.Gas.Cmp(target.Gas) < 0 { + // EIP150 - the 63/64 rule - rather than errors.CodedError we pass this specified fraction of the total available gas + gas := new(big.Int) + target.Gas.Sub(site.Gas, gas.Div(site.Gas, big64)) + } + // NOTE: we will return any used gas later. + site.Gas.Sub(site.Gas, target.Gas) + + // Setup callee params for call type + target.Origin = site.Origin + + // Set up the caller/callee context + switch target.CallType { + case exec.CallTypeCall: + // Calls contract at target from this contract normally + // Value: transferred + // Caller: this contract + // Storage: target + // Code: from target + target.Caller = site.Callee + + case exec.CallTypeStatic: + // Calls contract at target from this contract with no state mutation + // Value: not transferred + // Caller: this contract + // Storage: target (read-only) + // Code: from target + target.Caller = site.Callee + + childState.CallFrame.ReadOnly() + childState.EventSink = exec.NewLogFreeEventSink(childState.EventSink) + + case exec.CallTypeCode: + // Calling this contract from itself as if it had the code at target + // Value: transferred + // Caller: this contract + // Storage: this contract + // Code: from target + + target.Caller = site.Callee + target.Callee = site.Callee + + case exec.CallTypeDelegate: + // Calling this contract from the original caller as if it had the code at target + // Value: not transferred + // Caller: original caller + // Storage: this contract + // Code: from target + + target.Caller = site.Caller + target.Callee = site.Callee + + default: + // Switch should be exhaustive so we should reach this + panic("invalid call type") + } + + dispatch := dispatcher.Dispatch(acc) + if dispatch == nil { + return nil, errors.Errorf(errors.Codes.NotCallable, "cannot call: %v", acc.Address) + } + returnData, err := dispatch.Call(childState, target) + + if err == nil { + // Sync error is a hard stop + err = childState.CallFrame.Sync() + } + + // Handle remaining gas. + //site.Gas.Add(site.Gas, target.Gas) + return returnData, err +} diff --git a/execution/engine/call_frame.go b/execution/engine/call_frame.go new file mode 100644 index 000000000..602fb1a30 --- /dev/null +++ b/execution/engine/call_frame.go @@ -0,0 +1,75 @@ +package engine + +import ( + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/permission" +) + +type CallFrame struct { + // Cache this State wraps + *acmstate.Cache + // Where we sync + backend acmstate.ReaderWriter + // In order for nested cache to inherit any options + cacheOptions []acmstate.CacheOption + // Depth of the call stack + callStackDepth uint64 + // Max call stack depth + maxCallStackDepth uint64 +} + +// Create a new CallFrame to hold state updates at a particular level in the call stack +func NewCallFrame(st acmstate.ReaderWriter, cacheOptions ...acmstate.CacheOption) *CallFrame { + return newCallFrame(st, 0, 0, cacheOptions...) +} + +func newCallFrame(st acmstate.ReaderWriter, stackDepth uint64, maxCallStackDepth uint64, cacheOptions ...acmstate.CacheOption) *CallFrame { + return &CallFrame{ + Cache: acmstate.NewCache(st, cacheOptions...), + backend: st, + cacheOptions: cacheOptions, + callStackDepth: stackDepth, + maxCallStackDepth: maxCallStackDepth, + } +} + +// Put this CallFrame in permanent read-only mode +func (st *CallFrame) ReadOnly() *CallFrame { + acmstate.ReadOnly(st.Cache) + return st +} + +func (st *CallFrame) WithMaxCallStackDepth(max uint64) *CallFrame { + st.maxCallStackDepth = max + return st +} + +func (st *CallFrame) NewFrame(cacheOptions ...acmstate.CacheOption) (*CallFrame, error) { + if st.maxCallStackDepth > 0 && st.maxCallStackDepth == st.callStackDepth { + return nil, errors.Codes.CallStackOverflow + } + return newCallFrame(st.Cache, st.callStackDepth+1, st.maxCallStackDepth, + append(st.cacheOptions, cacheOptions...)...), nil +} + +func (st *CallFrame) Sync() error { + err := st.Cache.Sync(st.backend) + if err != nil { + return errors.AsException(err) + } + return nil +} + +func (st *CallFrame) CallStackDepth() uint64 { + return st.callStackDepth +} + +func (st *CallFrame) CreateAccount(creator, address crypto.Address) error { + err := EnsurePermission(st, creator, permission.CreateAccount) + if err != nil { + return err + } + return CreateAccount(st, address) +} diff --git a/execution/engine/callable.go b/execution/engine/callable.go new file mode 100644 index 000000000..273c06646 --- /dev/null +++ b/execution/engine/callable.go @@ -0,0 +1,37 @@ +package engine + +import ( + "math/big" + "time" + + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/exec" +) + +type Blockchain interface { + LastBlockHeight() uint64 + LastBlockTime() time.Time + BlockHash(height uint64) ([]byte, error) + ChainID() string +} + +type CallParams struct { + CallType exec.CallType + Origin crypto.Address + Caller crypto.Address + Callee crypto.Address + Input []byte + Value big.Int + Gas *big.Int +} + +// Effectively a contract, but can either represent a single function or a contract with multiple functions and a selector +type Callable interface { + Call(state State, params CallParams) (output []byte, err error) +} + +type CallableFunc func(st State, params CallParams) (output []byte, err error) + +func (c CallableFunc) Call(state State, params CallParams) (output []byte, err error) { + return c(state, params) +} diff --git a/execution/engine/dispatcher.go b/execution/engine/dispatcher.go new file mode 100644 index 000000000..e05713778 --- /dev/null +++ b/execution/engine/dispatcher.go @@ -0,0 +1,90 @@ +package engine + +import ( + "github.com/hyperledger/burrow/acm" +) + +type Dispatcher interface { + // If this Dispatcher is capable of dispatching this account (e.g. if it has the correct bytecode) then return a + // Callable that wraps the function, otherwise return nil + Dispatch(acc *acm.Account) Callable +} + +type DispatcherFunc func(acc *acm.Account) Callable + +func (d DispatcherFunc) Dispatch(acc *acm.Account) Callable { + return d(acc) +} + +// An ExternalDispatcher is able to Dispatch accounts to external engines as well as Dispatch to itself +type ExternalDispatcher interface { + Dispatcher + SetExternals(externals Dispatcher) +} + +// An ExternalDispatcher is able to Dispatch accounts to external engines as well as Dispatch to itself +type Externals struct { + // Provide any foreign dispatchers to allow calls between VMs + externals Dispatcher +} + +var _ ExternalDispatcher = (*Externals)(nil) + +func (ed *Externals) Dispatch(acc *acm.Account) Callable { + // Try external calls then fallback to EVM + if ed.externals == nil { + return nil + } + return ed.externals.Dispatch(acc) +} + +func (ed *Externals) SetExternals(externals Dispatcher) { + ed.externals = externals +} + +type Dispatchers []Dispatcher + +func NewDispatchers(dispatchers ...Dispatcher) Dispatchers { + out := dispatchers[:0] + // Flatten dispatchers and omit nil dispatchers (allows optional dispatchers in chain) + for i, d := range dispatchers { + ds, ok := d.(Dispatchers) + if ok { + // Add tail to nested dispatchers if one exists + if len(dispatchers) > i { + ds = append(ds, dispatchers[i+1:]...) + } + return append(out, NewDispatchers(ds...)...) + } else if d != nil { + out = append(out, d) + } + } + return out +} + +// Connect ExternalDispatchers eds to each other so that the underlying engines can mutually call contracts hosted by +// other dispatchers +func Connect(eds ...ExternalDispatcher) { + for i, ed := range eds { + // Collect external dispatchers excluding this one (to avoid infinite dispatcher loops!) + others := make([]Dispatcher, 0, len(eds)-1) + for offset := 1; offset < len(eds); offset++ { + idx := (i + offset) % len(eds) + others = append(others, eds[idx]) + } + ed.SetExternals(NewDispatchers(others...)) + } +} + +func (ds Dispatchers) Dispatch(acc *acm.Account) Callable { + for _, d := range ds { + callable := d.Dispatch(acc) + if callable != nil { + return callable + } + } + return nil +} + +type ExternalsStorage struct { +} diff --git a/execution/engine/dispatcher_test.go b/execution/engine/dispatcher_test.go new file mode 100644 index 000000000..b9b44cc45 --- /dev/null +++ b/execution/engine/dispatcher_test.go @@ -0,0 +1,82 @@ +package engine + +import ( + "fmt" + "testing" + + "github.com/hyperledger/burrow/acm" + "github.com/stretchr/testify/require" +) + +type testDispatcher struct { + name string + externals Dispatcher +} + +func newDispatcher(name string) *testDispatcher { + return &testDispatcher{ + name: name, + } +} + +func (t *testDispatcher) SetExternals(externals Dispatcher) { + t.externals = externals +} + +func (t *testDispatcher) String() string { + if t.externals != nil { + ds, ok := t.externals.(Dispatchers) + if ok { + var exts []string + for _, d := range ds { + td, ok := d.(*testDispatcher) + if ok { + exts = append(exts, td.name) + } + } + if len(exts) > 0 { + return fmt.Sprintf("%s -> %v", t.name, exts) + } + } + } + return t.name +} + +func (t *testDispatcher) Dispatch(acc *acm.Account) Callable { + return nil +} + +func TestNewDispatchers(t *testing.T) { + d1 := newDispatcher("1") + d2 := newDispatcher("2") + d3 := newDispatcher("3") + + dd1 := NewDispatchers(d1, d2, d3) + + require.Equal(t, "[1 2 3 1 2 3]", fmt.Sprint(NewDispatchers(dd1, dd1))) + require.Equal(t, "[1 2 3 1 3]", fmt.Sprint(NewDispatchers(dd1, d1, d3))) + require.Equal(t, "[3 1 1 2 3]", fmt.Sprint(NewDispatchers(d3, d1, dd1))) +} + +func TestConnect(t *testing.T) { + d1 := newDispatcher("1") + d2 := newDispatcher("2") + d3 := newDispatcher("3") + + // Check we don't panic + Connect() + + // Does nothing but fine + Connect(d1) + require.Equal(t, "1", d1.String()) + + Connect(d1, d2) + require.Equal(t, "1 -> [2]", d1.String()) + require.Equal(t, "2 -> [1]", d2.String()) + require.Equal(t, "3", d3.String()) + + Connect(d1, d2, d3) + require.Equal(t, "1 -> [2 3]", d1.String()) + require.Equal(t, "2 -> [3 1]", d2.String()) + require.Equal(t, "3 -> [1 2]", d3.String()) +} diff --git a/execution/engine/gas.go b/execution/engine/gas.go new file mode 100644 index 000000000..332c458e1 --- /dev/null +++ b/execution/engine/gas.go @@ -0,0 +1,42 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package engine + +import ( + "math/big" + + "github.com/hyperledger/burrow/execution/errors" +) + +const ( + GasSha3 uint64 = 1 + GasGetAccount uint64 = 1 + GasStorageUpdate uint64 = 1 + GasCreateAccount uint64 = 1 + + GasBaseOp uint64 = 0 // TODO: make this 1 + GasStackOp uint64 = 1 + + GasEcRecover uint64 = 1 + GasSha256Word uint64 = 1 + GasSha256Base uint64 = 1 + GasRipemd160Word uint64 = 1 + GasRipemd160Base uint64 = 1 + GasExpModWord uint64 = 1 + GasExpModBase uint64 = 1 + GasIdentityWord uint64 = 1 + GasIdentityBase uint64 = 1 +) + +// Try to deduct gasToUse from gasLeft. If ok return false, otherwise +// set err and return true. +func UseGasNegative(gasLeft *big.Int, gasToUse uint64) errors.CodedError { + delta := new(big.Int).SetUint64(gasToUse) + if gasLeft.Cmp(delta) >= 0 { + gasLeft.Sub(gasLeft, delta) + } else { + return errors.Codes.InsufficientGas + } + return nil +} diff --git a/execution/evm/memory.go b/execution/engine/memory.go similarity index 97% rename from execution/evm/memory.go rename to execution/engine/memory.go index 01476ca41..9df1add22 100644 --- a/execution/evm/memory.go +++ b/execution/engine/memory.go @@ -1,4 +1,4 @@ -package evm +package engine import ( "fmt" @@ -17,7 +17,7 @@ const ( // written to the backing slice at a time when it is grown. A larger number may // lead to fewer calls to append to achieve the desired capacity although it is // unlikely to make a lot of difference. -var zeroBlock []byte = make([]byte, 32) +var zeroBlock = make([]byte, 32) // Interface for a bounded linear memory indexed by a single *big.Int parameter // for each byte in the memory. @@ -159,3 +159,8 @@ func (mem *dynamicMemory) ensureCapacity(newCapacity uint64) error { mem.slice = mem.slice[:newCapacity] return nil } + +type fixedMemory struct { + slice []byte + errSink errors.Sink +} diff --git a/execution/evm/memory_test.go b/execution/engine/memory_test.go similarity index 78% rename from execution/evm/memory_test.go rename to execution/engine/memory_test.go index d51076998..32c8499a1 100644 --- a/execution/evm/memory_test.go +++ b/execution/engine/memory_test.go @@ -1,4 +1,4 @@ -package evm +package engine import ( "testing" @@ -13,51 +13,51 @@ import ( // Test static memory allocation with maximum == initial capacity - memory should not grow func TestDynamicMemory_StaticAllocation(t *testing.T) { - err := errors.FirstOnly() - mem := NewDynamicMemory(4, 4, err).(*dynamicMemory) + maybe := new(errors.Maybe) + mem := NewDynamicMemory(4, 4, maybe).(*dynamicMemory) mem.Write(big.NewInt(0), []byte{1}) mem.Write(big.NewInt(1), []byte{0, 0, 1}) assert.Equal(t, []byte{1, 0, 0, 1}, mem.slice) assert.Equal(t, 4, cap(mem.slice), "Slice capacity should not grow") - require.NoError(t, err.Error()) + require.NoError(t, maybe.Error()) } // Test reading beyond the current capacity - memory should grow func TestDynamicMemory_ReadAhead(t *testing.T) { - err := errors.FirstOnly() - mem := NewDynamicMemory(4, 8, err).(*dynamicMemory) + maybe := new(errors.Maybe) + mem := NewDynamicMemory(4, 8, maybe).(*dynamicMemory) value := mem.Read(big.NewInt(2), big.NewInt(4)) - require.NoError(t, err.Error()) + require.NoError(t, maybe.Error()) // Value should be size requested assert.Equal(t, []byte{0, 0, 0, 0}, value) // Slice should have grown to that plus offset assert.Equal(t, []byte{0, 0, 0, 0, 0, 0}, mem.slice) - err.Reset() + *maybe = errors.Maybe{} value = mem.Read(big.NewInt(2), big.NewInt(6)) - require.NoError(t, err.Error()) + require.NoError(t, maybe.Error()) assert.Equal(t, []byte{0, 0, 0, 0, 0, 0}, value) assert.Equal(t, []byte{0, 0, 0, 0, 0, 0, 0, 0}, mem.slice) // Check cannot read out of bounds mem.Read(big.NewInt(2), big.NewInt(7)) - assert.Error(t, err.Error()) + assert.Error(t, maybe.Error()) } // Test writing beyond the current capacity - memory should grow func TestDynamicMemory_WriteAhead(t *testing.T) { - err := errors.FirstOnly() - mem := NewDynamicMemory(4, 8, err).(*dynamicMemory) + maybe := new(errors.Maybe) + mem := NewDynamicMemory(4, 8, maybe).(*dynamicMemory) mem.Write(big.NewInt(4), []byte{1, 2, 3, 4}) - require.NoError(t, err.Error()) + require.NoError(t, maybe.Error()) assert.Equal(t, []byte{0, 0, 0, 0, 1, 2, 3, 4}, mem.slice) mem.Write(big.NewInt(4), []byte{1, 2, 3, 4, 5}) - assert.Error(t, err.Error()) + assert.Error(t, maybe.Error()) } func TestDynamicMemory_WriteRead(t *testing.T) { - err := errors.FirstOnly() + err := new(errors.Maybe) mem := NewDynamicMemory(1, 0x10000000, err).(*dynamicMemory) // Text is out of copyright bytesToWrite := []byte(`He paused. He felt the rhythm of the verse about him in the room. @@ -80,7 +80,7 @@ example. If he could get back again into that mood....`) } func TestDynamicMemory_ZeroInitialMemory(t *testing.T) { - err := errors.FirstOnly() + err := new(errors.Maybe) mem := NewDynamicMemory(0, 16, err).(*dynamicMemory) mem.Write(big.NewInt(4), []byte{1, 2, 3, 4}) require.NoError(t, err.Error()) @@ -88,29 +88,29 @@ func TestDynamicMemory_ZeroInitialMemory(t *testing.T) { } func TestDynamicMemory_Capacity(t *testing.T) { - err := errors.FirstOnly() - mem := NewDynamicMemory(1, 0x10000000, err).(*dynamicMemory) + maybe := new(errors.Maybe) + mem := NewDynamicMemory(1, 0x10000000, maybe).(*dynamicMemory) assert.Equal(t, big.NewInt(1), mem.Capacity()) capacity := big.NewInt(1234) - mem.ensureCapacity(capacity.Uint64()) - require.NoError(t, err.Error()) + maybe.PushError(mem.ensureCapacity(capacity.Uint64())) + require.NoError(t, maybe.Error()) assert.Equal(t, capacity, mem.Capacity()) capacity = big.NewInt(123456789) - mem.ensureCapacity(capacity.Uint64()) - require.NoError(t, err.Error()) + maybe.PushError(mem.ensureCapacity(capacity.Uint64())) + require.NoError(t, maybe.Error()) assert.Equal(t, capacity, mem.Capacity()) // Check doesn't shrink or err - mem.ensureCapacity(12) - require.NoError(t, err.Error()) + maybe.PushError(mem.ensureCapacity(12)) + require.NoError(t, maybe.Error()) assert.Equal(t, capacity, mem.Capacity()) } func TestDynamicMemory_ensureCapacity(t *testing.T) { - mem := NewDynamicMemory(4, 16, errors.FirstOnly()).(*dynamicMemory) + mem := NewDynamicMemory(4, 16, new(errors.Maybe)).(*dynamicMemory) // Check we can grow within bounds err := mem.ensureCapacity(8) require.NoError(t, err) diff --git a/execution/engine/natives.go b/execution/engine/natives.go new file mode 100644 index 000000000..54de6017b --- /dev/null +++ b/execution/engine/natives.go @@ -0,0 +1,19 @@ +package engine + +import ( + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/crypto" +) + +type Native interface { + Callable + SetExternals(externals Dispatcher) + ContractMeta() []*acm.ContractMeta + FullName() string + Address() crypto.Address +} + +type Natives interface { + ExternalDispatcher + GetByAddress(address crypto.Address) Native +} diff --git a/execution/engine/options.go b/execution/engine/options.go new file mode 100644 index 000000000..34dec2d79 --- /dev/null +++ b/execution/engine/options.go @@ -0,0 +1,20 @@ +package engine + +import ( + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/logging" +) + +// Options are parameters that are generally stable across a burrow configuration. +// Defaults will be used for any zero values. +type Options struct { + MemoryProvider func(errors.Sink) Memory + Natives Natives + Nonce []byte + DebugOpcodes bool + DumpTokens bool + CallStackMaxDepth uint64 + DataStackInitialCapacity uint64 + DataStackMaxDepth uint64 + Logger *logging.Logger +} diff --git a/execution/engine/state.go b/execution/engine/state.go new file mode 100644 index 000000000..47de46647 --- /dev/null +++ b/execution/engine/state.go @@ -0,0 +1,11 @@ +package engine + +import ( + "github.com/hyperledger/burrow/execution/exec" +) + +type State struct { + *CallFrame + Blockchain + exec.EventSink +} diff --git a/execution/errors/code.go b/execution/errors/code.go new file mode 100644 index 000000000..d184391e4 --- /dev/null +++ b/execution/errors/code.go @@ -0,0 +1,56 @@ +package errors + +import ( + "fmt" +) + +// An annotated version of the pure numeric error code +type Code struct { + Number uint32 + Name string + Description string +} + +func code(description string) *Code { + return &Code{Description: description} +} + +func (c *Code) Equal(other *Code) bool { + if c == nil { + return false + } + return c.Number == other.Number +} + +func (c *Code) ErrorCode() *Code { + return c +} + +func (c *Code) Uint32() uint32 { + if c == nil { + return 0 + } + return c.Number +} + +func (c *Code) Error() string { + if c == nil { + return "" + } + return fmt.Sprintf("Error %d: %s", c.Number, c.Description) +} + +func (c *Code) ErrorMessage() string { + if c == nil { + return "" + } + return c.Description +} + +func GetCode(err error) *Code { + exception := AsException(err) + if exception == nil { + return Codes.None + } + return exception.GetCode() +} diff --git a/execution/errors/code_test.go b/execution/errors/code_test.go new file mode 100644 index 000000000..d695166dc --- /dev/null +++ b/execution/errors/code_test.go @@ -0,0 +1,19 @@ +package errors + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestCodings(t *testing.T) { + a := Codes.CodeOutOfBounds + b := Codes.CodeOutOfBounds + ap := a + bp := b + require.True(t, ap.Equal(bp)) + require.True(t, ap == bp) + js := Codes.JSON() + fmt.Println(js) +} diff --git a/execution/errors/codes.go b/execution/errors/codes.go new file mode 100644 index 000000000..2106f68f9 --- /dev/null +++ b/execution/errors/codes.go @@ -0,0 +1,91 @@ +package errors + +import ( + "encoding/json" + "fmt" + "reflect" +) + +type codes struct { + None *Code + Generic *Code + UnknownAddress *Code + InsufficientBalance *Code + InvalidJumpDest *Code + InsufficientGas *Code + MemoryOutOfBounds *Code + CodeOutOfBounds *Code + InputOutOfBounds *Code + ReturnDataOutOfBounds *Code + CallStackOverflow *Code + CallStackUnderflow *Code + DataStackOverflow *Code + DataStackUnderflow *Code + InvalidContract *Code + NativeContractCodeCopy *Code + ExecutionAborted *Code + ExecutionReverted *Code + PermissionDenied *Code + NativeFunction *Code + EventPublish *Code + InvalidString *Code + EventMapping *Code + InvalidAddress *Code + DuplicateAddress *Code + InsufficientFunds *Code + Overpayment *Code + ZeroPayment *Code + InvalidSequence *Code + ReservedAddress *Code + IllegalWrite *Code + IntegerOverflow *Code + InvalidProposal *Code + ExpiredProposal *Code + ProposalExecuted *Code + NoInputPermission *Code + InvalidBlockNumber *Code + BlockNumberOutOfRange *Code + AlreadyVoted *Code + UnresolvedSymbols *Code + InvalidContractCode *Code + NonExistentAccount *Code + NotCallable *Code + + // For lookup + codes []*Code +} + +func (es *codes) init() error { + rv := reflect.ValueOf(es).Elem() + rt := rv.Type() + es.codes = make([]*Code, 0, rv.NumField()) + for i := 0; i < rv.NumField(); i++ { + ty := rt.Field(i) + // If field is exported + if ty.PkgPath == "" { + coding := rv.Field(i).Interface().(*Code) + if coding.Description == "" { + return fmt.Errorf("error code '%s' has no description", ty.Name) + } + coding.Number = uint32(i) + coding.Name = ty.Name + es.codes = append(es.codes, coding) + } + } + return nil +} + +func (es *codes) JSON() string { + bs, err := json.MarshalIndent(es, "", "\t") + if err != nil { + panic(fmt.Errorf("could not create JSON errors object: %v", err)) + } + return string(bs) +} + +func (es *codes) Get(number uint32) *Code { + if int(number) > len(es.codes)-1 { + return nil + } + return es.codes[number] +} diff --git a/execution/errors/errors.go b/execution/errors/errors.go index 7c71f580e..4b327391b 100644 --- a/execution/errors/errors.go +++ b/execution/errors/errors.go @@ -1,259 +1,75 @@ package errors -import ( - "fmt" -) - type CodedError interface { error - ErrorCode() Code - String() string -} - -type Provider interface { - // Returns the an error if errors occurred some execution or nil if none occurred - Error() CodedError + ErrorCode() *Code + // The error message excluding the code + ErrorMessage() string } +// Error sinks are useful for recording errors but continuing with computation. Implementations may choose to just store +// the first error pushed and ignore subsequent ones or they may record an error trace. Pushing a nil error should have +// no effects. type Sink interface { - PushError(error) -} - -type Code uint32 - -const ( - ErrorCodeGeneric Code = iota - ErrorCodeUnknownAddress - ErrorCodeInsufficientBalance - ErrorCodeInvalidJumpDest - ErrorCodeInsufficientGas - ErrorCodeMemoryOutOfBounds - ErrorCodeCodeOutOfBounds - ErrorCodeInputOutOfBounds - ErrorCodeReturnDataOutOfBounds - ErrorCodeCallStackOverflow - ErrorCodeCallStackUnderflow - ErrorCodeDataStackOverflow - ErrorCodeDataStackUnderflow - ErrorCodeInvalidContract - ErrorCodeNativeContractCodeCopy - ErrorCodeExecutionAborted - ErrorCodeExecutionReverted - ErrorCodePermissionDenied - ErrorCodeNativeFunction - ErrorCodeEventPublish - ErrorCodeInvalidString - ErrorCodeEventMapping - ErrorCodeInvalidAddress - ErrorCodeDuplicateAddress - ErrorCodeInsufficientFunds - ErrorCodeOverpayment - ErrorCodeZeroPayment - ErrorCodeInvalidSequence - ErrorCodeReservedAddress - ErrorCodeIllegalWrite - ErrorCodeIntegerOverflow - ErrorCodeInvalidProposal - ErrorCodeExpiredProposal - ErrorCodeProposalExecuted - ErrorCodeNoInputPermission - ErrorCodeInvalidBlockNumber - ErrorCodeBlockNumberOutOfRange - ErrorCodeAlreadyVoted - ErrorCodeUnresolvedSymbols - ErrorCodeInvalidContractCode -) - -func (c Code) ErrorCode() Code { - return c -} - -func (c Code) Uint32() uint32 { - return uint32(c) -} - -func (c Code) Error() string { - return fmt.Sprintf("Error %d: %s", c, c.String()) -} - -func (c Code) String() string { - switch c { - case ErrorCodeUnknownAddress: - return "unknown address" - case ErrorCodeInsufficientBalance: - return "insufficient balance" - case ErrorCodeInvalidJumpDest: - return "invalid jump dest" - case ErrorCodeInsufficientGas: - return "insufficient gas" - case ErrorCodeMemoryOutOfBounds: - return "memory out of bounds" - case ErrorCodeCodeOutOfBounds: - return "code out of bounds" - case ErrorCodeInputOutOfBounds: - return "input out of bounds" - case ErrorCodeReturnDataOutOfBounds: - return "return data out of bounds" - case ErrorCodeCallStackOverflow: - return "call stack overflow" - case ErrorCodeCallStackUnderflow: - return "call stack underflow" - case ErrorCodeDataStackOverflow: - return "data stack overflow" - case ErrorCodeDataStackUnderflow: - return "data stack underflow" - case ErrorCodeInvalidContract: - return "invalid contract" - case ErrorCodePermissionDenied: - return "permission denied" - case ErrorCodeNativeContractCodeCopy: - return "tried to copy native contract code" - case ErrorCodeExecutionAborted: - return "execution aborted" - case ErrorCodeExecutionReverted: - return "execution reverted" - case ErrorCodeNativeFunction: - return "native function error" - case ErrorCodeEventPublish: - return "event publish error" - case ErrorCodeInvalidString: - return "invalid string" - case ErrorCodeEventMapping: - return "event mapping error" - case ErrorCodeGeneric: - return "generic error" - case ErrorCodeInvalidAddress: - return "invalid address" - case ErrorCodeDuplicateAddress: - return "duplicate address" - case ErrorCodeInsufficientFunds: - return "insufficient funds" - case ErrorCodeOverpayment: - return "overpayment" - case ErrorCodeZeroPayment: - return "zero payment error" - case ErrorCodeInvalidSequence: - return "invalid sequence number" - case ErrorCodeReservedAddress: - return "address is reserved for SNative or internal use" - case ErrorCodeIllegalWrite: - return "callee attempted to illegally modify state" - case ErrorCodeIntegerOverflow: - return "integer overflow" - case ErrorCodeInvalidProposal: - return "proposal is invalid" - case ErrorCodeExpiredProposal: - return "proposal is expired since sequence number does not match" - case ErrorCodeProposalExecuted: - return "proposal has already been executed" - case ErrorCodeNoInputPermission: - return "account has no input permission" - case ErrorCodeInvalidBlockNumber: - return "invalid block number" - case ErrorCodeBlockNumberOutOfRange: - return "block number out of range" - case ErrorCodeAlreadyVoted: - return "vote already registered for this address" - case ErrorCodeUnresolvedSymbols: - return "code has unresolved symbols" - case ErrorCodeInvalidContractCode: - return "contract being created with unexpected code" - default: - return "Unknown error" - } + // Push an error to the error. If a nil error is passed then that value should not be pushed. Returns true iff error + // is non nil. + PushError(error) bool } -func NewException(errorCode Code, exception string) *Exception { - if exception == "" { - return nil - } - return &Exception{ - Code: errorCode, - Exception: exception, - } -} - -// Wraps any error as a Exception -func AsException(err error) *Exception { - if err == nil { - return nil - } - switch e := err.(type) { - case *Exception: - return e - case CodedError: - return NewException(e.ErrorCode(), e.String()) - default: - return NewException(ErrorCodeGeneric, err.Error()) - } -} - -func Wrap(err error, message string) *Exception { - ex := AsException(err) - return NewException(ex.ErrorCode(), message+": "+ex.Error()) -} - -func Errorf(format string, a ...interface{}) *Exception { - return ErrorCodef(ErrorCodeGeneric, format, a...) -} - -func ErrorCodef(errorCode Code, format string, a ...interface{}) *Exception { - return NewException(errorCode, fmt.Sprintf(format, a...)) -} - -func (e *Exception) AsError() error { - // We need to return a bare untyped error here so that err == nil downstream - if e == nil { - return nil - } - return e -} - -func (e *Exception) ErrorCode() Code { - return e.Code -} - -func (e *Exception) Error() string { - return fmt.Sprintf("error %d - %s: %s", e.Code, e.Code.String(), e.Exception) -} - -func (e *Exception) String() string { - if e == nil { - return "" - } - return e.Exception -} - -func (e *Exception) Equal(ce CodedError) bool { - ex := AsException(ce) - if e == nil || ex == nil { - return e == nil && ex == nil - } - return e.Code == ex.Code && e.Exception == ex.Exception -} - -type singleError struct { - CodedError -} - -func FirstOnly() *singleError { - return &singleError{} -} - -func (se *singleError) PushError(err error) { - if se.CodedError == nil { - // Do our nil dance - ex := AsException(err) - if ex != nil { - se.CodedError = ex - } +type Source interface { + // Returns the an error if errors occurred some execution or nil if none occurred + Error() error +} + +var Codes = codes{ + None: code("none"), + UnknownAddress: code("unknown address"), + InsufficientBalance: code("insufficient balance"), + InvalidJumpDest: code("invalid jump destination"), + InsufficientGas: code("insufficient gas"), + MemoryOutOfBounds: code("memory out of bounds"), + CodeOutOfBounds: code("code out of bounds"), + InputOutOfBounds: code("input out of bounds"), + ReturnDataOutOfBounds: code("data out of bounds"), + CallStackOverflow: code("call stack overflow"), + CallStackUnderflow: code("call stack underflow"), + DataStackOverflow: code("data stack overflow"), + DataStackUnderflow: code("data stack underflow"), + InvalidContract: code("invalid contract"), + PermissionDenied: code("permission denied"), + NativeContractCodeCopy: code("tried to copy native contract code"), + ExecutionAborted: code("execution aborted"), + ExecutionReverted: code("execution reverted"), + NativeFunction: code("native function error"), + EventPublish: code("event publish error"), + InvalidString: code("invalid string"), + EventMapping: code("event mapping error"), + Generic: code("generic error"), + InvalidAddress: code("invalid address"), + DuplicateAddress: code("duplicate address"), + InsufficientFunds: code("insufficient funds"), + Overpayment: code("overpayment"), + ZeroPayment: code("zero payment error"), + InvalidSequence: code("invalid sequence number"), + ReservedAddress: code("address is reserved for SNative or internal use"), + IllegalWrite: code("callee attempted to illegally modify state"), + IntegerOverflow: code("integer overflow"), + InvalidProposal: code("proposal is invalid"), + ExpiredProposal: code("proposal is expired since sequence number does not match"), + ProposalExecuted: code("proposal has already been executed"), + NoInputPermission: code("account has no input permission"), + InvalidBlockNumber: code("invalid block number"), + BlockNumberOutOfRange: code("block number out of range"), + AlreadyVoted: code("vote already registered for this address"), + UnresolvedSymbols: code("code has unresolved symbols"), + InvalidContractCode: code("contract being created with unexpected code"), + NonExistentAccount: code("account does not exist"), + NotCallable: code("cannot dispatch call"), +} + +func init() { + err := Codes.init() + if err != nil { + panic(err) } } - -func (se *singleError) Error() CodedError { - return se.CodedError -} - -func (se *singleError) Reset() { - se.CodedError = nil -} diff --git a/execution/errors/errors.pb.go b/execution/errors/errors.pb.go index ca00467b7..7b1fa60d9 100644 --- a/execution/errors/errors.pb.go +++ b/execution/errors/errors.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -23,10 +24,10 @@ 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 type Exception struct { - Code Code `protobuf:"varint,1,opt,name=Code,proto3,casttype=Code" json:"Code,omitempty"` + CodeNumber uint32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` Exception string `protobuf:"bytes,2,opt,name=Exception,proto3" json:"Exception,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -43,7 +44,7 @@ func (m *Exception) XXX_Unmarshal(b []byte) error { } func (m *Exception) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -61,9 +62,9 @@ func (m *Exception) XXX_DiscardUnknown() { var xxx_messageInfo_Exception proto.InternalMessageInfo -func (m *Exception) GetCode() Code { +func (m *Exception) GetCodeNumber() uint32 { if m != nil { - return m.Code + return m.CodeNumber } return 0 } @@ -87,26 +88,26 @@ func init() { proto.RegisterFile("errors.proto", fileDescriptor_24fe73c7f0ddb19c func init() { golang_proto.RegisterFile("errors.proto", fileDescriptor_24fe73c7f0ddb19c) } var fileDescriptor_24fe73c7f0ddb19c = []byte{ - // 194 bytes of a gzipped FileDescriptorProto + // 193 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x2d, 0x2a, 0xca, - 0x2f, 0x2a, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0xa4, 0x74, 0xd3, 0x33, - 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0xd2, - 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0xf9, 0x72, 0x71, 0xba, 0x56, - 0x24, 0xa7, 0x16, 0x94, 0x64, 0xe6, 0xe7, 0x09, 0xc9, 0x70, 0xb1, 0x38, 0xe7, 0xa7, 0xa4, 0x4a, - 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x3a, 0x71, 0xfc, 0xba, 0x27, 0x0f, 0xe6, 0x07, 0x81, 0x49, 0x21, - 0x19, 0x24, 0xa5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x08, 0x01, 0x2b, 0x96, 0x19, 0x0b, - 0xe4, 0x19, 0x9c, 0x3c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, - 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x0f, 0x3c, 0x96, 0x63, 0x3c, 0xf1, 0x58, 0x8e, 0x31, 0x4a, 0x0f, - 0xc9, 0x5d, 0x19, 0x95, 0x05, 0xa9, 0x45, 0x39, 0xa9, 0x29, 0xe9, 0xa9, 0x45, 0xfa, 0x49, 0xa5, - 0x45, 0x45, 0xf9, 0xe5, 0xfa, 0xa9, 0x15, 0xa9, 0xc9, 0xa5, 0x20, 0x83, 0xf4, 0x21, 0xfe, 0x48, - 0x62, 0x03, 0xbb, 0xcf, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x38, 0x0d, 0x6e, 0xa5, 0xe6, 0x00, - 0x00, 0x00, + 0x2f, 0x2a, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0xa4, 0x44, 0xd2, 0xf3, + 0xd3, 0xf3, 0xc1, 0x42, 0xfa, 0x20, 0x16, 0x44, 0x56, 0x29, 0x98, 0x8b, 0xd3, 0xb5, 0x22, 0x39, + 0xb5, 0xa0, 0x24, 0x33, 0x3f, 0x4f, 0x48, 0x89, 0x8b, 0xc5, 0x39, 0x3f, 0x25, 0x55, 0x82, 0x51, + 0x81, 0x51, 0x83, 0xd7, 0x89, 0xef, 0xd1, 0x3d, 0x79, 0x2e, 0x10, 0xdf, 0xaf, 0x34, 0x37, 0x29, + 0xb5, 0x28, 0x08, 0x2c, 0x27, 0x24, 0x83, 0xa4, 0x41, 0x82, 0x49, 0x81, 0x51, 0x83, 0x33, 0x08, + 0x21, 0x60, 0xc5, 0x32, 0x63, 0x81, 0x3c, 0x83, 0x93, 0xc7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, + 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x81, 0xc7, 0x72, 0x8c, 0x27, + 0x1e, 0xcb, 0x31, 0x46, 0xe9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, + 0x67, 0x54, 0x16, 0xa4, 0x16, 0xe5, 0xa4, 0xa6, 0xa4, 0xa7, 0x16, 0xe9, 0x27, 0x95, 0x16, 0x15, + 0xe5, 0x97, 0xeb, 0xa7, 0x56, 0xa4, 0x26, 0x97, 0x82, 0x0c, 0xd2, 0x87, 0x38, 0x3a, 0x89, 0x0d, + 0xec, 0x4a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x6d, 0xcb, 0x28, 0xd3, 0x00, 0x00, + 0x00, } func (m *Exception) 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 } @@ -114,35 +115,44 @@ func (m *Exception) Marshal() (dAtA []byte, err error) { } func (m *Exception) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Exception) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintErrors(dAtA, i, uint64(m.Code)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Exception) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Exception) + copy(dAtA[i:], m.Exception) i = encodeVarintErrors(dAtA, i, uint64(len(m.Exception))) - i += copy(dAtA[i:], m.Exception) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.CodeNumber != 0 { + i = encodeVarintErrors(dAtA, i, uint64(m.CodeNumber)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func encodeVarintErrors(dAtA []byte, offset int, v uint64) int { + offset -= sovErrors(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 (m *Exception) Size() (n int) { if m == nil { @@ -150,8 +160,8 @@ func (m *Exception) Size() (n int) { } var l int _ = l - if m.Code != 0 { - n += 1 + sovErrors(uint64(m.Code)) + if m.CodeNumber != 0 { + n += 1 + sovErrors(uint64(m.CodeNumber)) } l = len(m.Exception) if l > 0 { @@ -164,14 +174,7 @@ func (m *Exception) Size() (n int) { } func sovErrors(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozErrors(x uint64) (n int) { return sovErrors(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -207,9 +210,9 @@ func (m *Exception) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CodeNumber", wireType) } - m.Code = 0 + m.CodeNumber = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowErrors @@ -219,7 +222,7 @@ func (m *Exception) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= Code(b&0x7F) << shift + m.CodeNumber |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -262,10 +265,7 @@ func (m *Exception) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthErrors - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthErrors } if (iNdEx + skippy) > l { @@ -284,6 +284,7 @@ func (m *Exception) Unmarshal(dAtA []byte) error { func skipErrors(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -315,10 +316,8 @@ func skipErrors(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -339,55 +338,30 @@ func skipErrors(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthErrors } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthErrors - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowErrors - } - 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 := skipErrors(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthErrors - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupErrors + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthErrors + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthErrors = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowErrors = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthErrors = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowErrors = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupErrors = fmt.Errorf("proto: unexpected end of group") ) diff --git a/execution/errors/errors_test.go b/execution/errors/errors_test.go index 4a6210c90..c3704696e 100644 --- a/execution/errors/errors_test.go +++ b/execution/errors/errors_test.go @@ -10,7 +10,7 @@ import ( ) func TestErrorCode_MarshalJSON(t *testing.T) { - ec := NewException(ErrorCodeDataStackOverflow, "arrgh") + ec := NewException(Codes.DataStackOverflow, "arrgh") bs, err := json.Marshal(ec) require.NoError(t, err) @@ -22,17 +22,6 @@ func TestErrorCode_MarshalJSON(t *testing.T) { } func TestCode_String(t *testing.T) { - err := ErrorCodeCodeOutOfBounds + err := Codes.CodeOutOfBounds fmt.Println(err.Error()) } - -func TestFirstOnly(t *testing.T) { - err := FirstOnly() - // This will be a wrapped nil - it should not register as first error - var ex CodedError = (*Exception)(nil) - err.PushError(ex) - // This one should - realErr := ErrorCodef(ErrorCodeInsufficientBalance, "real error") - err.PushError(realErr) - assert.True(t, realErr.Equal(err.Error())) -} diff --git a/execution/errors/exception.go b/execution/errors/exception.go new file mode 100644 index 000000000..95f8f2da5 --- /dev/null +++ b/execution/errors/exception.go @@ -0,0 +1,81 @@ +package errors + +import "fmt" + +func NewException(code *Code, exception string) *Exception { + if exception == "" { + return nil + } + return &Exception{ + CodeNumber: code.Number, + Exception: exception, + } +} + +// Wraps any error as a Exception +func AsException(err error) *Exception { + if err == nil { + return nil + } + switch e := err.(type) { + case *Exception: + return e + case CodedError: + return NewException(e.ErrorCode(), e.ErrorMessage()) + default: + return NewException(Codes.Generic, err.Error()) + } +} + +func Wrapf(err error, format string, a ...interface{}) *Exception { + ex := AsException(err) + return NewException(Codes.Get(ex.CodeNumber), fmt.Sprintf(format, a...)) +} + +func Wrap(err error, message string) *Exception { + ex := AsException(err) + return NewException(Codes.Get(ex.CodeNumber), message+": "+ex.Exception) +} + +func Errorf(code *Code, format string, a ...interface{}) *Exception { + return NewException(code, fmt.Sprintf(format, a...)) +} + +func (e *Exception) AsError() error { + // We need to return a bare untyped error here so that err == nil downstream + if e == nil { + return nil + } + return e +} + +func (e *Exception) ErrorCode() *Code { + return Codes.Get(e.CodeNumber) +} + +func (e *Exception) Error() string { + return fmt.Sprintf("error %d - %s: %s", e.CodeNumber, Codes.Get(e.CodeNumber), e.Exception) +} + +func (e *Exception) String() string { + return e.Error() +} + +func (e *Exception) ErrorMessage() string { + if e == nil { + return "" + } + return e.Exception +} + +func (e *Exception) Equal(ce CodedError) bool { + ex := AsException(ce) + if e == nil || ex == nil { + return e == nil && ex == nil + } + return e.CodeNumber == ex.CodeNumber && e.Exception == ex.Exception +} + +func (e *Exception) GetCode() *Code { + return Codes.Get(e.CodeNumber) +} diff --git a/execution/errors/maybe.go b/execution/errors/maybe.go new file mode 100644 index 000000000..24da47686 --- /dev/null +++ b/execution/errors/maybe.go @@ -0,0 +1,75 @@ +package errors + +import ( + "math/big" + + "github.com/hyperledger/burrow/crypto" +) + +type Maybe struct { + // Any error that may have occurred + error CodedError +} + +func (m *Maybe) Error() error { + if m.error == nil { + return nil + } + return m.error +} + +// Errors pushed to state may end up in TxExecutions and therefore the merkle state so it is essential that errors are +// deterministic and independent of the code path taken to execution (e.g. replay takes a different path to that of +// normal consensus reactor so stack traces may differ - as they may across architectures) +func (m *Maybe) PushError(err error) bool { + if err == nil { + return false + } + if m.error == nil { + // Make sure we are not wrapping a known nil value + ex := AsException(err) + if ex != nil { + m.error = ex + } + } + return true +} + +func (m *Maybe) Uint64(value uint64, err error) uint64 { + if err != nil { + m.PushError(err) + } + return value +} + +func (m *Maybe) Bool(value bool, err error) bool { + if err != nil { + m.PushError(err) + } + return value +} + +func (m *Maybe) Bytes(value []byte, err error) []byte { + if err != nil { + m.PushError(err) + } + return value +} + +func (m *Maybe) Address(value crypto.Address, err error) crypto.Address { + if err != nil { + m.PushError(err) + } + return value +} + +func (m *Maybe) BigInt(value *big.Int, err error) *big.Int { + if err != nil { + m.PushError(err) + } + return value +} + +func (m *Maybe) Void(err error) { + m.PushError(err) +} diff --git a/execution/errors/native.go b/execution/errors/native.go index bd64b6f75..00d5b9e91 100644 --- a/execution/errors/native.go +++ b/execution/errors/native.go @@ -6,15 +6,21 @@ import ( "github.com/hyperledger/burrow/crypto" ) -type LacksSNativePermission struct { - Address crypto.Address - SNative string +type LacksNativePermission struct { + Address crypto.Address + NativeName string } -func (e LacksSNativePermission) Error() string { - return fmt.Sprintf("account %s does not have SNative function call permission: %s", e.Address, e.SNative) +var _ CodedError = &LacksNativePermission{} + +func (e *LacksNativePermission) ErrorMessage() string { + return fmt.Sprintf("account %s does not have native function call permission: %s", e.Address, e.NativeName) +} + +func (e *LacksNativePermission) Error() string { + return e.ErrorMessage() } -func (e LacksSNativePermission) ErrorCode() Code { - return ErrorCodeNativeFunction +func (e *LacksNativePermission) ErrorCode() *Code { + return Codes.NativeFunction } diff --git a/execution/errors/vm.go b/execution/errors/vm.go index bfcf25ce5..74809f194 100644 --- a/execution/errors/vm.go +++ b/execution/errors/vm.go @@ -13,8 +13,8 @@ type PermissionDenied struct { Perm permission.PermFlag } -func (err PermissionDenied) ErrorCode() Code { - return ErrorCodePermissionDenied +func (err PermissionDenied) ErrorCode() *Code { + return Codes.PermissionDenied } func (err PermissionDenied) Error() string { @@ -43,7 +43,7 @@ type CallError struct { func (err CallError) Error() string { buf := new(bytes.Buffer) buf.WriteString("Call error: ") - buf.WriteString(err.CodedError.String()) + buf.WriteString(err.CodedError.Error()) if len(err.NestedErrors) > 0 { buf.WriteString(", nested call errors:\n") for _, nestedErr := range err.NestedErrors { diff --git a/execution/evm/abi/abi.go b/execution/evm/abi/abi.go index 7dddb9b6d..79244b2b4 100644 --- a/execution/evm/abi/abi.go +++ b/execution/evm/abi/abi.go @@ -24,7 +24,7 @@ type Variable struct { // LoadPath loads one abi file or finds all files in a directory func LoadPath(abiFileOrDirs ...string) (*Spec, error) { if len(abiFileOrDirs) == 0 { - return &Spec{}, fmt.Errorf("no ABI file or directory provided") + return nil, fmt.Errorf("no ABI file or directory provided") } specs := make([]*Spec, 0) @@ -35,7 +35,7 @@ func LoadPath(abiFileOrDirs ...string) (*Spec, error) { return fmt.Errorf("error returned while walking abiDir '%s': %v", dir, err) } ext := filepath.Ext(path) - if fi.IsDir() || !(ext == ".bin" || ext == ".abi") { + if fi.IsDir() || !(ext == ".bin" || ext == ".abi" || ext == ".json") { return nil } abiSpc, err := ReadSpecFile(path) @@ -46,7 +46,7 @@ func LoadPath(abiFileOrDirs ...string) (*Spec, error) { return nil }) if err != nil { - return &Spec{}, err + return nil, err } } return MergeSpec(specs), nil @@ -183,25 +183,24 @@ func ReadSpecFile(filename string) (*Spec, error) { // described a struct. Both args and rets should be set to the return value of reflect.TypeOf() // with the respective struct as an argument. func SpecFromStructReflect(fname string, args reflect.Type, rets reflect.Type) *FunctionSpec { - s := FunctionSpec{ - Inputs: make([]Argument, args.NumField()), - Outputs: make([]Argument, rets.NumField()), - } + inputs := make([]Argument, args.NumField()) + outputs := make([]Argument, rets.NumField()) + for i := 0; i < args.NumField(); i++ { f := args.Field(i) a := typeFromReflect(f.Type) a.Name = f.Name - s.Inputs[i] = a + inputs[i] = a } + for i := 0; i < rets.NumField(); i++ { f := rets.Field(i) a := typeFromReflect(f.Type) a.Name = f.Name - s.Outputs[i] = a + outputs[i] = a } - s.SetFunctionID(fname) - return &s + return NewFunctionSpec(fname, inputs, outputs) } func SpecFromFunctionReflect(fname string, v reflect.Value, skipIn, skipOut int) *FunctionSpec { @@ -211,20 +210,18 @@ func SpecFromFunctionReflect(fname string, v reflect.Value, skipIn, skipOut int) panic(fmt.Sprintf("%s is not a function", t.Name())) } - s := FunctionSpec{} - s.Inputs = make([]Argument, t.NumIn()-skipIn) - s.Outputs = make([]Argument, t.NumOut()-skipOut) + inputs := make([]Argument, t.NumIn()-skipIn) + outputs := make([]Argument, t.NumOut()-skipOut) - for i := range s.Inputs { - s.Inputs[i] = typeFromReflect(t.In(i + skipIn)) + for i := range inputs { + inputs[i] = typeFromReflect(t.In(i + skipIn)) } - for i := range s.Outputs { - s.Outputs[i] = typeFromReflect(t.Out(i)) + for i := range outputs { + outputs[i] = typeFromReflect(t.Out(i)) } - s.SetFunctionID(fname) - return &s + return NewFunctionSpec(fname, inputs, outputs) } func GetPackingTypes(args []Argument) []interface{} { diff --git a/execution/evm/abi/abi_test.go b/execution/evm/abi/abi_test.go index 5c84aa495..b25071c54 100644 --- a/execution/evm/abi/abi_test.go +++ b/execution/evm/abi/abi_test.go @@ -8,6 +8,7 @@ import ( "github.com/tmthrgd/go-hex" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/logging" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -25,6 +26,20 @@ func TestPacker(t *testing.T) { name string expectedOutput []byte }{ + // Test string address + { + `[{"constant":false,"inputs":[{"internalType":"address payable","name":"friend","type":"address"}],"name":"sendToAFriend","outputs":[],"payable":true,"stateMutability":"payable","type":"function"}]`, + []interface{}{"C42DEED84BDF2CA695F2E91F4E6395D191CF35FC"}, + "sendToAFriend", + pad([]byte{196, 45, 238, 216, 75, 223, 44, 166, 149, 242, 233, 31, 78, 99, 149, 209, 145, 207, 53, 252}, 32, true), + }, + // From: https://github.com/hyperledger/burrow/issues/1326 + { + `[{"constant":false,"inputs":[{"internalType":"address payable","name":"friend","type":"address"}],"name":"sendToAFriend","outputs":[],"payable":true,"stateMutability":"payable","type":"function"}]`, + []interface{}{crypto.Address{1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4}}, + "sendToAFriend", + pad([]byte{1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4}, 32, true), + }, { `[{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"UInt","outputs":[],"payable":false,"type":"function"}]`, []interface{}{"1"}, @@ -127,7 +142,7 @@ func TestPacker(t *testing.T) { } { t.Log(test.args) if output, _, err := EncodeFunctionCall(test.ABI, test.name, logging.NewNoopLogger(), test.args...); err != nil { - t.Error("Unexpected error in ", test.name, ": ", err) + t.Errorf("Unexpected error in %s: %v", test.name, err) } else { if !bytes.Equal(output[4:], test.expectedOutput) { t.Errorf("Incorrect output,\n\t expected %v,\n\t got %v", test.expectedOutput, output[4:]) diff --git a/execution/evm/abi/event_spec.go b/execution/evm/abi/event_spec.go index 6061aa822..146481b0f 100644 --- a/execution/evm/abi/event_spec.go +++ b/execution/evm/abi/event_spec.go @@ -4,9 +4,9 @@ import ( "encoding/json" "reflect" - "github.com/hyperledger/burrow/crypto/sha3" "github.com/hyperledger/burrow/event/query" "github.com/tmthrgd/go-hex" + "golang.org/x/crypto/sha3" ) // Argument is a decoded function parameter, return or event field @@ -73,7 +73,7 @@ func (e *EventSpec) unmarshalSpec(s *specJSON) error { type EventID [EventIDSize]byte func GetEventID(signature string) (id EventID) { - hash := sha3.NewKeccak256() + hash := sha3.NewLegacyKeccak256() hash.Write([]byte(signature)) copy(id[:], hash.Sum(nil)) return diff --git a/execution/evm/abi/function_spec.go b/execution/evm/abi/function_spec.go index ccfca6f79..0ba06173e 100644 --- a/execution/evm/abi/function_spec.go +++ b/execution/evm/abi/function_spec.go @@ -3,13 +3,14 @@ package abi import ( "fmt" - "github.com/hyperledger/burrow/crypto/sha3" + "golang.org/x/crypto/sha3" ) // FunctionIDSize is the length of the function selector const FunctionIDSize = 4 type FunctionSpec struct { + Name string FunctionID FunctionID Constant bool Inputs []Argument @@ -18,8 +19,19 @@ type FunctionSpec struct { type FunctionID [FunctionIDSize]byte +func NewFunctionSpec(name string, inputs, outputs []Argument) *FunctionSpec { + sig := Signature(name, inputs) + return &FunctionSpec{ + Name: name, + FunctionID: GetFunctionID(sig), + Constant: false, + Inputs: inputs, + Outputs: outputs, + } +} + func GetFunctionID(signature string) (id FunctionID) { - hash := sha3.NewKeccak256() + hash := sha3.NewLegacyKeccak256() hash.Write([]byte(signature)) copy(id[:], hash.Sum(nil)[:4]) return @@ -29,14 +41,15 @@ func Signature(name string, args []Argument) string { return name + argsToSignature(args, false) } -func (f *FunctionSpec) String(name string) string { - return name + argsToSignature(f.Inputs, true) + - " returns " + argsToSignature(f.Outputs, true) +// Sets this function as constant +func (f *FunctionSpec) SetConstant() *FunctionSpec { + f.Constant = true + return f } -func (f *FunctionSpec) SetFunctionID(functionName string) { - sig := Signature(functionName, f.Inputs) - f.FunctionID = GetFunctionID(sig) +func (f *FunctionSpec) String() string { + return f.Name + argsToSignature(f.Inputs, true) + + " returns " + argsToSignature(f.Outputs, true) } func (fs FunctionID) Bytes() []byte { diff --git a/execution/evm/abi/packing_test.go b/execution/evm/abi/packing_test.go index c7bf4d6ec..3654ff288 100644 --- a/execution/evm/abi/packing_test.go +++ b/execution/evm/abi/packing_test.go @@ -66,11 +66,11 @@ func TestPackEvent(t *testing.T) { Bignum: 100, Hash: "ba", } - topics, data, err := PackEvent(&eventSpec, in) + topics, data, err := PackEvent(eventSpec, in) require.NoError(t, err) out := new(args) - err = UnpackEvent(&eventSpec, topics, data, out) + err = UnpackEvent(eventSpec, topics, data, out) require.NoError(t, err) }) diff --git a/execution/evm/abi/primitives.go b/execution/evm/abi/primitives.go index 5f89715c6..1982613fa 100644 --- a/execution/evm/abi/primitives.go +++ b/execution/evm/abi/primitives.go @@ -188,7 +188,7 @@ func (e EVMUint) pack(v interface{}) ([]byte, error) { b := n.Bytes() if uint64(len(b)) > e.M { - return nil, fmt.Errorf("value to large for int%d", e.M) + return nil, fmt.Errorf("value too large for int%d", e.M) } return pad(b, ElementSize, true), nil } @@ -219,49 +219,49 @@ func (e EVMUint) unpack(data []byte, offset int, v interface{}) (int, error) { case *uint64: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen { - return 0, fmt.Errorf("value to large for uint64") + return 0, fmt.Errorf("value too large for uint64") } *v = binary.BigEndian.Uint64(data[ElementSize-maxLen : ElementSize]) case *uint32: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen { - return 0, fmt.Errorf("value to large for uint64") + return 0, fmt.Errorf("value too large for uint64") } *v = binary.BigEndian.Uint32(data[ElementSize-maxLen : ElementSize]) case *uint16: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen { - return 0, fmt.Errorf("value to large for uint16") + return 0, fmt.Errorf("value too large for uint16") } *v = binary.BigEndian.Uint16(data[ElementSize-maxLen : ElementSize]) case *uint8: maxLen := 1 if length > maxLen { - return 0, fmt.Errorf("value to large for uint8") + return 0, fmt.Errorf("value too large for uint8") } *v = uint8(data[31]) case *int64: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen || (data[ElementSize-maxLen]&0x80) != 0 { - return 0, fmt.Errorf("value to large for int64") + return 0, fmt.Errorf("value too large for int64") } *v = int64(binary.BigEndian.Uint64(data[ElementSize-maxLen : ElementSize])) case *int32: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen || (data[ElementSize-maxLen]&0x80) != 0 { - return 0, fmt.Errorf("value to large for int64") + return 0, fmt.Errorf("value too large for int32") } *v = int32(binary.BigEndian.Uint32(data[ElementSize-maxLen : ElementSize])) case *int16: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen || (data[ElementSize-maxLen]&0x80) != 0 { - return 0, fmt.Errorf("value to large for int16") + return 0, fmt.Errorf("value too large for int16") } *v = int16(binary.BigEndian.Uint16(data[ElementSize-maxLen : ElementSize])) case *int8: maxLen := 1 if length > maxLen || (data[ElementSize-maxLen]&0x80) != 0 { - return 0, fmt.Errorf("value to large for int8") + return 0, fmt.Errorf("value too large for int8") } *v = int8(data[ElementSize-1]) default: @@ -355,11 +355,11 @@ func (e EVMInt) pack(v interface{}) ([]byte, error) { b := n.Bytes() if uint64(len(b)) > e.M { - return nil, fmt.Errorf("value to large for int%d", e.M) + return nil, fmt.Errorf("value too large for int%d", e.M) } res := pad(b, ElementSize, true) if (res[0] & 0x80) != 0 { - return nil, fmt.Errorf("value to large for int%d", e.M) + return nil, fmt.Errorf("value too large for int%d", e.M) } if n.Sign() < 0 { // One's complement; i.e. 0xffff is -1, not 0. @@ -428,7 +428,7 @@ func (e EVMInt) unpack(data []byte, offset int, v interface{}) (int, error) { } maxLen := int(unsafe.Sizeof(*v)) if length > maxLen { - return 0, fmt.Errorf("value to large for %T", *v) + return 0, fmt.Errorf("value too large for %T", *v) } *v = binary.BigEndian.Uint64(data[ElementSize-maxLen : ElementSize]) case *uint32: @@ -437,7 +437,7 @@ func (e EVMInt) unpack(data []byte, offset int, v interface{}) (int, error) { } maxLen := int(unsafe.Sizeof(*v)) if length > maxLen { - return 0, fmt.Errorf("value to large for %T", *v) + return 0, fmt.Errorf("value too large for %T", *v) } *v = binary.BigEndian.Uint32(data[ElementSize-maxLen : ElementSize]) case *uint16: @@ -446,7 +446,7 @@ func (e EVMInt) unpack(data []byte, offset int, v interface{}) (int, error) { } maxLen := int(unsafe.Sizeof(*v)) if length > maxLen { - return 0, fmt.Errorf("value to large for %T", *v) + return 0, fmt.Errorf("value too large for %T", *v) } *v = binary.BigEndian.Uint16(data[ElementSize-maxLen : ElementSize]) case *uint8: @@ -454,30 +454,30 @@ func (e EVMInt) unpack(data []byte, offset int, v interface{}) (int, error) { return 0, fmt.Errorf("cannot convert negative EVM int to %T", *v) } if length > 1 { - return 0, fmt.Errorf("value to large for %T", *v) + return 0, fmt.Errorf("value too large for %T", *v) } *v = data[ElementSize-1] case *int64: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen || (inv[ElementSize-maxLen]&0x80) != 0 { - return 0, fmt.Errorf("value to large for %T", *v) + return 0, fmt.Errorf("value too large for %T", *v) } *v = int64(binary.BigEndian.Uint64(data[ElementSize-maxLen : ElementSize])) case *int32: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen || (inv[ElementSize-maxLen]&0x80) != 0 { - return 0, fmt.Errorf("value to large for %T", *v) + return 0, fmt.Errorf("value too large for %T", *v) } *v = int32(binary.BigEndian.Uint32(data[ElementSize-maxLen : ElementSize])) case *int16: maxLen := int(unsafe.Sizeof(*v)) if length > maxLen || (inv[ElementSize-maxLen]&0x80) != 0 { - return 0, fmt.Errorf("value to large for %T", *v) + return 0, fmt.Errorf("value too large for %T", *v) } *v = int16(binary.BigEndian.Uint16(data[ElementSize-maxLen : ElementSize])) case *int8: if length > 1 || (inv[ElementSize-1]&0x80) != 0 { - return 0, fmt.Errorf("value to large for %T", *v) + return 0, fmt.Errorf("value too large for %T", *v) } *v = int8(data[ElementSize-1]) default: @@ -514,32 +514,34 @@ func (e EVMAddress) GetSignature() string { } func (e EVMAddress) pack(v interface{}) ([]byte, error) { - var err error - a, ok := v.(crypto.Address) - if !ok { - s, ok := v.(string) - if ok { - a, err = crypto.AddressFromHexString(s) - if err != nil { - return nil, err - } - } - } else { - b, ok := v.([]byte) - if !ok { - return nil, fmt.Errorf("cannot map to %s to EVM address", reflect.ValueOf(v).Kind().String()) + var bs []byte + switch a := v.(type) { + case crypto.Address: + bs = a[:] + case *crypto.Address: + bs = (*a)[:] + case string: + address, err := crypto.AddressFromHexString(a) + if err != nil { + return nil, fmt.Errorf("could not convert '%s' to address: %v", a, err) } - - a, err = crypto.AddressFromBytes(b) + bs = address[:] + case []byte: + address, err := crypto.AddressFromBytes(a) if err != nil { - return nil, err + return nil, fmt.Errorf("could not convert byte 0x%X to address: %v", a, err) } + bs = address[:] + default: + return nil, fmt.Errorf("cannot map from %s to EVM address", reflect.ValueOf(v).Kind().String()) } - - return pad(a[:], ElementSize, true), nil + return pad(bs, ElementSize, true), nil } func (e EVMAddress) unpack(data []byte, offset int, v interface{}) (int, error) { + if len(data)-offset < ElementSize { + return 0, fmt.Errorf("%v: not enough data", e) + } addr, err := crypto.AddressFromBytes(data[offset+ElementSize-crypto.AddressLength : offset+ElementSize]) if err != nil { return 0, err @@ -619,6 +621,9 @@ func (e EVMBytes) pack(v interface{}) ([]byte, error) { } func (e EVMBytes) unpack(data []byte, offset int, v interface{}) (int, error) { + if len(data)-offset < ElementSize { + return 0, fmt.Errorf("%v: not enough data", e) + } if e.M == 0 { s := EVMString{} diff --git a/execution/evm/abi/spec.go b/execution/evm/abi/spec.go index 54e4ace27..33c44ee0e 100644 --- a/execution/evm/abi/spec.go +++ b/execution/evm/abi/spec.go @@ -10,13 +10,16 @@ import ( "github.com/hyperledger/burrow/crypto" ) +// Token to use in deploy yaml in order to indicate call to the fallback function. +const FallbackFunctionName = "()" + // Spec is the ABI for contract decoded. type Spec struct { - Constructor FunctionSpec - Fallback FunctionSpec - Functions map[string]FunctionSpec - EventsByName map[string]EventSpec - EventsByID map[EventID]EventSpec + Constructor *FunctionSpec + Fallback *FunctionSpec + Functions map[string]*FunctionSpec + EventsByName map[string]*EventSpec + EventsByID map[EventID]*EventSpec } type specJSON struct { @@ -24,12 +27,21 @@ type specJSON struct { Type string Inputs []argumentJSON Outputs []argumentJSON - Constant bool - Payable bool StateMutability string Anonymous bool } +func NewSpec() *Spec { + return &Spec{ + // Zero value for constructor and fallback function is assumed when those functions are not present + Constructor: &FunctionSpec{}, + Fallback: &FunctionSpec{}, + EventsByName: make(map[string]*EventSpec), + EventsByID: make(map[EventID]*EventSpec), + Functions: make(map[string]*FunctionSpec), + } +} + // ReadSpec takes an ABI and decodes it for futher use func ReadSpec(specBytes []byte) (*Spec, error) { var specJ []specJSON @@ -46,11 +58,7 @@ func ReadSpec(specBytes []byte) (*Spec, error) { specJ = binFile.Abi } - abiSpec := Spec{ - EventsByName: make(map[string]EventSpec), - EventsByID: make(map[EventID]EventSpec), - Functions: make(map[string]FunctionSpec), - } + abiSpec := NewSpec() for _, s := range specJ { switch s.Type { @@ -62,8 +70,10 @@ func ReadSpec(specBytes []byte) (*Spec, error) { case "fallback": abiSpec.Fallback.Inputs = make([]Argument, 0) abiSpec.Fallback.Outputs = make([]Argument, 0) + abiSpec.Fallback.SetConstant() + abiSpec.Functions[FallbackFunctionName] = abiSpec.Fallback case "event": - var ev EventSpec + ev := new(EventSpec) err = ev.unmarshalSpec(&s) if err != nil { return nil, err @@ -79,24 +89,18 @@ func ReadSpec(specBytes []byte) (*Spec, error) { if err != nil { return nil, err } - fs := FunctionSpec{Inputs: inputs, Outputs: outputs, Constant: s.Constant} - fs.SetFunctionID(s.Name) - abiSpec.Functions[s.Name] = fs + abiSpec.Functions[s.Name] = NewFunctionSpec(s.Name, inputs, outputs).SetConstant() } } - return &abiSpec, nil + return abiSpec, nil } // MergeSpec takes multiple Specs and merges them into once structure. Note that // the same function name or event name can occur in different abis, so there might be // some information loss. func MergeSpec(abiSpec []*Spec) *Spec { - newSpec := Spec{ - EventsByName: make(map[string]EventSpec), - EventsByID: make(map[EventID]EventSpec), - Functions: make(map[string]FunctionSpec), - } + newSpec := NewSpec() for _, s := range abiSpec { for n, f := range s.Functions { @@ -111,7 +115,7 @@ func MergeSpec(abiSpec []*Spec) *Spec { } } - return &newSpec + return newSpec } func (spec *Spec) GetEventAbi(id EventID, addresses crypto.Address) (*EventSpec, error) { @@ -119,7 +123,7 @@ func (spec *Spec) GetEventAbi(id EventID, addresses crypto.Address) (*EventSpec, if !ok { return nil, fmt.Errorf("could not find ABI for event with ID %v", id) } - return &eventSpec, nil + return eventSpec, nil } // Pack ABI encodes a function call. The fname specifies which function should called, if @@ -129,19 +133,19 @@ func (spec *Spec) GetEventAbi(id EventID, addresses crypto.Address) (*EventSpec, // Returns the ABI encoded function call, whether the function is constant according // to the ABI (which means it does not modified contract state) func (spec *Spec) Pack(fname string, args ...interface{}) ([]byte, *FunctionSpec, error) { - var funcSpec FunctionSpec + var funcSpec *FunctionSpec var argSpec []Argument if fname != "" { if _, ok := spec.Functions[fname]; ok { funcSpec = spec.Functions[fname] } else { - return nil, nil, fmt.Errorf("Unknown function %s", fname) + return nil, nil, fmt.Errorf("unknown function in Pack: %s", fname) } } else { if spec.Constructor.Inputs != nil { funcSpec = spec.Constructor } else { - return nil, nil, fmt.Errorf("Contract does not have a constructor") + return nil, nil, fmt.Errorf("contract does not have a constructor") } } @@ -158,12 +162,12 @@ func (spec *Spec) Pack(fname string, args ...interface{}) ([]byte, *FunctionSpec return nil, nil, err } - return append(packed, packedArgs...), &funcSpec, nil + return append(packed, packedArgs...), funcSpec, nil } // Unpack decodes the return values from a function call func (spec *Spec) Unpack(data []byte, fname string, args ...interface{}) error { - var funcSpec FunctionSpec + var funcSpec *FunctionSpec var argSpec []Argument if fname != "" { if _, ok := spec.Functions[fname]; ok { @@ -178,7 +182,7 @@ func (spec *Spec) Unpack(data []byte, fname string, args ...interface{}) error { argSpec = funcSpec.Outputs if argSpec == nil { - return fmt.Errorf("Unknown function %s", fname) + return fmt.Errorf("unknown function in Unpack: %s", fname) } return unpack(argSpec, data, func(i int) interface{} { @@ -198,7 +202,7 @@ func (spec *Spec) UnpackWithID(data []byte, args ...interface{}) error { } if argSpec == nil { - return fmt.Errorf("Unknown function %x", id) + return fmt.Errorf("unknown function in UnpackWithID: %x", id) } return unpack(argSpec, data[4:], func(i int) interface{} { diff --git a/execution/evm/asm/opcodes.go b/execution/evm/asm/opcodes.go index 23d67a159..6f8b78b35 100644 --- a/execution/evm/asm/opcodes.go +++ b/execution/evm/asm/opcodes.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package asm @@ -82,8 +71,9 @@ const ( COINBASE TIMESTAMP BLOCKHEIGHT - DIFFICULTY_DEPRECATED + DIFFICULTY GASLIMIT + CHAINID ) const ( @@ -185,10 +175,10 @@ const ( CALLCODE RETURN DELEGATECALL + CREATE2 // 0x70 range - other STATICCALL = 0xfa - CREATE2 = 0xfb REVERT = 0xfd INVALID = 0xfe SELFDESTRUCT = 0xff @@ -247,12 +237,13 @@ var opCodeNames = map[OpCode]string{ EXTCODEHASH: "EXTCODEHASH", // 0x40 range - block operations - BLOCKHASH: "BLOCKHASH", - COINBASE: "COINBASE", - TIMESTAMP: "TIMESTAMP", - BLOCKHEIGHT: "BLOCKHEIGHT", - DIFFICULTY_DEPRECATED: "DIFFICULTY_DEPRECATED", - GASLIMIT: "GASLIMIT", + BLOCKHASH: "BLOCKHASH", + COINBASE: "COINBASE", + TIMESTAMP: "TIMESTAMP", + BLOCKHEIGHT: "BLOCKHEIGHT", + DIFFICULTY: "DIFFICULTY", + GASLIMIT: "GASLIMIT", + CHAINID: "CHAINID", // 0x50 range - 'storage' and execution POP: "POP", @@ -347,9 +338,9 @@ var opCodeNames = map[OpCode]string{ RETURN: "RETURN", CALLCODE: "CALLCODE", DELEGATECALL: "DELEGATECALL", + CREATE2: "CREATE2", STATICCALL: "STATICCALL", // 0x70 range - other - CREATE2: "CREATE2", REVERT: "REVERT", INVALID: "INVALID", SELFDESTRUCT: "SELFDESTRUCT", diff --git a/execution/evm/code.go b/execution/evm/code.go new file mode 100644 index 000000000..90ab6d8c6 --- /dev/null +++ b/execution/evm/code.go @@ -0,0 +1,66 @@ +package evm + +import ( + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/execution/evm/asm" + "github.com/tmthrgd/go-bitset" +) + +type Code struct { + Bytecode acm.Bytecode + OpcodeBitset bitset.Bitset +} + +// Build a Code object that includes analysis of which symbols are opcodes versus push data +func NewCode(code []byte) *Code { + return &Code{ + Bytecode: code, + OpcodeBitset: opcodeBitset(code), + } +} + +func (code *Code) Length() uint64 { + if code == nil { + return 0 + } + return uint64(len(code.Bytecode)) +} + +func (code *Code) GetBytecode() acm.Bytecode { + if code == nil { + return nil + } + return code.Bytecode +} + +func (code *Code) IsOpcode(indexOfSymbolInCode uint64) bool { + if code == nil || indexOfSymbolInCode >= uint64(code.OpcodeBitset.Len()) { + return false + } + return code.OpcodeBitset.IsSet(uint(indexOfSymbolInCode)) +} + +func (code *Code) IsPushData(indexOfSymbolInCode uint64) bool { + return !code.IsOpcode(indexOfSymbolInCode) +} + +func (code *Code) GetSymbol(n uint64) asm.OpCode { + if code.Length() <= n { + return asm.STOP + } else { + return asm.OpCode(code.Bytecode[n]) + } +} + +// If code[i] is an opcode (rather than PUSH data) then bitset.IsSet(i) will be true +func opcodeBitset(code []byte) bitset.Bitset { + bs := bitset.New(uint(len(code))) + for i := 0; i < len(code); i++ { + bs.Set(uint(i)) + symbol := asm.OpCode(code[i]) + if symbol >= asm.PUSH1 && symbol <= asm.PUSH32 { + i += int(symbol - asm.PUSH1 + 1) + } + } + return bs +} diff --git a/execution/evm/code_test.go b/execution/evm/code_test.go new file mode 100644 index 000000000..69f9ce3c5 --- /dev/null +++ b/execution/evm/code_test.go @@ -0,0 +1,94 @@ +package evm + +import ( + "fmt" + "reflect" + "testing" + + "github.com/hyperledger/burrow/execution/evm/asm" + "github.com/hyperledger/burrow/execution/evm/asm/bc" + "github.com/stretchr/testify/assert" + "github.com/tmthrgd/go-bitset" +) + +func TestOpcodeBitset(t *testing.T) { + tests := []struct { + name string + code []byte + bitset bitset.Bitset + }{ + { + name: "Only one real JUMPDEST", + code: bc.MustSplice(asm.PUSH2, 1, asm.JUMPDEST, asm.ADD, asm.JUMPDEST), + bitset: mkBitset("10011"), + }, + { + name: "Two JUMPDESTs", + code: bc.MustSplice(asm.PUSH1, 1, asm.JUMPDEST, asm.ADD, asm.JUMPDEST), + bitset: mkBitset("10111"), + }, + { + name: "One PUSH", + code: bc.MustSplice(asm.PUSH4, asm.JUMPDEST, asm.ADD, asm.JUMPDEST, asm.PUSH32, asm.BALANCE), + bitset: mkBitset("100001"), + }, + { + name: "Two PUSHes", + code: bc.MustSplice(asm.PUSH3, asm.JUMPDEST, asm.ADD, asm.JUMPDEST, asm.PUSH32, asm.BALANCE), + bitset: mkBitset("100010"), + }, + { + name: "Three PUSHes", + code: bc.MustSplice(asm.PUSH3, asm.JUMPDEST, asm.ADD, asm.PUSH2, asm.PUSH32, asm.BALANCE), + bitset: mkBitset("100010"), + }, + { + name: "No PUSH", + code: bc.MustSplice(asm.JUMPDEST, asm.ADD, asm.BALANCE), + bitset: mkBitset("111"), + }, + { + name: "End PUSH", + code: bc.MustSplice(asm.JUMPDEST, asm.ADD, asm.PUSH6), + bitset: mkBitset("111"), + }, + { + name: "Middle PUSH", + code: bc.MustSplice(asm.JUMPDEST, asm.PUSH2, asm.PUSH1, asm.PUSH2, asm.BLOCKHASH), + bitset: mkBitset("11001"), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := opcodeBitset(tt.code); !reflect.DeepEqual(got, tt.bitset) { + t.Errorf("opcodeBitset() = %v, want %v", got, tt.bitset) + } + }) + } +} + +func TestCode_IsOpcodeAt(t *testing.T) { + code := NewCode(bc.MustSplice(asm.PUSH2, 2, 3)) + + assert.True(t, code.IsOpcode(0)) + assert.False(t, code.IsOpcode(1)) + assert.False(t, code.IsOpcode(2)) + assert.False(t, code.IsOpcode(3)) +} + +func mkBitset(binaryString string) bitset.Bitset { + length := uint(len(binaryString)) + bs := bitset.New(length) + for i := uint(0); i < length; i++ { + switch binaryString[i] { + case '1': + bs.Set(i) + case '0': + case ' ': + i++ + default: + panic(fmt.Errorf("mkBitset() expects a string containing only 1s, 0s, and spaces")) + } + } + return bs +} diff --git a/execution/evm/contract.go b/execution/evm/contract.go new file mode 100644 index 000000000..201926e04 --- /dev/null +++ b/execution/evm/contract.go @@ -0,0 +1,843 @@ +package evm + +import ( + "bytes" + "encoding/binary" + "fmt" + "io/ioutil" + "math/big" + "strings" + + "github.com/hyperledger/burrow/acm" + . "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/evm/abi" + . "github.com/hyperledger/burrow/execution/evm/asm" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/permission" + "github.com/hyperledger/burrow/txs" +) + +type Contract struct { + *EVM + *Code +} + +func (c *Contract) Call(state engine.State, params engine.CallParams) ([]byte, error) { + return engine.Call(state, params, c.execute) +} + +// Executes the EVM code passed in the appropriate context +func (c *Contract) execute(st engine.State, params engine.CallParams) ([]byte, error) { + c.debugf("(%d) (%s) %s (code=%d) gas: %v (d) %X\n", + st.CallFrame.CallStackDepth(), params.Caller, params.Callee, c.Length(), *params.Gas, params.Input) + + if c.Length() == 0 { + return nil, nil + } + + if c.options.DumpTokens { + dumpTokens(c.options.Nonce, params.Caller, params.Callee, c.GetBytecode()) + } + + // Program counter - the index into code that tracks current instruction + var pc uint64 + // Return data from a call + var returnData []byte + + // Maybe serves 3 purposes: 1. provides 'capture first error semantics', 2. reduces clutter of error handling + // particular for 1, 3. acts a shared error sink for stack, memory, and the main execute loop + maybe := new(errors.Maybe) + + // Provide stack and memory storage - passing in the callState as an error provider + stack := NewStack(maybe, c.options.DataStackInitialCapacity, c.options.DataStackMaxDepth, params.Gas) + memory := c.options.MemoryProvider(maybe) + + for { + // Check for any error in this frame. + if maybe.Error() != nil { + return nil, maybe.Error() + } + + var op = c.GetSymbol(pc) + c.debugf("(pc) %-3d (op) %-14s (st) %-4d (gas) %d", pc, op.String(), stack.Len(), params.Gas) + // Use BaseOp gas. + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasBaseOp)) + + switch op { + + case ADD: // 0x01 + x, y := stack.PopBigInt(), stack.PopBigInt() + sum := new(big.Int).Add(x, y) + res := stack.PushBigInt(sum) + c.debugf(" %v + %v = %v (%v)\n", x, y, sum, res) + + case MUL: // 0x02 + x, y := stack.PopBigInt(), stack.PopBigInt() + prod := new(big.Int).Mul(x, y) + res := stack.PushBigInt(prod) + c.debugf(" %v * %v = %v (%v)\n", x, y, prod, res) + + case SUB: // 0x03 + x, y := stack.PopBigInt(), stack.PopBigInt() + diff := new(big.Int).Sub(x, y) + res := stack.PushBigInt(diff) + c.debugf(" %v - %v = %v (%v)\n", x, y, diff, res) + + case DIV: // 0x04 + x, y := stack.PopBigInt(), stack.PopBigInt() + if y.Sign() == 0 { + stack.Push(Zero256) + c.debugf(" %v / %v = %v\n", x, y, 0) + } else { + div := new(big.Int).Div(x, y) + res := stack.PushBigInt(div) + c.debugf(" %v / %v = %v (%v)\n", x, y, div, res) + } + + case SDIV: // 0x05 + x, y := stack.PopBigIntSigned(), stack.PopBigIntSigned() + if y.Sign() == 0 { + stack.Push(Zero256) + c.debugf(" %v / %v = %v\n", x, y, 0) + } else { + div := new(big.Int).Quo(x, y) + res := stack.PushBigInt(div) + c.debugf(" %v / %v = %v (%v)\n", x, y, div, res) + } + + case MOD: // 0x06 + x, y := stack.PopBigInt(), stack.PopBigInt() + if y.Sign() == 0 { + stack.Push(Zero256) + c.debugf(" %v %% %v = %v\n", x, y, 0) + } else { + mod := new(big.Int).Mod(x, y) + res := stack.PushBigInt(mod) + c.debugf(" %v %% %v = %v (%v)\n", x, y, mod, res) + } + + case SMOD: // 0x07 + x, y := stack.PopBigIntSigned(), stack.PopBigIntSigned() + if y.Sign() == 0 { + stack.Push(Zero256) + c.debugf(" %v %% %v = %v\n", x, y, 0) + } else { + mod := new(big.Int).Rem(x, y) + res := stack.PushBigInt(mod) + c.debugf(" %v %% %v = %v (%v)\n", x, y, mod, res) + } + + case ADDMOD: // 0x08 + x, y, z := stack.PopBigInt(), stack.PopBigInt(), stack.PopBigInt() + if z.Sign() == 0 { + stack.Push(Zero256) + c.debugf(" %v %% %v = %v\n", x, y, 0) + } else { + add := new(big.Int).Add(x, y) + mod := add.Mod(add, z) + res := stack.PushBigInt(mod) + c.debugf(" %v + %v %% %v = %v (%v)\n", x, y, z, mod, res) + } + + case MULMOD: // 0x09 + x, y, z := stack.PopBigInt(), stack.PopBigInt(), stack.PopBigInt() + if z.Sign() == 0 { + stack.Push(Zero256) + c.debugf(" %v %% %v = %v\n", x, y, 0) + } else { + mul := new(big.Int).Mul(x, y) + mod := mul.Mod(mul, z) + res := stack.PushBigInt(mod) + c.debugf(" %v * %v %% %v = %v (%v)\n", x, y, z, mod, res) + } + + case EXP: // 0x0A + x, y := stack.PopBigInt(), stack.PopBigInt() + pow := new(big.Int).Exp(x, y, nil) + res := stack.PushBigInt(pow) + c.debugf(" %v ** %v = %v (%v)\n", x, y, pow, res) + + case SIGNEXTEND: // 0x0B + back := stack.PopBigInt().Uint64() + if back < Word256Bytes-1 { + bits := uint((back + 1) * 8) + stack.PushBigInt(SignExtend(stack.PopBigInt(), bits)) + } + // Continue leaving the sign extension argument on the stack. This makes sign-extending a no-op if embedded + // integer is already one word wide + + case LT: // 0x10 + x, y := stack.PopBigInt(), stack.PopBigInt() + if x.Cmp(y) < 0 { + stack.Push(One256) + c.debugf(" %v < %v = %v\n", x, y, 1) + } else { + stack.Push(Zero256) + c.debugf(" %v < %v = %v\n", x, y, 0) + } + + case GT: // 0x11 + x, y := stack.PopBigInt(), stack.PopBigInt() + if x.Cmp(y) > 0 { + stack.Push(One256) + c.debugf(" %v > %v = %v\n", x, y, 1) + } else { + stack.Push(Zero256) + c.debugf(" %v > %v = %v\n", x, y, 0) + } + + case SLT: // 0x12 + x, y := stack.PopBigIntSigned(), stack.PopBigIntSigned() + if x.Cmp(y) < 0 { + stack.Push(One256) + c.debugf(" %v < %v = %v\n", x, y, 1) + } else { + stack.Push(Zero256) + c.debugf(" %v < %v = %v\n", x, y, 0) + } + + case SGT: // 0x13 + x, y := stack.PopBigIntSigned(), stack.PopBigIntSigned() + if x.Cmp(y) > 0 { + stack.Push(One256) + c.debugf(" %v > %v = %v\n", x, y, 1) + } else { + stack.Push(Zero256) + c.debugf(" %v > %v = %v\n", x, y, 0) + } + + case EQ: // 0x14 + x, y := stack.Pop(), stack.Pop() + if bytes.Equal(x[:], y[:]) { + stack.Push(One256) + c.debugf(" %v == %v = %v\n", x, y, 1) + } else { + stack.Push(Zero256) + c.debugf(" %v == %v = %v\n", x, y, 0) + } + + case ISZERO: // 0x15 + x := stack.Pop() + if x.IsZero() { + stack.Push(One256) + c.debugf(" %v == 0 = %v\n", x, 1) + } else { + stack.Push(Zero256) + c.debugf(" %v == 0 = %v\n", x, 0) + } + + case AND: // 0x16 + x, y := stack.Pop(), stack.Pop() + z := [32]byte{} + for i := 0; i < 32; i++ { + z[i] = x[i] & y[i] + } + stack.Push(z) + c.debugf(" %v & %v = %v\n", x, y, z) + + case OR: // 0x17 + x, y := stack.Pop(), stack.Pop() + z := [32]byte{} + for i := 0; i < 32; i++ { + z[i] = x[i] | y[i] + } + stack.Push(z) + c.debugf(" %v | %v = %v\n", x, y, z) + + case XOR: // 0x18 + x, y := stack.Pop(), stack.Pop() + z := [32]byte{} + for i := 0; i < 32; i++ { + z[i] = x[i] ^ y[i] + } + stack.Push(z) + c.debugf(" %v ^ %v = %v\n", x, y, z) + + case NOT: // 0x19 + x := stack.Pop() + z := [32]byte{} + for i := 0; i < 32; i++ { + z[i] = ^x[i] + } + stack.Push(z) + c.debugf(" !%v = %v\n", x, z) + + case BYTE: // 0x1A + idx := stack.Pop64() + val := stack.Pop() + res := byte(0) + if idx < 32 { + res = val[idx] + } + stack.Push64(uint64(res)) + c.debugf(" => 0x%X\n", res) + + case SHL: //0x1B + shift, x := stack.PopBigInt(), stack.PopBigInt() + + if shift.Cmp(Big256) >= 0 { + reset := big.NewInt(0) + stack.PushBigInt(reset) + c.debugf(" %v << %v = %v\n", x, shift, reset) + } else { + shiftedValue := x.Lsh(x, uint(shift.Uint64())) + stack.PushBigInt(shiftedValue) + c.debugf(" %v << %v = %v\n", x, shift, shiftedValue) + } + + case SHR: //0x1C + shift, x := stack.PopBigInt(), stack.PopBigInt() + + if shift.Cmp(Big256) >= 0 { + reset := big.NewInt(0) + stack.PushBigInt(reset) + c.debugf(" %v << %v = %v\n", x, shift, reset) + } else { + shiftedValue := x.Rsh(x, uint(shift.Uint64())) + stack.PushBigInt(shiftedValue) + c.debugf(" %v << %v = %v\n", x, shift, shiftedValue) + } + + case SAR: //0x1D + shift, x := stack.PopBigInt(), stack.PopBigIntSigned() + + if shift.Cmp(Big256) >= 0 { + reset := big.NewInt(0) + if x.Sign() < 0 { + reset.SetInt64(-1) + } + stack.PushBigInt(reset) + c.debugf(" %v << %v = %v\n", x, shift, reset) + } else { + shiftedValue := x.Rsh(x, uint(shift.Uint64())) + stack.PushBigInt(shiftedValue) + c.debugf(" %v << %v = %v\n", x, shift, shiftedValue) + } + + case SHA3: // 0x20 + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasSha3)) + offset, size := stack.PopBigInt(), stack.PopBigInt() + data := memory.Read(offset, size) + data = crypto.Keccak256(data) + stack.PushBytes(data) + c.debugf(" => (%v) %X\n", size, data) + + case ADDRESS: // 0x30 + stack.Push(params.Callee.Word256()) + c.debugf(" => %v\n", params.Callee) + + case BALANCE: // 0x31 + address := stack.PopAddress() + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasGetAccount)) + balance := engine.MustGetAccount(st.CallFrame, maybe, address).Balance + stack.Push64(balance) + c.debugf(" => %v (%v)\n", balance, address) + + case ORIGIN: // 0x32 + stack.Push(params.Origin.Word256()) + c.debugf(" => %v\n", params.Origin) + + case CALLER: // 0x33 + stack.Push(params.Caller.Word256()) + c.debugf(" => %v\n", params.Caller) + + case CALLVALUE: // 0x34 + stack.PushBigInt(¶ms.Value) + c.debugf(" => %v\n", params.Value) + + case CALLDATALOAD: // 0x35 + offset := stack.Pop64() + data := maybe.Bytes(subslice(params.Input, offset, 32)) + res := LeftPadWord256(data) + stack.Push(res) + c.debugf(" => 0x%v\n", res) + + case CALLDATASIZE: // 0x36 + stack.Push64(uint64(len(params.Input))) + c.debugf(" => %d\n", len(params.Input)) + + case CALLDATACOPY: // 0x37 + memOff := stack.PopBigInt() + inputOff := stack.Pop64() + length := stack.Pop64() + data := maybe.Bytes(subslice(params.Input, inputOff, length)) + memory.Write(memOff, data) + c.debugf(" => [%v, %v, %v] %X\n", memOff, inputOff, length, data) + + case CODESIZE: // 0x38 + l := uint64(c.Length()) + stack.Push64(l) + c.debugf(" => %d\n", l) + + case CODECOPY: // 0x39 + memOff := stack.PopBigInt() + codeOff := stack.Pop64() + length := stack.Pop64() + data := maybe.Bytes(subslice(c.GetBytecode(), codeOff, length)) + memory.Write(memOff, data) + c.debugf(" => [%v, %v, %v] %X\n", memOff, codeOff, length, data) + + case GASPRICE_DEPRECATED: // 0x3A + stack.Push(Zero256) + c.debugf(" => %v (GASPRICE IS DEPRECATED)\n", Zero256) + + case EXTCODESIZE: // 0x3B + address := stack.PopAddress() + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasGetAccount)) + acc := engine.MustGetAccount(st.CallFrame, maybe, address) + if acc == nil { + stack.Push(Zero256) + c.debugf(" => 0\n") + } else { + length := uint64(len(acc.Code())) + stack.Push64(length) + c.debugf(" => %d\n", length) + } + case EXTCODECOPY: // 0x3C + address := stack.PopAddress() + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasGetAccount)) + acc := engine.MustGetAccount(st.CallFrame, maybe, address) + if acc == nil { + maybe.PushError(errors.Codes.UnknownAddress) + } else { + code := acc.EVMCode + memOff := stack.PopBigInt() + codeOff := stack.Pop64() + length := stack.Pop64() + data := maybe.Bytes(subslice(code, codeOff, length)) + memory.Write(memOff, data) + c.debugf(" => [%v, %v, %v] %X\n", memOff, codeOff, length, data) + } + + case RETURNDATASIZE: // 0x3D + stack.Push64(uint64(len(returnData))) + c.debugf(" => %d\n", len(returnData)) + + case RETURNDATACOPY: // 0x3E + memOff, outputOff, length := stack.PopBigInt(), stack.PopBigInt(), stack.PopBigInt() + end := new(big.Int).Add(outputOff, length) + + if end.BitLen() > 64 || uint64(len(returnData)) < end.Uint64() { + maybe.PushError(errors.Codes.ReturnDataOutOfBounds) + continue + } + + memory.Write(memOff, returnData) + c.debugf(" => [%v, %v, %v] %X\n", memOff, outputOff, length, returnData) + + case EXTCODEHASH: // 0x3F + address := stack.PopAddress() + + acc := engine.GetAccount(st.CallFrame, maybe, address) + if acc == nil { + // In case the account does not exist 0 is pushed to the stack. + stack.Push64(0) + } else { + // keccak256 hash of a contract's code + var extcodehash Word256 + if len(acc.CodeHash) > 0 { + copy(extcodehash[:], acc.CodeHash) + } else { + copy(extcodehash[:], crypto.Keccak256(acc.Code())) + } + stack.Push(extcodehash) + } + + case BLOCKHASH: // 0x40 + blockNumber := stack.Pop64() + + lastBlockHeight := st.Blockchain.LastBlockHeight() + if blockNumber >= lastBlockHeight { + c.debugf(" => attempted to get block hash of a non-existent block: %v", blockNumber) + maybe.PushError(errors.Codes.InvalidBlockNumber) + } else if lastBlockHeight-blockNumber > MaximumAllowedBlockLookBack { + c.debugf(" => attempted to get block hash of a block %d outside of the allowed range "+ + "(must be within %d blocks)", blockNumber, MaximumAllowedBlockLookBack) + maybe.PushError(errors.Codes.BlockNumberOutOfRange) + } else { + hash := maybe.Bytes(st.Blockchain.BlockHash(blockNumber)) + blockHash := LeftPadWord256(hash) + stack.Push(blockHash) + c.debugf(" => 0x%v\n", blockHash) + } + + case COINBASE: // 0x41 + stack.Push(Zero256) + c.debugf(" => 0x%v (NOT SUPPORTED)\n", stack.Peek()) + + case TIMESTAMP: // 0x42 + blockTime := st.Blockchain.LastBlockTime().Unix() + stack.Push64(uint64(blockTime)) + c.debugf(" => %d\n", blockTime) + + case BLOCKHEIGHT: // 0x43 + number := st.Blockchain.LastBlockHeight() + stack.Push64(number) + c.debugf(" => %d\n", number) + + case DIFFICULTY: // 0x44 + // ~ hashes per solution - by convention we'll use unity since there are no misses if you are proposer + stack.Push(One256) + c.debugf(" => %v\n", One256) + + case GASLIMIT: // 0x45 + stack.PushBigInt(params.Gas) + c.debugf(" => %v\n", *params.Gas) + + case CHAINID: // 0x46 + id := encoding.GetEthChainID(st.Blockchain.ChainID()) + stack.PushBigInt(id) + c.debugf(" => %X\n", id) + + case POP: // 0x50 + popped := stack.Pop() + c.debugf(" => 0x%v\n", popped) + + case MLOAD: // 0x51 + offset := stack.PopBigInt() + data := memory.Read(offset, BigWord256Bytes) + stack.Push(LeftPadWord256(data)) + c.debugf(" => 0x%X @ 0x%v\n", data, offset) + + case MSTORE: // 0x52 + offset, data := stack.PopBigInt(), stack.Pop() + memory.Write(offset, data.Bytes()) + c.debugf(" => 0x%v @ 0x%v\n", data, offset) + + case MSTORE8: // 0x53 + offset := stack.PopBigInt() + val64 := stack.PopBigInt().Uint64() + val := byte(val64 & 0xFF) + memory.Write(offset, []byte{val}) + c.debugf(" => [%v] 0x%X\n", offset, val) + + case SLOAD: // 0x54 + loc := stack.Pop() + data := LeftPadWord256(maybe.Bytes(st.CallFrame.GetStorage(params.Callee, loc))) + stack.Push(data) + c.debugf("%v {0x%v = 0x%v}\n", params.Callee, loc, data) + + case SSTORE: // 0x55 + loc, data := stack.Pop(), stack.Pop() + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasStorageUpdate)) + maybe.PushError(st.CallFrame.SetStorage(params.Callee, loc, data.Bytes())) + c.debugf("%v {%v := %v}\n", params.Callee, loc, data) + + case JUMP: // 0x56 + to := stack.Pop64() + maybe.PushError(c.jump(to, &pc)) + continue + + case JUMPI: // 0x57 + pos := stack.Pop64() + cond := stack.Pop() + if !cond.IsZero() { + maybe.PushError(c.jump(pos, &pc)) + continue + } else { + c.debugf(" ~> false\n") + } + + case PC: // 0x58 + stack.Push64(pc) + + case MSIZE: // 0x59 + // Note: Solidity will write to this offset expecting to find guaranteed + // free memory to be allocated for it if a subsequent MSTORE is made to + // this offset. + capacity := memory.Capacity() + stack.PushBigInt(capacity) + c.debugf(" => 0x%X\n", capacity) + + case GAS: // 0x5A + stack.PushBigInt(params.Gas) + c.debugf(" => %X\n", params.Gas) + + case JUMPDEST: // 0x5B + c.debugf("\n") + // Do nothing + + case PUSH1, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8, PUSH9, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16, PUSH17, PUSH18, PUSH19, PUSH20, PUSH21, PUSH22, PUSH23, PUSH24, PUSH25, PUSH26, PUSH27, PUSH28, PUSH29, PUSH30, PUSH31, PUSH32: + a := uint64(op - PUSH1 + 1) + codeSegment := maybe.Bytes(subslice(c.GetBytecode(), pc+1, a)) + res := LeftPadWord256(codeSegment) + stack.Push(res) + pc += a + c.debugf(" => 0x%v\n", res) + + case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16: + n := int(op - DUP1 + 1) + stack.Dup(n) + c.debugf(" => [%d] 0x%v\n", n, stack.Peek()) + + case SWAP1, SWAP2, SWAP3, SWAP4, SWAP5, SWAP6, SWAP7, SWAP8, SWAP9, SWAP10, SWAP11, SWAP12, SWAP13, SWAP14, SWAP15, SWAP16: + n := int(op - SWAP1 + 2) + stack.Swap(n) + c.debugf(" => [%d] %v\n", n, stack.Peek()) + + case LOG0, LOG1, LOG2, LOG3, LOG4: + n := int(op - LOG0) + topics := make([]Word256, n) + offset, size := stack.PopBigInt(), stack.PopBigInt() + for i := 0; i < n; i++ { + topics[i] = stack.Pop() + } + data := memory.Read(offset, size) + maybe.PushError(st.EventSink.Log(&exec.LogEvent{ + Address: params.Callee, + Topics: topics, + Data: data, + })) + c.debugf(" => T:%v D:%X\n", topics, data) + + case CREATE, CREATE2: // 0xF0, 0xFB + returnData = nil + contractValue := stack.PopBigInt() + offset, size := stack.PopBigInt(), stack.PopBigInt() + input := memory.Read(offset, size) + + // TODO charge for gas to create account _ the code length * GasCreateByte + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasCreateAccount)) + + var newAccountAddress crypto.Address + if op == CREATE { + c.sequence++ + nonce := make([]byte, txs.HashLength+uint64Length) + copy(nonce, c.options.Nonce) + binary.BigEndian.PutUint64(nonce[txs.HashLength:], c.sequence) + newAccountAddress = crypto.NewContractAddress(params.Callee, nonce) + } else if op == CREATE2 { + salt := stack.Pop() + code := engine.MustGetAccount(st.CallFrame, maybe, params.Callee).EVMCode + newAccountAddress = crypto.NewContractAddress2(params.Callee, salt, code) + } + + // Check the CreateContract permission for this account + if maybe.PushError(engine.EnsurePermission(st.CallFrame, params.Callee, permission.CreateContract)) { + continue + } + + // Establish a frame in which the putative account exists + childCallFrame, err := st.CallFrame.NewFrame() + maybe.PushError(err) + maybe.PushError(engine.CreateAccount(childCallFrame, newAccountAddress)) + + // Run the input to get the contract code. + // NOTE: no need to copy 'input' as per Call contract. + ret, callErr := c.Contract(input).Call( + engine.State{ + CallFrame: childCallFrame, + Blockchain: st.Blockchain, + EventSink: st.EventSink, + }, + engine.CallParams{ + Origin: params.Origin, + Caller: params.Callee, + Callee: newAccountAddress, + Input: input, + Value: *contractValue, + Gas: params.Gas, + }) + if callErr != nil { + stack.Push(Zero256) + // Note we both set the return buffer and return the result normally in order to service the error to + // EVM caller + returnData = ret + } else { + // Update the account with its initialised contract code + maybe.PushError(engine.InitChildCode(childCallFrame, newAccountAddress, params.Callee, ret)) + maybe.PushError(childCallFrame.Sync()) + stack.PushAddress(newAccountAddress) + } + + case CALL, CALLCODE, DELEGATECALL, STATICCALL: // 0xF1, 0xF2, 0xF4, 0xFA + returnData = nil + + if maybe.PushError(engine.EnsurePermission(st.CallFrame, params.Callee, permission.Call)) { + continue + } + // Pull arguments off stack: + gasLimit := stack.PopBigInt() + target := stack.PopAddress() + value := params.Value + // NOTE: for DELEGATECALL value is preserved from the original + // caller, as such it is not stored on stack as an argument + // for DELEGATECALL and should not be popped. Instead previous + // caller value is used. for CALL and CALLCODE value is stored + // on stack and needs to be overwritten from the given value. + if op != DELEGATECALL && op != STATICCALL { + value = *stack.PopBigInt() + } + // inputs + inOffset, inSize := stack.PopBigInt(), stack.PopBigInt() + // outputs + retOffset := stack.PopBigInt() + retSize := stack.Pop64() + c.debugf(" => %v\n", target) + + var err error + returnData, err = engine.CallFromSite(st, c.externalDispatcher, params, engine.CallParams{ + CallType: callTypeFromOpCode(op), + Callee: target, + Input: memory.Read(inOffset, inSize), + Value: value, + Gas: gasLimit, + }) + // Push result + if err != nil { + c.debugf("error from nested sub-call (depth: %v): %s\n", st.CallFrame.CallStackDepth(), err) + // So we can return nested errors.CodedError if the top level return is an errors.CodedError + stack.Push(Zero256) + + } else { + stack.Push(One256) + } + + code := errors.GetCode(err) + if code == errors.Codes.None || code == errors.Codes.ExecutionReverted { + memory.Write(retOffset, RightPadBytes(returnData, int(retSize))) + } else { + maybe.PushError(err) + } + + // TODO: decide how to handle this + // Apply refund of any unused gas + params.Gas.Add(params.Gas, gasLimit) + + c.debugf("resume %s (%v)\n", params.Callee, params.Gas) + + case RETURN: // 0xF3 + offset, size := stack.PopBigInt(), stack.PopBigInt() + output := memory.Read(offset, size) + c.debugf(" => [%v, %v] (%d) 0x%X\n", offset, size, len(output), output) + return output, maybe.Error() + + case REVERT: // 0xFD + offset, size := stack.PopBigInt(), stack.PopBigInt() + output := memory.Read(offset, size) + c.debugf(" => [%v, %v] (%d) 0x%X\n", offset, size, len(output), output) + maybe.PushError(newRevertException(output)) + return output, maybe.Error() + + case INVALID: // 0xFE + maybe.PushError(errors.Codes.ExecutionAborted) + return nil, maybe.Error() + + case SELFDESTRUCT: // 0xFF + receiver := stack.PopAddress() + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasGetAccount)) + if engine.GetAccount(st.CallFrame, maybe, receiver) == nil { + // If receiver address doesn't exist, try to create it + maybe.PushError(engine.UseGasNegative(params.Gas, engine.GasCreateAccount)) + if maybe.PushError(st.CallFrame.CreateAccount(params.Callee, receiver)) { + continue + } + } + balance := engine.MustGetAccount(st.CallFrame, maybe, params.Callee).Balance + maybe.PushError(engine.UpdateAccount(st.CallFrame, receiver, func(account *acm.Account) error { + return account.AddToBalance(balance) + })) + maybe.PushError(engine.RemoveAccount(st.CallFrame, params.Callee)) + c.debugf(" => (%X) %v\n", receiver[:4], balance) + return nil, maybe.Error() + + case STOP: // 0x00 + c.debugf("\n") + return nil, maybe.Error() + + default: + c.debugf("(pc) %-3v Unknown opcode %v\n", pc, op) + maybe.PushError(errors.Errorf(errors.Codes.Generic, "unknown opcode %v", op)) + return nil, maybe.Error() + } + pc++ + } + return nil, maybe.Error() +} + +func (c *Contract) jump(to uint64, pc *uint64) error { + dest := c.GetSymbol(to) + if dest != JUMPDEST || c.IsPushData(to) { + c.debugf(" ~> %v invalid jump dest %v\n", to, dest) + return errors.Codes.InvalidJumpDest + } + c.debugf(" ~> %v\n", to) + *pc = to + return nil +} + +// Returns a subslice from offset of length length and a bool +// (true iff slice was possible). If the subslice +// extends past the end of data it returns A COPY of the segment at the end of +// data padded with zeroes on the right. If offset == len(data) it returns all +// zeroes. if offset > len(data) it returns a false +func subslice(data []byte, offset, length uint64) ([]byte, error) { + size := uint64(len(data)) + if size < offset || offset < 0 || length < 0 { + return nil, errors.Errorf(errors.Codes.InputOutOfBounds, + "subslice could not slice data of size %d at offset %d for length %d", size, offset, length) + } + if size < offset+length { + // Extract slice from offset to end padding to requested length + ret := make([]byte, length) + copy(ret, data[offset:]) + return ret, nil + } + return data[offset : offset+length], nil +} + +// Dump the bytecode being sent to the EVM in the current working directory +func dumpTokens(nonce []byte, caller, callee crypto.Address, code []byte) { + var tokensString string + tokens, err := acm.Bytecode(code).Tokens() + if err != nil { + tokensString = fmt.Sprintf("error generating tokens from bytecode: %v", err) + } else { + tokensString = strings.Join(tokens, "\n") + } + txHashString := "nil-nonce" + if len(nonce) >= 4 { + txHashString = fmt.Sprintf("nonce-%X", nonce[:4]) + } + callerString := "caller-none" + if caller != crypto.ZeroAddress { + callerString = fmt.Sprintf("caller-%v", caller) + } + calleeString := "callee-none" + if callee != crypto.ZeroAddress { + calleeString = fmt.Sprintf("callee-%v", caller) + } + _ = ioutil.WriteFile(fmt.Sprintf("tokens_%s_%s_%s.asm", txHashString, callerString, calleeString), + []byte(tokensString), 0777) +} + +func newRevertException(ret []byte) errors.CodedError { + code := errors.Codes.ExecutionReverted + if len(ret) > 0 { + // Attempt decode + reason, err := abi.UnpackRevert(ret) + if err == nil { + return errors.Errorf(code, "with reason '%s'", *reason) + } + } + return code +} + +func callTypeFromOpCode(o OpCode) exec.CallType { + switch o { + case CALL: + return exec.CallTypeCall + case CALLCODE: + return exec.CallTypeCode + case STATICCALL: + return exec.CallTypeStatic + case DELEGATECALL: + return exec.CallTypeDelegate + default: + return exec.CallTypeInvalid + } +} diff --git a/execution/evm/evm.go b/execution/evm/evm.go new file mode 100644 index 000000000..b23c28c4e --- /dev/null +++ b/execution/evm/evm.go @@ -0,0 +1,102 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package evm + +import ( + "fmt" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/execution/defaults" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/execution/native" + "github.com/hyperledger/burrow/logging" +) + +const ( + DataStackInitialCapacity = 1024 + MaximumAllowedBlockLookBack = 256 + uint64Length = 8 +) + +type EVM struct { + options engine.Options + sequence uint64 + // Provide any foreign dispatchers to allow calls between VMs + engine.Externals + externalDispatcher engine.Dispatcher + // User dispatcher.CallableProvider to get access to other VMs + logger *logging.Logger +} + +func New(options engine.Options) *EVM { + options = defaults.CompleteOptions(options) + vm := &EVM{ + options: options, + } + vm.logger = options.Logger.WithScope("NewVM").With("evm_nonce", options.Nonce) + vm.externalDispatcher = engine.Dispatchers{&vm.Externals, options.Natives, vm} + return vm +} + +func Default() *EVM { + return New(engine.Options{}) +} + +// Initiate an EVM call against the provided state pushing events to eventSink. code should contain the EVM bytecode, +// input the CallData (readable by CALLDATALOAD), value the amount of native token to transfer with the call +// an quantity metering the number of computational steps available to the execution according to the gas schedule. +func (vm *EVM) Execute(st acmstate.ReaderWriter, blockchain engine.Blockchain, eventSink exec.EventSink, + params engine.CallParams, code []byte) ([]byte, error) { + + // Make it appear as if natives are stored in state + st = native.NewState(vm.options.Natives, st) + + state := engine.State{ + CallFrame: engine.NewCallFrame(st).WithMaxCallStackDepth(vm.options.CallStackMaxDepth), + Blockchain: blockchain, + EventSink: eventSink, + } + + output, err := vm.Contract(code).Call(state, params) + if err == nil { + // Only sync back when there was no exception + err = state.CallFrame.Sync() + } + // Always return output - we may have a reverted exception for which the return is meaningful + return output, err +} + +// Sets a new nonce and resets the sequence number. Nonces should only be used once! +// A global counter or sufficient randomness will work. +func (vm *EVM) SetNonce(nonce []byte) { + vm.options.Nonce = nonce + vm.sequence = 0 +} + +func (vm *EVM) SetLogger(logger *logging.Logger) { + vm.logger = logger +} + +func (vm *EVM) Dispatch(acc *acm.Account) engine.Callable { + // Let the EVM handle code-less (e.g. those created by a call) contracts (so only return nil if there is _other_ non-EVM code) + if len(acc.EVMCode) == 0 && len(acc.Code()) != 0 { + return nil + } + return vm.Contract(acc.EVMCode) +} + +func (vm *EVM) Contract(code []byte) *Contract { + return &Contract{ + EVM: vm, + Code: NewCode(code), + } +} + +func (vm *EVM) debugf(format string, a ...interface{}) { + if vm.options.DebugOpcodes { + fmt.Printf(format, a...) + } +} diff --git a/execution/evm/evm_test.go b/execution/evm/evm_test.go new file mode 100644 index 000000000..3bac3785f --- /dev/null +++ b/execution/evm/evm_test.go @@ -0,0 +1,1791 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package evm + +import ( + "bytes" + "encoding/binary" + "math/big" + "reflect" + "testing" + "time" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + . "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/evm/abi" + . "github.com/hyperledger/burrow/execution/evm/asm" + . "github.com/hyperledger/burrow/execution/evm/asm/bc" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/execution/native" + "github.com/hyperledger/burrow/execution/solidity" + "github.com/hyperledger/burrow/txs" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/tmthrgd/go-hex" +) + +// Test output is a bit clearer if we /dev/null the logging, but can be re-enabled by uncommenting the below +//var logger, _, _ = lifecycle.NewStdErrLogger() + +// Runs a basic loop +func TestEVM(t *testing.T) { + vm := New(engine.Options{ + Natives: native.MustDefaultNatives(), + }) + + t.Run("BasicLoop", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + // Create accounts + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + bytecode := MustSplice(PUSH1, 0x00, PUSH1, 0x20, MSTORE, JUMPDEST, PUSH2, 0x0F, 0x0F, PUSH1, 0x20, MLOAD, + SLT, ISZERO, PUSH1, 0x1D, JUMPI, PUSH1, 0x01, PUSH1, 0x20, MLOAD, ADD, PUSH1, 0x20, + MSTORE, PUSH1, 0x05, JUMP, JUMPDEST) + + start := time.Now() + output, err := vm.Execute(st, blockchain, eventSink, engine.CallParams{ + Caller: account1, + Callee: account2, + Gas: big.NewInt(100000), + }, bytecode) + t.Logf("Output: %v Error: %v\n", output, err) + t.Logf("Call took: %v", time.Since(start)) + require.NoError(t, err) + }) + + t.Run("SHL", func(t *testing.T) { + st := acmstate.NewMemoryState() + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + gas := big.NewInt(100000) + + //Shift left 0 + bytecode := MustSplice(PUSH1, 0x01, PUSH1, 0x00, SHL, return1()) + output, err := call(vm, st, account1, account2, bytecode, nil, gas) + value := []byte{0x1} + expected := LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift left 0 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x00, SHL, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift left 1 + bytecode = MustSplice(PUSH1, 0x01, PUSH1, 0x01, SHL, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x2} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift left 1 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x01, SHL, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x2} + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift left 1 + bytecode = MustSplice(PUSH32, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x01, SHL, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift left 255 + bytecode = MustSplice(PUSH1, 0x01, PUSH1, 0xFF, SHL, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x80} + expected = RightPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift left 255 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0xFF, SHL, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x80} + expected = RightPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift left 256 (overflow) + bytecode = MustSplice(PUSH1, 0x01, PUSH2, 0x01, 0x00, SHL, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift left 256 (overflow) + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH2, 0x01, 0x00, SHL, + return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift left 257 (overflow) + bytecode = MustSplice(PUSH1, 0x01, PUSH2, 0x01, 0x01, SHL, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + }) + + t.Run("SHR", func(t *testing.T) { + st := acmstate.NewMemoryState() + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + gas := big.NewInt(100000) + + //Shift right 0 + bytecode := MustSplice(PUSH1, 0x01, PUSH1, 0x00, SHR, return1()) + output, err := call(vm, st, account1, account2, bytecode, nil, gas) + value := []byte{0x1} + expected := LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift right 0 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x00, SHR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift right 1 + bytecode = MustSplice(PUSH1, 0x01, PUSH1, 0x01, SHR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift right 1 + bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, 0x01, SHR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x40} + expected = RightPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift right 1 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x01, SHR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift right 255 + bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, 0xFF, SHR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x1} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift right 255 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0xFF, SHR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x1} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift right 256 (underflow) + bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH2, 0x01, 0x00, SHR, + return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift right 256 (underflow) + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH2, 0x01, 0x00, SHR, + return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift right 257 (underflow) + bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH2, 0x01, 0x01, SHR, + return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + }) + + t.Run("SAR", func(t *testing.T) { + st := acmstate.NewMemoryState() + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + gas := big.NewInt(100000) + + //Shift arith right 0 + bytecode := MustSplice(PUSH1, 0x01, PUSH1, 0x00, SAR, return1()) + output, err := call(vm, st, account1, account2, bytecode, nil, gas) + value := []byte{0x1} + expected := LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative arith shift right 0 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x00, SAR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift arith right 1 + bytecode = MustSplice(PUSH1, 0x01, PUSH1, 0x01, SAR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift arith right 1 + bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, 0x01, SAR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0xc0} + expected = RightPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift arith right 1 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x01, SAR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift arith right 255 + bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, 0xFF, SAR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift arith right 255 + bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0xFF, SAR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift arith right 255 + bytecode = MustSplice(PUSH32, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0xFF, SAR, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []uint8([]byte{0x00}) + expected = RightPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift arith right 256 (reset) + bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH2, 0x01, 0x00, SAR, + return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Alternative shift arith right 256 (reset) + bytecode = MustSplice(PUSH32, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH2, 0x01, 0x00, SAR, + return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + value = []byte{0x00} + expected = LeftPadBytes(value, 32) + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + + //Shift arith right 257 (reset) + bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH2, 0x01, 0x01, SAR, + return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + expected = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + assert.Equal(t, expected, output) + + t.Logf("Result: %v == %v\n", output, expected) + + if err != nil { + t.Fatal(err) + } + }) + + //Test attempt to jump to bad destination (position 16) + t.Run("JumpErr", func(t *testing.T) { + st := acmstate.NewMemoryState() + + // Create accounts + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "2") + + gas := big.NewInt(100000) + + bytecode := MustSplice(PUSH1, 0x10, JUMP) + + var err error + ch := make(chan struct{}) + go func() { + _, err = call(vm, st, account1, account2, bytecode, nil, gas) + ch <- struct{}{} + }() + tick := time.NewTicker(time.Second * 2) + select { + case <-tick.C: + t.Fatal("VM ended up in an infinite loop from bad jump dest (it took too long!)") + case <-ch: + if err == nil { + t.Fatal("Expected invalid jump dest err") + } + } + }) + + // Tests the code for a subcurrency contract compiled by serpent + t.Run("Subcurrency", func(t *testing.T) { + st := acmstate.NewMemoryState() + // Create accounts + account1 := newAccount(t, st, "1, 2, 3") + account2 := newAccount(t, st, "3, 2, 1") + + gas := big.NewInt(1000) + + bytecode := MustSplice(PUSH3, 0x0F, 0x42, 0x40, CALLER, SSTORE, PUSH29, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, + 0x00, CALLDATALOAD, DIV, PUSH4, 0x15, 0xCF, 0x26, 0x84, DUP2, EQ, ISZERO, PUSH2, + 0x00, 0x46, JUMPI, PUSH1, 0x04, CALLDATALOAD, PUSH1, 0x40, MSTORE, PUSH1, 0x40, + MLOAD, SLOAD, PUSH1, 0x60, MSTORE, PUSH1, 0x20, PUSH1, 0x60, RETURN, JUMPDEST, + PUSH4, 0x69, 0x32, 0x00, 0xCE, DUP2, EQ, ISZERO, PUSH2, 0x00, 0x87, JUMPI, PUSH1, + 0x04, CALLDATALOAD, PUSH1, 0x80, MSTORE, PUSH1, 0x24, CALLDATALOAD, PUSH1, 0xA0, + MSTORE, CALLER, SLOAD, PUSH1, 0xC0, MSTORE, CALLER, PUSH1, 0xE0, MSTORE, PUSH1, + 0xA0, MLOAD, PUSH1, 0xC0, MLOAD, SLT, ISZERO, ISZERO, PUSH2, 0x00, 0x86, JUMPI, + PUSH1, 0xA0, MLOAD, PUSH1, 0xC0, MLOAD, SUB, PUSH1, 0xE0, MLOAD, SSTORE, PUSH1, + 0xA0, MLOAD, PUSH1, 0x80, MLOAD, SLOAD, ADD, PUSH1, 0x80, MLOAD, SSTORE, JUMPDEST, + JUMPDEST, POP, JUMPDEST, PUSH1, 0x00, PUSH1, 0x00, RETURN) + + data := hex.MustDecodeString("693200CE0000000000000000000000004B4363CDE27C2EB05E66357DB05BC5C88F850C1A0000000000000000000000000000000000000000000000000000000000000005") + output, err := call(vm, st, account1, account2, bytecode, data, gas) + t.Logf("Output: %v Error: %v\n", output, err) + if err != nil { + t.Fatal(err) + } + require.NoError(t, err) + }) + + //This test case is taken from EIP-140 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-140.md); + //it is meant to test the implementation of the REVERT opcode + t.Run("Revert", func(t *testing.T) { + st := acmstate.NewMemoryState() + + // Create accounts + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "1, 0, 1") + + key, value := []byte{0x00}, []byte{0x00} + err := st.SetStorage(account1, LeftPadWord256(key), value) + require.NoError(t, err) + + gas := big.NewInt(100000) + + bytecode := MustSplice(PUSH13, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x64, 0x61, 0x74, 0x61, + PUSH1, 0x00, SSTORE, PUSH32, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + PUSH1, 0x00, MSTORE, PUSH1, 0x0E, PUSH1, 0x00, REVERT) + + /*bytecode := MustSplice(PUSH32, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, PUSH1, 0x00, MSTORE, PUSH1, 0x0E, PUSH1, 0x00, REVERT)*/ + + output, err := call(vm, st, account1, account2, bytecode, nil, gas) + assert.Error(t, err, "Expected execution reverted error") + + storageVal, err := st.GetStorage(account1, LeftPadWord256(key)) + require.NoError(t, err) + assert.Equal(t, value, storageVal) + + t.Logf("Output: %v\n", output) + }) + + // Test sending tokens from a contract to another account + t.Run("SendCall", func(t *testing.T) { + st := acmstate.NewMemoryState() + + // Create accounts + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "2") + account3 := newAccount(t, st, "3") + + // account1 will call account2 which will trigger CALL opcode to account3 + addr := account3 + contractCode := callContractCode(addr) + + //---------------------------------------------- + // account2 has insufficient balance, should fail + //txe := runVM(st, account1, account2, contractCode, 100000) + //exCalls := txe.ExceptionalCalls() + //require.Len(t, exCalls, 1) + //require.Equal(t, errors.Codes.InsufficientBalance, errors.GetCode(exCalls[0].Header.Exception)) + + //---------------------------------------------- + // give account2 sufficient balance, should pass + addToBalance(t, st, account2, 100000) + //txe = runVM(st, account1, account2, contractCode, 1000) + //assert.Nil(t, txe.Exception, "Should have sufficient balance") + + //---------------------------------------------- + // insufficient gas, should fail + txe := runVM(st, account1, account2, contractCode, 19) + assert.NotNil(t, txe.Exception, "Expected insufficient gas error") + }) + + // Test to ensure that contracts called with STATICCALL cannot modify state + // as per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-214.md + t.Run("StaticCallReadOnly", func(t *testing.T) { + gas1, gas2 := byte(0x1), byte(0x1) + value := byte(0x69) + var inOff, inSize, retOff, retSize byte + + logDefault := MustSplice(PUSH1, inSize, PUSH1, inOff) + testRecipient := engine.AddressFromName("1") + // check all illegal state modifications in child staticcall frame + for _, illegalContractCode := range []acm.Bytecode{ + MustSplice(PUSH9, "arbitrary", PUSH1, 0x00, SSTORE), + MustSplice(logDefault, LOG0), + MustSplice(logDefault, PUSH1, 0x1, LOG1), + MustSplice(logDefault, PUSH1, 0x1, PUSH1, 0x1, LOG2), + MustSplice(logDefault, PUSH1, 0x1, PUSH1, 0x1, PUSH1, 0x1, LOG3), + MustSplice(logDefault, PUSH1, 0x1, PUSH1, 0x1, PUSH1, 0x1, PUSH1, 0x1, LOG4), + MustSplice(PUSH1, 0x0, PUSH1, 0x0, PUSH1, 0x69, CREATE), + MustSplice(PUSH20, testRecipient, SELFDESTRUCT), + } { + // TODO: CREATE2 + + t.Logf("Testing state-modifying bytecode: %v", illegalContractCode.MustTokens()) + st := acmstate.NewMemoryState() + callee := makeAccountWithCode(t, st, "callee", MustSplice(illegalContractCode, PUSH1, 0x1, return1())) + + // equivalent to CALL, but enforce state immutability for children + code := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, inOff, + PUSH1, value, PUSH20, callee, PUSH2, gas1, gas2, STATICCALL, PUSH1, retSize, + PUSH1, retOff, RETURN) + caller := makeAccountWithCode(t, st, "caller", code) + + txe := runVM(st, caller, callee, code, 1000) + // the topmost caller can never *illegally* modify state + require.Error(t, txe.Exception) + require.Equal(t, errors.Codes.IllegalWrite, txe.Exception.ErrorCode(), + "should get an error from child accounts that st is read only") + } + }) + + t.Run("StaticCallWithValue", func(t *testing.T) { + gas1, gas2 := byte(0x1), byte(0x1) + value := byte(0x69) + var inOff, inSize, retOff, retSize byte + + st := acmstate.NewMemoryState() + + finalAddress := makeAccountWithCode(t, st, "final", MustSplice(PUSH1, int64(20), return1())) + + // intermediate account CALLs another contract *with* a value + callee := makeAccountWithCode(t, st, "callee", MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, + inOff, PUSH1, value, PUSH20, finalAddress, PUSH2, gas1, gas2, CALL, returnWord())) + + callerCode := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, + inOff, PUSH1, value, PUSH20, callee, PUSH2, gas1, gas2, STATICCALL, PUSH1, retSize, + PUSH1, retOff, RETURN) + caller := makeAccountWithCode(t, st, "caller", callerCode) + + addToBalance(t, st, callee, 100000) + txe := runVM(st, caller, callee, callerCode, 1000) + require.NotNil(t, txe.Exception) + require.Equal(t, errors.Codes.IllegalWrite, txe.Exception.ErrorCode(), + "expected static call violation because of call with value") + }) + + t.Run("StaticCallNoValue", func(t *testing.T) { + gas1, gas2 := byte(0x1), byte(0x1) + value := byte(0x69) + var inOff, inSize, retOff, retSize byte + + // this final test just checks that STATICCALL actually works + st := acmstate.NewMemoryState() + + finalAddress := makeAccountWithCode(t, st, "final", MustSplice(PUSH1, int64(20), return1())) + // intermediate account CALLs another contract *without* a value + callee := makeAccountWithCode(t, st, "callee", MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, + inOff, PUSH1, 0x00, PUSH20, finalAddress, PUSH2, gas1, gas2, CALL, returnWord())) + + callerCode := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, + inOff, PUSH1, value, PUSH20, callee, PUSH2, gas1, gas2, STATICCALL, PUSH1, retSize, + PUSH1, retOff, RETURN) + caller := makeAccountWithCode(t, st, "caller", callerCode) + + addToBalance(t, st, callee, 100000) + txe := runVM(st, caller, callee, callerCode, 1000) + // no exceptions expected because value never set in children + require.NoError(t, txe.Exception.AsError()) + exCalls := txe.ExceptionalCalls() + require.Len(t, exCalls, 0) + }) + + // Test evm account creation + t.Run("Create", func(t *testing.T) { + st := acmstate.NewMemoryState() + + code := MustSplice(PUSH1, 0x0, PUSH1, 0x0, PUSH1, 0x0, CREATE, PUSH1, 0, MSTORE, PUSH1, 20, PUSH1, 12, RETURN) + callee := makeAccountWithCode(t, st, "callee", code) + // ensure pre-generated address has same sequence number + nonce := make([]byte, txs.HashLength+uint64Length) + binary.BigEndian.PutUint64(nonce[txs.HashLength:], 1) + addr := crypto.NewContractAddress(callee, nonce) + + gas := big.NewInt(100000) + caller := newAccount(t, st, "1, 2, 3") + output, err := call(vm, st, caller, callee, code, nil, gas) + assert.NoError(t, err, "Should return new address without error") + assert.Equal(t, addr.Bytes(), output, "Addresses should be equal") + }) + + // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1014.md + t.Run("Create2", func(t *testing.T) { + st := acmstate.NewMemoryState() + + // salt of 0s + var salt [32]byte + code := MustSplice(PUSH1, 0x0, PUSH1, 0x0, PUSH1, 0x0, PUSH32, salt[:], CREATE2, PUSH1, 0, MSTORE, PUSH1, 20, PUSH1, 12, RETURN) + callee := makeAccountWithCode(t, st, "callee", code) + addr := crypto.NewContractAddress2(callee, salt, code) + + gas := big.NewInt(100000) + caller := newAccount(t, st, "1, 2, 3") + output, err := call(vm, st, caller, callee, code, nil, gas) + assert.NoError(t, err, "Should return new address without error") + assert.Equal(t, addr.Bytes(), output, "Returned value not equal to create2 address") + }) + + // This test was introduced to cover an issues exposed in our handling of the + // gas limit passed from caller to callee on various forms of CALL. + // The idea of this test is to implement a simple DelegateCall in EVM code + // We first run the DELEGATECALL with _just_ enough gas expecting a simple return, + // and then run it with 1 gas unit less, expecting a failure + t.Run("DelegateCallGas", func(t *testing.T) { + st := acmstate.NewMemoryState() + + inOff := 0 + inSize := 0 // no call data + retOff := 0 + retSize := 32 + calleeReturnValue := int64(20) + + callee := makeAccountWithCode(t, st, "callee", MustSplice(PUSH1, calleeReturnValue, PUSH1, 0, MSTORE, PUSH1, 32, PUSH1, 0, RETURN)) + + // 6 op codes total + baseOpsCost := engine.GasBaseOp * 6 + // 4 pushes + pushCost := engine.GasStackOp * 4 + // 2 pushes 2 pops + returnCost := engine.GasStackOp * 4 + + delegateCallCost := baseOpsCost + pushCost + returnCost + + // Here we split up the caller code so we can make a DELEGATE call with + // different amounts of gas. The value we sandwich in the middle is the amount + // we subtract from the available gas (that the caller has available), so: + // code := MustSplice(callerCodePrefix, , callerCodeSuffix) + // gives us the code to make the call + callerCodePrefix := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, + PUSH1, inOff, PUSH20, callee, PUSH1) + callerCodeSuffix := MustSplice(DELEGATECALL, returnWord()) + + // Perform a delegate call + //Give just enough gas to make the DELEGATECALL + callerCode := MustSplice(callerCodePrefix, + delegateCallCost, callerCodeSuffix) + caller := makeAccountWithCode(t, st, "caller", callerCode) + // Should pass + txe := runVM(st, caller, callee, callerCode, 100) + assert.Nil(t, txe.Exception, "Should have sufficient funds for call") + assert.Equal(t, Int64ToWord256(calleeReturnValue).Bytes(), txe.Result.Return) + + callerCode2 := MustSplice(callerCodePrefix, + // Shouldn't be enough gas to make call + delegateCallCost-1, callerCodeSuffix) + caller2 := makeAccountWithCode(t, st, "caller2", callerCode2) + + // Should fail + txe = runVM(st, caller2, callee, callerCode2, 100) + assert.NotNil(t, txe.Exception, "Should have insufficient gas for call") + }) + + t.Run("MemoryBounds", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + vm := New(engine.Options{ + MemoryProvider: func(err errors.Sink) engine.Memory { + return engine.NewDynamicMemory(1024, 2048, err) + }, + }) + caller := makeAccountWithCode(t, st, "caller", nil) + callee := makeAccountWithCode(t, st, "callee", nil) + word := One256 + // This attempts to store a value at the memory boundary and return it + params := engine.CallParams{ + Gas: big.NewInt(100000), + Caller: caller, + Callee: callee, + } + code := MustSplice(pushWord(word), storeAtEnd(), MLOAD, storeAtEnd(), returnAfterStore()) + + output, err := vm.Execute(st, blockchain, eventSink, params, code) + assert.NoError(t, err) + assert.Equal(t, word.Bytes(), output) + + // Same with number + word = Int64ToWord256(232234234432) + code = MustSplice(pushWord(word), storeAtEnd(), MLOAD, storeAtEnd(), returnAfterStore()) + output, err = vm.Execute(st, blockchain, eventSink, params, code) + assert.NoError(t, err) + assert.Equal(t, word.Bytes(), output) + + // Now test a series of boundary stores + code = pushWord(word) + for i := 0; i < 10; i++ { + code = MustSplice(code, storeAtEnd(), MLOAD) + } + code = MustSplice(code, storeAtEnd(), returnAfterStore()) + output, err = vm.Execute(st, blockchain, eventSink, params, code) + assert.NoError(t, err) + assert.Equal(t, word.Bytes(), output) + + // Same as above but we should breach the upper memory limit set in memoryProvider + code = pushWord(word) + for i := 0; i < 100; i++ { + code = MustSplice(code, storeAtEnd(), MLOAD) + } + code = MustSplice(code, storeAtEnd(), returnAfterStore()) + _, err = vm.Execute(st, blockchain, eventSink, params, code) + assert.Error(t, err, "Should hit memory out of bounds") + }) + + t.Run("MsgSender", func(t *testing.T) { + st := acmstate.NewMemoryState() + account1 := newAccount(t, st, "1, 2, 3") + account2 := newAccount(t, st, "3, 2, 1") + gas := big.NewInt(100000) + + /* + pragma solidity ^0.5.4; + + contract SimpleStorage { + function get() public constant returns (address) { + return msg.sender; + } + } + */ + + // This bytecode is compiled from Solidity contract above using remix.ethereum.org online compiler + code := hex.MustDecodeString("6060604052341561000f57600080fd5b60ca8061001d6000396000f30060606040526004361060" + + "3f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c14604457" + + "5b600080fd5b3415604e57600080fd5b60546096565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ff" + + "ffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000339050905600a165627a" + + "7a72305820b9ebf49535372094ae88f56d9ad18f2a79c146c8f56e7ef33b9402924045071e0029") + + var err error + // Run the contract initialisation code to obtain the contract code that would be mounted at account2 + contractCode, err := call(vm, st, account1, account2, code, code, gas) + require.NoError(t, err) + + // Not needed for this test (since contract code is passed as argument to vm), but this is what an execution + // framework must do + err = engine.InitEVMCode(st, account2, contractCode) + require.NoError(t, err) + + // Input is the function hash of `get()` + input := hex.MustDecodeString("6d4ce63c") + + output, err := call(vm, st, account1, account2, contractCode, input, gas) + require.NoError(t, err) + + assert.Equal(t, account1.Word256().Bytes(), output) + }) + + t.Run("Invalid", func(t *testing.T) { + st := acmstate.NewMemoryState() + + // Create accounts + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "1, 0, 1") + + gas := big.NewInt(100000) + + bytecode := MustSplice(PUSH32, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, PUSH1, 0x00, MSTORE, PUSH1, 0x0E, PUSH1, 0x00, INVALID) + + output, err := call(vm, st, account1, account2, bytecode, nil, gas) + assert.Equal(t, errors.Codes.ExecutionAborted, errors.GetCode(err)) + t.Logf("Output: %v Error: %v\n", output, err) + }) + + t.Run("ReturnDataSize", func(t *testing.T) { + st := acmstate.NewMemoryState() + + accountName := "account2addresstests" + + ret := "My return message" + callcode := MustSplice(PUSH32, RightPadWord256([]byte(ret)), PUSH1, 0x00, MSTORE, PUSH1, len(ret), PUSH1, 0x00, RETURN) + + // Create accounts + account1 := newAccount(t, st, "1") + account2 := makeAccountWithCode(t, st, accountName, callcode) + + gas := big.NewInt(100000) + + gas1, gas2 := byte(0x1), byte(0x1) + value := byte(0x69) + inOff, inSize := byte(0x0), byte(0x0) // no call data + retOff, retSize := byte(0x0), byte(len(ret)) + + bytecode := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, inOff, PUSH1, value, + PUSH20, account2, PUSH2, gas1, gas2, CALL, + RETURNDATASIZE, PUSH1, 0x00, MSTORE, PUSH1, 0x20, PUSH1, 0x00, RETURN) + + expected := Uint64ToWord256(uint64(len(ret))).Bytes() + + output, err := call(vm, st, account1, account2, bytecode, nil, gas) + require.NoError(t, err) + assert.Equal(t, expected, output) + + t.Logf("Output: %v Error: %v\n", output, err) + + if err != nil { + t.Fatal(err) + } + }) + + t.Run("ReturnDataCopy", func(t *testing.T) { + st := acmstate.NewMemoryState() + + accountName := "account2addresstests" + + ret := "My return message" + callcode := MustSplice(PUSH32, RightPadWord256([]byte(ret)), PUSH1, 0x00, MSTORE, PUSH1, len(ret), PUSH1, 0x00, RETURN) + + // Create accounts + account1 := newAccount(t, st, "1") + account2 := makeAccountWithCode(t, st, accountName, callcode) + + gas := big.NewInt(100000) + + gas1, gas2 := byte(0x1), byte(0x1) + value := byte(0x69) + inOff, inSize := byte(0x0), byte(0x0) // no call data + retOff, retSize := byte(0x0), byte(len(ret)) + + bytecode := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, inOff, PUSH1, value, + PUSH20, account2, PUSH2, gas1, gas2, CALL, RETURNDATASIZE, PUSH1, 0x00, PUSH1, 0x00, RETURNDATACOPY, + RETURNDATASIZE, PUSH1, 0x00, RETURN) + + expected := []byte(ret) + + output, err := call(vm, st, account1, account2, bytecode, nil, gas) + require.NoError(t, err) + assert.Equal(t, expected, output) + + t.Logf("Output: %v Error: %v\n", output, err) + }) + + t.Run("CallNonExistent", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + account1 := newAccount(t, st, "1") + addToBalance(t, st, account1, 100000) + unknownAddress := engine.AddressFromName("nonexistent") + + params := engine.CallParams{ + Caller: account1, + Callee: unknownAddress, + Value: *big.NewInt(100), + Gas: big.NewInt(100000), + } + _, ex := vm.Execute(st, blockchain, eventSink, params, nil) + require.Equal(t, errors.Codes.NonExistentAccount, errors.GetCode(ex), + "Should not be able to call account before creating it (even before initialising)") + acc, err := st.GetAccount(unknownAddress) + require.NoError(t, err) + require.Nil(t, acc) + }) + + t.Run("GetBlockHash", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + // Create accounts + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + var gas = big.NewInt(100000) + + bytecode := MustSplice(PUSH1, 2, BLOCKHASH) + + params := engine.CallParams{ + Caller: account1, + Callee: account2, + Gas: gas, + } + // Non existing block + blockchain.BlockHeight = 1 + _, err := vm.Execute(st, blockchain, eventSink, params, bytecode) + require.Equal(t, errors.Codes.InvalidBlockNumber, errors.GetCode(err), + "attempt to get block hash of a non-existent block") + + // Excessive old block + blockchain.BlockHeight = 258 + bytecode = MustSplice(PUSH1, 1, BLOCKHASH) + + _, err = vm.Execute(st, blockchain, eventSink, params, bytecode) + require.Equal(t, errors.Codes.BlockNumberOutOfRange, errors.GetCode(err), + "attempt to get block hash of a block outside of allowed range") + + // Get block hash + blockchain.BlockHeight = 257 + bytecode = MustSplice(PUSH1, 2, BLOCKHASH, return1()) + + output, err := vm.Execute(st, blockchain, eventSink, params, bytecode) + assert.NoError(t, err) + assert.Equal(t, LeftPadWord256([]byte{2}), LeftPadWord256(output)) + + // Get block hash fail + blockchain.BlockHeight = 3 + bytecode = MustSplice(PUSH1, 4, BLOCKHASH, return1()) + + _, err = vm.Execute(st, blockchain, eventSink, params, bytecode) + require.Equal(t, errors.Codes.InvalidBlockNumber, errors.GetCode(err), + "attempt to get block hash failed") + }) + + t.Run("PushWord", func(t *testing.T) { + word := Int64ToWord256(int64(2133213213)) + assert.Equal(t, MustSplice(PUSH4, 0x7F, 0x26, 0x40, 0x1D), pushWord(word)) + word[0] = 1 + assert.Equal(t, MustSplice(PUSH32, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x7F, 0x26, 0x40, 0x1D), pushWord(word)) + assert.Equal(t, MustSplice(PUSH1, 0), pushWord(Word256{})) + assert.Equal(t, MustSplice(PUSH1, 1), pushWord(Int64ToWord256(1))) + }) + + // Kind of indirect test of Splice, but here to avoid import cycles + t.Run("Bytecode", func(t *testing.T) { + assert.Equal(t, + MustSplice(1, 2, 3, 4, 5, 6), + MustSplice(1, 2, 3, MustSplice(4, 5, 6))) + assert.Equal(t, + MustSplice(1, 2, 3, 4, 5, 6, 7, 8), + MustSplice(1, 2, 3, MustSplice(4, MustSplice(5), 6), 7, 8)) + assert.Equal(t, + MustSplice(PUSH1, 2), + MustSplice(byte(PUSH1), 0x02)) + assert.Equal(t, + []byte{}, + MustSplice(MustSplice(MustSplice()))) + + contractAccount := &acm.Account{Address: crypto.AddressFromWord256(Int64ToWord256(102))} + addr := contractAccount.Address + gas1, gas2 := byte(0x1), byte(0x1) + value := byte(0x69) + inOff, inSize := byte(0x0), byte(0x0) // no call data + retOff, retSize := byte(0x0), byte(0x20) + contractCodeBytecode := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, + inOff, PUSH1, value, PUSH20, addr, PUSH2, gas1, gas2, CALL, PUSH1, retSize, + PUSH1, retOff, RETURN) + contractCode := []byte{0x60, retSize, 0x60, retOff, 0x60, inSize, 0x60, inOff, 0x60, value, 0x73} + contractCode = append(contractCode, addr[:]...) + contractCode = append(contractCode, []byte{0x61, gas1, gas2, 0xf1, 0x60, 0x20, 0x60, 0x0, 0xf3}...) + assert.Equal(t, contractCode, contractCodeBytecode) + }) + + t.Run("Concat", func(t *testing.T) { + assert.Equal(t, + []byte{0x01, 0x02, 0x03, 0x04}, + Concat([]byte{0x01, 0x02}, []byte{0x03, 0x04})) + }) + + t.Run("Subslice", func(t *testing.T) { + const size = 10 + data := make([]byte, size) + for i := 0; i < size; i++ { + data[i] = byte(i) + } + for n := uint64(0); n < size; n++ { + data = data[:n] + for offset := uint64(0); offset < size; offset++ { + for length := uint64(0); length < size; length++ { + _, err := subslice(data, offset, length) + if offset < 0 || length < 0 || n < offset { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + } + } + } + + bs, err := subslice([]byte{1, 2, 3, 4, 5, 6, 7, 8}, 4, 32) + require.NoError(t, err) + assert.Equal(t, []byte{ + 5, 6, 7, 8, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }, bs) + }) + + t.Run("DataStackOverflow", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + account1 := newAccount(t, st, "1, 2, 3") + account2 := newAccount(t, st, "3, 2, 1") + + /* + pragma solidity ^0.5.4; + + contract SimpleStorage { + function get() public constant returns (address) { + return get(); + } + } + */ + + // This bytecode is compiled from Solidity contract above using remix.ethereum.org online compiler + code, err := hex.DecodeString("608060405234801561001057600080fd5b5060d18061001f6000396000f300608060405260043610" + + "603f576000357c0100000000000000000000000000000000000000000000000000000000900463ff" + + "ffffff1680636d4ce63c146044575b600080fd5b348015604f57600080fd5b5060566098565b6040" + + "51808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffff" + + "ffffffffffff16815260200191505060405180910390f35b600060a06098565b9050905600a16562" + + "7a7a72305820daacfba0c21afacb5b67f26bc8021de63eaa560db82f98357d4e513f3249cf350029") + require.NoError(t, err) + + // Run the contract initialisation code to obtain the contract code that would be mounted at account2 + params := engine.CallParams{ + Caller: account1, + Callee: account2, + Input: code, + Gas: big.NewInt(1000000), + } + vm := New(engine.Options{ + DataStackMaxDepth: 4, + }) + + code, err = vm.Execute(st, blockchain, eventSink, params, code) + require.NoError(t, err) + + // Input is the function hash of `get()` + params.Input, err = hex.DecodeString("6d4ce63c") + require.NoError(t, err) + + _, ex := vm.Execute(st, blockchain, eventSink, params, code) + require.Equal(t, errors.Codes.DataStackOverflow, errors.GetCode(ex), "Should be stack overflow") + }) + + t.Run("CallStackOverflow", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + txe := new(exec.TxExecution) + + account1 := newAccount(t, st, "1, 2, 3") + account2 := newAccount(t, st, "3, 2, 1") + + // Sender accepts lot of gaz but we run on a caped call stack node + /* + pragma solidity ^0.5.4; + + contract A { + function callMeBack() public { + return require(msg.sender.call(bytes4(keccak256("callMeBack()")),this)); + } + } + */ + + // This bytecode is compiled from Solidity contract above using remix.ethereum.org online compiler + code, err := hex.DecodeString("608060405234801561001057600080fd5b5061017a806100206000396000f3006080604052600436" + + "10610041576000357c01000000000000000000000000000000000000000000000000000000009004" + + "63ffffffff168063692c3b7c14610046575b600080fd5b34801561005257600080fd5b5061005b61" + + "005d565b005b3373ffffffffffffffffffffffffffffffffffffffff1660405180807f63616c6c4d" + + "654261636b28290000000000000000000000000000000000000000815250600c0190506040518091" + + "0390207c010000000000000000000000000000000000000000000000000000000090043060405182" + + "63ffffffff167c010000000000000000000000000000000000000000000000000000000002815260" + + "0401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffff" + + "ffffffffffffff1681526020019150506000604051808303816000875af192505050151561014c57" + + "600080fd5b5600a165627a7a723058209315a40abb8b23b7c2a340e938b01367b419a23818475a2e" + + "ee80d09da3f7ba780029") + require.NoError(t, err) + + params := engine.CallParams{ + Caller: account1, + Callee: account2, + Input: code, + Gas: big.NewInt(1000000), + } + options := engine.Options{ + CallStackMaxDepth: 2, + } + vm := New(options) + // Run the contract initialisation code to obtain the contract code that would be mounted at account2 + contractCode, err := vm.Execute(st, blockchain, eventSink, params, code) + require.NoError(t, err) + + err = engine.InitEVMCode(st, account1, contractCode) + require.NoError(t, err) + err = engine.InitEVMCode(st, account2, contractCode) + require.NoError(t, err) + + // keccak256 hash of 'callMeBack()' + params.Input, err = hex.DecodeString("692c3b7c") + require.NoError(t, err) + + _, err = vm.Execute(st, blockchain, txe, params, contractCode) + // The TxExecution must be an exception to get the callerror + txe.PushError(err) + require.Error(t, err) + callError := txe.CallError() + require.Error(t, callError) + require.Equal(t, errors.Codes.CallStackOverflow, errors.GetCode(callError)) + // Errors are post-order so first is deepest + require.True(t, len(callError.NestedErrors) > 0) + deepestErr := callError.NestedErrors[0] + require.Equal(t, errors.Codes.CallStackOverflow, errors.GetCode(deepestErr)) + assert.Equal(t, options.CallStackMaxDepth, deepestErr.StackDepth) + assert.Equal(t, account2, deepestErr.Callee) + assert.Equal(t, account1, deepestErr.Caller) + }) + + t.Run("ExtCodeHash", func(t *testing.T) { + st := acmstate.NewMemoryState() + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + gas := big.NewInt(100000) + + // The EXTCODEHASH of the account without code is c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 + // what is the keccack256 hash of empty data. + bytecode := MustSplice(PUSH20, account1, EXTCODEHASH, return1()) + output, err := call(vm, st, account1, account2, bytecode, nil, gas) + assert.NoError(t, err) + assert.Equal(t, hex.MustDecodeString("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"), output) + + // The EXTCODEHASH of a native account is hash of its name. + bytecode = MustSplice(PUSH1, 0x03, EXTCODEHASH, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + assert.NoError(t, err) + assert.Equal(t, crypto.Keccak256([]byte("ripemd160Func")), output) + + // EXTCODEHASH of non-existent account should be 0 + bytecode = MustSplice(PUSH1, 0xff, EXTCODEHASH, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + assert.NoError(t, err) + assert.Equal(t, Zero256[:], output) + + // EXTCODEHASH is the hash of an account code + acc := makeAccountWithCode(t, st, "trustedCode", MustSplice(BLOCKHASH, return1())) + bytecode = MustSplice(PUSH20, acc, EXTCODEHASH, return1()) + output, err = call(vm, st, account1, account2, bytecode, nil, gas) + assert.NoError(t, err) + assert.Equal(t, hex.MustDecodeString("010da270094b5199d3e54f89afe4c66cdd658dd8111a41998714227e14e171bd"), output) + }) + + // Tests logs and events. + t.Run("TestLogEvents", func(t *testing.T) { + expectedData := []byte{0x10} + expectedHeight := uint64(0) + expectedTopics := []Word256{ + Int64ToWord256(1), + Int64ToWord256(2), + Int64ToWord256(3), + Int64ToWord256(4)} + + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + // Create accounts + address1 := crypto.Address{1, 3, 5, 7, 9} + address2 := crypto.Address{2, 4, 6, 8, 10} + + err := engine.CreateAccount(st, address1) + require.NoError(t, err) + err = engine.CreateAccount(st, address2) + require.NoError(t, err) + + mstore8 := byte(MSTORE8) + push1 := byte(PUSH1) + log4 := byte(LOG4) + stop := byte(STOP) + + code := []byte{ + push1, 16, // data value + push1, 0, // memory slot + mstore8, + push1, 4, // topic 4 + push1, 3, // topic 3 + push1, 2, // topic 2 + push1, 1, // topic 1 + push1, 1, // size of data + push1, 0, // data starts at this offset + log4, + stop, + } + + txe := new(exec.TxExecution) + + params := engine.CallParams{ + Caller: address1, + Callee: address2, + Gas: big.NewInt(1000000), + } + _, err = vm.Execute(st, blockchain, txe, params, code) + require.NoError(t, err) + + for _, ev := range txe.Events { + if ev.Log != nil { + if !reflect.DeepEqual(ev.Log.Topics, expectedTopics) { + t.Errorf("Event topics are wrong. Got: %v. Expected: %v", ev.Log.Topics, expectedTopics) + } + if !bytes.Equal(ev.Log.Data, expectedData) { + t.Errorf("Event data is wrong. Got: %s. Expected: %s", ev.Log.Data, expectedData) + } + if ev.Header.Height != expectedHeight { + t.Errorf("Event block height is wrong. Got: %d. Expected: %d", ev.Header.Height, expectedHeight) + } + return + } + } + t.Fatalf("Did not see LogEvent") + }) + + t.Run("BigModExp", func(t *testing.T) { + st := acmstate.NewMemoryState() + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + // The solidity compiled contract. It calls bigmodexp with b,e,m inputs and compares the result with proof, where m is the mod, b the base, e the exp, and proof the expected result. + bytecode := solidity.DeployedBytecode_BigMod + + // The function "expmod" is an assertion. It takes the base, exponent, modulus, and the expected value and + // returns 1 if the values match. + spec, err := abi.ReadSpec(solidity.Abi_BigMod) + require.NoError(t, err) + + expModFunctionID := spec.Functions["expmod"].FunctionID + + n := int64(10) + for base := -n; base < n; base++ { + for exp := -n; exp < n; exp++ { + for mod := int64(1); mod < n; mod++ { + b := big.NewInt(base) + e := big.NewInt(exp) + m := big.NewInt(mod) + v := new(big.Int).Exp(b, e, m) + if v == nil { + continue + } + + input := MustSplice(expModFunctionID, // expmod function + BigIntToWord256(b), BigIntToWord256(e), BigIntToWord256(m), // base^exp % mod + BigIntToWord256(v)) // == expected + + gas := big.NewInt(10000000) + out, err := call(vm, st, account1, account2, bytecode, input, gas) + + require.NoError(t, err) + + require.Equal(t, One256, LeftPadWord256(out), "expected %d^%d mod %d == %d", + base, exp, mod, e) + } + } + } + }) + + t.Run("SDIV", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + tests := []struct { + name string + bytecode []byte + expected []byte + }{ + { + // (SDIV 7 3 ) + name: "sdiv0", + bytecode: MustSplice(PUSH1, 0x03, PUSH1, 0x07, SDIV, return1()), + expected: []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, + }, + { + // (SDIV 7 (- 0 3) ) + name: "sdiv1", + bytecode: MustSplice(PUSH1, 0x03, PUSH1, 0x00, SUB, PUSH1, 0x07, SDIV, return1()), + expected: []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}, + }, + { + // (SDIV (- 0 7) 3 ) + name: "sdiv2", + bytecode: MustSplice(PUSH1, 0x03, PUSH1, 0x07, PUSH1, 0x00, SUB, SDIV, return1()), + expected: []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}, + }, + { + // (SDIV (- 0 7) (- 0 3) ) + name: "sdiv3", + bytecode: MustSplice(PUSH1, 0x03, PUSH1, 0x00, SUB, PUSH1, 0x07, PUSH1, 0x00, SUB, SDIV, return1()), + expected: []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, + }, + } + for _, tt := range tests { + params := engine.CallParams{ + Caller: account1, + Callee: account2, + Gas: big.NewInt(1000000), + } + if output, err := vm.Execute(st, blockchain, eventSink, params, tt.bytecode); err != nil || !bytes.Equal(output, tt.expected) { + t.Errorf("Reported error in %v.", tt.name) + assert.NoError(t, err) + assert.Equal(t, tt.expected, output) + } + } + }) + + t.Run("SMOD", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + tests := []struct { + name string + bytecode []byte + expected []byte + }{ + { + // (SMOD 7 3) + name: "smod0", + bytecode: MustSplice(PUSH1, 0x03, PUSH1, 0x07, SMOD, return1()), + expected: []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, + }, + { + // (SMOD 7 (- 0 3)) + name: "smod1", + bytecode: MustSplice(PUSH1, 0x03, PUSH1, 0x00, SUB, PUSH1, 0x07, SMOD, return1()), + expected: []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, + }, + { + // (SMOD (- 0 7) 3) + name: "smod2", + bytecode: MustSplice(PUSH1, 0x03, PUSH1, 0x07, PUSH1, 0x00, SUB, SMOD, return1()), + expected: []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + }, + { + // (SMOD (- 0 7) (- 0 3)) + name: "smod3", + bytecode: MustSplice(PUSH1, 0x03, PUSH1, 0x00, SUB, PUSH1, 0x07, PUSH1, 0x00, SUB, SMOD, return1()), + expected: []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + }, + } + for _, tt := range tests { + params := engine.CallParams{ + Caller: account1, + Callee: account2, + Gas: big.NewInt(1000000), + } + if output, err := vm.Execute(st, blockchain, eventSink, params, tt.bytecode); err != nil || !bytes.Equal(output, tt.expected) { + t.Errorf("Reported error in %v.", tt.name) + assert.NoError(t, err) + assert.Equal(t, tt.expected, output) + } + } + }) + + t.Run("SIGNEXTEND and MSTORE8", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + tests := []struct { + name string + bytecode []byte + expected []byte + }{ + { + // 0x6A == 0b01101010 + name: "signextend0", + bytecode: MustSplice(PUSH3, 0x12, 0x2F, 0x6A, PUSH1, 0x00, SIGNEXTEND, return1()), + expected: []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A}, + }, + { + name: "signextend1", + bytecode: MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, SIGNEXTEND, return1()), + expected: []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + }, + { + name: "mstore8", + bytecode: MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + PUSH1, 0x01, MSTORE8, PUSH1, 0x01, MLOAD, return1()), + expected: []byte{0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + }, + } + for _, tt := range tests { + params := engine.CallParams{ + Caller: account1, + Callee: account2, + Gas: big.NewInt(1000000), + } + if output, err := vm.Execute(st, blockchain, eventSink, params, tt.bytecode); err != nil || !bytes.Equal(output, tt.expected) { + t.Errorf("Reported error in %v.", tt.name) + assert.NoError(t, err) + assert.Equal(t, tt.expected, output) + } + } + }) + + t.Run("JUMPDEST", func(t *testing.T) { + st := acmstate.NewMemoryState() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + account1 := newAccount(t, st, "1") + account2 := newAccount(t, st, "101") + + tests := []struct { + name string + bytecode []byte + expected_out []byte + expected_err *errors.Code + }{ + { + name: "Jump_InsidePushWithJumpDest", + bytecode: MustSplice(PUSH1, 0x04, PUSH1, 0x03, ADD, JUMP, + PUSH6, JUMPDEST, 0x60, 0x01, 0x60, 0x01, 0x55, return1()), + expected_err: errors.Codes.InvalidJumpDest, + }, + { + name: "Jumpi_InsidePushWithJumpDest", + bytecode: MustSplice(PUSH1, 0x01, PUSH1, 0x06, PUSH1, 0x03, ADD, JUMPI, + PUSH6, JUMPDEST, 0x60, 0x01, 0x60, 0x01, 0x55, return1()), + expected_err: errors.Codes.InvalidJumpDest, + }, + } + for _, tt := range tests { + params := engine.CallParams{ + Caller: account1, + Callee: account2, + Gas: big.NewInt(1000000), + } + if output, err := vm.Execute(st, blockchain, eventSink, params, tt.bytecode); errors.GetCode(err) != tt.expected_err { + t.Errorf("FAIL: %v.", tt.name) + assert.Equal(t, tt.expected_err, errors.GetCode(err)) + } else if tt.expected_err == errors.Codes.None && !bytes.Equal(output, tt.expected_out) { + t.Errorf("FAIL: %v.", tt.name) + assert.Equal(t, tt.expected_out, output) + } + } + }) +} + +// helpers + +func newAccount(t testing.TB, st acmstate.ReaderWriter, name string) crypto.Address { + address := engine.AddressFromName(name) + err := engine.CreateAccount(st, address) + require.NoError(t, err) + return address +} + +func makeAccountWithCode(t testing.TB, st acmstate.ReaderWriter, name string, code []byte) crypto.Address { + address := engine.AddressFromName(name) + err := engine.CreateAccount(st, address) + require.NoError(t, err) + err = engine.InitEVMCode(st, address, code) + require.NoError(t, err) + addToBalance(t, st, address, 9999999) + return address +} + +func addToBalance(t testing.TB, st acmstate.ReaderWriter, address crypto.Address, amount uint64) { + err := engine.UpdateAccount(st, address, func(account *acm.Account) error { + return account.AddToBalance(amount) + }) + require.NoError(t, err) +} + +func call(vm *EVM, st acmstate.ReaderWriter, origin, callee crypto.Address, code []byte, input []byte, + gas *big.Int) ([]byte, error) { + + evs := new(exec.Events) + out, err := vm.Execute(st, new(engine.TestBlockchain), evs, engine.CallParams{ + Caller: origin, + Callee: callee, + Input: input, + Gas: gas, + }, code) + + if err != nil { + return nil, &errors.CallError{ + CodedError: errors.AsException(err), + NestedErrors: evs.NestedCallErrors(), + } + } + return out, nil +} + +// These code segment helpers exercise the MSTORE MLOAD MSTORE cycle to test +// both of the memory operations. Each MSTORE is done on the memory boundary +// (at MSIZE) which Solidity uses to find guaranteed unallocated memory. + +// storeAtEnd expects the value to be stored to be on top of the stack, it then +// stores that value at the current memory boundary +func storeAtEnd() []byte { + // Pull in MSIZE (to carry forward to MLOAD), swap in value to store, store it at MSIZE + return MustSplice(MSIZE, SWAP1, DUP2, MSTORE) +} + +func returnAfterStore() []byte { + return MustSplice(PUSH1, 32, DUP2, RETURN) +} + +// Store the top element of the stack (which is a 32-byte word) in memory +// and return it. Useful for a simple return value. +func return1() []byte { + return MustSplice(PUSH1, 0, MSTORE, returnWord()) +} + +func returnWord() []byte { + // PUSH1 => return size, PUSH1 => return offset, RETURN + return MustSplice(PUSH1, 32, PUSH1, 0, RETURN) +} + +// Subscribes to an AccCall, runs the vm, returns the output any direct exception +// and then waits for any exceptions transmitted by Data in the AccCall +// event (in the case of no direct error from call we will block waiting for +// at least 1 AccCall event) +func runVM(st acmstate.ReaderWriter, caller, callee crypto.Address, code []byte, gas uint64) *exec.TxExecution { + gasBefore := new(big.Int).SetUint64(gas) + txe := new(exec.TxExecution) + vm := New(engine.Options{ + DebugOpcodes: true, + }) + bigGas := new(big.Int).SetUint64(gas) + params := engine.CallParams{ + Caller: caller, + Callee: callee, + Gas: bigGas, + } + output, err := vm.Execute(st, new(engine.TestBlockchain), txe, params, code) + txe.PushError(err) + for _, ev := range txe.ExceptionalCalls() { + txe.PushError(ev.Header.Exception) + } + txe.Return(output, gasBefore.Sub(gasBefore, bigGas).Uint64()) + return txe +} + +// this is code to call another contract (hardcoded as addr) +func callContractCode(addr crypto.Address) []byte { + gas1, gas2 := byte(0x1), byte(0x1) + value := byte(0x69) + inOff, inSize := byte(0x0), byte(0x0) // no call data + retOff, retSize := byte(0x0), byte(0x20) + // this is the code we want to run (send funds to an account and return) + return MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, + inOff, PUSH1, value, PUSH20, addr, PUSH2, gas1, gas2, CALL, PUSH1, retSize, + PUSH1, retOff, RETURN) +} + +// Produce bytecode for a PUSH, b_1, ..., b_N where the N is number of bytes +// contained in the unpadded word +func pushWord(word Word256) []byte { + leadingZeros := byte(0) + for leadingZeros < 32 { + if word[leadingZeros] == 0 { + leadingZeros++ + } else { + return MustSplice(byte(PUSH32)-leadingZeros, word[leadingZeros:]) + } + } + return MustSplice(PUSH1, 0) +} diff --git a/execution/evm/fake_app_state.go b/execution/evm/fake_app_state.go deleted file mode 100644 index e12558e67..000000000 --- a/execution/evm/fake_app_state.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package evm - -import ( - "fmt" - - "bytes" - - "github.com/hyperledger/burrow/acm" - "github.com/hyperledger/burrow/acm/acmstate" - . "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto" -) - -type FakeAppState struct { - accounts map[crypto.Address]*acm.Account - storage map[string][]byte - metadata map[acmstate.MetadataHash]string -} - -var _ acmstate.ReaderWriter = &FakeAppState{} - -func (fas *FakeAppState) GetAccount(addr crypto.Address) (*acm.Account, error) { - account := fas.accounts[addr] - return account, nil -} - -func (fas *FakeAppState) GetMetadata(metahash acmstate.MetadataHash) (string, error) { - return fas.metadata[metahash], nil -} - -func (fas *FakeAppState) SetMetadata(metahash acmstate.MetadataHash, metadata string) error { - fas.metadata[metahash] = metadata - return nil -} - -func (fas *FakeAppState) UpdateAccount(account *acm.Account) error { - fas.accounts[account.GetAddress()] = account - return nil -} - -func (fas *FakeAppState) RemoveAccount(address crypto.Address) error { - _, ok := fas.accounts[address] - if !ok { - panic(fmt.Sprintf("Invalid account addr: %s", address)) - } else { - // Remove account - delete(fas.accounts, address) - } - return nil -} - -func (fas *FakeAppState) GetStorage(addr crypto.Address, key Word256) ([]byte, error) { - _, ok := fas.accounts[addr] - if !ok { - panic(fmt.Sprintf("Invalid account addr: %s", addr)) - } - - value, ok := fas.storage[addr.String()+key.String()] - if ok { - return value, nil - } else { - return []byte{}, nil - } -} - -func (fas *FakeAppState) SetStorage(addr crypto.Address, key Word256, value []byte) error { - _, ok := fas.accounts[addr] - if !ok { - - fmt.Println("\n\n", fas.accountsDump()) - panic(fmt.Sprintf("Invalid account addr: %s", addr)) - } - - fas.storage[addr.String()+key.String()] = value - return nil -} - -func (fas *FakeAppState) accountsDump() string { - buf := new(bytes.Buffer) - fmt.Fprint(buf, "Dumping accounts...", "\n") - for _, acc := range fas.accounts { - fmt.Fprint(buf, acc.GetAddress().String(), "\n") - } - return buf.String() -} diff --git a/execution/evm/gas.go b/execution/evm/gas.go deleted file mode 100644 index dff920c15..000000000 --- a/execution/evm/gas.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package evm - -const ( - GasSha3 uint64 = 1 - GasGetAccount uint64 = 1 - GasStorageUpdate uint64 = 1 - GasCreateAccount uint64 = 1 - - GasBaseOp uint64 = 0 // TODO: make this 1 - GasStackOp uint64 = 1 - - GasEcRecover uint64 = 1 - GasSha256Word uint64 = 1 - GasSha256Base uint64 = 1 - GasRipemd160Word uint64 = 1 - GasRipemd160Base uint64 = 1 - GasIdentityWord uint64 = 1 - GasIdentityBase uint64 = 1 -) diff --git a/execution/evm/log_event_test.go b/execution/evm/log_event_test.go deleted file mode 100644 index e7d567012..000000000 --- a/execution/evm/log_event_test.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package evm - -import ( - "testing" - - "bytes" - "reflect" - - "github.com/hyperledger/burrow/acm" - . "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto" - . "github.com/hyperledger/burrow/execution/evm/asm" - "github.com/hyperledger/burrow/execution/exec" - "github.com/stretchr/testify/require" -) - -var expectedData = []byte{0x10} -var expectedHeight uint64 = 0 -var expectedTopics = []Word256{ - Int64ToWord256(1), - Int64ToWord256(2), - Int64ToWord256(3), - Int64ToWord256(4)} - -// Tests logs and events. -func TestLog4(t *testing.T) { - st := newAppState() - cache := NewState(st, blockHashGetter) - // Create accounts - account1 := &acm.Account{ - Address: crypto.Address{1, 3, 5, 7, 9}, - } - account2 := &acm.Account{ - Address: crypto.Address{2, 4, 6, 8, 10}, - } - st.accounts[account1.Address] = account1 - st.accounts[account2.Address] = account2 - - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - txe := new(exec.TxExecution) - - var gas uint64 = 100000 - - mstore8 := byte(MSTORE8) - push1 := byte(PUSH1) - log4 := byte(LOG4) - stop := byte(STOP) - - code := []byte{ - push1, 16, // data value - push1, 0, // memory slot - mstore8, - push1, 4, // topic 4 - push1, 3, // topic 3 - push1, 2, // topic 2 - push1, 1, // topic 1 - push1, 1, // size of data - push1, 0, // data starts at this offset - log4, - stop, - } - - _, err := ourVm.Call(cache, txe, account1.Address, account2.Address, code, []byte{}, 0, &gas) - require.NoError(t, err) - - for _, ev := range txe.Events { - if ev.Log != nil { - if !reflect.DeepEqual(ev.Log.Topics, expectedTopics) { - t.Errorf("Event topics are wrong. Got: %v. Expected: %v", ev.Log.Topics, expectedTopics) - } - if !bytes.Equal(ev.Log.Data, expectedData) { - t.Errorf("Event data is wrong. Got: %s. Expected: %s", ev.Log.Data, expectedData) - } - if ev.Header.Height != expectedHeight { - t.Errorf("Event block height is wrong. Got: %d. Expected: %d", ev.Header.Height, expectedHeight) - } - return - } - } - t.Fatalf("Did not see LogEvent") -} diff --git a/execution/evm/native.go b/execution/evm/native.go deleted file mode 100644 index 9c2382140..000000000 --- a/execution/evm/native.go +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package evm - -import ( - "crypto/sha256" - - . "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/logging" - "golang.org/x/crypto/ripemd160" -) - -var registeredNativeContracts = make(map[crypto.Address]NativeContract) - -func IsRegisteredNativeContract(address crypto.Address) bool { - _, ok := registeredNativeContracts[address] - return ok -} - -func RegisterNativeContract(address crypto.Address, fn NativeContract) bool { - _, exists := registeredNativeContracts[address] - if exists { - return false - } - registeredNativeContracts[address] = fn - return true -} - -func init() { - registerNativeContracts() - registerSNativeContracts() -} - -func registerNativeContracts() { - // registeredNativeContracts[Int64ToWord256(1)] = ecrecoverFunc - registeredNativeContracts[crypto.Address{2}] = sha256Func - registeredNativeContracts[crypto.Address{3}] = ripemd160Func - registeredNativeContracts[crypto.Address{4}] = identityFunc -} - -//----------------------------------------------------------------------------- - -func ExecuteNativeContract(address crypto.Address, st Interface, caller crypto.Address, input []byte, gas *uint64, - logger *logging.Logger) ([]byte, errors.CodedError) { - - contract, ok := registeredNativeContracts[address] - if !ok { - return nil, errors.ErrorCodef(errors.ErrorCodeNativeFunction, - "no native contract registered at address: %v", address) - } - output, err := contract(st, caller, input, gas, logger) - if err != nil { - return nil, errors.NewException(errors.ErrorCodeNativeFunction, err.Error()) - } - return output, nil -} - -type NativeContract func(state Interface, caller crypto.Address, input []byte, gas *uint64, - logger *logging.Logger) (output []byte, err error) - -/* Removed due to C dependency -func ecrecoverFunc(state State, caller crypto.Address, input []byte, gas *int64) (output []byte, err error) { - // Deduct gas - gasRequired := GasEcRecover - if *gas < gasRequired { - return nil, ErrInsufficientGas - } else { - *gas -= gasRequired - } - // Recover - hash := input[:32] - v := byte(input[32] - 27) // ignore input[33:64], v is small. - sig := append(input[64:], v) - - recovered, err := secp256k1.RecoverPubkey(hash, sig) - if err != nil { - return nil, err -OH NO STOCASTIC CAT CODING!!!! - } - hashed := sha3.Sha3(recovered[1:]) - return LeftPadBytes(hashed, 32), nil -} -*/ - -func sha256Func(state Interface, caller crypto.Address, input []byte, gas *uint64, - logger *logging.Logger) (output []byte, err error) { - // Deduct gas - gasRequired := uint64((len(input)+31)/32)*GasSha256Word + GasSha256Base - if *gas < gasRequired { - return nil, errors.ErrorCodeInsufficientGas - } else { - *gas -= gasRequired - } - // Hash - hasher := sha256.New() - // CONTRACT: this does not err - hasher.Write(input) - return hasher.Sum(nil), nil -} - -func ripemd160Func(state Interface, caller crypto.Address, input []byte, gas *uint64, - logger *logging.Logger) (output []byte, err error) { - // Deduct gas - gasRequired := uint64((len(input)+31)/32)*GasRipemd160Word + GasRipemd160Base - if *gas < gasRequired { - return nil, errors.ErrorCodeInsufficientGas - } else { - *gas -= gasRequired - } - // Hash - hasher := ripemd160.New() - // CONTRACT: this does not err - hasher.Write(input) - return LeftPadBytes(hasher.Sum(nil), 32), nil -} - -func identityFunc(state Interface, caller crypto.Address, input []byte, gas *uint64, - logger *logging.Logger) (output []byte, err error) { - // Deduct gas - gasRequired := uint64((len(input)+31)/32)*GasIdentityWord + GasIdentityBase - if *gas < gasRequired { - return nil, errors.ErrorCodeInsufficientGas - } else { - *gas -= gasRequired - } - // Return identity - return input, nil -} diff --git a/execution/evm/options.go b/execution/evm/options.go deleted file mode 100644 index 19f127b29..000000000 --- a/execution/evm/options.go +++ /dev/null @@ -1,25 +0,0 @@ -package evm - -import "github.com/hyperledger/burrow/execution/errors" - -func MemoryProvider(memoryProvider func(errors.Sink) Memory) func(*VM) { - return func(vm *VM) { - vm.memoryProvider = memoryProvider - } -} - -func DebugOpcodes(vm *VM) { - vm.debugOpcodes = true -} - -func DumpTokens(vm *VM) { - vm.dumpTokens = true -} - -func StackOptions(callStackMaxDepth uint64, dataStackInitialCapacity uint64, dataStackMaxDepth uint64) func(*VM) { - return func(vm *VM) { - vm.params.CallStackMaxDepth = callStackMaxDepth - vm.params.DataStackInitialCapacity = dataStackInitialCapacity - vm.params.DataStackMaxDepth = dataStackMaxDepth - } -} diff --git a/execution/evm/precompiles_test.go b/execution/evm/precompiles_test.go new file mode 100644 index 000000000..4175858a0 --- /dev/null +++ b/execution/evm/precompiles_test.go @@ -0,0 +1,73 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package evm + +import ( + "math/big" + "testing" + + "github.com/hyperledger/burrow/execution/evm/abi" + + "github.com/btcsuite/btcd/btcec" + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/execution/native" + "github.com/hyperledger/burrow/execution/solidity" + + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/exec" + "github.com/stretchr/testify/require" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/crypto" + + "github.com/hyperledger/burrow/execution/evm/asm/bc" + "github.com/stretchr/testify/assert" +) + +func TestECRecover(t *testing.T) { + message := []byte("THIS MESSAGE IS NOT SIGNED") + digest := crypto.Keccak256(message) + privateKey, err := btcec.NewPrivateKey(btcec.S256()) + require.NoError(t, err) + + sig, err := btcec.SignCompact(btcec.S256(), privateKey, digest, false) + require.NoError(t, err) + + st := native.NewState(native.MustDefaultNatives(), acmstate.NewMemoryState()) + caller := &acm.Account{ + Address: crypto.Address{1, 1, 1}, + } + function := native.Precompiles.GetByName("ecrecover").(*native.Function) + require.NotNil(t, function, "Could not get function: %s") + require.NoError(t, st.UpdateAccount(caller)) + + state := engine.State{ + CallFrame: engine.NewCallFrame(st), + EventSink: exec.NewNoopEventSink(), + } + + spec, err := abi.ReadSpec(solidity.Abi_ECRecover) + require.NoError(t, err) + funcId := spec.Functions["recoverSigningAddress"].FunctionID + input := bc.MustSplice(funcId, digest, binary.Int64ToWord256(int64(sig[2*binary.Word256Bytes])), sig[:2*binary.Word256Bytes]) + + params := engine.CallParams{ + Caller: caller.Address, + Input: input, + Gas: big.NewInt(10000), + } + + vm := New(engine.Options{ + Natives: native.MustDefaultNatives(), + }) + returnValue, err := vm.Contract(solidity.DeployedBytecode_ECRecover).Call(state, params) + require.NoError(t, err) + priv, err := crypto.PrivateKeyFromRawBytes(privateKey.Serialize(), crypto.CurveTypeSecp256k1) + require.NoError(t, err) + address := priv.GetPublicKey().GetAddress() + addressOut := crypto.AddressFromWord256(binary.LeftPadWord256(returnValue)) + require.NoError(t, err) + assert.Equal(t, address, addressOut) +} diff --git a/execution/evm/snative.go b/execution/evm/snative.go deleted file mode 100644 index 04bd9c8d6..000000000 --- a/execution/evm/snative.go +++ /dev/null @@ -1,495 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package evm - -import ( - "fmt" - "reflect" - - "strings" - - "github.com/hyperledger/burrow/acm" - "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" - "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/execution/evm/abi" - "github.com/hyperledger/burrow/logging" - "github.com/hyperledger/burrow/logging/structure" - "github.com/hyperledger/burrow/permission" -) - -// -// SNative (from 'secure natives') are native (go) contracts that are dispatched -// based on account permissions and can access and modify an account's permissions -// - -// Metadata for SNative contract. Acts as a call target from the EVM. Can be -// used to generate bindings in a smart contract languages. -type SNativeContractDescription struct { - // Comment describing purpose of SNative contract and reason for assembling - // the particular functions - Comment string - // Name of the SNative contract - Name string - functionsByID map[abi.FunctionID]*SNativeFunctionDescription - functions []*SNativeFunctionDescription -} - -// Metadata for SNative functions. Act as call targets for the EVM when -// collected into an SNativeContractDescription. Can be used to generate -// bindings in a smart contract languages. -type SNativeFunctionDescription struct { - // Comment describing function's purpose, parameters, and return value - Comment string - // Function name (used to form signature) - Name string - // Function arguments - Arguments reflect.Type - // Function return values - Returns reflect.Type - // The abi - Abi abi.FunctionSpec - // Permissions required to call function - PermFlag permission.PermFlag - // Native function to which calls will be dispatched when a containing - F func(stateWriter Interface, caller crypto.Address, gas *uint64, logger *logging.Logger, - v interface{}) (interface{}, error) -} - -func registerSNativeContracts() { - for _, contract := range SNativeContracts() { - if !RegisterNativeContract(contract.Address(), contract.Dispatch) { - panic(fmt.Errorf("could not register SNative contract %s because address %s already registered", - contract.Address(), contract.Name)) - } - } -} - -// Returns a map of all SNative contracts defined indexed by name -func SNativeContracts() map[string]*SNativeContractDescription { - contracts := []*SNativeContractDescription{ - NewSNativeContract(` - * Interface for managing Secure Native authorizations. - * @dev This interface describes the functions exposed by the SNative permissions layer in burrow. - `, - "Permissions", - &SNativeFunctionDescription{Comment: ` - * @notice Adds a role to an account - * @param Account account address - * @param Role role name - * @return result whether role was added - `, - Name: "addRole", - PermFlag: permission.AddRole, - Arguments: reflect.TypeOf(addRoleArgs{}), - Returns: reflect.TypeOf(addRoleRets{}), - F: addRole}, - - &SNativeFunctionDescription{Comment: ` - * @notice Removes a role from an account - * @param Account account address - * @param Role role name - * @return result whether role was removed - `, - Name: "removeRole", - PermFlag: permission.RemoveRole, - Arguments: reflect.TypeOf(removeRoleArgs{}), - Returns: reflect.TypeOf(removeRoleRets{}), - F: removeRole}, - - &SNativeFunctionDescription{Comment: ` - * @notice Indicates whether an account has a role - * @param Account account address - * @param Role role name - * @return result whether account has role - `, - Name: "hasRole", - PermFlag: permission.HasRole, - Arguments: reflect.TypeOf(hasRoleArgs{}), - Returns: reflect.TypeOf(hasRoleRets{}), - F: hasRole}, - - &SNativeFunctionDescription{Comment: ` - * @notice Sets the permission flags for an account. Makes them explicitly set (on or off). - * @param Account account address - * @param Permission the base permissions flags to set for the account - * @param Set whether to set or unset the permissions flags at the account level - * @return The permission flag that was set as uint64 - `, - Name: "setBase", - PermFlag: permission.SetBase, - Arguments: reflect.TypeOf(setBaseArgs{}), - Returns: reflect.TypeOf(setBaseRets{}), - F: setBase}, - - &SNativeFunctionDescription{Comment: ` - * @notice Unsets the permissions flags for an account. Causes permissions being unset to fall through to global permissions. - * @param Account account address - * @param Permission the permissions flags to unset for the account - * @return The permission flag that was unset as uint64 - `, - Name: "unsetBase", - PermFlag: permission.UnsetBase, - Arguments: reflect.TypeOf(unsetBaseArgs{}), - Returns: reflect.TypeOf(unsetBaseRets{}), - F: unsetBase}, - - &SNativeFunctionDescription{Comment: ` - * @notice Indicates whether an account has a subset of permissions set - * @param Account account address - * @param Permission the permissions flags (mask) to check whether enabled against base permissions for the account - * @return result whether account has the passed permissions flags set - `, - Name: "hasBase", - PermFlag: permission.HasBase, - Arguments: reflect.TypeOf(hasBaseArgs{}), - Returns: reflect.TypeOf(hasBaseRets{}), - F: hasBase}, - - &SNativeFunctionDescription{Comment: ` - * @notice Sets the global (default) permissions flags for the entire chain - * @param Permission the permissions flags to set - * @param Set whether to set (or unset) the permissions flags - * @return The permission flag that was set as uint64 - `, - Name: "setGlobal", - PermFlag: permission.SetGlobal, - Arguments: reflect.TypeOf(setGlobalArgs{}), - Returns: reflect.TypeOf(setGlobalRets{}), - F: setGlobal}, - ), - } - - contractMap := make(map[string]*SNativeContractDescription, len(contracts)) - for _, contract := range contracts { - if _, ok := contractMap[contract.Name]; ok { - // If this happens we have a pseudo compile time error that will be caught - // on native.go init() - panic(fmt.Errorf("duplicate contract with name %s defined. "+ - "Contract names must be unique", contract.Name)) - } - contractMap[contract.Name] = contract - } - return contractMap -} - -// Create a new SNative contract description object by passing a comment, name -// and a list of member functions descriptions -func NewSNativeContract(comment, name string, - functions ...*SNativeFunctionDescription) *SNativeContractDescription { - - functionsByID := make(map[abi.FunctionID]*SNativeFunctionDescription, len(functions)) - for _, f := range functions { - - f.Abi = *abi.SpecFromStructReflect(f.Name, f.Arguments, f.Returns) - fid := f.Abi.FunctionID - otherF, ok := functionsByID[fid] - if ok { - panic(fmt.Errorf("function with ID %x already defined: %s", fid, otherF.Signature())) - } - functionsByID[fid] = f - } - return &SNativeContractDescription{ - Comment: comment, - Name: name, - functionsByID: functionsByID, - functions: functions, - } -} - -// This function is designed to be called from the EVM once a SNative contract -// has been selected. It is also placed in a registry by registerSNativeContracts -// So it can be looked up by SNative address -func (contract *SNativeContractDescription) Dispatch(st Interface, caller crypto.Address, - args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { - - logger = logger.With(structure.ScopeKey, "Dispatch", "contract_name", contract.Name) - - if len(args) < abi.FunctionIDSize { - return nil, errors.ErrorCodef(errors.ErrorCodeNativeFunction, - "SNatives dispatch requires a 4-byte function identifier but arguments are only %v bytes long", - len(args)) - } - - var id abi.FunctionID - copy(id[:], args) - function, err := contract.FunctionByID(id) - if err != nil { - return nil, err - } - - logger.TraceMsg("Dispatching to function", - "caller", caller, - "function_name", function.Name) - - remainingArgs := args[abi.FunctionIDSize:] - - // check if we have permission to call this function - if !HasPermission(st, caller, function.PermFlag) { - return nil, errors.LacksSNativePermission{Address: caller, SNative: function.Name} - } - - nativeArgs := reflect.New(function.Arguments).Interface() - err = abi.Unpack(function.Abi.Inputs, remainingArgs, nativeArgs) - if err != nil { - return nil, err - } - - nativeRets, err := function.F(st, caller, gas, logger, nativeArgs) - if err != nil { - return nil, err - } - err = st.Error() - if err != nil { - return nil, fmt.Errorf("state error in %v: %v", function, err) - } - - return abi.Pack(function.Abi.Outputs, nativeRets) -} - -// We define the address of an SNative contact as the last 20 bytes of the sha3 -// hash of its name -func (contract *SNativeContractDescription) Address() (address crypto.Address) { - hash := sha3.Sha3([]byte(contract.Name)) - copy(address[:], hash[len(hash)-crypto.AddressLength:]) - return -} - -// Get function by calling identifier FunctionSelector -func (contract *SNativeContractDescription) FunctionByID(id abi.FunctionID) (*SNativeFunctionDescription, errors.CodedError) { - f, ok := contract.functionsByID[id] - if !ok { - return nil, - errors.ErrorCodef(errors.ErrorCodeNativeFunction, "unknown SNative function with ID %x", id) - } - return f, nil -} - -// Get function by name -func (contract *SNativeContractDescription) FunctionByName(name string) (*SNativeFunctionDescription, error) { - for _, f := range contract.functions { - if f.Name == name { - return f, nil - } - } - return nil, fmt.Errorf("unknown SNative function with name %s", name) -} - -// Get functions in order of declaration -func (contract *SNativeContractDescription) Functions() []*SNativeFunctionDescription { - functions := make([]*SNativeFunctionDescription, len(contract.functions)) - copy(functions, contract.functions) - return functions -} - -// -// SNative functions -// - -// Get function signature -func (function *SNativeFunctionDescription) Signature() string { - argTypeNames := make([]string, len(function.Abi.Inputs)) - for i, arg := range function.Abi.Inputs { - argTypeNames[i] = arg.EVM.GetSignature() - } - return fmt.Sprintf("%s(%s)", function.Name, - strings.Join(argTypeNames, ",")) -} - -// Get number of function arguments -func (function *SNativeFunctionDescription) NArgs() int { - return len(function.Abi.Inputs) -} - -func (fn *SNativeFunctionDescription) String() string { - return fmt.Sprintf("SNativeFunction{Name: %s; Inputs: %d; Outputs: %d}", - fn.Name, len(fn.Abi.Inputs), len(fn.Abi.Outputs)) -} - -// Permission function defintions - -// TODO: catch errors, log em, return 0s to the vm (should some errors cause exceptions though?) -type hasBaseArgs struct { - Account crypto.Address - Permission uint64 -} - -type hasBaseRets struct { - Result bool -} - -func hasBase(state Interface, caller crypto.Address, gas *uint64, logger *logging.Logger, - a interface{}) (interface{}, error) { - args := a.(*hasBaseArgs) - - if !state.Exists(args.Account) { - return false, fmt.Errorf("unknown account %s", args.Account) - } - permN := permission.PermFlag(args.Permission) // already shifted - if !permN.IsValid() { - return false, permission.ErrInvalidPermission(permN) - } - hasPermission := HasPermission(state, args.Account, permN) - logger.Trace.Log("function", "hasBase", - "address", args.Account.String(), - "perm_flag", fmt.Sprintf("%b", permN), - "has_permission", hasPermission) - return hasBaseRets{Result: hasPermission}, nil -} - -type setBaseArgs struct { - Account crypto.Address - Permission uint64 - Set bool -} - -type setBaseRets struct { - Result uint64 -} - -func setBase(stateWriter Interface, caller crypto.Address, gas *uint64, - logger *logging.Logger, a interface{}) (interface{}, error) { - args := a.(*setBaseArgs) - - exists := stateWriter.Exists(args.Account) - if !exists { - return false, fmt.Errorf("unknown account %s", args.Account) - } - permN := permission.PermFlag(args.Permission) - if !permN.IsValid() { - return 0, permission.ErrInvalidPermission(permN) - } - stateWriter.SetPermission(args.Account, permN, args.Set) - logger.Trace.Log("function", "setBase", "address", args.Account.String(), - "permission_flag", fmt.Sprintf("%b", permN), - "permission_value", args.Permission) - return setBaseRets{Result: uint64(permN)}, nil -} - -type unsetBaseArgs struct { - Account crypto.Address - Permission uint64 -} - -type unsetBaseRets struct { - Result uint64 -} - -func unsetBase(stateWriter Interface, caller crypto.Address, gas *uint64, logger *logging.Logger, - a interface{}) (r interface{}, err error) { - args := a.(*unsetBaseArgs) - - if !stateWriter.Exists(args.Account) { - return false, fmt.Errorf("unknown account %s", args.Account) - } - permN := permission.PermFlag(args.Permission) - if !permN.IsValid() { - return 0, permission.ErrInvalidPermission(permN) - } - stateWriter.UnsetPermission(args.Account, permN) - logger.Trace.Log("function", "unsetBase", "address", args.Account.String(), - "perm_flag", fmt.Sprintf("%b", permN), - "permission_flag", fmt.Sprintf("%b", permN)) - - return unsetBaseRets{Result: uint64(permN)}, nil -} - -type setGlobalArgs struct { - Permission uint64 - Set bool -} - -type setGlobalRets struct { - Result uint64 -} - -func setGlobal(stateWriter Interface, caller crypto.Address, gas *uint64, - logger *logging.Logger, a interface{}) (interface{}, error) { - - args := a.(*setGlobalArgs) - - permN := permission.PermFlag(args.Permission) - if !permN.IsValid() { - return 0, permission.ErrInvalidPermission(permN) - } - stateWriter.SetPermission(acm.GlobalPermissionsAddress, permN, args.Set) - logger.Trace.Log("function", "setGlobal", - "permission_flag", fmt.Sprintf("%b", permN), - "permission_value", args.Set) - return setGlobalRets{Result: uint64(permN)}, nil -} - -type hasRoleArgs struct { - Account crypto.Address - Role string -} - -type hasRoleRets struct { - Result bool -} - -func hasRole(st Interface, caller crypto.Address, gas *uint64, - logger *logging.Logger, a interface{}) (interface{}, error) { - - args := a.(*hasRoleArgs) - perms := st.GetPermissions(args.Account) - if err := st.Error(); err != nil { - return false, fmt.Errorf("hasRole could not get permissions: %v", err) - } - hasRole := perms.HasRole(args.Role) - logger.Trace.Log("function", "hasRole", "address", args.Account.String(), - "role", args.Role, - "has_role", hasRole) - return hasRoleRets{Result: hasRole}, nil -} - -type addRoleArgs struct { - Account crypto.Address - Role string -} - -type addRoleRets struct { - Result bool -} - -func addRole(stateWriter Interface, caller crypto.Address, gas *uint64, logger *logging.Logger, - v interface{}) (interface{}, error) { - args := v.(*addRoleArgs) - roleAdded := stateWriter.AddRole(args.Account, args.Role) - logger.Trace.Log("function", "addRole", "address", args.Account.String(), - "role", args.Role, - "role_added", roleAdded) - return addRoleRets{Result: roleAdded}, nil -} - -type removeRoleArgs struct { - Account crypto.Address - Role string -} - -type removeRoleRets struct { - Result bool -} - -func removeRole(stateWriter Interface, caller crypto.Address, gas *uint64, logger *logging.Logger, - a interface{}) (interface{}, error) { - args := a.(*removeRoleArgs) - - roleRemoved := stateWriter.RemoveRole(args.Account, args.Role) - logger.Trace.Log("function", "removeRole", "address", args.Account.String(), - "role", args.Role, - "role_removed", roleRemoved) - return removeRoleRets{Result: roleRemoved}, nil -} diff --git a/execution/evm/snative_test.go b/execution/evm/snative_test.go deleted file mode 100644 index afcb317f0..000000000 --- a/execution/evm/snative_test.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package evm - -import ( - "encoding/hex" - "testing" - - "github.com/stretchr/testify/require" - - "strings" - - "github.com/hyperledger/burrow/acm" - . "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" - "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/execution/evm/abi" - "github.com/hyperledger/burrow/execution/evm/asm/bc" - "github.com/hyperledger/burrow/permission" - "github.com/stretchr/testify/assert" -) - -// Compiling the Permissions solidity contract at -// (generated by with 'make snatives' function) and passing to -// https://ethereum.github.io/browser-solidity (toggle details to get list) -// yields: -// Keep this updated to drive TestPermissionsContractSignatures -const compiledSigs = ` -7d72aa65 addRole(address,string) -1bfe0308 removeRole(address,string) -217fe6c6 hasRole(address,string) -dbd4a8ea setBase(address,uint64,bool) -b7d4dc0d unsetBase(address,uint64) -225b6574 hasBase(address,uint64) -c4bc7b70 setGlobal(uint64,bool) -` - -func TestPermissionsContractSignatures(t *testing.T) { - contract := SNativeContracts()["Permissions"] - - nFuncs := len(contract.functions) - - sigMap := idToSignatureMap() - - assert.Len(t, sigMap, nFuncs, - "Permissions contract defines %s functions so we need %s "+ - "signatures in compiledSigs", - nFuncs, nFuncs) - - for funcID, signature := range sigMap { - assertFunctionIDSignature(t, contract, funcID, signature) - } -} - -func TestSNativeContractDescription_Dispatch(t *testing.T) { - contract := SNativeContracts()["Permissions"] - st := newAppState() - caller := &acm.Account{ - Address: crypto.Address{1, 1, 1}, - } - grantee := &acm.Account{ - Address: crypto.Address{2, 2, 2}, - } - require.NoError(t, st.UpdateAccount(caller)) - require.NoError(t, st.UpdateAccount(grantee)) - cache := NewState(st, blockHashGetter) - - function, err := contract.FunctionByName("addRole") - if err != nil { - t.Fatalf("Could not get function: %s", err) - } - funcID := function.Abi.FunctionID - gas := uint64(1000) - - // Should fail since we have no permissions - _, err = contract.Dispatch(cache, caller.Address, bc.MustSplice(funcID[:], grantee.Address, - permFlagToWord256(permission.CreateAccount)), &gas, logger) - if !assert.Error(t, err, "Should fail due to lack of permissions") { - return - } - assert.IsType(t, err, errors.LacksSNativePermission{}) - - // Grant all permissions and dispatch should success - cache.SetPermission(caller.Address, permission.AddRole, true) - require.NoError(t, cache.Error()) - retValue, err := contract.Dispatch(cache, caller.Address, bc.MustSplice(funcID[:], - grantee.Address.Word256(), permFlagToWord256(permission.CreateAccount)), &gas, logger) - require.NoError(t, err) - assert.Equal(t, retValue, LeftPadBytes([]byte{1}, 32)) -} - -func TestSNativeContractDescription_Address(t *testing.T) { - contract := NewSNativeContract("A comment", - "CoolButVeryLongNamedContractOfDoom") - assert.Equal(t, sha3.Sha3(([]byte)(contract.Name))[12:], contract.Address().Bytes()) -} - -// -// Helpers -// -func assertFunctionIDSignature(t *testing.T, contract *SNativeContractDescription, - funcIDHex string, expectedSignature string) { - fromHex := funcIDFromHex(t, funcIDHex) - function, err := contract.FunctionByID(fromHex) - assert.NoError(t, err, - "Error retrieving SNativeFunctionDescription with ID %s", funcIDHex) - if err == nil { - assert.Equal(t, expectedSignature, function.Signature()) - } -} - -func funcIDFromHex(t *testing.T, hexString string) (funcID abi.FunctionID) { - bs, err := hex.DecodeString(hexString) - assert.NoError(t, err, "Could not decode hex string '%s'", hexString) - if len(bs) != 4 { - t.Fatalf("FunctionSelector must be 4 bytes but '%s' is %v bytes", hexString, - len(bs)) - } - copy(funcID[:], bs) - return -} - -func permFlagToWord256(permFlag permission.PermFlag) Word256 { - return Uint64ToWord256(uint64(permFlag)) -} - -// turns the solidity compiler function summary into a map to drive signature -// test -func idToSignatureMap() map[string]string { - sigMap := make(map[string]string) - lines := strings.Split(compiledSigs, "\n") - for _, line := range lines { - trimmed := strings.Trim(line, " \t") - if trimmed != "" { - idSig := strings.Split(trimmed, " ") - sigMap[idSig[0]] = idSig[1] - } - } - return sigMap -} diff --git a/execution/evm/stack.go b/execution/evm/stack.go index 188043b84..a8e29ff35 100644 --- a/execution/evm/stack.go +++ b/execution/evm/stack.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package evm @@ -19,6 +8,8 @@ import ( "math" "math/big" + "github.com/hyperledger/burrow/execution/engine" + . "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/errors" @@ -30,11 +21,11 @@ type Stack struct { maxCapacity uint64 ptr int - gas *uint64 + gas *big.Int errSink errors.Sink } -func NewStack(initialCapacity uint64, maxCapacity uint64, gas *uint64, errSink errors.Sink) *Stack { +func NewStack(errSink errors.Sink, initialCapacity uint64, maxCapacity uint64, gas *big.Int) *Stack { return &Stack{ slice: make([]Word256, initialCapacity), ptr: 0, @@ -44,29 +35,27 @@ func NewStack(initialCapacity uint64, maxCapacity uint64, gas *uint64, errSink e } } -func (st *Stack) useGas(gasToUse uint64) { - if *st.gas > gasToUse { - *st.gas -= gasToUse - } else { - st.pushErr(errors.ErrorCodeInsufficientGas) - } -} - -func (st *Stack) pushErr(err errors.CodedError) { - st.errSink.PushError(err) -} - func (st *Stack) Push(d Word256) { - st.useGas(GasStackOp) + st.useGas(engine.GasStackOp) err := st.ensureCapacity(uint64(st.ptr) + 1) if err != nil { - st.pushErr(errors.ErrorCodeDataStackOverflow) + st.pushErr(errors.Codes.DataStackOverflow) return } st.slice[st.ptr] = d st.ptr++ } +func (st *Stack) Pop() Word256 { + st.useGas(engine.GasStackOp) + if st.ptr == 0 { + st.pushErr(errors.Codes.DataStackUnderflow) + return Zero256 + } + st.ptr-- + return st.slice[st.ptr] +} + // currently only called after sha3.Sha3 func (st *Stack) PushBytes(bz []byte) { if len(bz) != 32 { @@ -79,12 +68,17 @@ func (st *Stack) PushAddress(address crypto.Address) { st.Push(address.Word256()) } -func (st *Stack) Push64(i int64) { - st.Push(Int64ToWord256(i)) +func (st *Stack) Push64(i uint64) { + st.Push(Uint64ToWord256(i)) } -func (st *Stack) PushU64(i uint64) { - st.Push(Uint64ToWord256(i)) +func (st *Stack) Pop64() uint64 { + d := st.Pop() + if Is64BitOverflow(d) { + st.pushErr(errors.Errorf(errors.Codes.IntegerOverflow, "uint64 overflow from word: %v", d)) + return 0 + } + return Uint64FromWord256(d) } // Pushes the bigInt as a Word256 encoding negative values in 32-byte twos complement and returns the encoded result @@ -94,16 +88,13 @@ func (st *Stack) PushBigInt(bigInt *big.Int) Word256 { return word } -// Pops +func (st *Stack) PopBigIntSigned() *big.Int { + return S256(st.PopBigInt()) +} -func (st *Stack) Pop() Word256 { - st.useGas(GasStackOp) - if st.ptr == 0 { - st.pushErr(errors.ErrorCodeDataStackUnderflow) - return Zero256 - } - st.ptr-- - return st.slice[st.ptr] +func (st *Stack) PopBigInt() *big.Int { + d := st.Pop() + return new(big.Int).SetBytes(d[:]) } func (st *Stack) PopBytes() []byte { @@ -114,50 +105,23 @@ func (st *Stack) PopAddress() crypto.Address { return crypto.AddressFromWord256(st.Pop()) } -func (st *Stack) Pop64() int64 { - d := st.Pop() - if Is64BitOverflow(d) { - st.pushErr(errors.ErrorCodef(errors.ErrorCodeIntegerOverflow, "int64 overflow from word: %v", d)) - return 0 - } - return Int64FromWord256(d) -} - -func (st *Stack) PopU64() uint64 { - d := st.Pop() - if Is64BitOverflow(d) { - st.pushErr(errors.ErrorCodef(errors.ErrorCodeIntegerOverflow, "uint64 overflow from word: %v", d)) - return 0 - } - return Uint64FromWord256(d) -} - -func (st *Stack) PopBigIntSigned() *big.Int { - return S256(st.PopBigInt()) -} - -func (st *Stack) PopBigInt() *big.Int { - d := st.Pop() - return new(big.Int).SetBytes(d[:]) -} - func (st *Stack) Len() int { return st.ptr } func (st *Stack) Swap(n int) { - st.useGas(GasStackOp) + st.useGas(engine.GasStackOp) if st.ptr < n { - st.pushErr(errors.ErrorCodeDataStackUnderflow) + st.pushErr(errors.Codes.DataStackUnderflow) return } st.slice[st.ptr-n], st.slice[st.ptr-1] = st.slice[st.ptr-1], st.slice[st.ptr-n] } func (st *Stack) Dup(n int) { - st.useGas(GasStackOp) + st.useGas(engine.GasStackOp) if st.ptr < n { - st.pushErr(errors.ErrorCodeDataStackUnderflow) + st.pushErr(errors.Codes.DataStackUnderflow) return } st.Push(st.slice[st.ptr-n]) @@ -166,7 +130,7 @@ func (st *Stack) Dup(n int) { // Not an opcode, costs no gas. func (st *Stack) Peek() Word256 { if st.ptr == 0 { - st.pushErr(errors.ErrorCodeDataStackUnderflow) + st.pushErr(errors.Codes.DataStackUnderflow) return Zero256 } return st.slice[st.ptr-1] @@ -232,3 +196,11 @@ func (st *Stack) ensureCapacity(newCapacity uint64) error { st.slice = st.slice[:newCapacity] return nil } + +func (st *Stack) useGas(gasToUse uint64) { + st.pushErr(engine.UseGasNegative(st.gas, gasToUse)) +} + +func (st *Stack) pushErr(err errors.CodedError) { + st.errSink.PushError(err) +} diff --git a/execution/evm/stack_test.go b/execution/evm/stack_test.go index cc91ef30e..abd673758 100644 --- a/execution/evm/stack_test.go +++ b/execution/evm/stack_test.go @@ -2,18 +2,19 @@ package evm import ( "math" + "math/big" "testing" - "github.com/stretchr/testify/require" - "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/execution/errors" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) +var maxUint64 = big.NewInt(math.MaxInt64) + func TestStack_MaxDepthInt32(t *testing.T) { - var gaz uint64 = math.MaxUint64 - st := NewStack(0, 0, &gaz, errors.FirstOnly()) + st := NewStack(new(errors.Maybe), 0, 0, maxUint64) err := st.ensureCapacity(math.MaxInt32 + 1) assert.Error(t, err) @@ -21,9 +22,8 @@ func TestStack_MaxDepthInt32(t *testing.T) { // Test static memory allocation with unlimited depth - memory should grow func TestStack_UnlimitedAllocation(t *testing.T) { - err := errors.FirstOnly() - var gaz uint64 = math.MaxUint64 - st := NewStack(0, 0, &gaz, err) + err := new(errors.Maybe) + st := NewStack(err, 0, 0, maxUint64) st.Push64(math.MaxInt64) require.NoError(t, err.Error()) @@ -33,9 +33,9 @@ func TestStack_UnlimitedAllocation(t *testing.T) { // Test static memory allocation with maximum == initial capacity - memory should not grow func TestStack_StaticAllocation(t *testing.T) { - err := errors.FirstOnly() - var gaz uint64 = math.MaxUint64 - st := NewStack(4, 4, &gaz, err) + err := new(errors.Maybe) + + st := NewStack(err, 4, 4, maxUint64) for i := 0; i < 4; i++ { st.Push64(math.MaxInt64) @@ -47,9 +47,9 @@ func TestStack_StaticAllocation(t *testing.T) { // Test writing beyond the current capacity - memory should grow func TestDynamicMemory_PushAhead(t *testing.T) { - err := errors.FirstOnly() - var gaz uint64 = math.MaxUint64 - st := NewStack(2, 4, &gaz, err) + err := new(errors.Maybe) + + st := NewStack(err, 2, 4, maxUint64) for i := 0; i < 4; i++ { st.Push64(math.MaxInt64) @@ -57,21 +57,21 @@ func TestDynamicMemory_PushAhead(t *testing.T) { } st.Push64(math.MaxInt64) - assert.Equal(t, errors.ErrorCodeDataStackOverflow, err.Error().ErrorCode()) + assert.Equal(t, errors.Codes.DataStackOverflow, errors.GetCode(err.Error())) } func TestStack_ZeroInitialCapacity(t *testing.T) { - err := errors.FirstOnly() - var gaz uint64 = math.MaxUint64 - st := NewStack(0, 16, &gaz, err) + err := new(errors.Maybe) + + st := NewStack(err, 0, 16, maxUint64) require.NoError(t, err.Error()) st.Push64(math.MaxInt64) assert.Equal(t, []binary.Word256{binary.Int64ToWord256(math.MaxInt64)}, st.slice) } func TestStack_ensureCapacity(t *testing.T) { - var gaz uint64 = math.MaxUint64 - st := NewStack(4, 16, &gaz, errors.FirstOnly()) + + st := NewStack(new(errors.Maybe), 4, 16, maxUint64) // Check we can grow within bounds err := st.ensureCapacity(8) assert.NoError(t, err) diff --git a/execution/evm/state.go b/execution/evm/state.go deleted file mode 100644 index d9db08f68..000000000 --- a/execution/evm/state.go +++ /dev/null @@ -1,430 +0,0 @@ -package evm - -import ( - "bytes" - "fmt" - - "github.com/hyperledger/burrow/acm" - "github.com/hyperledger/burrow/acm/acmstate" - "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" - "github.com/hyperledger/burrow/deploy/compile" - "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/permission" -) - -type Interface interface { - Reader - Writer - // Capture any errors when accessing or writing state - will return nil if no errors have occurred so far - errors.Provider - errors.Sink - // Create a new cached state over this one inheriting any cache options - NewCache(cacheOptions ...acmstate.CacheOption) Interface - // Sync this state cache to into its originator - Sync() errors.CodedError -} - -type Reader interface { - GetStorage(address crypto.Address, key binary.Word256) []byte - GetBalance(address crypto.Address) uint64 - GetPermissions(address crypto.Address) permission.AccountPermissions - GetEVMCode(address crypto.Address) acm.Bytecode - GetWASMCode(address crypto.Address) acm.Bytecode - GetCodeHash(address crypto.Address) []byte - GetForebear(address crypto.Address) crypto.Address - GetSequence(address crypto.Address) uint64 - Exists(address crypto.Address) bool - // GetBlockHash returns hash of the specific block - GetBlockHash(blockNumber uint64) (binary.Word256, error) -} - -type Writer interface { - CreateAccount(address crypto.Address) - InitWASMCode(address crypto.Address, code []byte) - InitCode(address crypto.Address, code []byte) - InitChildCode(address crypto.Address, forebear crypto.Address, code []byte) - RemoveAccount(address crypto.Address) - SetStorage(address crypto.Address, key binary.Word256, value []byte) - AddToBalance(address crypto.Address, amount uint64) - SubtractFromBalance(address crypto.Address, amount uint64) - SetPermission(address crypto.Address, permFlag permission.PermFlag, value bool) - UnsetPermission(address crypto.Address, permFlag permission.PermFlag) - AddRole(address crypto.Address, role string) bool - RemoveRole(address crypto.Address, role string) bool -} - -type State struct { - // Where we sync - backend acmstate.ReaderWriter - // Block chain info - blockHashGetter func(height uint64) []byte - // Cache this State wraps - cache *acmstate.Cache - // Any error that may have occurred - error errors.CodedError - // In order for nested cache to inherit any options - cacheOptions []acmstate.CacheOption -} - -func NewState(st acmstate.ReaderWriter, blockHashGetter func(height uint64) []byte, cacheOptions ...acmstate.CacheOption) *State { - return &State{ - backend: st, - blockHashGetter: blockHashGetter, - cache: acmstate.NewCache(st, cacheOptions...), - cacheOptions: cacheOptions, - } -} - -func (st *State) NewCache(cacheOptions ...acmstate.CacheOption) Interface { - return NewState(st.cache, st.blockHashGetter, append(st.cacheOptions, cacheOptions...)...) -} - -func (st *State) Sync() errors.CodedError { - // Do not sync if we have erred - if st.error != nil { - return st.error - } - err := st.cache.Sync(st.backend) - if err != nil { - return errors.AsException(err) - } - return nil -} - -func (st *State) Error() errors.CodedError { - if st.error == nil { - return nil - } - return st.error -} - -// Errors pushed to state may end up in TxExecutions and therefore the merkle state so it is essential that errors are -// deterministic and independent of the code path taken to execution (e.g. replay takes a different path to that of -// normal consensus reactor so stack traces may differ - as they may across architectures) -func (st *State) PushError(err error) { - if st.error == nil { - // Make sure we are not wrapping a known nil value - ex := errors.AsException(err) - if ex != nil { - st.error = ex - } - } -} - -// Reader - -func (st *State) GetStorage(address crypto.Address, key binary.Word256) []byte { - value, err := st.cache.GetStorage(address, key) - if err != nil { - st.PushError(err) - return []byte{} - } - return value -} - -func (st *State) GetBalance(address crypto.Address) uint64 { - acc := st.account(address) - if acc == nil { - return 0 - } - return acc.Balance -} - -func (st *State) GetPermissions(address crypto.Address) permission.AccountPermissions { - acc := st.account(address) - if acc == nil { - return permission.AccountPermissions{} - } - return acc.Permissions -} - -func (st *State) GetEVMCode(address crypto.Address) acm.Bytecode { - acc := st.account(address) - if acc == nil { - return nil - } - return acc.EVMCode -} - -func (st *State) GetWASMCode(address crypto.Address) acm.Bytecode { - acc := st.account(address) - if acc == nil { - return nil - } - - return acc.WASMCode -} - -func (st *State) GetCodeHash(address crypto.Address) []byte { - acc := st.account(address) - if acc == nil || len(acc.CodeHash) == 0 { - return nil - } - return acc.CodeHash -} - -func (st *State) Exists(address crypto.Address) bool { - acc, err := st.cache.GetAccount(address) - if err != nil { - st.PushError(err) - return false - } - if acc == nil { - return false - } - return true -} - -func (st *State) GetSequence(address crypto.Address) uint64 { - acc := st.account(address) - if acc == nil { - return 0 - } - return acc.Sequence -} - -func (st *State) GetForebear(address crypto.Address) crypto.Address { - acc := st.account(address) - if acc == nil && acc.Forebear != nil { - return *acc.Forebear - } - return address -} - -// Writer - -func (st *State) CreateAccount(address crypto.Address) { - if st.Exists(address) { - st.PushError(errors.ErrorCodef(errors.ErrorCodeDuplicateAddress, - "tried to create an account at an address that already exists: %v", address)) - return - } - st.updateAccount(&acm.Account{Address: address}) -} - -func (st *State) InitCode(address crypto.Address, code []byte) { - st.initCode(address, nil, code) -} - -func (st *State) InitChildCode(address crypto.Address, parent crypto.Address, code []byte) { - st.initCode(address, &parent, code) - -} - -func (st *State) initCode(address crypto.Address, parent *crypto.Address, code []byte) { - acc := st.mustAccount(address) - if acc == nil { - st.PushError(errors.ErrorCodef(errors.ErrorCodeInvalidAddress, - "tried to initialise code for an account that does not exist: %v", address)) - return - } - if acc.EVMCode != nil || acc.WASMCode != nil { - st.PushError(errors.ErrorCodef(errors.ErrorCodeIllegalWrite, - "tried to initialise code for a contract that already exists: %v", address)) - return - } - - acc.EVMCode = code - - // keccak256 hash of a contract's code - hash := sha3.NewKeccak256() - hash.Write(code) - codehash := hash.Sum(nil) - - forebear := &address - metamap := acc.ContractMeta - if parent != nil { - // find our ancestor, i.e. the initial contract that was deployed, from which this contract descends - ancestor := st.mustAccount(*parent) - if ancestor.Forebear != nil { - ancestor = st.mustAccount(*ancestor.Forebear) - forebear = ancestor.Forebear - } else { - forebear = parent - } - metamap = ancestor.ContractMeta - } - - // If we have a list of ABIs for this contract, we also know what contract code it is allowed to create - // For compatibility with older contracts, allow any contract to be created if we have no mappings - if metamap != nil && len(metamap) > 0 { - found := codehashPermitted(codehash, metamap) - - // Libraries lie about their deployed bytecode - if !found { - deployCodehash := compile.GetDeployCodeHash(code, address) - found = codehashPermitted(deployCodehash, metamap) - } - - if !found { - st.PushError(errors.ErrorCodeInvalidContractCode) - return - } - } - - acc.CodeHash = codehash - acc.Forebear = forebear - - st.updateAccount(acc) -} - -func codehashPermitted(codehash []byte, metamap []*acm.ContractMeta) bool { - for _, m := range metamap { - if bytes.Equal(codehash, m.CodeHash) { - return true - } - } - - return false -} - -func (st *State) InitWASMCode(address crypto.Address, code []byte) { - acc := st.mustAccount(address) - if acc == nil { - st.PushError(errors.ErrorCodef(errors.ErrorCodeInvalidAddress, - "tried to initialise code for an account that does not exist: %v", address)) - return - } - if acc.EVMCode != nil || acc.WASMCode != nil { - st.PushError(errors.ErrorCodef(errors.ErrorCodeIllegalWrite, - "tried to initialise code for a contract that already exists: %v", address)) - return - } - - acc.WASMCode = code - // keccak256 hash of a contract's code - hash := sha3.NewKeccak256() - hash.Write(code) - acc.CodeHash = hash.Sum(nil) - st.updateAccount(acc) -} - -func (st *State) UpdateMetaMap(address crypto.Address, mapping []*acm.ContractMeta) { - acc := st.mustAccount(address) - if acc == nil { - st.PushError(errors.ErrorCodef(errors.ErrorCodeInvalidAddress, - "tried to initialise code for an account that does not exist: %v", address)) - return - } - acc.ContractMeta = mapping - st.updateAccount(acc) -} - -func (st *State) SetMetadata(metahash acmstate.MetadataHash, abi string) error { - return st.cache.SetMetadata(metahash, abi) -} - -func (st *State) RemoveAccount(address crypto.Address) { - if !st.Exists(address) { - st.PushError(errors.ErrorCodef(errors.ErrorCodeDuplicateAddress, - "tried to remove an account at an address that does not exist: %v", address)) - return - } - st.removeAccount(address) -} - -func (st *State) SetStorage(address crypto.Address, key binary.Word256, value []byte) { - err := st.cache.SetStorage(address, key, value) - if err != nil { - st.PushError(err) - } -} - -func (st *State) AddToBalance(address crypto.Address, amount uint64) { - acc := st.mustAccount(address) - if acc == nil { - return - } - st.PushError(acc.AddToBalance(amount)) - st.updateAccount(acc) -} - -func (st *State) SubtractFromBalance(address crypto.Address, amount uint64) { - acc := st.mustAccount(address) - if acc == nil { - return - } - st.PushError(acc.SubtractFromBalance(amount)) - st.updateAccount(acc) -} - -func (st *State) SetPermission(address crypto.Address, permFlag permission.PermFlag, value bool) { - acc := st.mustAccount(address) - if acc == nil { - return - } - st.PushError(acc.Permissions.Base.Set(permFlag, value)) - st.updateAccount(acc) -} - -func (st *State) UnsetPermission(address crypto.Address, permFlag permission.PermFlag) { - acc := st.mustAccount(address) - if acc == nil { - return - } - st.PushError(acc.Permissions.Base.Unset(permFlag)) - st.updateAccount(acc) -} - -func (st *State) AddRole(address crypto.Address, role string) bool { - acc := st.mustAccount(address) - if acc == nil { - return false - } - added := acc.Permissions.AddRole(role) - st.updateAccount(acc) - return added -} - -func (st *State) RemoveRole(address crypto.Address, role string) bool { - acc := st.mustAccount(address) - if acc == nil { - return false - } - removed := acc.Permissions.RemoveRole(role) - st.updateAccount(acc) - return removed -} - -func (st *State) GetBlockHash(height uint64) (binary.Word256, error) { - hash := st.blockHashGetter(height) - if len(hash) == 0 { - st.PushError(fmt.Errorf("got empty BlockHash from blockHashGetter")) - } - return binary.LeftPadWord256(hash), nil -} - -// Helpers - -func (st *State) account(address crypto.Address) *acm.Account { - acc, err := st.cache.GetAccount(address) - if err != nil { - st.PushError(err) - } - return acc -} - -func (st *State) mustAccount(address crypto.Address) *acm.Account { - acc := st.account(address) - if acc == nil { - st.PushError(errors.ErrorCodef(errors.ErrorCodeIllegalWrite, - "attempted to modify non-existent account: %v", address)) - } - return acc -} - -func (st *State) updateAccount(account *acm.Account) { - err := st.cache.UpdateAccount(account) - if err != nil { - st.PushError(err) - } -} - -func (st *State) removeAccount(address crypto.Address) { - err := st.cache.RemoveAccount(address) - if err != nil { - st.PushError(err) - } -} diff --git a/execution/evm/state_test.go b/execution/evm/state_test.go deleted file mode 100644 index dfe7b2780..000000000 --- a/execution/evm/state_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package evm - -import ( - "fmt" - "testing" - - "github.com/hyperledger/burrow/binary" - - "github.com/hyperledger/burrow/acm/acmstate" - "github.com/stretchr/testify/require" - - "github.com/hyperledger/burrow/execution/errors" - "github.com/stretchr/testify/assert" -) - -func TestState_PushError(t *testing.T) { - st := NewState(newAppState(), blockHashGetter) - // This will be a wrapped nil - it should not register as first error - var ex errors.CodedError = (*errors.Exception)(nil) - st.PushError(ex) - // This one should - realErr := errors.ErrorCodef(errors.ErrorCodeInsufficientBalance, "real error") - st.PushError(realErr) - assert.True(t, realErr.Equal(st.Error())) -} - -func TestState_CreateAccount(t *testing.T) { - st := NewState(newAppState(), blockHashGetter) - address := newAddress("frogs") - st.CreateAccount(address) - require.Nil(t, st.Error()) - st.CreateAccount(address) - assertErrorCode(t, errors.ErrorCodeDuplicateAddress, st.Error()) - - st = NewState(newAppState(), blockHashGetter) - st.CreateAccount(address) - require.Nil(t, st.Error()) - st.InitCode(address, []byte{1, 2, 3}) - require.Nil(t, st.Error()) -} - -func TestState_Sync(t *testing.T) { - backend := acmstate.NewCache(newAppState()) - st := NewState(backend, blockHashGetter) - address := newAddress("frogs") - - st.CreateAccount(address) - amt := uint64(1232) - st.AddToBalance(address, amt) - - var err error - err = st.Sync() - require.Nil(t, err) - acc, err := backend.GetAccount(address) - require.NoError(t, err) - assert.Equal(t, acc.Balance, amt) -} - -func TestState_NewCache(t *testing.T) { - st := NewState(newAppState(), blockHashGetter) - address := newAddress("frogs") - - cache := st.NewCache() - cache.CreateAccount(address) - amt := uint64(1232) - cache.AddToBalance(address, amt) - - var err error - assert.Equal(t, uint64(0), st.GetBalance(address)) - require.Nil(t, st.Error()) - - // Sync through to cache - err = cache.Sync() - require.NoError(t, err) - assert.Equal(t, amt, st.GetBalance(address)) - require.Nil(t, st.Error()) - - cache = st.NewCache(acmstate.ReadOnly).NewCache() - require.Nil(t, st.Error()) - cache.AddToBalance(address, amt) - assertErrorCode(t, errors.ErrorCodeIllegalWrite, cache.Error()) -} - -func blockHashGetter(height uint64) []byte { - return binary.LeftPadWord256([]byte(fmt.Sprintf("block_hash_%d", height))).Bytes() -} diff --git a/execution/evm/vm.go b/execution/evm/vm.go deleted file mode 100644 index 3a1a1f021..000000000 --- a/execution/evm/vm.go +++ /dev/null @@ -1,1100 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package evm - -import ( - "bytes" - "encoding/binary" - "fmt" - "io/ioutil" - "math/big" - "strings" - - "github.com/hyperledger/burrow/execution/evm/abi" - - "github.com/hyperledger/burrow/acm" - "github.com/hyperledger/burrow/acm/acmstate" - . "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" - "github.com/hyperledger/burrow/execution/errors" - . "github.com/hyperledger/burrow/execution/evm/asm" - "github.com/hyperledger/burrow/execution/exec" - "github.com/hyperledger/burrow/logging" - "github.com/hyperledger/burrow/permission" - "github.com/hyperledger/burrow/txs" -) - -const ( - DataStackInitialCapacity = 1024 - MaximumAllowedBlockLookBack = 256 - uint64Length = 8 -) - -type Params struct { - BlockHeight uint64 - BlockTime int64 - GasLimit uint64 - CallStackMaxDepth uint64 - DataStackInitialCapacity uint64 - DataStackMaxDepth uint64 -} - -type VM struct { - memoryProvider func(errors.Sink) Memory - params Params - origin crypto.Address - nonce []byte - stackDepth uint64 - logger *logging.Logger - debugOpcodes bool - dumpTokens bool - sequence uint64 -} - -// Create a new EVM instance. Nonce is required to be globally unique (nearly almost surely) to avoid duplicate -// addresses for EVM created accounts. In Burrow we use TxHash for this but a random nonce or sequence number could be -// used. -func NewVM(params Params, origin crypto.Address, nonce []byte, logger *logging.Logger, options ...func(*VM)) *VM { - vm := &VM{ - memoryProvider: DefaultDynamicMemoryProvider, - params: params, - origin: origin, - stackDepth: 0, - nonce: nonce, - logger: logger.WithScope("NewVM"), - } - for _, option := range options { - option(vm) - } - return vm -} - -func (vm *VM) Debugf(format string, a ...interface{}) { - if vm.debugOpcodes { - fmt.Printf(format, a...) - } -} - -// CONTRACT: it is the duty of the contract writer to call known permissions -// we do not convey if a permission is not set -// (unlike in state/execution, where we guarantee HasPermission is called -// on known permissions and panics else) -// If the perm is not defined in the acc nor set by default in GlobalPermissions, -// this function returns false. -func HasPermission(st Interface, address crypto.Address, perm permission.PermFlag) bool { - globalPerms := st.GetPermissions(acm.GlobalPermissionsAddress) - accPerms := st.GetPermissions(address) - perms := accPerms.Base.Compose(globalPerms.Base) - value, err := perms.Get(perm) - if err != nil { - return false - } - return value -} - -func EnsurePermission(st Interface, address crypto.Address, perm permission.PermFlag) { - if !HasPermission(st, address, perm) { - st.PushError(errors.PermissionDenied{ - Address: address, - Perm: perm, - }) - } -} - -func (vm *VM) fireCallEvent(eventSink EventSink, callType exec.CallType, errProvider errors.Provider, output *[]byte, - callerAddress, calleeAddress crypto.Address, input []byte, value uint64, gas *uint64, errSink errors.Sink) { - // fire the post call event (including exception if applicable) - eventErr := eventSink.Call(&exec.CallEvent{ - CallType: callType, - CallData: &exec.CallData{ - Caller: callerAddress, - Callee: calleeAddress, - Data: input, - Value: value, - Gas: *gas, - }, - Origin: vm.origin, - StackDepth: vm.stackDepth, - Return: *output, - }, errors.AsException(errProvider.Error())) - errSink.PushError(eventErr) -} - -// Initiate an EVM call against the provided state pushing events to eventSink. code should contain the EVM bytecode, -// input the CallData (readable by CALLDATALOAD), value the amount of native token to transfer with the call -// an quantity metering the number of computational steps available to the execution according to the gas schedule. -func (vm *VM) Call(callState Interface, eventSink EventSink, caller, callee crypto.Address, code, - input []byte, value uint64, gas *uint64) (output []byte, err errors.CodedError) { - - // Always return output - we may have a reverted exception for which the return is meaningful - output, err = vm.call(callState, eventSink, caller, callee, code, input, value, gas, exec.CallTypeCall) - if err == nil { - err = callState.Error() - } - return -} - -func (vm *VM) call(callState Interface, eventSink EventSink, caller, callee crypto.Address, code, - input []byte, value uint64, gas *uint64, callType exec.CallType) (output []byte, err errors.CodedError) { - - // fire the post call event (including exception if applicable) and make sure we return the accumulated call error - defer func() { - vm.fireCallEvent(eventSink, callType, callState, &output, caller, callee, input, value, gas, callState) - err = callState.Error() - }() - - callState.PushError(transfer(callState, caller, callee, value)) - callState.PushError(vm.ensureStackDepth()) - - // Early exit - if callState.Error() != nil { - return - } - - if len(code) > 0 { - vm.stackDepth += 1 - output = vm.execute(callState, eventSink, caller, callee, code, input, value, gas) - vm.stackDepth -= 1 - if err != nil { - callState.PushError(err) - callState.PushError(transfer(callState, callee, caller, value)) - } - } - - return -} - -// DelegateCall is executed by the DELEGATECALL opcode, introduced as off Ethereum Homestead. -// The intent of delegate call is to run the code of the callee in the storage context of the caller; -// while preserving the original caller to the previous callee. -// Different to the normal CALL or CALLCODE, the value does not need to be transferred to the callee. -func (vm *VM) delegateCall(callState Interface, eventSink EventSink, caller, callee crypto.Address, - code, input []byte, value uint64, gas *uint64, - callType exec.CallType) (output []byte, err errors.CodedError) { - - // fire the post call event (including exception if applicable) and make sure we return the accumulated call error - defer func() { - vm.fireCallEvent(eventSink, callType, callState, &output, caller, callee, input, value, gas, callState) - err = callState.Error() - }() - - // DelegateCall does not transfer the value to the callee. - - callState.PushError(vm.ensureStackDepth()) - - // Early exit - if callState.Error() != nil { - return - } - - if len(code) > 0 { - vm.stackDepth += 1 - output = vm.execute(callState, eventSink, caller, callee, code, input, value, gas) - vm.stackDepth -= 1 - } - return -} - -// Try to deduct gasToUse from gasLeft. If ok return false, otherwise -// set err and return true. -func useGasNegative(gasLeft *uint64, gasToUse uint64, err errors.Sink) { - if *gasLeft >= gasToUse { - *gasLeft -= gasToUse - } else { - err.PushError(errors.ErrorCodeInsufficientGas) - } -} - -// Executes the EVM code passed in the appropriate context -func (vm *VM) execute(callState Interface, eventSink EventSink, caller, callee crypto.Address, - code, input []byte, value uint64, gas *uint64) (returnData []byte) { - vm.Debugf("(%d) (%s) %s (code=%d) gas: %v (d) %X\n", vm.stackDepth, caller, callee, len(code), *gas, input) - - logger := vm.logger.With("evm_nonce", vm.nonce) - - if vm.dumpTokens { - dumpTokens(vm.nonce, caller, callee, code) - } - - // Program counter - the index into code that tracks current instruction - pc := int64(0) - // Provide stack and memory storage - passing in the callState as an error provider - stack := NewStack(vm.params.DataStackInitialCapacity, vm.params.DataStackMaxDepth, gas, callState) - memory := vm.memoryProvider(callState) - - for { - // Check for any error accrued to state - if callState.Error() != nil { - return - } - - var op = codeGetOp(code, pc) - vm.Debugf("(pc) %-3d (op) %-14s (st) %-4d (gas) %d", pc, op.String(), stack.Len(), *gas) - // Use BaseOp gas. - useGasNegative(gas, GasBaseOp, callState) - - switch op { - - case ADD: // 0x01 - x, y := stack.PopBigInt(), stack.PopBigInt() - sum := new(big.Int).Add(x, y) - res := stack.PushBigInt(sum) - vm.Debugf(" %v + %v = %v (%X)\n", x, y, sum, res) - - case MUL: // 0x02 - x, y := stack.PopBigInt(), stack.PopBigInt() - prod := new(big.Int).Mul(x, y) - res := stack.PushBigInt(prod) - vm.Debugf(" %v * %v = %v (%X)\n", x, y, prod, res) - - case SUB: // 0x03 - x, y := stack.PopBigInt(), stack.PopBigInt() - diff := new(big.Int).Sub(x, y) - res := stack.PushBigInt(diff) - vm.Debugf(" %v - %v = %v (%X)\n", x, y, diff, res) - - case DIV: // 0x04 - x, y := stack.PopBigInt(), stack.PopBigInt() - if y.Sign() == 0 { - stack.Push(Zero256) - vm.Debugf(" %x / %x = %v\n", x, y, 0) - } else { - div := new(big.Int).Div(x, y) - res := stack.PushBigInt(div) - vm.Debugf(" %v / %v = %v (%X)\n", x, y, div, res) - } - - case SDIV: // 0x05 - x, y := stack.PopBigIntSigned(), stack.PopBigIntSigned() - if y.Sign() == 0 { - stack.Push(Zero256) - vm.Debugf(" %x / %x = %v\n", x, y, 0) - } else { - div := new(big.Int).Div(x, y) - res := stack.PushBigInt(div) - vm.Debugf(" %v / %v = %v (%X)\n", x, y, div, res) - } - - case MOD: // 0x06 - x, y := stack.PopBigInt(), stack.PopBigInt() - if y.Sign() == 0 { - stack.Push(Zero256) - vm.Debugf(" %v %% %v = %v\n", x, y, 0) - } else { - mod := new(big.Int).Mod(x, y) - res := stack.PushBigInt(mod) - vm.Debugf(" %v %% %v = %v (%X)\n", x, y, mod, res) - } - - case SMOD: // 0x07 - x, y := stack.PopBigIntSigned(), stack.PopBigIntSigned() - if y.Sign() == 0 { - stack.Push(Zero256) - vm.Debugf(" %v %% %v = %v\n", x, y, 0) - } else { - mod := new(big.Int).Mod(x, y) - res := stack.PushBigInt(mod) - vm.Debugf(" %v %% %v = %v (%X)\n", x, y, mod, res) - } - - case ADDMOD: // 0x08 - x, y, z := stack.PopBigInt(), stack.PopBigInt(), stack.PopBigInt() - if z.Sign() == 0 { - stack.Push(Zero256) - vm.Debugf(" %v %% %v = %v\n", x, y, 0) - } else { - add := new(big.Int).Add(x, y) - mod := add.Mod(add, z) - res := stack.PushBigInt(mod) - vm.Debugf(" %v + %v %% %v = %v (%X)\n", x, y, z, mod, res) - } - - case MULMOD: // 0x09 - x, y, z := stack.PopBigInt(), stack.PopBigInt(), stack.PopBigInt() - if z.Sign() == 0 { - stack.Push(Zero256) - vm.Debugf(" %v %% %v = %v\n", x, y, 0) - } else { - mul := new(big.Int).Mul(x, y) - mod := mul.Mod(mul, z) - res := stack.PushBigInt(mod) - vm.Debugf(" %v * %v %% %v = %v (%X)\n", x, y, z, mod, res) - } - - case EXP: // 0x0A - x, y := stack.PopBigInt(), stack.PopBigInt() - pow := new(big.Int).Exp(x, y, nil) - res := stack.PushBigInt(pow) - vm.Debugf(" %v ** %v = %v (%X)\n", x, y, pow, res) - - case SIGNEXTEND: // 0x0B - back := stack.PopU64() - if back < Word256Length-1 { - stack.PushBigInt(SignExtend(back, stack.PopBigInt())) - } - - case LT: // 0x10 - x, y := stack.PopBigInt(), stack.PopBigInt() - if x.Cmp(y) < 0 { - stack.Push(One256) - vm.Debugf(" %v < %v = %v\n", x, y, 1) - } else { - stack.Push(Zero256) - vm.Debugf(" %v < %v = %v\n", x, y, 0) - } - - case GT: // 0x11 - x, y := stack.PopBigInt(), stack.PopBigInt() - if x.Cmp(y) > 0 { - stack.Push(One256) - vm.Debugf(" %v > %v = %v\n", x, y, 1) - } else { - stack.Push(Zero256) - vm.Debugf(" %v > %v = %v\n", x, y, 0) - } - - case SLT: // 0x12 - x, y := stack.PopBigIntSigned(), stack.PopBigIntSigned() - if x.Cmp(y) < 0 { - stack.Push(One256) - vm.Debugf(" %v < %v = %v\n", x, y, 1) - } else { - stack.Push(Zero256) - vm.Debugf(" %v < %v = %v\n", x, y, 0) - } - - case SGT: // 0x13 - x, y := stack.PopBigIntSigned(), stack.PopBigIntSigned() - if x.Cmp(y) > 0 { - stack.Push(One256) - vm.Debugf(" %v > %v = %v\n", x, y, 1) - } else { - stack.Push(Zero256) - vm.Debugf(" %v > %v = %v\n", x, y, 0) - } - - case EQ: // 0x14 - x, y := stack.Pop(), stack.Pop() - if bytes.Equal(x[:], y[:]) { - stack.Push(One256) - vm.Debugf(" %X == %X = %v\n", x, y, 1) - } else { - stack.Push(Zero256) - vm.Debugf(" %X == %X = %v\n", x, y, 0) - } - - case ISZERO: // 0x15 - x := stack.Pop() - if x.IsZero() { - stack.Push(One256) - vm.Debugf(" %X == 0 = %v\n", x, 1) - } else { - stack.Push(Zero256) - vm.Debugf(" %X == 0 = %v\n", x, 0) - } - - case AND: // 0x16 - x, y := stack.Pop(), stack.Pop() - z := [32]byte{} - for i := 0; i < 32; i++ { - z[i] = x[i] & y[i] - } - stack.Push(z) - vm.Debugf(" %X & %X = %X\n", x, y, z) - - case OR: // 0x17 - x, y := stack.Pop(), stack.Pop() - z := [32]byte{} - for i := 0; i < 32; i++ { - z[i] = x[i] | y[i] - } - stack.Push(z) - vm.Debugf(" %X | %X = %X\n", x, y, z) - - case XOR: // 0x18 - x, y := stack.Pop(), stack.Pop() - z := [32]byte{} - for i := 0; i < 32; i++ { - z[i] = x[i] ^ y[i] - } - stack.Push(z) - vm.Debugf(" %X ^ %X = %X\n", x, y, z) - - case NOT: // 0x19 - x := stack.Pop() - z := [32]byte{} - for i := 0; i < 32; i++ { - z[i] = ^x[i] - } - stack.Push(z) - vm.Debugf(" !%X = %X\n", x, z) - - case BYTE: // 0x1A - idx := stack.Pop64() - val := stack.Pop() - res := byte(0) - if idx < 32 { - res = val[idx] - } - stack.Push64(int64(res)) - vm.Debugf(" => 0x%X\n", res) - - case SHL: //0x1B - shift, x := stack.PopBigInt(), stack.PopBigInt() - - if shift.Cmp(Big256) >= 0 { - reset := big.NewInt(0) - stack.PushBigInt(reset) - vm.Debugf(" %v << %v = %v\n", x, shift, reset) - } else { - shiftedValue := x.Lsh(x, uint(shift.Uint64())) - stack.PushBigInt(shiftedValue) - vm.Debugf(" %v << %v = %v\n", x, shift, shiftedValue) - } - - case SHR: //0x1C - shift, x := stack.PopBigInt(), stack.PopBigInt() - - if shift.Cmp(Big256) >= 0 { - reset := big.NewInt(0) - stack.PushBigInt(reset) - vm.Debugf(" %v << %v = %v\n", x, shift, reset) - } else { - shiftedValue := x.Rsh(x, uint(shift.Uint64())) - stack.PushBigInt(shiftedValue) - vm.Debugf(" %v << %v = %v\n", x, shift, shiftedValue) - } - - case SAR: //0x1D - shift, x := stack.PopBigInt(), stack.PopBigIntSigned() - - if shift.Cmp(Big256) >= 0 { - reset := big.NewInt(0) - if x.Sign() < 0 { - reset.SetInt64(-1) - } - stack.PushBigInt(reset) - vm.Debugf(" %v << %v = %v\n", x, shift, reset) - } else { - shiftedValue := x.Rsh(x, uint(shift.Uint64())) - stack.PushBigInt(shiftedValue) - vm.Debugf(" %v << %v = %v\n", x, shift, shiftedValue) - } - - case SHA3: // 0x20 - useGasNegative(gas, GasSha3, callState) - offset, size := stack.PopBigInt(), stack.PopBigInt() - data := memory.Read(offset, size) - data = sha3.Sha3(data) - stack.PushBytes(data) - vm.Debugf(" => (%v) %X\n", size, data) - - case ADDRESS: // 0x30 - stack.Push(callee.Word256()) - vm.Debugf(" => %X\n", callee) - - case BALANCE: // 0x31 - address := stack.PopAddress() - useGasNegative(gas, GasGetAccount, callState) - balance := callState.GetBalance(address) - stack.PushU64(balance) - vm.Debugf(" => %v (%X)\n", balance, address) - - case ORIGIN: // 0x32 - stack.Push(vm.origin.Word256()) - vm.Debugf(" => %v\n", vm.origin) - - case CALLER: // 0x33 - stack.Push(caller.Word256()) - vm.Debugf(" => %v\n", caller) - - case CALLVALUE: // 0x34 - stack.PushU64(value) - vm.Debugf(" => %v\n", value) - - case CALLDATALOAD: // 0x35 - offset := stack.Pop64() - data := subslice(input, offset, 32, callState) - res := LeftPadWord256(data) - stack.Push(res) - vm.Debugf(" => 0x%X\n", res) - - case CALLDATASIZE: // 0x36 - stack.Push64(int64(len(input))) - vm.Debugf(" => %d\n", len(input)) - - case CALLDATACOPY: // 0x37 - memOff := stack.PopBigInt() - inputOff := stack.Pop64() - length := stack.Pop64() - data := subslice(input, inputOff, length, callState) - memory.Write(memOff, data) - vm.Debugf(" => [%v, %v, %v] %X\n", memOff, inputOff, length, data) - - case CODESIZE: // 0x38 - l := int64(len(code)) - stack.Push64(l) - vm.Debugf(" => %d\n", l) - - case CODECOPY: // 0x39 - memOff := stack.PopBigInt() - codeOff := stack.Pop64() - length := stack.Pop64() - data := subslice(code, codeOff, length, callState) - memory.Write(memOff, data) - vm.Debugf(" => [%v, %v, %v] %X\n", memOff, codeOff, length, data) - - case GASPRICE_DEPRECATED: // 0x3A - stack.Push(Zero256) - vm.Debugf(" => %X (GASPRICE IS DEPRECATED)\n", Zero256) - - case EXTCODESIZE: // 0x3B - address := stack.PopAddress() - useGasNegative(gas, GasGetAccount, callState) - if callState.Exists(address) { - code := callState.GetEVMCode(address) - l := int64(len(code)) - stack.Push64(l) - vm.Debugf(" => %d\n", l) - } else { - if _, ok := registeredNativeContracts[address]; !ok { - callState.PushError(errors.ErrorCodeUnknownAddress) - continue - } - vm.Debugf(" => returning code size of 1 to indicated existence of native contract at %X\n", address) - stack.Push(One256) - } - case EXTCODECOPY: // 0x3C - address := stack.PopAddress() - useGasNegative(gas, GasGetAccount, callState) - if !callState.Exists(address) { - if _, ok := registeredNativeContracts[address]; ok { - vm.Debugf(" => attempted to copy native contract at %v but this is not supported\n", address) - callState.PushError(errors.ErrorCodeNativeContractCodeCopy) - } - callState.PushError(errors.ErrorCodeUnknownAddress) - continue - } - code := callState.GetEVMCode(address) - memOff := stack.PopBigInt() - codeOff := stack.Pop64() - length := stack.Pop64() - data := subslice(code, codeOff, length, callState) - memory.Write(memOff, data) - vm.Debugf(" => [%v, %v, %v] %X\n", memOff, codeOff, length, data) - - case RETURNDATASIZE: // 0x3D - stack.Push64(int64(len(returnData))) - vm.Debugf(" => %d\n", len(returnData)) - - case RETURNDATACOPY: // 0x3E - memOff, outputOff, length := stack.PopBigInt(), stack.PopBigInt(), stack.PopBigInt() - end := new(big.Int).Add(outputOff, length) - - if end.BitLen() > 64 || uint64(len(returnData)) < end.Uint64() { - callState.PushError(errors.ErrorCodeReturnDataOutOfBounds) - continue - } - - memory.Write(memOff, returnData) - vm.Debugf(" => [%v, %v, %v] %X\n", memOff, outputOff, length, returnData) - - case EXTCODEHASH: // 0x3F - address := stack.PopAddress() - - if !callState.Exists(address) { - // In case the account does not exist 0 is pushed to the stack. - stack.PushU64(0) - } else { - // keccak256 hash of a contract's code - var extcodehash Word256 - codehash := callState.GetCodeHash(address) - if codehash != nil { - copy(extcodehash[:], codehash) - } else { - hash := sha3.NewKeccak256() - copy(extcodehash[:], hash.Sum(nil)) - } - - stack.Push(extcodehash) - } - - case BLOCKHASH: // 0x40 - blockNumber := stack.PopU64() - - if blockNumber >= vm.params.BlockHeight { - vm.Debugf(" => attempted to get block hash of a non-existent block: %v", blockNumber) - callState.PushError(errors.ErrorCodeInvalidBlockNumber) - } else if vm.params.BlockHeight-blockNumber > MaximumAllowedBlockLookBack { - vm.Debugf(" => attempted to get block hash of a block %d outside of the allowed range "+ - "(must be within %d blocks)", blockNumber, MaximumAllowedBlockLookBack) - callState.PushError(errors.ErrorCodeBlockNumberOutOfRange) - } else { - blockHash, err := callState.GetBlockHash(blockNumber) - if err != nil { - vm.Debugf(" => error attempted to get block hash: %v, %v", blockNumber, err) - callState.PushError(errors.ErrorCodeInvalidBlockNumber) - } else { - stack.Push(blockHash) - vm.Debugf(" => 0x%X\n", blockHash) - } - } - - case COINBASE: // 0x41 - stack.Push(Zero256) - vm.Debugf(" => 0x%X (NOT SUPPORTED)\n", stack.Peek().Bytes()) - - case TIMESTAMP: // 0x42 - time := vm.params.BlockTime - stack.Push64(int64(time)) - vm.Debugf(" => 0x%X\n", time) - - case BLOCKHEIGHT: // 0x43 - number := vm.params.BlockHeight - stack.PushU64(number) - vm.Debugf(" => 0x%X\n", number) - - case GASLIMIT: // 0x45 - stack.PushU64(vm.params.GasLimit) - vm.Debugf(" => %v\n", vm.params.GasLimit) - - case POP: // 0x50 - popped := stack.Pop() - vm.Debugf(" => 0x%X\n", popped) - - case MLOAD: // 0x51 - offset := stack.PopBigInt() - data := memory.Read(offset, BigWord256Length) - stack.Push(LeftPadWord256(data)) - vm.Debugf(" => 0x%X @ 0x%X\n", data, offset) - - case MSTORE: // 0x52 - offset, data := stack.PopBigInt(), stack.Pop() - memory.Write(offset, data.Bytes()) - vm.Debugf(" => 0x%X @ 0x%X\n", data, offset) - - case MSTORE8: // 0x53 - offset := stack.PopBigInt() - val64 := stack.Pop64() - val := byte(val64 & 0xFF) - memory.Write(offset, []byte{val}) - vm.Debugf(" => [%v] 0x%X\n", offset, val) - - case SLOAD: // 0x54 - loc := stack.Pop() - data := LeftPadWord256(callState.GetStorage(callee, loc)) - stack.Push(data) - vm.Debugf("%s {0x%X = 0x%X}\n", callee, loc, data) - - case SSTORE: // 0x55 - loc, data := stack.Pop(), stack.Pop() - useGasNegative(gas, GasStorageUpdate, callState) - callState.SetStorage(callee, loc, data.Bytes()) - vm.Debugf("%v {%v := %v}\n", callee, loc, data) - - case JUMP: // 0x56 - to := stack.Pop64() - vm.jump(code, to, &pc, callState) - continue - - case JUMPI: // 0x57 - pos := stack.Pop64() - cond := stack.Pop() - if !cond.IsZero() { - vm.jump(code, pos, &pc, callState) - continue - } - vm.Debugf(" ~> false\n") - - case PC: // 0x58 - stack.Push64(pc) - - case MSIZE: // 0x59 - // Note: Solidity will write to this offset expecting to find guaranteed - // free memory to be allocated for it if a subsequent MSTORE is made to - // this offset. - capacity := memory.Capacity() - stack.PushBigInt(capacity) - vm.Debugf(" => 0x%X\n", capacity) - - case GAS: // 0x5A - stack.PushU64(*gas) - vm.Debugf(" => %X\n", *gas) - - case JUMPDEST: // 0x5B - vm.Debugf("\n") - // Do nothing - - case PUSH1, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8, PUSH9, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16, PUSH17, PUSH18, PUSH19, PUSH20, PUSH21, PUSH22, PUSH23, PUSH24, PUSH25, PUSH26, PUSH27, PUSH28, PUSH29, PUSH30, PUSH31, PUSH32: - a := int64(op - PUSH1 + 1) - codeSegment := subslice(code, pc+1, a, callState) - res := LeftPadWord256(codeSegment) - stack.Push(res) - pc += a - vm.Debugf(" => 0x%X\n", res) - - case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16: - n := int(op - DUP1 + 1) - stack.Dup(n) - vm.Debugf(" => [%d] 0x%X\n", n, stack.Peek().Bytes()) - - case SWAP1, SWAP2, SWAP3, SWAP4, SWAP5, SWAP6, SWAP7, SWAP8, SWAP9, SWAP10, SWAP11, SWAP12, SWAP13, SWAP14, SWAP15, SWAP16: - n := int(op - SWAP1 + 2) - stack.Swap(n) - vm.Debugf(" => [%d] %X\n", n, stack.Peek()) - - case LOG0, LOG1, LOG2, LOG3, LOG4: - n := int(op - LOG0) - topics := make([]Word256, n) - offset, size := stack.PopBigInt(), stack.PopBigInt() - for i := 0; i < n; i++ { - topics[i] = stack.Pop() - } - data := memory.Read(offset, size) - callState.PushError(eventSink.Log(&exec.LogEvent{ - Address: callee, - Topics: topics, - Data: data, - })) - vm.Debugf(" => T:%X D:%X\n", topics, data) - - case CREATE, CREATE2: // 0xF0, 0xFB - returnData = nil - contractValue := stack.PopU64() - offset, size := stack.PopBigInt(), stack.PopBigInt() - input := memory.Read(offset, size) - - // TODO charge for gas to create account _ the code length * GasCreateByte - useGasNegative(gas, GasCreateAccount, callState) - - var newAccount crypto.Address - if op == CREATE { - vm.sequence++ - nonce := make([]byte, txs.HashLength+uint64Length) - copy(nonce, vm.nonce) - binary.BigEndian.PutUint64(nonce[txs.HashLength:], vm.sequence) - newAccount = crypto.NewContractAddress(callee, nonce) - } else if op == CREATE2 { - salt := stack.Pop() - newAccount = crypto.NewContractAddress2(callee, salt, callState.GetEVMCode(callee)) - } - - // Check the CreateContract permission for this account - EnsurePermission(callState, callee, permission.CreateContract) - if callState.Error() != nil { - continue - } - - // Establish a frame in which the putative account exists - childCallState := callState.NewCache() - create(childCallState, newAccount) - - // Run the input to get the contract code. - // NOTE: no need to copy 'input' as per Call contract. - ret, callErr := vm.Call(childCallState, eventSink, callee, newAccount, input, input, contractValue, gas) - if callErr != nil { - stack.Push(Zero256) - // Note we both set the return buffer and return the result normally - returnData = ret - } else { - // Update the account with its initialised contract code - forebear := callState.GetForebear(callee) - childCallState.InitChildCode(newAccount, forebear, ret) - callState.PushError(childCallState.Sync()) - stack.PushAddress(newAccount) - } - - case CALL, CALLCODE, DELEGATECALL, STATICCALL: // 0xF1, 0xF2, 0xF4, 0xFA - returnData = nil - - EnsurePermission(callState, callee, permission.Call) - if callState.Error() != nil { - continue - } - gasLimit := stack.PopU64() - address := stack.PopAddress() - // NOTE: for DELEGATECALL value is preserved from the original - // caller, as such it is not stored on stack as an argument - // for DELEGATECALL and should not be popped. Instead previous - // caller value is used. for CALL and CALLCODE value is stored - // on stack and needs to be overwritten from the given value. - if op != DELEGATECALL && op != STATICCALL { - value = stack.PopU64() - } - // inputs - inOffset, inSize := stack.PopBigInt(), stack.PopBigInt() - // outputs - retOffset := stack.PopBigInt() - retSize := stack.Pop64() - vm.Debugf(" => %v\n", address) - - // Get the arguments from the memory - args := memory.Read(inOffset, inSize) - - // Ensure that gasLimit is reasonable - if *gas < gasLimit { - // EIP150 - the 63/64 rule - rather than errors.CodedError we pass this specified fraction of the total available gas - gasLimit = *gas - *gas/64 - } - // NOTE: we will return any used gas later. - *gas -= gasLimit - - // Begin execution - var callErr errors.CodedError - // Establish a stack frame and perform the call - var childCallState Interface - if IsRegisteredNativeContract(address) { - // Native contract - childCallState = callState.NewCache() - returnData, callErr = ExecuteNativeContract(address, childCallState, callee, args, &gasLimit, logger) - childCallState.PushError(callErr) - // for now we fire the Call event. maybe later we'll fire more particulars - // NOTE: these fire call go_events and not particular go_events for eg name reg or permissions - vm.fireCallEvent(eventSink, exec.CallTypeSNative, childCallState, &returnData, callee, address, args, value, - &gasLimit, childCallState) - } else { - // EVM contract - useGasNegative(gas, GasGetAccount, callState) - // since CALL is used also for sending funds, - // acc may not exist yet. This is an errors.CodedError for - // CALLCODE, but not for CALL, though I don't think - // ethereum actually cares - if !callState.Exists(address) { - if op != CALL { - callState.PushError(errors.ErrorCodeUnknownAddress) - continue - } - // We're sending funds to a new account so we must create it first - createAccount(callState, callee, address) - if callState.Error() != nil { - continue - } - } - switch op { - case CALL: - childCallState = callState.NewCache() - returnData, callErr = vm.call(childCallState, eventSink, callee, address, callState.GetEVMCode(address), - args, value, &gasLimit, exec.CallTypeCall) - - case CALLCODE: - childCallState = callState.NewCache() - returnData, callErr = vm.call(childCallState, eventSink, callee, callee, callState.GetEVMCode(address), - args, value, &gasLimit, exec.CallTypeCode) - - case DELEGATECALL: - childCallState = callState.NewCache() - returnData, callErr = vm.delegateCall(childCallState, eventSink, caller, callee, - callState.GetEVMCode(address), args, value, &gasLimit, exec.CallTypeDelegate) - - case STATICCALL: - childCallState = callState.NewCache(acmstate.ReadOnly) - returnData, callErr = vm.delegateCall(childCallState, NewLogFreeEventSink(eventSink), - callee, address, callState.GetEVMCode(address), args, value, &gasLimit, exec.CallTypeStatic) - - default: - panic(fmt.Errorf("switch statement should be exhaustive so this should not have been reached")) - } - - } - - if callErr == nil { - // Sync error is a hard stop - callState.PushError(childCallState.Sync()) - } - - // Push result - if callErr != nil { - vm.Debugf("error from nested sub-call (depth: %v): %s\n", vm.stackDepth, callErr.Error()) - // So we can return nested errors.CodedError if the top level return is an errors.CodedError - stack.Push(Zero256) - - if callErr.ErrorCode() == errors.ErrorCodeExecutionReverted { - memory.Write(retOffset, RightPadBytes(returnData, int(retSize))) - } - } else { - stack.Push(One256) - - // Should probably only be necessary when there is no return value and - // returnData is empty, but since EVM expects retSize to be respected this will - // defensively pad or truncate the portion of returnData to be returned. - memory.Write(retOffset, RightPadBytes(returnData, int(retSize))) - } - - // Handle remaining gas. - *gas += gasLimit - - vm.Debugf("resume %s (%v)\n", callee, gas) - - case RETURN: // 0xF3 - offset, size := stack.PopBigInt(), stack.PopBigInt() - output := memory.Read(offset, size) - vm.Debugf(" => [%v, %v] (%d) 0x%X\n", offset, size, len(output), output) - return output - - case REVERT: // 0xFD - offset, size := stack.PopBigInt(), stack.PopBigInt() - output := memory.Read(offset, size) - vm.Debugf(" => [%v, %v] (%d) 0x%X\n", offset, size, len(output), output) - callState.PushError(newRevertException(output)) - return output - - case INVALID: // 0xFE - callState.PushError(errors.ErrorCodeExecutionAborted) - return nil - - case SELFDESTRUCT: // 0xFF - receiver := stack.PopAddress() - useGasNegative(gas, GasGetAccount, callState) - if !callState.Exists(receiver) { - // If receiver address doesn't exist, try to create it - useGasNegative(gas, GasCreateAccount, callState) - createAccount(callState, callee, receiver) - if callState.Error() != nil { - continue - } - } - balance := callState.GetBalance(callee) - callState.AddToBalance(receiver, balance) - callState.RemoveAccount(callee) - vm.Debugf(" => (%X) %v\n", receiver[:4], balance) - return nil - - case STOP: // 0x00 - return nil - - default: - vm.Debugf("(pc) %-3v Unknown opcode %v\n", pc, op) - callState.PushError(errors.Errorf("unknown opcode %v", op)) - return nil - } - pc++ - } - return -} - -func createAccount(st Interface, creator, address crypto.Address) { - EnsurePermission(st, creator, permission.CreateAccount) - create(st, address) -} - -func create(st Interface, address crypto.Address) { - if IsRegisteredNativeContract(address) { - st.PushError(errors.ErrorCodef(errors.ErrorCodeReservedAddress, - "cannot create account at %v because that address is reserved for a native contract", address)) - } - st.CreateAccount(address) -} - -// Returns a subslice from offset of length length and a bool -// (true iff slice was possible). If the subslice -// extends past the end of data it returns A COPY of the segment at the end of -// data padded with zeroes on the right. If offset == len(data) it returns all -// zeroes. if offset > len(data) it returns a false -func subslice(data []byte, offset, length int64, err errors.Sink) []byte { - size := int64(len(data)) - if size < offset || offset < 0 || length < 0 { - err.PushError(errors.ErrorCodef(errors.ErrorCodeInputOutOfBounds, - "subslice could not slice data of size %d at offset %d for length %d", size, offset, length)) - return nil - } - if size < offset+length { - // Extract slice from offset to end padding to requested length - ret := make([]byte, length) - copy(ret, data[offset:]) - return ret - } - return data[offset : offset+length] -} - -func codeGetOp(code []byte, n int64) OpCode { - if int64(len(code)) <= n { - return OpCode(0) // stop - } else { - return OpCode(code[n]) - } -} - -func (vm *VM) jump(code []byte, to int64, pc *int64, err errors.Sink) { - dest := codeGetOp(code, to) - if dest != JUMPDEST { - vm.Debugf(" ~> %v invalid jump dest %v\n", to, dest) - err.PushError(errors.ErrorCodeInvalidJumpDest) - return - } - vm.Debugf(" ~> %v\n", to) - *pc = to -} - -func transfer(st Interface, from, to crypto.Address, amount uint64) errors.CodedError { - if amount == 0 { - return nil - } - if st.GetBalance(from) < amount { - return errors.ErrorCodeInsufficientBalance - } else { - st.SubtractFromBalance(from, amount) - st.AddToBalance(to, amount) - } - err := st.Error() - if err != nil { - return err - } - return nil -} - -// Dump the bytecode being sent to the EVM in the current working directory -func dumpTokens(nonce []byte, caller, callee crypto.Address, code []byte) { - var tokensString string - tokens, err := acm.Bytecode(code).Tokens() - if err != nil { - tokensString = fmt.Sprintf("error generating tokens from bytecode: %v", err) - } else { - tokensString = strings.Join(tokens, "\n") - } - txHashString := "nil-nonce" - if len(nonce) >= 4 { - txHashString = fmt.Sprintf("nonce-%X", nonce[:4]) - } - callerString := "caller-none" - if caller != crypto.ZeroAddress { - callerString = fmt.Sprintf("caller-%v", caller) - } - calleeString := "callee-none" - if callee != crypto.ZeroAddress { - calleeString = fmt.Sprintf("callee-%v", caller) - } - ioutil.WriteFile(fmt.Sprintf("tokens_%s_%s_%s.asm", txHashString, callerString, calleeString), - []byte(tokensString), 0777) -} - -func (vm *VM) ensureStackDepth() errors.CodedError { - if vm.params.CallStackMaxDepth > 0 && vm.stackDepth == vm.params.CallStackMaxDepth { - return errors.ErrorCodeCallStackOverflow - } - return nil -} - -func newRevertException(ret []byte) errors.CodedError { - code := errors.ErrorCodeExecutionReverted - if len(ret) > 0 { - // Attempt decode - reason, err := abi.UnpackRevert(ret) - if err == nil { - return errors.ErrorCodef(code, "with reason '%s'", *reason) - } - } - return code -} diff --git a/execution/evm/vm_test.go b/execution/evm/vm_test.go deleted file mode 100644 index b4347bbb6..000000000 --- a/execution/evm/vm_test.go +++ /dev/null @@ -1,1501 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package evm - -import ( - bin "encoding/binary" - "fmt" - "strconv" - "testing" - "time" - - "github.com/hyperledger/burrow/acm" - "github.com/hyperledger/burrow/acm/acmstate" - "github.com/hyperledger/burrow/binary" - . "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/execution/errors" - . "github.com/hyperledger/burrow/execution/evm/asm" - . "github.com/hyperledger/burrow/execution/evm/asm/bc" - "github.com/hyperledger/burrow/execution/exec" - "github.com/hyperledger/burrow/logging" - "github.com/hyperledger/burrow/permission" - "github.com/hyperledger/burrow/txs" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/tmthrgd/go-hex" - "golang.org/x/crypto/ripemd160" -) - -// Test output is a bit clearer if we /dev/null the logging, but can be re-enabled by uncommenting the below -//var logger, _, _ = lifecycle.NewStdErrLogger() -// -var logger = logging.NewNoopLogger() - -type testState struct { - *State - BlockHashProvider func(blockNumber uint64) (Word256, error) -} - -func NewTestState(st acmstate.ReaderWriter, blockHashGetter func(uint64) []byte) *testState { - evmState := NewState(st, blockHashGetter) - return &testState{ - State: evmState, - BlockHashProvider: evmState.GetBlockHash, - } -} - -func newAppState() *FakeAppState { - fas := &FakeAppState{ - accounts: make(map[crypto.Address]*acm.Account), - storage: make(map[string][]byte), - } - // For default permissions - fas.accounts[acm.GlobalPermissionsAddress] = &acm.Account{ - Permissions: permission.DefaultAccountPermissions, - } - return fas -} - -func newParams() Params { - return Params{ - BlockHeight: 0, - BlockTime: 0, - GasLimit: 0, - } -} - -func newAddress(name string) crypto.Address { - hasher := ripemd160.New() - hasher.Write([]byte(name)) - return crypto.MustAddressFromBytes(hasher.Sum(nil)) -} - -func newAccount(st Interface, name string) crypto.Address { - address := newAddress(name) - st.CreateAccount(address) - return address -} - -func makeAccountWithCode(st Interface, name string, code []byte) crypto.Address { - address := newAddress(name) - st.CreateAccount(address) - st.InitCode(address, code) - st.AddToBalance(address, 9999999) - return address -} - -// Runs a basic loop -func TestVM(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - // Create accounts - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "101") - - var gas uint64 = 100000 - - bytecode := MustSplice(PUSH1, 0x00, PUSH1, 0x20, MSTORE, JUMPDEST, PUSH2, 0x0F, 0x0F, PUSH1, 0x20, MLOAD, - SLT, ISZERO, PUSH1, 0x1D, JUMPI, PUSH1, 0x01, PUSH1, 0x20, MLOAD, ADD, PUSH1, 0x20, - MSTORE, PUSH1, 0x05, JUMP, JUMPDEST) - - start := time.Now() - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - t.Logf("Output: %v Error: %v\n", output, err) - t.Logf("Call took: %v", time.Since(start)) - require.NoError(t, err) - require.NoError(t, cache.Error()) -} - -func TestSHL(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "101") - - var gas uint64 = 100000 - - //Shift left 0 - bytecode := MustSplice(PUSH1, 0x01, PUSH1, 0x00, SHL, return1()) - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value := []uint8([]byte{0x1}) - expected := LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift left 0 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x00, SHL, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift left 1 - bytecode = MustSplice(PUSH1, 0x01, PUSH1, 0x01, SHL, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x2}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift left 1 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x01, SHL, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift left 1 - bytecode = MustSplice(PUSH32, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x01, SHL, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift left 255 - bytecode = MustSplice(PUSH1, 0x01, PUSH1, 0xFF, SHL, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x80}) - expected = RightPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift left 255 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0xFF, SHL, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x80}) - expected = RightPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift left 256 (overflow) - bytecode = MustSplice(PUSH1, 0x01, PUSH2, 0x01, 0x00, SHL, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift left 256 (overflow) - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH2, 0x01, 0x00, SHL, - return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift left 257 (overflow) - bytecode = MustSplice(PUSH1, 0x01, PUSH2, 0x01, 0x01, SHL, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - require.NoError(t, cache.Error()) -} - -func TestSHR(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "101") - - var gas uint64 = 100000 - - //Shift right 0 - bytecode := MustSplice(PUSH1, 0x01, PUSH1, 0x00, SHR, return1()) - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value := []uint8([]byte{0x1}) - expected := LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift right 0 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x00, SHR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift right 1 - bytecode = MustSplice(PUSH1, 0x01, PUSH1, 0x01, SHR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift right 1 - bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, 0x01, SHR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x40}) - expected = RightPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift right 1 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x01, SHR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift right 255 - bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, 0xFF, SHR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x1}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift right 255 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0xFF, SHR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x1}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift right 256 (underflow) - bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH2, 0x01, 0x00, SHR, - return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift right 256 (underflow) - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH2, 0x01, 0x00, SHR, - return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift right 257 (underflow) - bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH2, 0x01, 0x01, SHR, - return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - require.NoError(t, cache.Error()) -} - -func TestSAR(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "101") - - var gas uint64 = 100000 - - //Shift arith right 0 - bytecode := MustSplice(PUSH1, 0x01, PUSH1, 0x00, SAR, return1()) - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value := []uint8([]byte{0x1}) - expected := LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative arith shift right 0 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x00, SAR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift arith right 1 - bytecode = MustSplice(PUSH1, 0x01, PUSH1, 0x01, SAR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift arith right 1 - bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, 0x01, SAR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0xc0}) - expected = RightPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift arith right 1 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0x01, SAR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift arith right 255 - bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, 0xFF, SAR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift arith right 255 - bytecode = MustSplice(PUSH32, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0xFF, SAR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift arith right 255 - bytecode = MustSplice(PUSH32, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH1, 0xFF, SAR, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = RightPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift arith right 256 (reset) - bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH2, 0x01, 0x00, SAR, - return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Alternative shift arith right 256 (reset) - bytecode = MustSplice(PUSH32, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, PUSH2, 0x01, 0x00, SAR, - return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - value = []uint8([]byte{0x00}) - expected = LeftPadBytes(value, 32) - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - //Shift arith right 257 (reset) - bytecode = MustSplice(PUSH32, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH2, 0x01, 0x01, SAR, - return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - expected = []uint8([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}) - - assert.Equal(t, expected, output) - - t.Logf("Result: %v == %v\n", output, expected) - - if err != nil { - t.Fatal(err) - } - - require.NoError(t, cache.Error()) -} - -//Test attempt to jump to bad destination (position 16) -func TestJumpErr(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - // Create accounts - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "2") - - var gas uint64 = 100000 - - bytecode := MustSplice(PUSH1, 0x10, JUMP) - - var err error - ch := make(chan struct{}) - go func() { - _, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - ch <- struct{}{} - }() - tick := time.NewTicker(time.Second * 2) - select { - case <-tick.C: - t.Fatal("VM ended up in an infinite loop from bad jump dest (it took too long!)") - case <-ch: - if err == nil { - t.Fatal("Expected invalid jump dest err") - } - } -} - -// Tests the code for a subcurrency contract compiled by serpent -func TestSubcurrency(t *testing.T) { - st := newAppState() - cache := NewState(st, blockHashGetter) - // Create accounts - account1 := newAccount(cache, "1, 2, 3") - account2 := newAccount(cache, "3, 2, 1") - cache.Sync() - - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - var gas uint64 = 1000 - - bytecode := MustSplice(PUSH3, 0x0F, 0x42, 0x40, CALLER, SSTORE, PUSH29, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PUSH1, - 0x00, CALLDATALOAD, DIV, PUSH4, 0x15, 0xCF, 0x26, 0x84, DUP2, EQ, ISZERO, PUSH2, - 0x00, 0x46, JUMPI, PUSH1, 0x04, CALLDATALOAD, PUSH1, 0x40, MSTORE, PUSH1, 0x40, - MLOAD, SLOAD, PUSH1, 0x60, MSTORE, PUSH1, 0x20, PUSH1, 0x60, RETURN, JUMPDEST, - PUSH4, 0x69, 0x32, 0x00, 0xCE, DUP2, EQ, ISZERO, PUSH2, 0x00, 0x87, JUMPI, PUSH1, - 0x04, CALLDATALOAD, PUSH1, 0x80, MSTORE, PUSH1, 0x24, CALLDATALOAD, PUSH1, 0xA0, - MSTORE, CALLER, SLOAD, PUSH1, 0xC0, MSTORE, CALLER, PUSH1, 0xE0, MSTORE, PUSH1, - 0xA0, MLOAD, PUSH1, 0xC0, MLOAD, SLT, ISZERO, ISZERO, PUSH2, 0x00, 0x86, JUMPI, - PUSH1, 0xA0, MLOAD, PUSH1, 0xC0, MLOAD, SUB, PUSH1, 0xE0, MLOAD, SSTORE, PUSH1, - 0xA0, MLOAD, PUSH1, 0x80, MLOAD, SLOAD, ADD, PUSH1, 0x80, MLOAD, SSTORE, JUMPDEST, - JUMPDEST, POP, JUMPDEST, PUSH1, 0x00, PUSH1, 0x00, RETURN) - - data := hex.MustDecodeString("693200CE0000000000000000000000004B4363CDE27C2EB05E66357DB05BC5C88F850C1A0000000000000000000000000000000000000000000000000000000000000005") - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, data, 0, &gas) - t.Logf("Output: %v Error: %v\n", output, err) - if err != nil { - t.Fatal(err) - } - require.NoError(t, cache.Error()) -} - -//This test case is taken from EIP-140 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-140.md); -//it is meant to test the implementation of the REVERT opcode -func TestRevert(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - // Create accounts - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "1, 0, 1") - - key, value := []byte{0x00}, []byte{0x00} - cache.SetStorage(account1, LeftPadWord256(key), value) - - var gas uint64 = 100000 - - bytecode := MustSplice(PUSH13, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x64, 0x61, 0x74, 0x61, - PUSH1, 0x00, SSTORE, PUSH32, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - PUSH1, 0x00, MSTORE, PUSH1, 0x0E, PUSH1, 0x00, REVERT) - - /*bytecode := MustSplice(PUSH32, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, PUSH1, 0x00, MSTORE, PUSH1, 0x0E, PUSH1, 0x00, REVERT)*/ - - output, cErr := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assert.Error(t, cErr, "Expected execution reverted error") - - storageVal := cache.GetStorage(account1, LeftPadWord256(key)) - assert.Equal(t, value, storageVal) - - t.Logf("Output: %v\n", output) -} - -// Test sending tokens from a contract to another account -func TestSendCall(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - // Create accounts - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "2") - account3 := newAccount(cache, "3") - cache.Sync() - - // account1 will call account2 which will trigger CALL opcode to account3 - addr := account3 - contractCode := callContractCode(addr) - - //---------------------------------------------- - // account2 has insufficient balance, should fail - txe := runVM(cache, ourVm, account1, account2, contractCode, 100000) - exCalls := txe.ExceptionalCalls() - require.Len(t, exCalls, 1) - assertErrorCode(t, errors.ErrorCodeInsufficientBalance, exCalls[0].Header.Exception) - - //---------------------------------------------- - // give account2 sufficient balance, should pass - cache.AddToBalance(account2, 100000) - txe = runVM(cache, ourVm, account1, account2, contractCode, 1000) - assert.Nil(t, txe.Exception, "Should have sufficient balance") - - //---------------------------------------------- - // insufficient gas, should fail - txe = runVM(cache, ourVm, account1, account2, contractCode, 100) - assert.NotNil(t, txe.Exception, "Expected insufficient gas error") -} - -// Test to ensure that contracts called with STATICCALL cannot modify state -// as per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-214.md -func TestStaticCallReadOnly(t *testing.T) { - gas1, gas2 := byte(0x1), byte(0x1) - value := byte(0x69) - var inOff, inSize, retOff, retSize byte - - logDefault := MustSplice(PUSH1, inSize, PUSH1, inOff) - testRecipient := newAddress("1") - // check all illegal state modifications in child staticcall frame - for _, illegalContractCode := range []acm.Bytecode{ - MustSplice(PUSH9, "arbitrary", PUSH1, 0x00, SSTORE), - MustSplice(logDefault, LOG0), - MustSplice(logDefault, PUSH1, 0x1, LOG1), - MustSplice(logDefault, PUSH1, 0x1, PUSH1, 0x1, LOG2), - MustSplice(logDefault, PUSH1, 0x1, PUSH1, 0x1, PUSH1, 0x1, LOG3), - MustSplice(logDefault, PUSH1, 0x1, PUSH1, 0x1, PUSH1, 0x1, PUSH1, 0x1, LOG4), - MustSplice(PUSH1, 0x0, PUSH1, 0x0, PUSH1, 0x69, CREATE), - MustSplice(PUSH20, testRecipient, SELFDESTRUCT), - } { - // TODO: CREATE2 - - t.Logf("Testing state-modifying bytecode: %v", illegalContractCode.MustTokens()) - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger, DebugOpcodes) - callee := makeAccountWithCode(cache, "callee", MustSplice(illegalContractCode, PUSH1, 0x1, return1())) - - // equivalent to CALL, but enforce state immutability for children - caller := makeAccountWithCode(cache, "caller", - MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, inOff, - PUSH1, value, PUSH20, callee, PUSH2, gas1, gas2, STATICCALL, PUSH1, retSize, - PUSH1, retOff, RETURN)) - - txe := runVM(cache, ourVm, caller, callee, cache.GetEVMCode(caller), 1000) - // the topmost caller can never *illegally* modify state - require.Error(t, txe.Exception) - assertErrorCode(t, errors.ErrorCodeIllegalWrite, txe.Exception, - "should get an error from child accounts that cache is read only") - } -} - -func TestStaticCallWithValue(t *testing.T) { - gas1, gas2 := byte(0x1), byte(0x1) - value := byte(0x69) - var inOff, inSize, retOff, retSize byte - - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - finalAddress := makeAccountWithCode(cache, "final", MustSplice(PUSH1, int64(20), return1())) - - // intermediate account CALLs another contract *with* a value - callee := makeAccountWithCode(cache, "callee", MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, - inOff, PUSH1, value, PUSH20, finalAddress, PUSH2, gas1, gas2, CALL, returnWord())) - - caller := makeAccountWithCode(cache, "caller", - MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, - inOff, PUSH1, value, PUSH20, callee, PUSH2, gas1, gas2, STATICCALL, PUSH1, retSize, - PUSH1, retOff, RETURN)) - - cache.AddToBalance(callee, 100000) - txe := runVM(cache, ourVm, caller, callee, cache.GetEVMCode(caller), 1000) - require.NotNil(t, txe.Exception) - assertErrorCode(t, errors.ErrorCodeIllegalWrite, txe.Exception, "expected static call violation because of call with value") -} - -func TestStaticCallNoValue(t *testing.T) { - gas1, gas2 := byte(0x1), byte(0x1) - value := byte(0x69) - var inOff, inSize, retOff, retSize byte - - // this final test just checks that STATICCALL actually works - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - finalAddress := makeAccountWithCode(cache, "final", MustSplice(PUSH1, int64(20), return1())) - // intermediate account CALLs another contract *without* a value - callee := makeAccountWithCode(cache, "callee", MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, - inOff, PUSH1, 0x00, PUSH20, finalAddress, PUSH2, gas1, gas2, CALL, returnWord())) - - caller := makeAccountWithCode(cache, "caller", - MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, - inOff, PUSH1, value, PUSH20, callee, PUSH2, gas1, gas2, STATICCALL, PUSH1, retSize, - PUSH1, retOff, RETURN)) - - cache.AddToBalance(callee, 100000) - txe := runVM(cache, ourVm, caller, callee, cache.GetEVMCode(caller), 1000) - // no exceptions expected because value never set in children - require.NoError(t, txe.Exception.AsError()) - exCalls := txe.ExceptionalCalls() - require.Len(t, exCalls, 0) -} - -// Test evm account creation -func TestCreate(t *testing.T) { - st := newAppState() - cache := NewState(st, blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - callee := makeAccountWithCode(cache, "callee", MustSplice(PUSH1, 0x0, PUSH1, 0x0, PUSH1, 0x0, CREATE, PUSH1, 0, MSTORE, PUSH1, 20, PUSH1, 12, RETURN)) - // ensure pre-generated address has same sequence number - nonce := make([]byte, txs.HashLength+uint64Length) - copy(nonce, ourVm.nonce) - bin.BigEndian.PutUint64(nonce[txs.HashLength:], ourVm.sequence+1) - addr := crypto.NewContractAddress(callee, nonce) - - var gas uint64 = 100000 - caller := newAccount(cache, "1, 2, 3") - output, err := ourVm.Call(cache, NewNoopEventSink(), caller, callee, cache.GetEVMCode(callee), []byte{}, 0, &gas) - assert.NoError(t, err, "Should return new address without error") - assert.Equal(t, addr.Bytes(), output, "Addresses should be equal") -} - -// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1014.md -func TestCreate2(t *testing.T) { - st := newAppState() - cache := NewState(st, blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - // salt of 0s - var salt [32]byte - callee := makeAccountWithCode(cache, "callee", MustSplice(PUSH1, 0x0, PUSH1, 0x0, PUSH1, 0x0, PUSH32, salt[:], CREATE2, PUSH1, 0, MSTORE, PUSH1, 20, PUSH1, 12, RETURN)) - addr := crypto.NewContractAddress2(callee, salt, cache.GetEVMCode(callee)) - - var gas uint64 = 100000 - caller := newAccount(cache, "1, 2, 3") - output, err := ourVm.Call(cache, NewNoopEventSink(), caller, callee, cache.GetEVMCode(callee), []byte{}, 0, &gas) - assert.NoError(t, err, "Should return new address without error") - assert.Equal(t, addr.Bytes(), output, "Returned value not equal to create2 address") -} - -// This test was introduced to cover an issues exposed in our handling of the -// gas limit passed from caller to callee on various forms of CALL. -// The idea of this test is to implement a simple DelegateCall in EVM code -// We first run the DELEGATECALL with _just_ enough gas expecting a simple return, -// and then run it with 1 gas unit less, expecting a failure -func TestDelegateCallGas(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - inOff := 0 - inSize := 0 // no call data - retOff := 0 - retSize := 32 - calleeReturnValue := int64(20) - - callee := makeAccountWithCode(cache, "callee", - MustSplice(PUSH1, calleeReturnValue, PUSH1, 0, MSTORE, PUSH1, 32, PUSH1, 0, RETURN)) - - // 6 op codes total - baseOpsCost := GasBaseOp * 6 - // 4 pushes - pushCost := GasStackOp * 4 - // 2 pushes 2 pops - returnCost := GasStackOp * 4 - // To push success/failure - resumeCost := GasStackOp - - // Gas is not allowed to drop to 0 so we add resumecost - delegateCallCost := baseOpsCost + pushCost + returnCost + resumeCost - - // Here we split up the caller code so we can make a DELEGATE call with - // different amounts of gas. The value we sandwich in the middle is the amount - // we subtract from the available gas (that the caller has available), so: - // code := MustSplice(callerCodePrefix, , callerCodeSuffix) - // gives us the code to make the call - callerCodePrefix := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, - PUSH1, inOff, PUSH20, callee, PUSH1) - callerCodeSuffix := MustSplice(DELEGATECALL, returnWord()) - - // Perform a delegate call - caller := makeAccountWithCode(cache, "caller", MustSplice(callerCodePrefix, - // Give just enough gas to make the DELEGATECALL - delegateCallCost, callerCodeSuffix)) - - // Should pass - txe := runVM(cache, ourVm, caller, callee, cache.GetEVMCode(caller), 100) - assert.Nil(t, txe.Exception, "Should have sufficient funds for call") - assert.Equal(t, Int64ToWord256(calleeReturnValue).Bytes(), txe.Result.Return) - - caller2 := makeAccountWithCode(cache, "caller2", MustSplice(callerCodePrefix, - // Shouldn't be enough gas to make call - delegateCallCost-1, callerCodeSuffix)) - - // Should fail - txe = runVM(cache, ourVm, caller2, callee, cache.GetEVMCode(caller2), 100) - assert.NotNil(t, txe.Exception, "Should have insufficient gas for call") -} - -func TestMemoryBounds(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - memoryProvider := func(err errors.Sink) Memory { - return NewDynamicMemory(1024, 2048, err) - } - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger, MemoryProvider(memoryProvider)) - caller := makeAccountWithCode(cache, "caller", nil) - callee := makeAccountWithCode(cache, "callee", nil) - gas := uint64(100000) - // This attempts to store a value at the memory boundary and return it - word := One256 - output, err := ourVm.Call(cache, NewNoopEventSink(), caller, callee, - MustSplice(pushWord(word), storeAtEnd(), MLOAD, storeAtEnd(), returnAfterStore()), - nil, 0, &gas) - assert.NoError(t, err) - assert.Equal(t, word.Bytes(), output) - - // Same with number - word = Int64ToWord256(232234234432) - output, err = ourVm.Call(cache, NewNoopEventSink(), caller, callee, - MustSplice(pushWord(word), storeAtEnd(), MLOAD, storeAtEnd(), returnAfterStore()), - nil, 0, &gas) - assert.NoError(t, err) - assert.Equal(t, word.Bytes(), output) - - // Now test a series of boundary stores - code := pushWord(word) - for i := 0; i < 10; i++ { - code = MustSplice(code, storeAtEnd(), MLOAD) - } - output, err = ourVm.Call(cache, NewNoopEventSink(), caller, callee, MustSplice(code, storeAtEnd(), returnAfterStore()), - nil, 0, &gas) - assert.NoError(t, err) - assert.Equal(t, word.Bytes(), output) - - // Same as above but we should breach the upper memory limit set in memoryProvider - code = pushWord(word) - for i := 0; i < 100; i++ { - code = MustSplice(code, storeAtEnd(), MLOAD) - } - require.NoError(t, cache.Error()) - _, err = ourVm.Call(cache, NewNoopEventSink(), caller, callee, MustSplice(code, storeAtEnd(), returnAfterStore()), - nil, 0, &gas) - assert.Error(t, err, "Should hit memory out of bounds") -} - -func TestMsgSender(t *testing.T) { - st := newAppState() - cache := NewState(st, blockHashGetter) - account1 := newAccount(cache, "1, 2, 3") - account2 := newAccount(cache, "3, 2, 1") - - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - var gas uint64 = 100000 - - /* - pragma solidity ^0.5.4; - - contract SimpleStorage { - function get() public constant returns (address) { - return msg.sender; - } - } - */ - - // This bytecode is compiled from Solidity contract above using remix.ethereum.org online compiler - code := hex.MustDecodeString("6060604052341561000f57600080fd5b60ca8061001d6000396000f30060606040526004361060" + - "3f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c14604457" + - "5b600080fd5b3415604e57600080fd5b60546096565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ff" + - "ffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000339050905600a165627a" + - "7a72305820b9ebf49535372094ae88f56d9ad18f2a79c146c8f56e7ef33b9402924045071e0029") - - // Run the contract initialisation code to obtain the contract code that would be mounted at account2 - contractCode, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, code, code, 0, &gas) - require.NoError(t, err) - - // Not needed for this test (since contract code is passed as argument to vm), but this is what an execution - // framework must do - cache.InitCode(account2, contractCode) - - // Input is the function hash of `get()` - input := hex.MustDecodeString("6d4ce63c") - - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, contractCode, input, 0, &gas) - require.NoError(t, err) - - assert.Equal(t, account1.Word256().Bytes(), output) - - require.NoError(t, cache.Error()) -} - -func TestInvalid(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - // Create accounts - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "1, 0, 1") - - var gas uint64 = 100000 - - bytecode := MustSplice(PUSH32, 0x72, 0x65, 0x76, 0x65, 0x72, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, PUSH1, 0x00, MSTORE, PUSH1, 0x0E, PUSH1, 0x00, INVALID) - - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assert.Equal(t, errors.ErrorCodeExecutionAborted, err.ErrorCode()) - t.Logf("Output: %v Error: %v\n", output, err) -} - -func TestReturnDataSize(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - accountName := "account2addresstests" - - ret := "My return message" - callcode := MustSplice(PUSH32, RightPadWord256([]byte(ret)), PUSH1, 0x00, MSTORE, PUSH1, len(ret), PUSH1, 0x00, RETURN) - - // Create accounts - account1 := newAccount(cache, "1") - account2 := makeAccountWithCode(cache, accountName, callcode) - - var gas uint64 = 100000 - - gas1, gas2 := byte(0x1), byte(0x1) - value := byte(0x69) - inOff, inSize := byte(0x0), byte(0x0) // no call data - retOff, retSize := byte(0x0), byte(len(ret)) - - bytecode := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, inOff, PUSH1, value, - PUSH20, account2, PUSH2, gas1, gas2, CALL, - RETURNDATASIZE, PUSH1, 0x00, MSTORE, PUSH1, 0x20, PUSH1, 0x00, RETURN) - - expected := Uint64ToWord256(uint64(len(ret))).Bytes() - - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - require.NoError(t, err) - assert.Equal(t, expected, output) - - t.Logf("Output: %v Error: %v\n", output, err) - - if err != nil { - t.Fatal(err) - } - require.NoError(t, cache.Error()) -} - -func TestReturnDataCopy(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - - accountName := "account2addresstests" - - ret := "My return message" - callcode := MustSplice(PUSH32, RightPadWord256([]byte(ret)), PUSH1, 0x00, MSTORE, PUSH1, len(ret), PUSH1, 0x00, RETURN) - - // Create accounts - account1 := newAccount(cache, "1") - account2 := makeAccountWithCode(cache, accountName, callcode) - - var gas uint64 = 100000 - - gas1, gas2 := byte(0x1), byte(0x1) - value := byte(0x69) - inOff, inSize := byte(0x0), byte(0x0) // no call data - retOff, retSize := byte(0x0), byte(len(ret)) - - bytecode := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, inOff, PUSH1, value, - PUSH20, account2, PUSH2, gas1, gas2, CALL, RETURNDATASIZE, PUSH1, 0x00, PUSH1, 0x00, RETURNDATACOPY, - RETURNDATASIZE, PUSH1, 0x00, RETURN) - - expected := []byte(ret) - - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - require.NoError(t, err) - assert.Equal(t, expected, output) - - t.Logf("Output: %v Error: %v\n", output, err) - - require.NoError(t, cache.Error()) -} - -func TestCallNonExistent(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - account1 := newAccount(cache, "1") - cache.AddToBalance(account1, 10000) - unknownAddress := newAddress("nonexistent") - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - var gas uint64 - amt := uint64(100) - _, err := ourVm.Call(cache, NewNoopEventSink(), account1, unknownAddress, nil, nil, amt, &gas) - assertErrorCode(t, errors.ErrorCodeIllegalWrite, err, - "Should not be able to call account before creating it (even before initialising)") - assert.Equal(t, uint64(0), cache.GetBalance(unknownAddress)) -} - -func (ts testState) GetBlockHash(blockNumber uint64) (binary.Word256, error) { - return ts.BlockHashProvider(blockNumber) -} - -func TestGetBlockHash(t *testing.T) { - cache := NewTestState(newAppState(), blockHashGetter) - params := newParams() - - // Create accounts - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "101") - - var gas uint64 = 100000 - - // Non existing block - params.BlockHeight = 1 - ourVm := NewVM(params, crypto.ZeroAddress, nil, logger) - bytecode := MustSplice(PUSH1, 2, BLOCKHASH) - _, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assertErrorCode(t, errors.ErrorCodeInvalidBlockNumber, err, "attempt to get block hash of a non-existent block") - - // Excessive old block - cache.error = nil - params.BlockHeight = 258 - ourVm = NewVM(params, crypto.ZeroAddress, nil, logger) - bytecode = MustSplice(PUSH1, 1, BLOCKHASH) - - _, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assertErrorCode(t, errors.ErrorCodeBlockNumberOutOfRange, err, "attempt to get block hash of a block outside of allowed range") - - // Get block hash - cache.error = nil - params.BlockHeight = 257 - cache.BlockHashProvider = func(blockNumber uint64) (Word256, error) { - // Should be just within range 257 - 2 = 255 (and the first and last block count in that range so add one = 256) - assert.Equal(t, uint64(2), blockNumber) - return One256, nil - } - ourVm = NewVM(params, crypto.ZeroAddress, nil, logger) - bytecode = MustSplice(PUSH1, 2, BLOCKHASH, return1()) - - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assert.NoError(t, err) - assert.Equal(t, One256, LeftPadWord256(output)) - - // Get block hash fail - cache.error = nil - params.BlockHeight = 3 - cache.BlockHashProvider = func(blockNumber uint64) (Word256, error) { - assert.Equal(t, uint64(1), blockNumber) - return Zero256, fmt.Errorf("unknown block %v", blockNumber) - } - ourVm = NewVM(params, crypto.ZeroAddress, nil, logger) - bytecode = MustSplice(PUSH1, 1, BLOCKHASH, return1()) - - _, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assertErrorCode(t, errors.ErrorCodeInvalidBlockNumber, err, "attempt to get block hash failed") -} - -// These code segment helpers exercise the MSTORE MLOAD MSTORE cycle to test -// both of the memory operations. Each MSTORE is done on the memory boundary -// (at MSIZE) which Solidity uses to find guaranteed unallocated memory. - -// storeAtEnd expects the value to be stored to be on top of the stack, it then -// stores that value at the current memory boundary -func storeAtEnd() []byte { - // Pull in MSIZE (to carry forward to MLOAD), swap in value to store, store it at MSIZE - return MustSplice(MSIZE, SWAP1, DUP2, MSTORE) -} - -func returnAfterStore() []byte { - return MustSplice(PUSH1, 32, DUP2, RETURN) -} - -// Store the top element of the stack (which is a 32-byte word) in memory -// and return it. Useful for a simple return value. -func return1() []byte { - return MustSplice(PUSH1, 0, MSTORE, returnWord()) -} - -func returnWord() []byte { - // PUSH1 => return size, PUSH1 => return offset, RETURN - return MustSplice(PUSH1, 32, PUSH1, 0, RETURN) -} - -// Subscribes to an AccCall, runs the vm, returns the output any direct exception -// and then waits for any exceptions transmitted by Data in the AccCall -// event (in the case of no direct error from call we will block waiting for -// at least 1 AccCall event) -func runVM(vmCache Interface, ourVm *VM, caller, callee crypto.Address, contractCode []byte, - gas uint64) *exec.TxExecution { - gasBefore := gas - txe := new(exec.TxExecution) - output, err := ourVm.Call(vmCache, txe, caller, callee, contractCode, []byte{}, 0, &gas) - txe.PushError(err) - for _, ev := range txe.ExceptionalCalls() { - txe.PushError(ev.Header.Exception) - } - txe.Return(output, gasBefore-gas) - return txe -} - -// this is code to call another contract (hardcoded as addr) -func callContractCode(addr crypto.Address) []byte { - gas1, gas2 := byte(0x1), byte(0x1) - value := byte(0x69) - inOff, inSize := byte(0x0), byte(0x0) // no call data - retOff, retSize := byte(0x0), byte(0x20) - // this is the code we want to run (send funds to an account and return) - return MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, - inOff, PUSH1, value, PUSH20, addr, PUSH2, gas1, gas2, CALL, PUSH1, retSize, - PUSH1, retOff, RETURN) -} - -// Produce bytecode for a PUSH, b_1, ..., b_N where the N is number of bytes -// contained in the unpadded word -func pushWord(word Word256) []byte { - leadingZeros := byte(0) - for leadingZeros < 32 { - if word[leadingZeros] == 0 { - leadingZeros++ - } else { - return MustSplice(byte(PUSH32)-leadingZeros, word[leadingZeros:]) - } - } - return MustSplice(PUSH1, 0) -} - -func TestPushWord(t *testing.T) { - word := Int64ToWord256(int64(2133213213)) - assert.Equal(t, MustSplice(PUSH4, 0x7F, 0x26, 0x40, 0x1D), pushWord(word)) - word[0] = 1 - assert.Equal(t, MustSplice(PUSH32, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x7F, 0x26, 0x40, 0x1D), pushWord(word)) - assert.Equal(t, MustSplice(PUSH1, 0), pushWord(Word256{})) - assert.Equal(t, MustSplice(PUSH1, 1), pushWord(Int64ToWord256(1))) -} - -// Kind of indirect test of Splice, but here to avoid import cycles -func TestBytecode(t *testing.T) { - assert.Equal(t, - MustSplice(1, 2, 3, 4, 5, 6), - MustSplice(1, 2, 3, MustSplice(4, 5, 6))) - assert.Equal(t, - MustSplice(1, 2, 3, 4, 5, 6, 7, 8), - MustSplice(1, 2, 3, MustSplice(4, MustSplice(5), 6), 7, 8)) - assert.Equal(t, - MustSplice(PUSH1, 2), - MustSplice(byte(PUSH1), 0x02)) - assert.Equal(t, - []byte{}, - MustSplice(MustSplice(MustSplice()))) - - contractAccount := &acm.Account{Address: crypto.AddressFromWord256(Int64ToWord256(102))} - addr := contractAccount.Address - gas1, gas2 := byte(0x1), byte(0x1) - value := byte(0x69) - inOff, inSize := byte(0x0), byte(0x0) // no call data - retOff, retSize := byte(0x0), byte(0x20) - contractCodeBytecode := MustSplice(PUSH1, retSize, PUSH1, retOff, PUSH1, inSize, PUSH1, - inOff, PUSH1, value, PUSH20, addr, PUSH2, gas1, gas2, CALL, PUSH1, retSize, - PUSH1, retOff, RETURN) - contractCode := []byte{0x60, retSize, 0x60, retOff, 0x60, inSize, 0x60, inOff, 0x60, value, 0x73} - contractCode = append(contractCode, addr[:]...) - contractCode = append(contractCode, []byte{0x61, gas1, gas2, 0xf1, 0x60, 0x20, 0x60, 0x0, 0xf3}...) - assert.Equal(t, contractCode, contractCodeBytecode) -} - -func TestConcat(t *testing.T) { - assert.Equal(t, - []byte{0x01, 0x02, 0x03, 0x04}, - Concat([]byte{0x01, 0x02}, []byte{0x03, 0x04})) -} - -func TestSubslice(t *testing.T) { - const size = 10 - data := make([]byte, size) - for i := 0; i < size; i++ { - data[i] = byte(i) - } - err := errors.FirstOnly() - for n := int64(0); n < size; n++ { - data = data[:n] - for offset := int64(-size); offset < size; offset++ { - for length := int64(-size); length < size; length++ { - err.Reset() - subslice(data, offset, length, err) - if offset < 0 || length < 0 || n < offset { - assert.NotNil(t, err.Error()) - } else { - assert.Nil(t, err.Error()) - } - } - } - } - - err.Reset() - assert.Equal(t, []byte{ - 5, 6, 7, 8, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - }, subslice([]byte{1, 2, 3, 4, 5, 6, 7, 8}, 4, 32, err)) -} - -func TestHasPermission(t *testing.T) { - st := newAppState() - acc := &acm.Account{ - Address: newAddress("frog"), - Permissions: permission.AccountPermissions{ - Base: BasePermissionsFromStrings(t, - "00100000001000111", - "11011100010111000"), - }, - } - require.NoError(t, st.UpdateAccount(acc)) - // Ensure we are falling through to global permissions on those bits not set - cache := NewState(st, blockHashGetter) - assert.True(t, HasPermission(cache, acc.Address, PermFlagFromString(t, "100000001000110"))) - require.NoError(t, cache.Error()) -} - -func TestDataStackOverflow(t *testing.T) { - st := newAppState() - cache := NewState(st, blockHashGetter) - account1 := newAccount(cache, "1, 2, 3") - account2 := newAccount(cache, "3, 2, 1") - - params := newParams() - params.DataStackMaxDepth = 4 - ourVm := NewVM(params, crypto.ZeroAddress, nil, logger) - - var gas uint64 = 100000 - - /* - pragma solidity ^0.5.4; - - contract SimpleStorage { - function get() public constant returns (address) { - return get(); - } - } - */ - - // This bytecode is compiled from Solidity contract above using remix.ethereum.org online compiler - code, err := hex.DecodeString("608060405234801561001057600080fd5b5060d18061001f6000396000f300608060405260043610" + - "603f576000357c0100000000000000000000000000000000000000000000000000000000900463ff" + - "ffffff1680636d4ce63c146044575b600080fd5b348015604f57600080fd5b5060566098565b6040" + - "51808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffff" + - "ffffffffffff16815260200191505060405180910390f35b600060a06098565b9050905600a16562" + - "7a7a72305820daacfba0c21afacb5b67f26bc8021de63eaa560db82f98357d4e513f3249cf350029") - require.NoError(t, err) - - // Run the contract initialisation code to obtain the contract code that would be mounted at account2 - eventSink := NewNoopEventSink() - contractCode, err := ourVm.Call(cache, eventSink, account1, account2, code, code, 0, &gas) - require.NoError(t, err) - - // Input is the function hash of `get()` - input, err := hex.DecodeString("6d4ce63c") - require.NoError(t, err) - - _, err = ourVm.Call(cache, eventSink, account1, account2, contractCode, input, 0, &gas) - assertErrorCode(t, errors.ErrorCodeDataStackOverflow, err, "Should be stack overflow") -} - -func TestCallStackOverflow(t *testing.T) { - st := newAppState() - cache := NewState(st, blockHashGetter) - account1 := newAccount(cache, "1, 2, 3") - account2 := newAccount(cache, "3, 2, 1") - - params := newParams() - - // Sender accepts lot of gaz but we run on a caped call stack node - var gas uint64 = 100000 - params.CallStackMaxDepth = 2 - - ourVm := NewVM(params, crypto.ZeroAddress, nil, logger) - - /* - pragma solidity ^0.5.4; - - contract A { - function callMeBack() public { - return require(msg.sender.call(bytes4(keccak256("callMeBack()")),this)); - } - } - */ - - // This bytecode is compiled from Solidity contract above using remix.ethereum.org online compiler - code, err := hex.DecodeString("608060405234801561001057600080fd5b5061017a806100206000396000f3006080604052600436" + - "10610041576000357c01000000000000000000000000000000000000000000000000000000009004" + - "63ffffffff168063692c3b7c14610046575b600080fd5b34801561005257600080fd5b5061005b61" + - "005d565b005b3373ffffffffffffffffffffffffffffffffffffffff1660405180807f63616c6c4d" + - "654261636b28290000000000000000000000000000000000000000815250600c0190506040518091" + - "0390207c010000000000000000000000000000000000000000000000000000000090043060405182" + - "63ffffffff167c010000000000000000000000000000000000000000000000000000000002815260" + - "0401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffff" + - "ffffffffffffff1681526020019150506000604051808303816000875af192505050151561014c57" + - "600080fd5b5600a165627a7a723058209315a40abb8b23b7c2a340e938b01367b419a23818475a2e" + - "ee80d09da3f7ba780029") - require.NoError(t, err) - - // Run the contract initialisation code to obtain the contract code that would be mounted at account2 - contractCode, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, code, code, 0, &gas) - require.NoError(t, err) - - cache.InitCode(account1, contractCode) - cache.InitCode(account2, contractCode) - - // keccak256 hash of 'callMeBack()' - input, err := hex.DecodeString("692c3b7c") - require.NoError(t, err) - - txe := new(exec.TxExecution) - _, err = ourVm.Call(cache, txe, account1, account2, contractCode, input, 0, &gas) - txe.PushError(err) - require.Error(t, err) - callError := txe.CallError() - require.Error(t, callError) - assertErrorCode(t, errors.ErrorCodeExecutionReverted, callError) - // Errors are post-order so first is deepest - deepestErr := callError.NestedErrors[0] - assertErrorCode(t, errors.ErrorCodeCallStackOverflow, deepestErr) - assert.Equal(t, params.CallStackMaxDepth, deepestErr.StackDepth) - assert.Equal(t, account2, deepestErr.Callee) - assert.Equal(t, account1, deepestErr.Caller) -} - -func TestExtCodeHash(t *testing.T) { - cache := NewState(newAppState(), blockHashGetter) - ourVm := NewVM(newParams(), crypto.ZeroAddress, nil, logger) - account1 := newAccount(cache, "1") - account2 := newAccount(cache, "101") - - var gas uint64 = 100000 - - // 1. The EXTCODEHASH of the account without code is c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 - // what is the keccack256 hash of empty data. - bytecode := MustSplice(PUSH20, account1, EXTCODEHASH, return1()) - output, err := ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assert.NoError(t, err) - assert.Equal(t, hex.MustDecodeString("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"), output) - - // 2. The EXTCODEHASH of non-existent account is 0. - bytecode = MustSplice(PUSH1, 0x03, EXTCODEHASH, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assert.NoError(t, err) - assert.Equal(t, LeftPadBytes([]uint8([]byte{0x00}), 32), output) - - // 3. EXTCODEHASH is the hash of an account code - acc := makeAccountWithCode(cache, "trustedCode", MustSplice(BLOCKHASH, return1())) - bytecode = MustSplice(PUSH20, acc, EXTCODEHASH, return1()) - output, err = ourVm.Call(cache, NewNoopEventSink(), account1, account2, bytecode, []byte{}, 0, &gas) - assert.NoError(t, err) - assert.Equal(t, hex.MustDecodeString("010da270094b5199d3e54f89afe4c66cdd658dd8111a41998714227e14e171bd"), output) -} - -func BasePermissionsFromStrings(t *testing.T, perms, setBit string) permission.BasePermissions { - return permission.BasePermissions{ - Perms: PermFlagFromString(t, perms), - SetBit: PermFlagFromString(t, setBit), - } -} - -func PermFlagFromString(t *testing.T, binaryString string) permission.PermFlag { - permFlag, err := strconv.ParseUint(binaryString, 2, 64) - require.NoError(t, err) - return permission.PermFlag(permFlag) -} - -func assertErrorCode(t *testing.T, expectedCode errors.Code, err error, msgAndArgs ...interface{}) { - if assert.Error(t, err, msgAndArgs...) { - actualCode := errors.AsException(err).Code - if !assert.Equal(t, expectedCode, actualCode, "expected error code %v", expectedCode) { - t.Logf("Expected '%v' but got '%v'", expectedCode, actualCode) - } - } -} diff --git a/execution/exec/block_execution.go b/execution/exec/block_execution.go index ad664ba36..6f05c81cf 100644 --- a/execution/exec/block_execution.go +++ b/execution/exec/block_execution.go @@ -9,15 +9,19 @@ import ( "github.com/hyperledger/burrow/txs" ) -func EventStringBlockExecution(height uint64) string { return fmt.Sprintf("Execution/Block/%v", height) } +func EventStringBlockExecution(height uint64) string { + return fmt.Sprintf("Execution/Block/%v", height) +} // Write out TxExecutions parenthetically func (be *BlockExecution) StreamEvents() []*StreamEvent { var ses []*StreamEvent ses = append(ses, &StreamEvent{ BeginBlock: &BeginBlock{ - Height: be.Height, - Header: be.Header, + Height: be.Height, + PredecessorHeight: be.PredecessorHeight, + NumTxs: uint64(len(be.TxExecutions)), + Header: be.Header, }, }) for _, txe := range be.TxExecutions { diff --git a/execution/exec/block_execution_test.go b/execution/exec/block_execution_test.go index 009efa303..6cb6f9bcb 100644 --- a/execution/exec/block_execution_test.go +++ b/execution/exec/block_execution_test.go @@ -5,12 +5,12 @@ import ( "github.com/hyperledger/burrow/event/query" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) func TestBlockExecution_Marshal(t *testing.T) { be := &BlockExecution{ - Header: &types.Header{ + Header: &tmproto.Header{ Height: 3, AppHash: []byte{2}, ProposerAddress: []byte{1, 2, 33}, @@ -24,7 +24,7 @@ func TestBlockExecution_Marshal(t *testing.T) { func TestBlockExecution_StreamEvents(t *testing.T) { be := &BlockExecution{ - Header: &types.Header{ + Header: &tmproto.Header{ Height: 2, AppHash: []byte{2}, ProposerAddress: []byte{1, 2, 33}, diff --git a/execution/exec/call_event.go b/execution/exec/call_event.go index c7a5ef633..63ab6eba2 100644 --- a/execution/exec/call_event.go +++ b/execution/exec/call_event.go @@ -3,19 +3,19 @@ package exec type CallType uint32 const ( + CallTypeInvalid = CallType(1<<32 - 1) CallTypeCall = CallType(0x00) CallTypeCode = CallType(0x01) CallTypeDelegate = CallType(0x02) CallTypeStatic = CallType(0x03) - CallTypeSNative = CallType(0x04) ) var nameFromCallType = map[CallType]string{ + CallTypeInvalid: "InvalidCall", CallTypeCall: "Call", CallTypeCode: "CallCode", CallTypeDelegate: "DelegateCall", CallTypeStatic: "StaticCall", - CallTypeSNative: "SNativeCall", } var callTypeFromName = make(map[string]CallType) diff --git a/execution/exec/event.go b/execution/exec/event.go index ffa600fcc..153f38c3c 100644 --- a/execution/exec/event.go +++ b/execution/exec/event.go @@ -27,6 +27,7 @@ const ( TypeEnvelope TypeEndTx TypeEndBlock + TypePrint ) var nameFromType = map[EventType]string{ @@ -97,19 +98,6 @@ func (ev *Event) Body() string { return "" } -// Tags -type Events []*Event - -func (tevs Events) Filter(qry query.Query) Events { - var filtered Events - for _, tev := range tevs { - if qry.Matches(tev) { - filtered = append(filtered, tev) - } - } - return filtered -} - func (ev *Event) Get(key string) (value interface{}, ok bool) { switch key { case event.MessageTypeKey: diff --git a/execution/evm/event_sink.go b/execution/exec/event_sink.go similarity index 51% rename from execution/evm/event_sink.go rename to execution/exec/event_sink.go index 04642db24..ef5e4bde9 100644 --- a/execution/evm/event_sink.go +++ b/execution/exec/event_sink.go @@ -1,13 +1,13 @@ -package evm +package exec import ( "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/execution/exec" ) type EventSink interface { - Call(call *exec.CallEvent, exception *errors.Exception) error - Log(log *exec.LogEvent) error + Call(call *CallEvent, exception *errors.Exception) error + Log(log *LogEvent) error + Print(print *PrintEvent) error } type noopEventSink struct { @@ -17,11 +17,15 @@ func NewNoopEventSink() *noopEventSink { return &noopEventSink{} } -func (es *noopEventSink) Call(call *exec.CallEvent, exception *errors.Exception) error { +func (es *noopEventSink) Call(call *CallEvent, exception *errors.Exception) error { return nil } -func (es *noopEventSink) Log(log *exec.LogEvent) error { +func (es *noopEventSink) Log(log *LogEvent) error { + return nil +} + +func (es *noopEventSink) Print(print *PrintEvent) error { return nil } @@ -35,7 +39,7 @@ func NewLogFreeEventSink(eventSink EventSink) *logFreeEventSink { } } -func (esc *logFreeEventSink) Log(log *exec.LogEvent) error { - return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, +func (esc *logFreeEventSink) Log(log *LogEvent) error { + return errors.Errorf(errors.Codes.IllegalWrite, "Log emitted from contract %v, but current call should be log-free", log.Address) } diff --git a/execution/exec/event_test.go b/execution/exec/event_test.go index f57b2ed88..775410347 100644 --- a/execution/exec/event_test.go +++ b/execution/exec/event_test.go @@ -56,8 +56,6 @@ func TestEventTagQueries(t *testing.T) { require.NoError(t, err) assert.True(t, qry.Matches(ev)) require.NoError(t, qry.MatchError()) - - t.Logf("Query: %v", qry) } func BenchmarkMatching(b *testing.B) { diff --git a/execution/exec/events.go b/execution/exec/events.go new file mode 100644 index 000000000..6c5be8f6a --- /dev/null +++ b/execution/exec/events.go @@ -0,0 +1,104 @@ +package exec + +import ( + "fmt" + "strings" + + "github.com/hyperledger/burrow/event/query" + "github.com/hyperledger/burrow/execution/errors" +) + +type Events []*Event + +func (evs *Events) Append(tail ...*Event) { + for i, ev := range tail { + if ev != nil && ev.Header != nil { + ev.Header.Index = uint64(len(*evs) + i) + } + } + *evs = append(*evs, tail...) +} + +func (evs *Events) Call(call *CallEvent, exception *errors.Exception) error { + evs.Append(&Event{ + Header: &Header{ + EventType: TypeCall, + EventID: EventStringAccountCall(call.CallData.Callee), + Exception: exception, + }, + Call: call, + }) + return nil +} + +func (evs *Events) Log(log *LogEvent) error { + evs.Append(&Event{ + Header: &Header{ + EventType: TypeLog, + EventID: EventStringLogEvent(log.Address), + }, + Log: log, + }) + return nil +} + +func (evs *Events) Print(print *PrintEvent) error { + evs.Append(&Event{ + Header: &Header{ + EventType: TypePrint, + EventID: EventStringLogEvent(print.Address), + }, + Print: print, + }) + return nil +} + +func (evs Events) CallTrace() string { + var calls []string + for _, ev := range evs { + if ev.Call != nil { + ex := "" + if ev.Header.Exception != nil { + ex = fmt.Sprintf(" [%v]", ev.Header.Exception) + } + calls = append(calls, fmt.Sprintf("%v: %v -> %v: %v%s", + ev.Call.CallType, ev.Call.CallData.Caller, ev.Call.CallData.Callee, ev.Call.Return, ex)) + } + } + return strings.Join(calls, "\n") +} + +func (evs Events) ExceptionalCalls() []*Event { + var exCalls []*Event + for _, ev := range evs { + if ev.Call != nil && ev.Header.Exception != nil { + exCalls = append(exCalls, ev) + } + } + return exCalls +} + +func (evs Events) NestedCallErrors() []errors.NestedCallError { + var nestedErrors []errors.NestedCallError + for _, ev := range evs { + if ev.Call != nil && ev.Header.Exception != nil { + nestedErrors = append(nestedErrors, errors.NestedCallError{ + CodedError: ev.Header.Exception, + Caller: ev.Call.CallData.Caller, + Callee: ev.Call.CallData.Callee, + StackDepth: ev.Call.StackDepth, + }) + } + } + return nestedErrors +} + +func (evs Events) Filter(qry query.Query) Events { + var filtered Events + for _, tev := range evs { + if qry.Matches(tev) { + filtered = append(filtered, tev) + } + } + return filtered +} diff --git a/execution/exec/exec.pb.go b/execution/exec/exec.pb.go index aa23b65fc..a28c5e588 100644 --- a/execution/exec/exec.pb.go +++ b/execution/exec/exec.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" time "time" _ "github.com/gogo/protobuf/gogoproto" @@ -23,7 +24,7 @@ import ( github_com_hyperledger_burrow_txs "github.com/hyperledger/burrow/txs" txs "github.com/hyperledger/burrow/txs" github_com_hyperledger_burrow_txs_payload "github.com/hyperledger/burrow/txs/payload" - types "github.com/tendermint/tendermint/abci/types" + types "github.com/tendermint/tendermint/proto/tendermint/types" ) // Reference imports to suppress errors if they are not otherwise used. @@ -37,7 +38,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 // This message exists purely for framing []StreamEvent type StreamEvents struct { @@ -58,7 +59,7 @@ func (m *StreamEvents) XXX_Unmarshal(b []byte) error { } func (m *StreamEvents) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -110,7 +111,7 @@ func (m *StreamEvent) XXX_Unmarshal(b []byte) error { } func (m *StreamEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -169,7 +170,11 @@ func (*StreamEvent) XXX_MessageName() string { type BeginBlock struct { // The height of this block - Height uint64 `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"` + Height uint64 `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"` + // The number of transactions in the block (used as a checksum when consuming StreamEvents) + NumTxs uint64 `protobuf:"varint,3,opt,name=NumTxs,proto3" json:"NumTxs,omitempty"` + // The height of the most recent block we stored in state (which is the last non-empty block in current implementation) + PredecessorHeight uint64 `protobuf:"varint,4,opt,name=PredecessorHeight,proto3" json:"PredecessorHeight,omitempty"` Header *types.Header `protobuf:"bytes,2,opt,name=Header,proto3" json:"Header,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -187,7 +192,7 @@ func (m *BeginBlock) XXX_Unmarshal(b []byte) error { } func (m *BeginBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -212,6 +217,20 @@ func (m *BeginBlock) GetHeight() uint64 { return 0 } +func (m *BeginBlock) GetNumTxs() uint64 { + if m != nil { + return m.NumTxs + } + return 0 +} + +func (m *BeginBlock) GetPredecessorHeight() uint64 { + if m != nil { + return m.PredecessorHeight + } + return 0 +} + func (m *BeginBlock) GetHeader() *types.Header { if m != nil { return m.Header @@ -241,7 +260,7 @@ func (m *EndBlock) XXX_Unmarshal(b []byte) error { } func (m *EndBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -272,6 +291,8 @@ func (*EndBlock) XXX_MessageName() string { type BeginTx struct { TxHeader *TxHeader `protobuf:"bytes,1,opt,name=TxHeader,proto3" json:"TxHeader,omitempty"` + // The number of events generated by this transaction execution (used as a checksum when consuming StreamEvents) + NumEvents uint64 `protobuf:"varint,5,opt,name=NumEvents,proto3" json:"NumEvents,omitempty"` // Result of tx execution Result *Result `protobuf:"bytes,2,opt,name=Result,proto3" json:"Result,omitempty"` // If tx execution was an exception @@ -292,7 +313,7 @@ func (m *BeginTx) XXX_Unmarshal(b []byte) error { } func (m *BeginTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -317,6 +338,13 @@ func (m *BeginTx) GetTxHeader() *TxHeader { return nil } +func (m *BeginTx) GetNumEvents() uint64 { + if m != nil { + return m.NumEvents + } + return 0 +} + func (m *BeginTx) GetResult() *Result { if m != nil { return m.Result @@ -354,7 +382,7 @@ func (m *EndTx) XXX_Unmarshal(b []byte) error { } func (m *EndTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -381,7 +409,7 @@ type TxHeader struct { TxType github_com_hyperledger_burrow_txs_payload.Type `protobuf:"varint,1,opt,name=TxType,proto3,casttype=github.com/hyperledger/burrow/txs/payload.Type" json:"TxType,omitempty"` // The hash of the transaction that caused this event to be generated TxHash github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,2,opt,name=TxHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"TxHash"` - // The block height at which this Tx was included + // The block height at which this transaction was included Height uint64 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` // The index of this transaction within the block Index uint64 `protobuf:"varint,4,opt,name=Index,proto3" json:"Index,omitempty"` @@ -403,7 +431,7 @@ func (m *TxHeader) XXX_Unmarshal(b []byte) error { } func (m *TxHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -455,7 +483,9 @@ func (*TxHeader) XXX_MessageName() string { type BlockExecution struct { // The height of this block - Height uint64 `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"` + Height uint64 `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"` + // The height of the most recent block we stored in state (which is the last non-empty block in current implementation) + PredecessorHeight uint64 `protobuf:"varint,4,opt,name=PredecessorHeight,proto3" json:"PredecessorHeight,omitempty"` Header *types.Header `protobuf:"bytes,2,opt,name=Header,proto3" json:"Header,omitempty"` TxExecutions []*TxExecution `protobuf:"bytes,3,rep,name=TxExecutions,proto3" json:"TxExecutions,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -474,7 +504,7 @@ func (m *BlockExecution) XXX_Unmarshal(b []byte) error { } func (m *BlockExecution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -499,6 +529,13 @@ func (m *BlockExecution) GetHeight() uint64 { return 0 } +func (m *BlockExecution) GetPredecessorHeight() uint64 { + if m != nil { + return m.PredecessorHeight + } + return 0 +} + func (m *BlockExecution) GetHeader() *types.Header { if m != nil { return m.Header @@ -538,7 +575,7 @@ func (m *TxExecutionKey) XXX_Unmarshal(b []byte) error { } func (m *TxExecutionKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -604,7 +641,7 @@ func (m *TxExecution) XXX_Unmarshal(b []byte) error { } func (m *TxExecution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -686,7 +723,7 @@ func (m *Origin) XXX_Unmarshal(b []byte) error { } func (m *Origin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -766,7 +803,7 @@ func (m *Header) XXX_Unmarshal(b []byte) error { } func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -837,6 +874,7 @@ type Event struct { Call *CallEvent `protobuf:"bytes,4,opt,name=Call,proto3" json:"Call,omitempty"` Log *LogEvent `protobuf:"bytes,5,opt,name=Log,proto3" json:"Log,omitempty"` GovernAccount *GovernAccountEvent `protobuf:"bytes,6,opt,name=GovernAccount,proto3" json:"GovernAccount,omitempty"` + Print *PrintEvent `protobuf:"bytes,7,opt,name=Print,proto3" json:"Print,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -852,7 +890,7 @@ func (m *Event) XXX_Unmarshal(b []byte) error { } func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -912,6 +950,13 @@ func (m *Event) GetGovernAccount() *GovernAccountEvent { return nil } +func (m *Event) GetPrint() *PrintEvent { + if m != nil { + return m.Print + } + return nil +} + func (*Event) XXX_MessageName() string { return "exec.Event" } @@ -942,7 +987,7 @@ func (m *Result) XXX_Unmarshal(b []byte) error { } func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1012,7 +1057,7 @@ func (m *LogEvent) XXX_Unmarshal(b []byte) error { } func (m *LogEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1056,7 +1101,7 @@ func (m *CallEvent) XXX_Unmarshal(b []byte) error { } func (m *CallEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1099,6 +1144,47 @@ func (*CallEvent) XXX_MessageName() string { return "exec.CallEvent" } +type PrintEvent struct { + Address github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address"` + Data github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,2,opt,name=Data,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"Data"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PrintEvent) Reset() { *m = PrintEvent{} } +func (m *PrintEvent) String() string { return proto.CompactTextString(m) } +func (*PrintEvent) ProtoMessage() {} +func (*PrintEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_4d737c7315c25422, []int{16} +} +func (m *PrintEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PrintEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PrintEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_PrintEvent.Merge(m, src) +} +func (m *PrintEvent) XXX_Size() int { + return m.Size() +} +func (m *PrintEvent) XXX_DiscardUnknown() { + xxx_messageInfo_PrintEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_PrintEvent proto.InternalMessageInfo + +func (*PrintEvent) XXX_MessageName() string { + return "exec.PrintEvent" +} + type GovernAccountEvent struct { AccountUpdate *spec.TemplateAccount `protobuf:"bytes,1,opt,name=AccountUpdate,proto3" json:"AccountUpdate,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1110,14 +1196,14 @@ func (m *GovernAccountEvent) Reset() { *m = GovernAccountEvent{} } func (m *GovernAccountEvent) String() string { return proto.CompactTextString(m) } func (*GovernAccountEvent) ProtoMessage() {} func (*GovernAccountEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_4d737c7315c25422, []int{16} + return fileDescriptor_4d737c7315c25422, []int{17} } func (m *GovernAccountEvent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GovernAccountEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1157,14 +1243,14 @@ func (m *InputEvent) Reset() { *m = InputEvent{} } func (m *InputEvent) String() string { return proto.CompactTextString(m) } func (*InputEvent) ProtoMessage() {} func (*InputEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_4d737c7315c25422, []int{17} + return fileDescriptor_4d737c7315c25422, []int{18} } func (m *InputEvent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *InputEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1197,14 +1283,14 @@ func (m *OutputEvent) Reset() { *m = OutputEvent{} } func (m *OutputEvent) String() string { return proto.CompactTextString(m) } func (*OutputEvent) ProtoMessage() {} func (*OutputEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_4d737c7315c25422, []int{18} + return fileDescriptor_4d737c7315c25422, []int{19} } func (m *OutputEvent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OutputEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1227,28 +1313,29 @@ func (*OutputEvent) XXX_MessageName() string { } type CallData struct { - Caller github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Caller,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Caller"` - Callee github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,2,opt,name=Callee,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Callee"` - Data github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,3,opt,name=Data,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"Data"` - Value uint64 `protobuf:"varint,4,opt,name=Value,proto3" json:"Value,omitempty"` - Gas uint64 `protobuf:"varint,5,opt,name=Gas,proto3" json:"Gas,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Caller github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Caller,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Caller"` + Callee github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,2,opt,name=Callee,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Callee"` + Data github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,3,opt,name=Data,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"Data"` + // Bytes of a big integer value + Value []byte `protobuf:"bytes,4,opt,name=Value,proto3" json:"Value,omitempty"` + Gas []byte `protobuf:"bytes,5,opt,name=Gas,proto3" json:"Gas,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CallData) Reset() { *m = CallData{} } func (m *CallData) String() string { return proto.CompactTextString(m) } func (*CallData) ProtoMessage() {} func (*CallData) Descriptor() ([]byte, []int) { - return fileDescriptor_4d737c7315c25422, []int{19} + return fileDescriptor_4d737c7315c25422, []int{20} } func (m *CallData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *CallData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -1266,18 +1353,18 @@ func (m *CallData) XXX_DiscardUnknown() { var xxx_messageInfo_CallData proto.InternalMessageInfo -func (m *CallData) GetValue() uint64 { +func (m *CallData) GetValue() []byte { if m != nil { return m.Value } - return 0 + return nil } -func (m *CallData) GetGas() uint64 { +func (m *CallData) GetGas() []byte { if m != nil { return m.Gas } - return 0 + return nil } func (*CallData) XXX_MessageName() string { @@ -1316,6 +1403,8 @@ func init() { golang_proto.RegisterType((*LogEvent)(nil), "exec.LogEvent") proto.RegisterType((*CallEvent)(nil), "exec.CallEvent") golang_proto.RegisterType((*CallEvent)(nil), "exec.CallEvent") + proto.RegisterType((*PrintEvent)(nil), "exec.PrintEvent") + golang_proto.RegisterType((*PrintEvent)(nil), "exec.PrintEvent") proto.RegisterType((*GovernAccountEvent)(nil), "exec.GovernAccountEvent") golang_proto.RegisterType((*GovernAccountEvent)(nil), "exec.GovernAccountEvent") proto.RegisterType((*InputEvent)(nil), "exec.InputEvent") @@ -1330,93 +1419,97 @@ func init() { proto.RegisterFile("exec.proto", fileDescriptor_4d737c7315c25422) func init() { golang_proto.RegisterFile("exec.proto", fileDescriptor_4d737c7315c25422) } var fileDescriptor_4d737c7315c25422 = []byte{ - // 1275 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x93, 0x13, 0xc5, - 0x17, 0x67, 0x92, 0xc9, 0xaf, 0x4e, 0x96, 0x2f, 0x74, 0xf1, 0xa5, 0x52, 0x1c, 0x12, 0x1c, 0x14, - 0x11, 0x61, 0x42, 0xad, 0xa2, 0x16, 0x56, 0x59, 0x12, 0x36, 0xc2, 0x0a, 0x82, 0x36, 0x01, 0x4b, - 0x4b, 0x0f, 0x93, 0x99, 0x66, 0x32, 0x45, 0x32, 0x33, 0x35, 0xd3, 0xc1, 0xc9, 0x3f, 0xe0, 0xc1, - 0xf2, 0xa0, 0x37, 0xbc, 0x58, 0xfc, 0x1f, 0x5e, 0x3c, 0xee, 0x4d, 0x8e, 0x16, 0x87, 0x68, 0x2d, - 0x7f, 0x81, 0xe5, 0xc9, 0x3d, 0x59, 0xdd, 0xfd, 0x7a, 0xd2, 0x23, 0xcb, 0x2e, 0x65, 0xf6, 0xe0, - 0x25, 0xd5, 0xef, 0xbd, 0x4f, 0xbf, 0xbc, 0x7e, 0xef, 0xf3, 0xde, 0x1b, 0x84, 0x68, 0x46, 0x5d, - 0x3b, 0x4e, 0x22, 0x16, 0x61, 0x93, 0x9f, 0x4f, 0x9c, 0xf7, 0x03, 0x36, 0x9e, 0x8d, 0x6c, 0x37, - 0x9a, 0xf6, 0xfc, 0xc8, 0x8f, 0x7a, 0xc2, 0x38, 0x9a, 0xdd, 0x13, 0x92, 0x10, 0xc4, 0x49, 0x5e, - 0x3a, 0xf1, 0xb6, 0x06, 0x67, 0x34, 0xf4, 0x68, 0x32, 0x0d, 0x42, 0xa6, 0x1f, 0x9d, 0x91, 0x1b, - 0xf4, 0xd8, 0x3c, 0xa6, 0xa9, 0xfc, 0x85, 0x8b, 0x5d, 0x3f, 0x8a, 0xfc, 0x09, 0x5d, 0xba, 0x67, - 0xc1, 0x94, 0xa6, 0xcc, 0x99, 0xc6, 0x00, 0x68, 0xd1, 0x24, 0x89, 0x12, 0x05, 0x6f, 0x86, 0xce, - 0x34, 0xbf, 0xdb, 0x60, 0x99, 0x3a, 0x1e, 0x89, 0xf9, 0xdf, 0xa4, 0x69, 0x10, 0x85, 0xa0, 0x41, - 0x69, 0xac, 0x9e, 0x64, 0x0d, 0x50, 0xeb, 0x36, 0x4b, 0xa8, 0x33, 0x1d, 0x3c, 0xa0, 0x21, 0x4b, - 0xf1, 0xc5, 0xa2, 0xdc, 0x36, 0x4e, 0x96, 0xcf, 0x34, 0xd7, 0x8f, 0xda, 0x22, 0x0b, 0x9a, 0x85, - 0x14, 0x60, 0xd6, 0x4f, 0x25, 0xd4, 0xd4, 0x14, 0xf8, 0x02, 0x42, 0x7d, 0xea, 0x07, 0x61, 0x7f, - 0x12, 0xb9, 0xf7, 0xdb, 0xc6, 0x49, 0xe3, 0x4c, 0x73, 0xfd, 0x88, 0x74, 0xb2, 0xd4, 0x13, 0x0d, - 0x83, 0x5f, 0x45, 0x35, 0x21, 0x0d, 0xb3, 0x76, 0x49, 0xc0, 0xd7, 0x34, 0xf8, 0x30, 0x23, 0xca, - 0x8a, 0x3f, 0x43, 0xf5, 0x41, 0xf8, 0x80, 0x4e, 0xa2, 0x98, 0xb6, 0xcb, 0x80, 0xe4, 0xaf, 0x55, - 0xca, 0xbe, 0xfd, 0x64, 0xd1, 0x3d, 0xab, 0x25, 0x7d, 0x3c, 0x8f, 0x69, 0x32, 0xa1, 0x9e, 0x4f, - 0x93, 0xde, 0x68, 0x96, 0x24, 0xd1, 0x57, 0x3d, 0x1d, 0x4f, 0x72, 0x77, 0xf8, 0x25, 0x54, 0x11, - 0xe1, 0xb7, 0x4d, 0xe1, 0xb7, 0x29, 0x23, 0x90, 0xef, 0x95, 0x16, 0x01, 0x09, 0xbd, 0x61, 0xd6, - 0xae, 0x14, 0x20, 0x5c, 0x45, 0xa4, 0x05, 0x9f, 0xe5, 0x01, 0x7a, 0xf2, 0xe5, 0x55, 0x81, 0x3a, - 0x9c, 0xa3, 0xe4, 0xbb, 0x73, 0xfb, 0x25, 0x73, 0xeb, 0x51, 0xd7, 0xb0, 0xae, 0xeb, 0xd9, 0xc2, - 0xc7, 0x51, 0xf5, 0x1a, 0x0d, 0xfc, 0x31, 0x13, 0x79, 0x33, 0x09, 0x48, 0xf8, 0x15, 0xae, 0x77, - 0x3c, 0x9a, 0xe4, 0x09, 0x92, 0x6c, 0x91, 0x4a, 0x02, 0x46, 0xcb, 0x5a, 0xfe, 0xfd, 0xf3, 0x5c, - 0x59, 0xdf, 0x1a, 0x79, 0xb6, 0x79, 0xb8, 0xc3, 0x0c, 0x1c, 0x1b, 0x7a, 0xb8, 0x4a, 0x4b, 0x72, - 0x3b, 0x7e, 0x19, 0x55, 0x09, 0x4d, 0x67, 0x13, 0x06, 0x21, 0xb4, 0x24, 0x52, 0xea, 0x08, 0xd8, - 0x70, 0x0f, 0x35, 0x06, 0x99, 0x4b, 0x63, 0x16, 0x44, 0x21, 0xa4, 0xf2, 0xa8, 0x0d, 0x5c, 0xcd, - 0x0d, 0x64, 0x89, 0xb1, 0xee, 0x42, 0x52, 0xf1, 0x47, 0xa8, 0x3a, 0xcc, 0xae, 0x39, 0xe9, 0x58, - 0x54, 0xb6, 0xd5, 0xbf, 0xb8, 0xb5, 0xe8, 0x1e, 0x7a, 0xb2, 0xe8, 0x9e, 0xdf, 0xbb, 0x9c, 0xa3, - 0x20, 0x74, 0x92, 0xb9, 0x7d, 0x8d, 0x66, 0xfd, 0x39, 0xa3, 0x29, 0x01, 0x27, 0xd6, 0x5f, 0xc6, - 0xf2, 0x6d, 0xf8, 0x43, 0xee, 0x7b, 0x38, 0x8f, 0xa9, 0x78, 0xe5, 0x5a, 0x7f, 0x7d, 0x67, 0xd1, - 0xb5, 0xf7, 0xa5, 0x49, 0x2f, 0x76, 0xe6, 0x93, 0xc8, 0xf1, 0x6c, 0x7e, 0x93, 0x80, 0x07, 0x2d, - 0xce, 0xd2, 0x01, 0xc4, 0xa9, 0x95, 0xa9, 0x5c, 0xa8, 0xf8, 0x31, 0x54, 0xd9, 0x0c, 0x3d, 0x9a, - 0x89, 0x24, 0x9a, 0x44, 0x0a, 0xbc, 0x08, 0xb7, 0x92, 0xc0, 0x0f, 0x42, 0xe0, 0x20, 0x14, 0x41, - 0xea, 0x08, 0xd8, 0xac, 0xaf, 0x0d, 0x74, 0x58, 0x90, 0x60, 0x90, 0x51, 0x77, 0xc6, 0xd3, 0xbc, - 0x22, 0xb1, 0xf8, 0x68, 0x18, 0x66, 0xb9, 0xb7, 0xb4, 0x5d, 0xd6, 0x47, 0x83, 0x66, 0x21, 0x05, - 0x98, 0xf5, 0x3e, 0x3a, 0xac, 0xc9, 0xd7, 0xe9, 0xfc, 0xb9, 0x71, 0x1c, 0x47, 0xd5, 0x5b, 0xf7, - 0xee, 0xa5, 0x54, 0xb2, 0xcb, 0x24, 0x20, 0x59, 0x7f, 0x94, 0x50, 0x53, 0x73, 0x81, 0xcf, 0xe5, - 0xf1, 0xee, 0xca, 0xd7, 0xbe, 0xf9, 0x78, 0xd1, 0x35, 0xf2, 0xb0, 0xf5, 0x79, 0x51, 0x3d, 0xd8, - 0x79, 0x71, 0x0a, 0x55, 0x61, 0x4c, 0xd6, 0x44, 0x2e, 0x0a, 0x03, 0x03, 0x4c, 0x5a, 0xcf, 0xd4, - 0xf7, 0xe8, 0x99, 0xd3, 0xa8, 0x46, 0xa8, 0x4b, 0x83, 0x98, 0xb5, 0x1b, 0x00, 0xe3, 0x7f, 0x0a, - 0x3a, 0xa2, 0x8c, 0xc5, 0xde, 0x42, 0xfb, 0xf7, 0xd6, 0x33, 0x55, 0x6b, 0xbe, 0x58, 0xd5, 0xbe, - 0x31, 0x14, 0xcb, 0x70, 0x1b, 0xd5, 0xae, 0x8c, 0x9d, 0x20, 0xdc, 0xdc, 0x10, 0xf9, 0x6e, 0x10, - 0x25, 0x6a, 0x85, 0x2c, 0xed, 0xce, 0xdb, 0xb2, 0xce, 0xdb, 0x77, 0x90, 0x39, 0x0c, 0xa6, 0x14, - 0x26, 0xc2, 0x09, 0x5b, 0xae, 0x37, 0x5b, 0xad, 0x37, 0x7b, 0xa8, 0xd6, 0x5b, 0xbf, 0xce, 0xdb, - 0xe9, 0xbb, 0xdf, 0xba, 0x06, 0x11, 0x37, 0xac, 0x5f, 0x4a, 0xaa, 0xe2, 0xff, 0xe5, 0x2e, 0x7e, - 0x1d, 0x35, 0x44, 0xc9, 0x45, 0x74, 0x65, 0x11, 0xdd, 0xda, 0xce, 0xa2, 0xbb, 0x54, 0x92, 0xe5, - 0x91, 0x27, 0x55, 0x08, 0x9b, 0x1b, 0x22, 0x1f, 0x0d, 0xa2, 0x44, 0x2d, 0xa9, 0x95, 0xdd, 0x93, - 0x5a, 0xd5, 0x93, 0x5a, 0xe0, 0x43, 0x6d, 0x7f, 0x3e, 0x5c, 0x32, 0x1f, 0x3e, 0xea, 0x1e, 0xb2, - 0xbe, 0x2f, 0xc1, 0xaa, 0xe3, 0xf4, 0x2c, 0x34, 0x13, 0xd0, 0xf3, 0x1f, 0xbd, 0x7f, 0x9a, 0xff, - 0x79, 0x3c, 0x53, 0x73, 0x1f, 0x56, 0xb9, 0x50, 0xc1, 0x7a, 0x14, 0x67, 0xfc, 0x1a, 0xaa, 0xde, - 0x9a, 0x31, 0x0e, 0x2c, 0xab, 0x58, 0xc4, 0x6c, 0x12, 0x3a, 0xe8, 0x0b, 0x29, 0xe0, 0x53, 0xc8, - 0xbc, 0xe2, 0x4c, 0x26, 0x40, 0x87, 0xff, 0x49, 0x20, 0xd7, 0x48, 0x98, 0x30, 0xe2, 0x93, 0xa8, - 0x7c, 0x23, 0xf2, 0x61, 0xd0, 0x41, 0x9f, 0xdf, 0x88, 0x7c, 0x09, 0xe1, 0x26, 0xfc, 0x1e, 0x5a, - 0xbb, 0x1a, 0x3d, 0xa0, 0x49, 0x78, 0xd9, 0x75, 0xa3, 0x59, 0xc8, 0xa0, 0xc7, 0xdb, 0x12, 0x5b, - 0x30, 0xc9, 0x5b, 0x45, 0xf8, 0xa5, 0x3a, 0xcf, 0x87, 0xd8, 0xc2, 0x0f, 0x0d, 0xd5, 0xa9, 0xbc, - 0x06, 0x84, 0xb2, 0x59, 0x12, 0x8a, 0xa4, 0xb4, 0x08, 0x48, 0xbc, 0x6a, 0x57, 0x9d, 0xf4, 0x4e, - 0x4a, 0x3d, 0x60, 0xbc, 0x12, 0xf1, 0x59, 0xd4, 0xb8, 0xe9, 0x4c, 0xe9, 0x20, 0x64, 0xc9, 0x1c, - 0xde, 0xde, 0xb2, 0xe5, 0x17, 0x99, 0xd0, 0x91, 0xa5, 0x19, 0x5f, 0x40, 0xf5, 0x8f, 0x69, 0x32, - 0xbd, 0x9c, 0xf8, 0x29, 0xbc, 0xfe, 0x98, 0xad, 0x7d, 0xa4, 0x29, 0x1b, 0xc9, 0x51, 0xd6, 0x9f, - 0x06, 0xaa, 0xab, 0x67, 0xe3, 0x9b, 0xa8, 0x76, 0xd9, 0xf3, 0x12, 0x9a, 0xa6, 0x32, 0xba, 0xfe, - 0x9b, 0xc0, 0xdb, 0x73, 0x7b, 0xf3, 0xd6, 0x4d, 0xe6, 0x31, 0x8b, 0x6c, 0xb8, 0x4b, 0x94, 0x13, - 0xbc, 0x89, 0xcc, 0x0d, 0x87, 0x39, 0xab, 0x35, 0x81, 0x70, 0x81, 0x6f, 0xa0, 0xea, 0x30, 0x8a, - 0x03, 0x57, 0x2e, 0x87, 0x17, 0x8e, 0x0c, 0x9c, 0x7d, 0x1a, 0x25, 0xde, 0xfa, 0xc5, 0xb7, 0x08, - 0xf8, 0xb0, 0x7e, 0x2c, 0xa1, 0x46, 0x4e, 0x08, 0x7c, 0x06, 0xd5, 0xb9, 0x20, 0xba, 0xab, 0x22, - 0xba, 0xab, 0xb5, 0xb3, 0xe8, 0xe6, 0x3a, 0x92, 0x9f, 0xf8, 0x17, 0x0d, 0x3f, 0x8b, 0x47, 0x15, - 0x36, 0x84, 0xd2, 0x92, 0xdc, 0xce, 0x23, 0x86, 0x65, 0x5a, 0x5a, 0x21, 0x97, 0x6a, 0x54, 0x76, - 0x10, 0xba, 0xcd, 0x1c, 0xf7, 0xfe, 0x06, 0x8d, 0xd9, 0x18, 0xa6, 0x9f, 0xa6, 0xe1, 0x13, 0x07, - 0x78, 0x65, 0xae, 0x34, 0x71, 0xa4, 0x13, 0xeb, 0x13, 0x84, 0x9f, 0x25, 0x38, 0x7e, 0x17, 0xad, - 0x81, 0x7c, 0x27, 0xf6, 0x1c, 0x46, 0x21, 0x07, 0xff, 0xb7, 0xc5, 0x67, 0xff, 0x90, 0x4e, 0xe3, - 0x89, 0xc3, 0x28, 0x40, 0x48, 0x11, 0x6b, 0x7d, 0x81, 0xd0, 0xb2, 0xab, 0x0f, 0x9a, 0x6a, 0xd6, - 0x97, 0xa8, 0xa9, 0x8d, 0x82, 0x03, 0x77, 0xff, 0x43, 0x09, 0x15, 0x2a, 0xcb, 0xcf, 0x30, 0xd8, - 0xfe, 0x75, 0x65, 0xa5, 0x8f, 0xdc, 0x1b, 0x5d, 0x8d, 0x27, 0xd2, 0x47, 0xde, 0x72, 0xe5, 0xd5, - 0x5b, 0xee, 0x18, 0xaa, 0xdc, 0x75, 0x26, 0x33, 0xaa, 0xbe, 0x11, 0x85, 0x80, 0x8f, 0xa0, 0xf2, - 0x55, 0x27, 0x85, 0x0d, 0xc2, 0x8f, 0xfd, 0x0f, 0xb6, 0xb6, 0x3b, 0xc6, 0xe3, 0xed, 0x8e, 0xf1, - 0xeb, 0x76, 0xc7, 0xf8, 0x7d, 0xbb, 0x63, 0xfc, 0xfc, 0xb4, 0x63, 0x6c, 0x3d, 0xed, 0x18, 0x9f, - 0xef, 0xf3, 0x04, 0xaa, 0x3e, 0x0a, 0xc4, 0x69, 0x54, 0x15, 0xfb, 0xfa, 0x8d, 0xbf, 0x03, 0x00, - 0x00, 0xff, 0xff, 0xf5, 0x7c, 0x70, 0x97, 0x18, 0x0f, 0x00, 0x00, + // 1340 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xef, 0xda, 0x6b, 0xc7, 0x7e, 0x76, 0xfa, 0x6d, 0x47, 0xf9, 0x22, 0xab, 0xaa, 0xec, 0xb2, + 0x45, 0xa5, 0x94, 0xb2, 0xae, 0x02, 0x45, 0xa8, 0x48, 0x88, 0xba, 0x09, 0x6d, 0xa0, 0xa4, 0x65, + 0xea, 0x16, 0x81, 0xe0, 0xb0, 0xf1, 0x4e, 0x9d, 0x55, 0xed, 0xdd, 0xd5, 0xec, 0xb8, 0xac, 0xff, + 0x05, 0x4e, 0x1c, 0x8b, 0x84, 0x50, 0x6f, 0x48, 0xfc, 0x07, 0x88, 0x03, 0x1c, 0x73, 0xa3, 0x47, + 0xd4, 0x83, 0x41, 0xe9, 0x5f, 0x80, 0x38, 0xd1, 0x13, 0x9a, 0x99, 0x37, 0xeb, 0x5d, 0xd2, 0x26, + 0x15, 0x09, 0x52, 0x2f, 0xd1, 0xbc, 0xf7, 0x3e, 0xfb, 0xfc, 0x7e, 0x7c, 0xde, 0x9b, 0x09, 0x00, + 0x4b, 0xd9, 0xc0, 0x8d, 0x79, 0x24, 0x22, 0x62, 0xcb, 0xf3, 0xb1, 0xa5, 0x61, 0x34, 0x8c, 0x94, + 0xa2, 0x2b, 0x4f, 0xda, 0x76, 0xec, 0xb8, 0x60, 0xa1, 0xcf, 0xf8, 0x38, 0x08, 0x45, 0x57, 0x4c, + 0x63, 0x96, 0xe8, 0xbf, 0x68, 0xed, 0x0c, 0xa3, 0x68, 0x38, 0x62, 0x5d, 0x25, 0x6d, 0x4c, 0x6e, + 0x77, 0x45, 0x30, 0x66, 0x89, 0xf0, 0xc6, 0x31, 0x02, 0x9a, 0x8c, 0xf3, 0x88, 0x1b, 0x78, 0x23, + 0xf4, 0xc6, 0xd9, 0xb7, 0x75, 0x91, 0x9a, 0xe3, 0x91, 0x58, 0xfe, 0x42, 0x92, 0x04, 0x51, 0x88, + 0x1a, 0x48, 0x62, 0x13, 0x9e, 0xb3, 0x0a, 0xcd, 0x1b, 0x82, 0x33, 0x6f, 0xbc, 0x7a, 0x97, 0x85, + 0x22, 0x21, 0xe7, 0x8b, 0x72, 0xcb, 0x3a, 0x51, 0x3e, 0xdd, 0x58, 0x3e, 0xea, 0xaa, 0x8c, 0x72, + 0x16, 0x5a, 0x80, 0x39, 0x3f, 0x96, 0xa0, 0x91, 0x53, 0x90, 0x73, 0x00, 0x3d, 0x36, 0x0c, 0xc2, + 0xde, 0x28, 0x1a, 0xdc, 0x69, 0x59, 0x27, 0xac, 0xd3, 0x8d, 0xe5, 0x23, 0xda, 0xc9, 0x5c, 0x4f, + 0x73, 0x18, 0xf2, 0x32, 0x2c, 0x28, 0xa9, 0x9f, 0xb6, 0x4a, 0x0a, 0xbe, 0x98, 0x83, 0xf7, 0x53, + 0x6a, 0xac, 0xe4, 0x13, 0xa8, 0xad, 0x86, 0x77, 0xd9, 0x28, 0x8a, 0x59, 0xab, 0x8c, 0x48, 0x99, + 0xad, 0x51, 0xf6, 0xdc, 0x87, 0xb3, 0xce, 0x99, 0x61, 0x20, 0x36, 0x27, 0x1b, 0xee, 0x20, 0x1a, + 0x77, 0x37, 0xa7, 0x31, 0xe3, 0x23, 0xe6, 0x0f, 0x19, 0xef, 0x6e, 0x4c, 0x38, 0x8f, 0xbe, 0xe8, + 0xe6, 0xf1, 0x34, 0x73, 0x47, 0x5e, 0x84, 0x8a, 0x0a, 0xbf, 0x65, 0x2b, 0xbf, 0x0d, 0x1d, 0x81, + 0xce, 0x57, 0x5b, 0x14, 0x24, 0xf4, 0xfb, 0x69, 0xab, 0x52, 0x80, 0x48, 0x15, 0xd5, 0x16, 0x72, + 0x46, 0x06, 0xe8, 0xeb, 0xcc, 0xab, 0x0a, 0x75, 0x38, 0x43, 0xe9, 0xbc, 0x33, 0xfb, 0x05, 0x7b, + 0xeb, 0x7e, 0xc7, 0x72, 0xbe, 0xb1, 0xf2, 0xe5, 0x22, 0x2f, 0x40, 0xf5, 0x0a, 0x0b, 0x86, 0x9b, + 0x42, 0x15, 0xce, 0xa6, 0x28, 0x49, 0xfd, 0xfa, 0x64, 0xdc, 0x4f, 0x13, 0x95, 0xb7, 0x4d, 0x51, + 0x22, 0x67, 0xe1, 0xe8, 0x75, 0xce, 0x7c, 0x36, 0x60, 0x49, 0x12, 0x71, 0xfc, 0xd4, 0x56, 0x90, + 0x9d, 0x06, 0x72, 0x4e, 0x7a, 0xf7, 0x7c, 0xc6, 0xb1, 0xce, 0x2d, 0x77, 0xce, 0x42, 0x57, 0xf3, + 0x4f, 0xdb, 0x29, 0xe2, 0x1c, 0x67, 0x9e, 0xd0, 0xd3, 0x62, 0x73, 0xbe, 0xb7, 0xb2, 0xfe, 0xc9, + 0x02, 0xf4, 0x53, 0xfc, 0x0d, 0x2b, 0x5f, 0x00, 0xa3, 0xa5, 0x99, 0x9d, 0x1c, 0x87, 0xfa, 0xfa, + 0xc4, 0x90, 0xad, 0xa2, 0x5c, 0xce, 0x15, 0xe4, 0x25, 0xa8, 0x52, 0x96, 0x4c, 0x46, 0x02, 0x63, + 0x6d, 0x6a, 0x3f, 0x5a, 0x47, 0xd1, 0x46, 0xba, 0x50, 0x5f, 0x4d, 0x07, 0x2c, 0x16, 0x41, 0x14, + 0x62, 0xeb, 0x8e, 0xba, 0x38, 0x1b, 0x99, 0x81, 0xce, 0x31, 0xce, 0x2d, 0x6c, 0x22, 0xf9, 0x10, + 0xaa, 0xfd, 0xf4, 0x8a, 0x97, 0x6c, 0xaa, 0x8a, 0x36, 0x7b, 0xe7, 0xb7, 0x66, 0x9d, 0x43, 0x0f, + 0x67, 0x9d, 0xd7, 0x76, 0xa7, 0xcf, 0x46, 0x10, 0x7a, 0x7c, 0xea, 0x5e, 0x61, 0x69, 0x6f, 0x2a, + 0x58, 0x42, 0xd1, 0x89, 0xf3, 0x97, 0x35, 0xcf, 0x9c, 0xbc, 0x2f, 0x7d, 0xf7, 0xa7, 0x31, 0x53, + 0x35, 0x58, 0xec, 0x2d, 0x3f, 0x9e, 0x75, 0xdc, 0x3d, 0x69, 0xd9, 0x8d, 0xbd, 0xe9, 0x28, 0xf2, + 0x7c, 0x57, 0x7e, 0x49, 0xd1, 0x43, 0x2e, 0xce, 0xd2, 0x01, 0xc4, 0x99, 0x6b, 0x62, 0xb9, 0x40, + 0xb0, 0x25, 0xa8, 0xac, 0x85, 0x3e, 0x4b, 0x91, 0x3c, 0x5a, 0x90, 0x4d, 0xb8, 0xc6, 0x83, 0x61, + 0x10, 0x22, 0xe7, 0xb1, 0x09, 0x5a, 0x47, 0xd1, 0xe6, 0xfc, 0x64, 0xc1, 0x61, 0x45, 0x91, 0xd5, + 0x94, 0x0d, 0x26, 0xb2, 0xcc, 0x4f, 0xe5, 0xf1, 0x7f, 0xcc, 0x57, 0xb9, 0xc3, 0xfa, 0x69, 0x16, + 0x86, 0x9c, 0x96, 0xdc, 0x0e, 0xcb, 0x59, 0x68, 0x01, 0xe6, 0xbc, 0x0b, 0x87, 0x73, 0xf2, 0x07, + 0x6c, 0xba, 0xdb, 0x20, 0x5e, 0xbb, 0x7d, 0x3b, 0x61, 0x9a, 0x96, 0x36, 0x45, 0xc9, 0xf9, 0xa3, + 0x04, 0x8d, 0x9c, 0x0b, 0x72, 0x36, 0x0b, 0xfd, 0x89, 0x63, 0xd0, 0xb3, 0x1f, 0xcc, 0x3a, 0x56, + 0x16, 0x76, 0x7e, 0xb1, 0x55, 0x0f, 0x76, 0xb1, 0x9d, 0x84, 0x2a, 0x8e, 0xd8, 0x82, 0xaa, 0x45, + 0x61, 0xb3, 0x55, 0x77, 0x0c, 0x5b, 0x6d, 0x97, 0x61, 0x3b, 0x05, 0x0b, 0x94, 0x0d, 0x58, 0x10, + 0x8b, 0x56, 0x1d, 0x61, 0xf2, 0x47, 0x51, 0x47, 0x8d, 0xb1, 0x38, 0x94, 0xb0, 0xf7, 0x50, 0xee, + 0xe8, 0x5a, 0xe3, 0xd9, 0xba, 0xf6, 0xa5, 0x65, 0xe8, 0x49, 0x5a, 0xb0, 0x70, 0x69, 0xd3, 0x0b, + 0xc2, 0xb5, 0x15, 0x55, 0xef, 0x3a, 0x35, 0x62, 0xae, 0x91, 0xa5, 0x27, 0x13, 0xbe, 0x9c, 0x27, + 0xfc, 0x5b, 0x60, 0xf7, 0x83, 0x31, 0xc3, 0x55, 0x72, 0xcc, 0xd5, 0xf7, 0xb0, 0x6b, 0xee, 0x61, + 0xb7, 0x6f, 0xee, 0xe1, 0x5e, 0x4d, 0xce, 0xe1, 0x57, 0xbf, 0x75, 0x2c, 0xaa, 0xbe, 0x70, 0x7e, + 0x29, 0x99, 0x8e, 0x3f, 0xcf, 0xe3, 0xff, 0x2a, 0xd4, 0x55, 0xcb, 0x55, 0x74, 0x65, 0x15, 0xdd, + 0xe2, 0xe3, 0x59, 0x67, 0xae, 0xa4, 0xf3, 0xa3, 0x2c, 0xaa, 0x12, 0xd6, 0x56, 0x54, 0x3d, 0xea, + 0xd4, 0x88, 0xb9, 0xa2, 0x56, 0x9e, 0x5c, 0xd4, 0x6a, 0xbe, 0xa8, 0x05, 0x3e, 0x2c, 0xec, 0xcd, + 0x87, 0x0b, 0xf6, 0xbd, 0xfb, 0x9d, 0x43, 0xce, 0x0f, 0x25, 0xbc, 0x93, 0x25, 0x3d, 0x0b, 0xc3, + 0x84, 0xf4, 0xfc, 0xc7, 0xec, 0x9f, 0x92, 0x3f, 0x1e, 0x4f, 0xcc, 0x85, 0x81, 0x6f, 0x0e, 0xa5, + 0xc2, 0x7b, 0x5c, 0x9d, 0xc9, 0x2b, 0x50, 0xbd, 0x36, 0x11, 0x12, 0x58, 0x36, 0xb1, 0xa8, 0xa5, + 0xa6, 0x74, 0x38, 0x17, 0x5a, 0x20, 0x27, 0xc1, 0xbe, 0xe4, 0x8d, 0x46, 0x48, 0x87, 0xff, 0x69, + 0xa0, 0xd4, 0x68, 0x98, 0x32, 0x92, 0x13, 0x50, 0xbe, 0x1a, 0x0d, 0x71, 0x43, 0xe2, 0x9c, 0x5f, + 0x8d, 0x86, 0x1a, 0x22, 0x4d, 0xe4, 0x1d, 0x58, 0xbc, 0x1c, 0xdd, 0x65, 0x3c, 0xbc, 0x38, 0x18, + 0x44, 0x93, 0x50, 0xe0, 0x8c, 0xb7, 0x34, 0xb6, 0x60, 0xd2, 0x5f, 0x15, 0xe1, 0x32, 0xb3, 0xeb, + 0x3c, 0x08, 0x05, 0x16, 0x0f, 0x33, 0x53, 0x2a, 0xcc, 0x4c, 0x9d, 0x2f, 0xd4, 0x64, 0xdd, 0xd4, + 0xb3, 0xe2, 0x9e, 0x65, 0x26, 0x5a, 0xf6, 0x8a, 0x32, 0x31, 0xe1, 0xa1, 0x2a, 0x5e, 0x93, 0xa2, + 0x24, 0xbb, 0x7b, 0xd9, 0x4b, 0x6e, 0x26, 0xcc, 0xc7, 0xc9, 0x30, 0x22, 0x39, 0x03, 0xf5, 0x75, + 0x6f, 0xcc, 0x56, 0x43, 0xc1, 0xa7, 0x58, 0xa3, 0xa6, 0xab, 0x9f, 0x98, 0x4a, 0x47, 0xe7, 0x66, + 0x72, 0x0e, 0x6a, 0xd7, 0x19, 0x1f, 0x5f, 0xe4, 0xc3, 0x04, 0xab, 0xb4, 0xe4, 0xe6, 0x5e, 0x9d, + 0xc6, 0x46, 0x33, 0x94, 0xf3, 0xa7, 0x05, 0x35, 0x53, 0x1e, 0xb2, 0x0e, 0x0b, 0x17, 0x7d, 0x9f, + 0xb3, 0x24, 0xd1, 0xd1, 0xf5, 0xde, 0x40, 0x7e, 0x9f, 0xdd, 0x9d, 0xdf, 0x03, 0x3e, 0x8d, 0x45, + 0xe4, 0xe2, 0xb7, 0xd4, 0x38, 0x21, 0x6b, 0x60, 0xaf, 0x78, 0xc2, 0xdb, 0xdf, 0xb0, 0x28, 0x17, + 0xe4, 0x2a, 0x54, 0xfb, 0x51, 0x1c, 0x0c, 0xf4, 0x25, 0xf2, 0xcc, 0x91, 0xa1, 0xb3, 0x8f, 0x23, + 0xee, 0x2f, 0x9f, 0x7f, 0x93, 0xa2, 0x0f, 0xe7, 0xdb, 0x12, 0xd4, 0x33, 0xe2, 0x90, 0xd3, 0x50, + 0x93, 0x82, 0x9a, 0xc2, 0x8a, 0x9a, 0xc2, 0xe6, 0xe3, 0x59, 0x27, 0xd3, 0xd1, 0xec, 0x24, 0x1f, + 0x54, 0xf2, 0xac, 0x92, 0x2a, 0xdc, 0x24, 0x46, 0x4b, 0x33, 0xbb, 0x8c, 0x18, 0x6f, 0xeb, 0xd2, + 0x3e, 0x6a, 0x69, 0x56, 0x6a, 0x1b, 0xe0, 0x86, 0xf0, 0x06, 0x77, 0x56, 0x58, 0x2c, 0x36, 0x71, + 0x4b, 0xe6, 0x34, 0x72, 0x33, 0x21, 0xaf, 0xec, 0x7d, 0x6d, 0x26, 0xed, 0xc4, 0xf9, 0xce, 0x02, + 0x98, 0x33, 0xfa, 0x39, 0x26, 0x86, 0xf3, 0x11, 0x90, 0x9d, 0x23, 0x4b, 0xde, 0x86, 0x45, 0x94, + 0x6f, 0xc6, 0xbe, 0x27, 0x18, 0x76, 0xeb, 0xff, 0xae, 0xfa, 0x8f, 0xab, 0xcf, 0xc6, 0xf1, 0xc8, + 0x13, 0x0c, 0x21, 0xb4, 0x88, 0x75, 0x3e, 0x03, 0x98, 0xef, 0xa9, 0x83, 0xce, 0xdd, 0xf9, 0x1c, + 0x1a, 0xb9, 0xe5, 0x76, 0xe0, 0xee, 0xbf, 0x2e, 0x41, 0x81, 0x83, 0xf2, 0x8c, 0xab, 0xfa, 0x5f, + 0x73, 0x50, 0xfb, 0xc8, 0xbc, 0xb1, 0xfd, 0x31, 0x5a, 0xfb, 0xc8, 0x38, 0x50, 0xde, 0xff, 0x72, + 0x58, 0x82, 0xca, 0x2d, 0x6f, 0x34, 0xd1, 0x0f, 0x85, 0x26, 0xd5, 0x02, 0x39, 0x02, 0xe5, 0xcb, + 0x9e, 0xfe, 0x5f, 0xa6, 0x49, 0xe5, 0xb1, 0xf7, 0xde, 0xd6, 0x76, 0xdb, 0x7a, 0xb0, 0xdd, 0xb6, + 0x7e, 0xdd, 0x6e, 0x5b, 0xbf, 0x6f, 0xb7, 0xad, 0x9f, 0x1f, 0xb5, 0xad, 0xad, 0x47, 0x6d, 0xeb, + 0xd3, 0x3d, 0x52, 0x60, 0xe6, 0x99, 0xa3, 0x4e, 0x1b, 0x55, 0xf5, 0x02, 0x79, 0xfd, 0xef, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x10, 0x3f, 0xdf, 0xac, 0x5f, 0x10, 0x00, 0x00, } func (m *StreamEvents) 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 } @@ -1424,32 +1517,40 @@ func (m *StreamEvents) Marshal() (dAtA []byte, err error) { } func (m *StreamEvents) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamEvents) 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.StreamEvents) > 0 { - for _, msg := range m.StreamEvents { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.StreamEvents) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StreamEvents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(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 *StreamEvent) 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 } @@ -1457,80 +1558,98 @@ func (m *StreamEvent) Marshal() (dAtA []byte, err error) { } func (m *StreamEvent) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.BeginBlock != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.BeginBlock.Size())) - n1, err := m.BeginBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.BeginTx != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.BeginTx.Size())) - n2, err := m.BeginTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.EndBlock != nil { + { + size, err := m.EndBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x32 } - if m.Envelope != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Envelope.Size())) - n3, err := m.Envelope.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.EndTx != nil { + { + size, err := m.EndTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x2a } if m.Event != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Event.Size())) - n4, err := m.Event.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Event.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0x22 } - if m.EndTx != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.EndTx.Size())) - n5, err := m.EndTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Envelope != nil { + { + size := m.Envelope.Size() + i -= size + if _, err := m.Envelope.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0x1a } - if m.EndBlock != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.EndBlock.Size())) - n6, err := m.EndBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.BeginTx != nil { + { + size, err := m.BeginTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n6 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.BeginBlock != nil { + { + size, err := m.BeginBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *BeginBlock) 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 } @@ -1538,35 +1657,53 @@ func (m *BeginBlock) Marshal() (dAtA []byte, err error) { } func (m *BeginBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Height)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.PredecessorHeight != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.PredecessorHeight)) + i-- + dAtA[i] = 0x20 + } + if m.NumTxs != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.NumTxs)) + i-- + dAtA[i] = 0x18 } if m.Header != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Header.Size())) - n7, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n7 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *EndBlock) 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 } @@ -1574,25 +1711,31 @@ func (m *EndBlock) Marshal() (dAtA []byte, err error) { } func (m *EndBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EndBlock) 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 m.Height != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintExec(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *BeginTx) 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 } @@ -1600,50 +1743,67 @@ func (m *BeginTx) Marshal() (dAtA []byte, err error) { } func (m *BeginTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BeginTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TxHeader != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.TxHeader.Size())) - n8, err := m.TxHeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n8 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.Result != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Result.Size())) - n9, err := m.Result.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n9 + if m.NumEvents != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.NumEvents)) + i-- + dAtA[i] = 0x28 } if m.Exception != nil { + { + size, err := m.Exception.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x22 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Exception.Size())) - n10, err := m.Exception.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + if m.Result != nil { + { + size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n10 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.TxHeader != nil { + { + size, err := m.TxHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *EndTx) 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 } @@ -1651,28 +1811,36 @@ func (m *EndTx) Marshal() (dAtA []byte, err error) { } func (m *EndTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EndTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x1a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.TxHash.Size())) - n11, err := m.TxHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n11 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 := m.TxHash.Size() + i -= size + if _, err := m.TxHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + return len(dAtA) - i, nil } func (m *TxHeader) 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 } @@ -1680,53 +1848,63 @@ func (m *TxHeader) Marshal() (dAtA []byte, err error) { } func (m *TxHeader) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TxType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.TxType)) - } - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.TxHash.Size())) - n12, err := m.TxHash.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 += n12 - if m.Height != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Height)) + if m.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } if m.Index != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintExec(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x20 } - if m.Origin != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Origin.Size())) - n13, err := m.Origin.MarshalTo(dAtA[i:]) - if err != nil { + if m.Height != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + { + size := m.TxHash.Size() + i -= size + if _, err := m.TxHash.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n13 + i = encodeVarintExec(dAtA, i, uint64(size)) } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + if m.TxType != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.TxType)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *BlockExecution) 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 } @@ -1734,47 +1912,62 @@ func (m *BlockExecution) Marshal() (dAtA []byte, err error) { } func (m *BlockExecution) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockExecution) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Height)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.Header != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Header.Size())) - n14, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n14 + if m.PredecessorHeight != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.PredecessorHeight)) + i-- + dAtA[i] = 0x20 } if len(m.TxExecutions) > 0 { - for _, msg := range m.TxExecutions { + for iNdEx := len(m.TxExecutions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TxExecutions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x1a - i++ - i = encodeVarintExec(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *TxExecutionKey) 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 } @@ -1782,30 +1975,36 @@ func (m *TxExecutionKey) Marshal() (dAtA []byte, err error) { } func (m *TxExecutionKey) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxExecutionKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Height)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Offset != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintExec(dAtA, i, uint64(m.Offset)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *TxExecution) 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 } @@ -1813,94 +2012,114 @@ func (m *TxExecution) Marshal() (dAtA []byte, err error) { } func (m *TxExecution) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxExecution) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TxHeader != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.TxHeader.Size())) - n15, err := m.TxHeader.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.TxExecutions) > 0 { + for iNdEx := len(m.TxExecutions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TxExecutions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a } - i += n15 } - if m.Envelope != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Envelope.Size())) - n16, err := m.Envelope.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Exception != nil { + { + size, err := m.Exception.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n16 + i-- + dAtA[i] = 0x52 } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x3a - i++ - i = encodeVarintExec(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.Receipt != nil { + { + size, err := m.Receipt.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x4a } if m.Result != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Result.Size())) - n17, err := m.Result.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n17 + i-- + dAtA[i] = 0x42 } - if m.Receipt != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Receipt.Size())) - n18, err := m.Receipt.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + 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 = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a } - i += n18 } - if m.Exception != nil { - dAtA[i] = 0x52 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Exception.Size())) - n19, err := m.Exception.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Envelope != nil { + { + size := m.Envelope.Size() + i -= size + if _, err := m.Envelope.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n19 + i-- + dAtA[i] = 0x32 } - if len(m.TxExecutions) > 0 { - for _, msg := range m.TxExecutions { - dAtA[i] = 0x5a - i++ - i = encodeVarintExec(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.TxHeader != nil { + { + size, err := m.TxHeader.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintExec(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 *Origin) 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 } @@ -1908,44 +2127,51 @@ func (m *Origin) Marshal() (dAtA []byte, err error) { } func (m *Origin) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Origin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.ChainID) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(len(m.ChainID))) - i += copy(dAtA[i:], m.ChainID) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.Height != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Height)) + n18, err18 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err18 != nil { + return 0, err18 } + i -= n18 + i = encodeVarintExec(dAtA, i, uint64(n18)) + i-- + dAtA[i] = 0x22 if m.Index != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintExec(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x18 } - dAtA[i] = 0x22 - i++ - i = encodeVarintExec(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Time))) - n20, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i:]) - if err != nil { - return 0, err + if m.Height != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 } - i += n20 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintExec(dAtA, i, uint64(len(m.ChainID))) + 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 } @@ -1953,64 +2179,75 @@ 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 - if m.TxType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.TxType)) - } - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.TxHash.Size())) - n21, err := m.TxHash.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 += n21 - if m.EventType != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.EventType)) + if m.Exception != nil { + { + size, err := m.Exception.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a } - if len(m.EventID) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintExec(dAtA, i, uint64(len(m.EventID))) - i += copy(dAtA[i:], m.EventID) + if m.Index != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x30 } if m.Height != 0 { - dAtA[i] = 0x28 - i++ i = encodeVarintExec(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x28 } - if m.Index != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Index)) + if len(m.EventID) > 0 { + i -= len(m.EventID) + copy(dAtA[i:], m.EventID) + i = encodeVarintExec(dAtA, i, uint64(len(m.EventID))) + i-- + dAtA[i] = 0x22 } - if m.Exception != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Exception.Size())) - n22, err := m.Exception.MarshalTo(dAtA[i:]) - if err != nil { + if m.EventType != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.EventType)) + i-- + dAtA[i] = 0x18 + } + { + size := m.TxHash.Size() + i -= size + if _, err := m.TxHash.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n22 + i = encodeVarintExec(dAtA, i, uint64(size)) } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + if m.TxType != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.TxType)) + 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 } @@ -2018,80 +2255,110 @@ 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 m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Header.Size())) - n23, err := m.Header.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 m.Print != nil { + { + size, err := m.Print.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n23 + i-- + dAtA[i] = 0x3a } - if m.Input != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Input.Size())) - n24, err := m.Input.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.GovernAccount != nil { + { + size, err := m.GovernAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n24 + i-- + dAtA[i] = 0x32 } - if m.Output != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Output.Size())) - n25, err := m.Output.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Log != nil { + { + size, err := m.Log.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n25 + i-- + dAtA[i] = 0x2a } if m.Call != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Call.Size())) - n26, err := m.Call.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Call.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n26 + i-- + dAtA[i] = 0x22 } - if m.Log != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Log.Size())) - n27, err := m.Log.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Output != nil { + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n27 + i-- + dAtA[i] = 0x1a } - if m.GovernAccount != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.GovernAccount.Size())) - n28, err := m.GovernAccount.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n28 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Result) 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 } @@ -2099,51 +2366,62 @@ func (m *Result) Marshal() (dAtA []byte, err error) { } func (m *Result) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Return) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(len(m.Return))) - i += copy(dAtA[i:], m.Return) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.GasUsed != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.GasUsed)) + if m.PermArgs != nil { + { + size, err := m.PermArgs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 } if m.NameEntry != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.NameEntry.Size())) - n29, err := m.NameEntry.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.NameEntry.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n29 + i-- + dAtA[i] = 0x1a } - if m.PermArgs != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.PermArgs.Size())) - n30, err := m.PermArgs.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n30 + if m.GasUsed != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Return) > 0 { + i -= len(m.Return) + copy(dAtA[i:], m.Return) + i = encodeVarintExec(dAtA, i, uint64(len(m.Return))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LogEvent) 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 } @@ -2151,48 +2429,60 @@ func (m *LogEvent) Marshal() (dAtA []byte, err error) { } func (m *LogEvent) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LogEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Address.Size())) - n31, err := m.Address.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n31 - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Data.Size())) - n32, err := m.Data.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 += n32 if len(m.Topics) > 0 { - for _, msg := range m.Topics { - dAtA[i] = 0x1a - i++ - i = encodeVarintExec(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Topics) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Topics[iNdEx].Size() + i -= size + if _, err := m.Topics[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size := m.Data.Size() + i -= size + if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0x12 + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *CallEvent) 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 } @@ -2200,56 +2490,115 @@ func (m *CallEvent) Marshal() (dAtA []byte, err error) { } func (m *CallEvent) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CallEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.CallData != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.CallData.Size())) - n33, err := m.CallData.MarshalTo(dAtA[i:]) - if err != nil { + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.CallType != 0 { + i = encodeVarintExec(dAtA, i, uint64(m.CallType)) + i-- + dAtA[i] = 0x28 + } + { + size := m.Return.Size() + i -= size + if _, err := m.Return.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n33 - } - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Origin.Size())) - n34, err := m.Origin.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n34 + i-- + dAtA[i] = 0x22 if m.StackDepth != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintExec(dAtA, i, uint64(m.StackDepth)) + i-- + dAtA[i] = 0x18 } - dAtA[i] = 0x22 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Return.Size())) - n35, err := m.Return.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Origin.Size() + i -= size + if _, err := m.Origin.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n35 - if m.CallType != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.CallType)) + i-- + dAtA[i] = 0x12 + if m.CallData != nil { + { + size, err := m.CallData.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } + return len(dAtA) - i, nil +} + +func (m *PrintEvent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PrintEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PrintEvent) 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 + { + size := m.Data.Size() + i -= size + if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *GovernAccountEvent) 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 } @@ -2257,30 +2606,38 @@ func (m *GovernAccountEvent) Marshal() (dAtA []byte, err error) { } func (m *GovernAccountEvent) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovernAccountEvent) 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 m.AccountUpdate != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.AccountUpdate.Size())) - n36, err := m.AccountUpdate.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.AccountUpdate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintExec(dAtA, i, uint64(size)) } - i += n36 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *InputEvent) 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 } @@ -2288,28 +2645,36 @@ func (m *InputEvent) Marshal() (dAtA []byte, err error) { } func (m *InputEvent) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InputEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Address.Size())) - n37, err := m.Address.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n37 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 := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *OutputEvent) 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 } @@ -2317,28 +2682,36 @@ func (m *OutputEvent) Marshal() (dAtA []byte, err error) { } func (m *OutputEvent) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OutputEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Address.Size())) - n38, err := m.Address.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n38 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 := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *CallData) 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 } @@ -2346,58 +2719,76 @@ func (m *CallData) Marshal() (dAtA []byte, err error) { } func (m *CallData) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CallData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Caller.Size())) - n39, err := m.Caller.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n39 - dAtA[i] = 0x12 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Callee.Size())) - n40, err := m.Callee.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.Gas) > 0 { + i -= len(m.Gas) + copy(dAtA[i:], m.Gas) + i = encodeVarintExec(dAtA, i, uint64(len(m.Gas))) + i-- + dAtA[i] = 0x2a } - i += n40 - dAtA[i] = 0x1a - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Data.Size())) - n41, err := m.Data.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintExec(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x22 } - i += n41 - if m.Value != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Value)) + { + size := m.Data.Size() + i -= size + if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) } - if m.Gas != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintExec(dAtA, i, uint64(m.Gas)) + i-- + dAtA[i] = 0x1a + { + size := m.Callee.Size() + i -= size + if _, err := m.Callee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + { + size := m.Caller.Size() + i -= size + if _, err := m.Caller.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintExec(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func encodeVarintExec(dAtA []byte, offset int, v uint64) int { + offset -= sovExec(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 (m *StreamEvents) Size() (n int) { if m == nil { @@ -2466,6 +2857,12 @@ func (m *BeginBlock) Size() (n int) { l = m.Header.Size() n += 1 + l + sovExec(uint64(l)) } + if m.NumTxs != 0 { + n += 1 + sovExec(uint64(m.NumTxs)) + } + if m.PredecessorHeight != 0 { + n += 1 + sovExec(uint64(m.PredecessorHeight)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2505,6 +2902,9 @@ func (m *BeginTx) Size() (n int) { l = m.Exception.Size() n += 1 + l + sovExec(uint64(l)) } + if m.NumEvents != 0 { + n += 1 + sovExec(uint64(m.NumEvents)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2571,6 +2971,9 @@ func (m *BlockExecution) Size() (n int) { n += 1 + l + sovExec(uint64(l)) } } + if m.PredecessorHeight != 0 { + n += 1 + sovExec(uint64(m.PredecessorHeight)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2727,6 +3130,10 @@ func (m *Event) Size() (n int) { l = m.GovernAccount.Size() n += 1 + l + sovExec(uint64(l)) } + if m.Print != nil { + l = m.Print.Size() + n += 1 + l + sovExec(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2808,6 +3215,22 @@ func (m *CallEvent) Size() (n int) { return n } +func (m *PrintEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Address.Size() + n += 1 + l + sovExec(uint64(l)) + l = m.Data.Size() + n += 1 + l + sovExec(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *GovernAccountEvent) Size() (n int) { if m == nil { return 0 @@ -2864,11 +3287,13 @@ func (m *CallData) Size() (n int) { n += 1 + l + sovExec(uint64(l)) l = m.Data.Size() n += 1 + l + sovExec(uint64(l)) - if m.Value != 0 { - n += 1 + sovExec(uint64(m.Value)) + l = len(m.Value) + if l > 0 { + n += 1 + l + sovExec(uint64(l)) } - if m.Gas != 0 { - n += 1 + sovExec(uint64(m.Gas)) + l = len(m.Gas) + if l > 0 { + n += 1 + l + sovExec(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -2877,14 +3302,7 @@ func (m *CallData) Size() (n int) { } func sovExec(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozExec(x uint64) (n int) { return sovExec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -2954,6 +3372,9 @@ func (this *Event) GetValue() interface{} { if this.GovernAccount != nil { return this.GovernAccount } + if this.Print != nil { + return this.Print + } return nil } @@ -2971,6 +3392,8 @@ func (this *Event) SetValue(value interface{}) bool { this.Log = vt case *GovernAccountEvent: this.GovernAccount = vt + case *PrintEvent: + this.Print = vt default: return false } @@ -3045,10 +3468,7 @@ func (m *StreamEvents) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -3315,10 +3735,7 @@ func (m *StreamEvent) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -3418,16 +3835,51 @@ func (m *BeginBlock) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + 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 ErrIntOverflowExec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumTxs |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PredecessorHeight", wireType) + } + m.PredecessorHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PredecessorHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipExec(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -3497,10 +3949,7 @@ func (m *EndBlock) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -3653,16 +4102,32 @@ func (m *BeginTx) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumEvents", wireType) + } + m.NumEvents = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumEvents |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipExec(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -3746,10 +4211,7 @@ func (m *EndTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -3926,10 +4388,7 @@ func (m *TxHeader) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -4063,16 +4522,32 @@ func (m *BlockExecution) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PredecessorHeight", wireType) + } + m.PredecessorHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PredecessorHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipExec(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -4161,10 +4636,7 @@ func (m *TxExecutionKey) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -4463,10 +4935,7 @@ func (m *TxExecution) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -4620,10 +5089,7 @@ func (m *Origin) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -4851,10 +5317,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -5115,16 +5578,49 @@ func (m *Event) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Print", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthExec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Print == nil { + m.Print = &PrintEvent{} + } + if err := m.Print.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipExec(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -5300,10 +5796,7 @@ func (m *Result) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -5455,10 +5948,7 @@ func (m *LogEvent) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -5649,10 +6139,124 @@ func (m *CallEvent) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthExec + } + 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 *PrintEvent) 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 ErrIntOverflowExec + } + 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: PrintEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrintEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthExec + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthExec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthExec + } + postIndex := iNdEx + byteLen + if postIndex < 0 { return ErrInvalidLengthExec } - if (iNdEx + skippy) < 0 { + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipExec(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -5739,10 +6343,7 @@ func (m *GovernAccountEvent) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -5826,10 +6427,7 @@ func (m *InputEvent) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -5913,10 +6511,7 @@ func (m *OutputEvent) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -6061,10 +6656,10 @@ func (m *CallData) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 4: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } - m.Value = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowExec @@ -6074,16 +6669,31 @@ func (m *CallData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Value |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } + if byteLen < 0 { + return ErrInvalidLengthExec + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthExec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex case 5: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Gas", wireType) } - m.Gas = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowExec @@ -6093,21 +6703,33 @@ func (m *CallData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Gas |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } + if byteLen < 0 { + return ErrInvalidLengthExec + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthExec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Gas = append(m.Gas[:0], dAtA[iNdEx:postIndex]...) + if m.Gas == nil { + m.Gas = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipExec(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthExec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthExec } if (iNdEx + skippy) > l { @@ -6126,6 +6748,7 @@ func (m *CallData) Unmarshal(dAtA []byte) error { func skipExec(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -6157,10 +6780,8 @@ func skipExec(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -6181,55 +6802,30 @@ func skipExec(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthExec } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthExec - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowExec - } - 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 := skipExec(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthExec - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupExec + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthExec + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthExec = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowExec = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthExec = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowExec = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupExec = fmt.Errorf("proto: unexpected end of group") ) diff --git a/execution/exec/log_event.go b/execution/exec/log_event.go index 9d245963c..403793c4a 100644 --- a/execution/exec/log_event.go +++ b/execution/exec/log_event.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package exec @@ -78,8 +67,8 @@ func (log *LogEvent) GetTopic(i int) Word256 { return Word256{} } -func (log *LogEvent) SolidityEventID() abi.EventID { +func SolidityEventID(topics []Word256) abi.EventID { var eventID abi.EventID - copy(eventID[:], log.Topics[0].Bytes()) + copy(eventID[:], topics[0].Bytes()) return eventID } diff --git a/execution/exec/stream_event.go b/execution/exec/stream_event.go index 4db6b04b2..a62edef30 100644 --- a/execution/exec/stream_event.go +++ b/execution/exec/stream_event.go @@ -35,6 +35,8 @@ func (ev *StreamEvent) EventType() EventType { return TypeEndTx case ev.EndBlock != nil: return TypeEndBlock + case ev.Event.Print != nil: + return TypePrint } return TypeUnknown } @@ -56,11 +58,60 @@ func (ev *StreamEvent) Get(key string) (interface{}, bool) { ev.EndBlock).Get(key) } -func ConsumeBlockExecution(stream EventStream) (block *BlockExecution, err error) { +type ContinuityOpt byte + +func (so ContinuityOpt) Allows(opt ContinuityOpt) bool { + return so&opt > 0 +} + +// ContinuityOpt encodes the following possible relaxations in continuity +const ( + // Default - continuous blocks, txs, and events are always permitted + Continuous ContinuityOpt = iota + // Allows consumption of blocks where the next block has a different predecessor block to that which was last consumed + NonConsecutiveBlocks + // Allows consumption of transactions with non-monotonic index (within block) or a different number of transactions + // to that which is expected + NonConsecutiveTxs + // Allows consumption of events with non-monotonic index (within transaction) or a different number of events + // to that which is expected + NonConsecutiveEvents +) + +type BlockAccumulator struct { + block *BlockExecution + // Number of txs expected in current block + numTxs uint64 + // Height of last block consumed that contained transactions + previousNonEmptyBlockHeight uint64 + // Accumulator for Txs + stack TxStack + // Continuity requirements for the stream + continuity ContinuityOpt +} + +func GetContinuity(continuityOptions ...ContinuityOpt) ContinuityOpt { + continuity := Continuous + for _, opt := range continuityOptions { + continuity |= opt + } + return continuity +} + +func NewBlockAccumulator(continuityOptions ...ContinuityOpt) *BlockAccumulator { + continuity := GetContinuity(continuityOptions...) + return &BlockAccumulator{ + continuity: continuity, + stack: TxStack{ + continuity: continuity, + }, + } +} + +func (ba *BlockAccumulator) ConsumeBlockExecution(stream EventStream) (block *BlockExecution, err error) { var ev *StreamEvent - accum := new(BlockAccumulator) for ev, err = stream.Recv(); err == nil; ev, err = stream.Recv() { - block, err = accum.Consume(ev) + block, err = ba.Consume(ev) if err != nil { return nil, err } @@ -72,19 +123,28 @@ func ConsumeBlockExecution(stream EventStream) (block *BlockExecution, err error return nil, err } -type BlockAccumulator struct { - block *BlockExecution - stack TxStack -} - // Consume will add the StreamEvent passed to the block accumulator and if the block complete is complete return the // BlockExecution, otherwise will return nil func (ba *BlockAccumulator) Consume(ev *StreamEvent) (*BlockExecution, error) { switch { case ev.BeginBlock != nil: + if !ba.continuity.Allows(NonConsecutiveBlocks) && + (ba.previousNonEmptyBlockHeight > 0 && ba.previousNonEmptyBlockHeight != ev.BeginBlock.PredecessorHeight) { + return nil, fmt.Errorf("BlockAccumulator.Consume: received non-consecutive block at height %d: "+ + "predecessor height %d, but previous (non-empty) block height was %d", + ev.BeginBlock.Height, ev.BeginBlock.PredecessorHeight, ba.previousNonEmptyBlockHeight) + } + // If we are consuming blocks over the event stream (rather than from state) we may see empty blocks + // by definition empty blocks will not be a predecessor + if ev.BeginBlock.NumTxs > 0 { + ba.previousNonEmptyBlockHeight = ev.BeginBlock.Height + } + ba.numTxs = ev.BeginBlock.NumTxs ba.block = &BlockExecution{ - Height: ev.BeginBlock.Height, - Header: ev.BeginBlock.Header, + Height: ev.BeginBlock.Height, + PredecessorHeight: ev.BeginBlock.PredecessorHeight, + Header: ev.BeginBlock.Header, + TxExecutions: make([]*TxExecution, 0, ba.numTxs), } case ev.BeginTx != nil, ev.Envelope != nil, ev.Event != nil, ev.EndTx != nil: txe, err := ba.stack.Consume(ev) @@ -92,37 +152,69 @@ func (ba *BlockAccumulator) Consume(ev *StreamEvent) (*BlockExecution, error) { return nil, err } if txe != nil { + if !ba.continuity.Allows(NonConsecutiveTxs) && uint64(len(ba.block.TxExecutions)) != txe.Index { + return nil, fmt.Errorf("BlockAccumulator.Consume recieved transaction with index %d at "+ + "position %d in the event stream", txe.Index, len(ba.block.TxExecutions)) + } ba.block.TxExecutions = append(ba.block.TxExecutions, txe) } case ev.EndBlock != nil: + if !ba.continuity.Allows(NonConsecutiveTxs) && uint64(len(ba.block.TxExecutions)) != ba.numTxs { + return nil, fmt.Errorf("BlockAccumulator.Consume did not receive the expected number of "+ + "transactions for block %d, expected: %d, received: %d", + ba.block.Height, ba.numTxs, len(ba.block.TxExecutions)) + } return ba.block, nil } return nil, nil } // TxStack is able to consume potentially nested txs -type TxStack []*TxExecution +type TxStack struct { + // Stack of TxExecutions, top of stack is TxExecution receiving innermost events + txes []*TxExecution + // Track the expected number events from the BeginTx event (also a stack) + numEvents []uint64 + // Relaxations of transaction/event continuity + continuity ContinuityOpt +} -func (stack *TxStack) Push(txe *TxExecution) { +func (stack *TxStack) Push(beginTx *BeginTx) { // Put this txe in the parent position - *stack = append(*stack, txe) + stack.txes = append(stack.txes, &TxExecution{ + TxHeader: beginTx.TxHeader, + Result: beginTx.Result, + Events: make([]*Event, 0, beginTx.NumEvents), + Exception: beginTx.Exception, + }) + stack.numEvents = append(stack.numEvents, beginTx.NumEvents) } -func (stack TxStack) Peek() (*TxExecution, error) { - if len(stack) < 1 { +func (stack *TxStack) Peek() (*TxExecution, error) { + if len(stack.txes) < 1 { return nil, fmt.Errorf("tried to peek from an empty TxStack - might be missing essential StreamEvents") } - return stack[len(stack)-1], nil + return stack.txes[len(stack.txes)-1], nil } func (stack *TxStack) Pop() (*TxExecution, error) { - s := *stack - txc, err := s.Peek() + txe, err := stack.Peek() if err != nil { return nil, err } - *stack = s[:len(s)-1] - return txc, nil + newLength := len(stack.txes) - 1 + stack.txes = stack.txes[:newLength] + numEvents := stack.numEvents[newLength] + if !stack.continuity.Allows(NonConsecutiveEvents) && uint64(len(txe.Events)) != numEvents { + return nil, fmt.Errorf("TxStack.Pop emitted transaction %s with wrong number of events, "+ + "expected: %d, received: %d", txe.TxHash, numEvents, len(txe.Events)) + } + stack.numEvents = stack.numEvents[:newLength] + return txe, nil +} + +func (stack *TxStack) Length() int { + return len(stack.txes) } // Consume will add the StreamEvent to the transaction stack and if that completes a single outermost transaction @@ -130,7 +222,7 @@ func (stack *TxStack) Pop() (*TxExecution, error) { func (stack *TxStack) Consume(ev *StreamEvent) (*TxExecution, error) { switch { case ev.BeginTx != nil: - stack.Push(initTx(ev.BeginTx)) + stack.Push(ev.BeginTx) case ev.Envelope != nil: txe, err := stack.Peek() if err != nil { @@ -143,13 +235,24 @@ func (stack *TxStack) Consume(ev *StreamEvent) (*TxExecution, error) { if err != nil { return nil, err } + if !stack.continuity.Allows(NonConsecutiveEvents) && uint64(len(txe.Events)) != ev.Event.Header.Index { + return nil, fmt.Errorf("TxStack.Consume recieved event with index %d at "+ + "position %d in the event stream", ev.Event.GetHeader().GetIndex(), len(txe.Events)) + } txe.Events = append(txe.Events, ev.Event) case ev.EndTx != nil: txe, err := stack.Pop() if err != nil { return nil, err } - if len(*stack) == 0 { + // If Origin _is_ set then it implies the transaction originates from a dump and is in an abbreviated + // 'pseudo transaction' for which no envelope is stored (since the dump format is intended to minimal) and we + // must relax the Envelope presence continuity check + if txe.TxHeader.Origin == nil && (txe.Envelope == nil || txe.Receipt == nil) { + return nil, fmt.Errorf("TxStack.Consume did not receive transaction envelope for transaction %s", + txe.TxHash) + } + if stack.Length() == 0 { // This terminates the outermost transaction return txe, nil } @@ -162,11 +265,3 @@ func (stack *TxStack) Consume(ev *StreamEvent) (*TxExecution, error) { } return nil, nil } - -func initTx(beginTx *BeginTx) *TxExecution { - return &TxExecution{ - TxHeader: beginTx.TxHeader, - Result: beginTx.Result, - Exception: beginTx.Exception, - } -} diff --git a/execution/exec/stream_event_test.go b/execution/exec/stream_event_test.go index 001b56979..c37790bb9 100644 --- a/execution/exec/stream_event_test.go +++ b/execution/exec/stream_event_test.go @@ -1,22 +1,23 @@ package exec import ( + "encoding/json" "testing" "time" - "github.com/hyperledger/burrow/crypto/sha3" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/txs" "github.com/hyperledger/burrow/txs/payload" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) var genesisDoc, accounts, _ = genesis.NewDeterministicGenesis(345234523).GenesisDoc(10, 0) func TestTxExecution(t *testing.T) { - txe := NewTxExecution(txs.Enclose(genesisDoc.ChainID(), newCallTx(0, 1))) + txe := NewTxExecution(txs.Enclose(genesisDoc.GetChainID(), newCallTx(0, 1))) stack := new(TxStack) var txeOut *TxExecution @@ -26,7 +27,7 @@ func TestTxExecution(t *testing.T) { txeOut, err = stack.Consume(ev) require.NoError(t, err) if txeOut != nil { - require.Equal(t, txe, txeOut) + require.Equal(t, jsonString(t, txe), jsonString(t, txeOut)) } } @@ -36,29 +37,28 @@ func TestTxExecution(t *testing.T) { func TestConsumeBlockExecution(t *testing.T) { height := int64(234242) be := &BlockExecution{ - Header: &types.Header{ - ChainID: genesisDoc.ChainID(), - AppHash: sha3.Sha3([]byte("hashily")), - NumTxs: 1, + Header: &tmproto.Header{ + ChainID: genesisDoc.GetChainID(), + AppHash: crypto.Keccak256([]byte("hashily")), Time: time.Now(), Height: height, }, Height: uint64(height), - TxExecutions: []*TxExecution{ - NewTxExecution(txs.Enclose(genesisDoc.ChainID(), newCallTx(0, 3))), - NewTxExecution(txs.Enclose(genesisDoc.ChainID(), newCallTx(0, 2))), - NewTxExecution(txs.Enclose(genesisDoc.ChainID(), newCallTx(2, 1))), - }, } + be.AppendTxs( + NewTxExecution(txs.Enclose(genesisDoc.GetChainID(), newCallTx(0, 3))), + NewTxExecution(txs.Enclose(genesisDoc.GetChainID(), newCallTx(0, 2))), + NewTxExecution(txs.Enclose(genesisDoc.GetChainID(), newCallTx(2, 1))), + ) - stack := new(BlockAccumulator) + stack := NewBlockAccumulator() var beOut *BlockExecution var err error for _, ev := range be.StreamEvents() { beOut, err = stack.Consume(ev) require.NoError(t, err) if beOut != nil { - require.Equal(t, be, beOut) + require.Equal(t, jsonString(t, be), jsonString(t, beOut)) } } assert.NotNil(t, beOut, "should have consumed input BlockExecution") @@ -69,3 +69,9 @@ func newCallTx(fromIndex, toIndex int) *payload.CallTx { to := accounts[toIndex].GetAddress() return payload.NewCallTxWithSequence(from.GetPublicKey(), &to, []byte{1, 2, 3}, 324, 34534534, 23, 1) } + +func jsonString(t testing.TB, conf interface{}) string { + bs, err := json.MarshalIndent(conf, "", " ") + require.NoError(t, err, "must be able to convert interface to string for comparison") + return string(bs) +} diff --git a/execution/exec/tx_execution.go b/execution/exec/tx_execution.go index effe87acb..284266492 100644 --- a/execution/exec/tx_execution.go +++ b/execution/exec/tx_execution.go @@ -3,7 +3,6 @@ package exec import ( "fmt" "reflect" - "strings" "github.com/hyperledger/burrow/binary" @@ -41,6 +40,7 @@ func (txe *TxExecution) StreamEvents() []*StreamEvent { &StreamEvent{ BeginTx: &BeginTx{ TxHeader: txe.TxHeader, + NumEvents: uint64(len(txe.Events)), Exception: txe.Exception, Result: txe.Result, }, @@ -128,10 +128,21 @@ func (txe *TxExecution) GovernAccount(governAccount *GovernAccountEvent, excepti }) } +func (txe *TxExecution) Print(print *PrintEvent) error { + txe.Append(&Event{ + Header: txe.Header(TypePrint, EventStringLogEvent(print.Address), nil), + Print: print, + }) + return nil +} + // Errors pushed to TxExecutions end up in merkle state so it is essential that they are deterministic and independent // of the code path taken to execution (e.g. replay takes a different path to that of normal consensus reactor so stack // traces may differ - as they may across architectures) -func (txe *TxExecution) PushError(err error) { +func (txe *TxExecution) PushError(err error) bool { + if err == nil { + return false + } if txe.Exception == nil { // Don't forget the nil jig ex := errors.AsException(err) @@ -139,51 +150,24 @@ func (txe *TxExecution) PushError(err error) { txe.Exception = ex } } + return true } func (txe *TxExecution) CallTrace() string { - var calls []string - for _, ev := range txe.Events { - if ev.Call != nil { - ex := "" - if ev.Header.Exception != nil { - ex = fmt.Sprintf(" [%v]", ev.Header.Exception) - } - calls = append(calls, fmt.Sprintf("%v: %v -> %v: %v%s", - ev.Call.CallType, ev.Call.CallData.Caller, ev.Call.CallData.Callee, ev.Call.Return, ex)) - } - } - return strings.Join(calls, "\n") + return Events(txe.Events).CallTrace() } func (txe *TxExecution) ExceptionalCalls() []*Event { - var exCalls []*Event - for _, ev := range txe.Events { - if ev.Call != nil && ev.Header.Exception != nil { - exCalls = append(exCalls, ev) - } - } - return exCalls + return Events(txe.Events).ExceptionalCalls() } func (txe *TxExecution) CallError() *errors.CallError { if txe.Exception == nil { return nil } - var nestedErrors []errors.NestedCallError - for _, ev := range txe.Events { - if ev.Call != nil && ev.Header.Exception != nil { - nestedErrors = append(nestedErrors, errors.NestedCallError{ - CodedError: ev.Header.Exception, - Caller: ev.Call.CallData.Caller, - Callee: ev.Call.CallData.Callee, - StackDepth: ev.Call.StackDepth, - }) - } - } return &errors.CallError{ CodedError: txe.Exception, - NestedErrors: nestedErrors, + NestedErrors: Events(txe.Events).NestedCallErrors(), } } diff --git a/execution/execution.go b/execution/execution.go index 755bed5a9..e5ddd16f7 100644 --- a/execution/execution.go +++ b/execution/execution.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package execution @@ -20,28 +9,29 @@ import ( "runtime/debug" "sync" - "github.com/hyperledger/burrow/acm/validator" - "github.com/hyperledger/burrow/genesis" - - "github.com/hyperledger/burrow/execution/state" + "github.com/hyperledger/burrow/execution/vms" "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/acm/validator" "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/event" "github.com/hyperledger/burrow/execution/contexts" + "github.com/hyperledger/burrow/execution/engine" "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/execution/evm" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/execution/names" "github.com/hyperledger/burrow/execution/proposal" + "github.com/hyperledger/burrow/execution/registry" + "github.com/hyperledger/burrow/execution/state" + "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" "github.com/hyperledger/burrow/permission" "github.com/hyperledger/burrow/txs" "github.com/hyperledger/burrow/txs/payload" - abciTypes "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/proto/tendermint/types" ) type Executor interface { @@ -56,12 +46,14 @@ func (f ExecutorFunc) Execute(txEnv *txs.Envelope) (*exec.TxExecution, error) { type ExecutorState interface { Update(updater func(ws state.Updatable) error) (hash []byte, version int64, err error) + LastStoredHeight() (uint64, error) + acmstate.IterableReader + acmstate.MetadataReader names.Reader + registry.Reader proposal.Reader - acmstate.IterableReader validator.IterableReader } - type BatchExecutor interface { // Provides access to write lock for a BatchExecutor so reads can be prevented for the duration of a commit sync.Locker @@ -77,7 +69,7 @@ type BatchExecutor interface { type BatchCommitter interface { BatchExecutor // Commit execution results to underlying State and provide opportunity to mutate state before it is saved - Commit(header *abciTypes.Header) (stateHash []byte, err error) + Commit(header *types.Header) (stateHash []byte, err error) } type executor struct { @@ -86,13 +78,15 @@ type executor struct { params Params state ExecutorState stateCache *acmstate.Cache + metadataCache *acmstate.MetadataCache nameRegCache *names.Cache + nodeRegCache *registry.Cache proposalRegCache *proposal.Cache validatorCache *validator.Cache emitter *event.Emitter block *exec.BlockExecution logger *logging.Logger - vmOptions []func(*evm.VM) + vmOptions engine.Options contexts map[payload.Type]contexts.Context } @@ -103,7 +97,7 @@ type Params struct { func ParamsFromGenesis(genesisDoc *genesis.GenesisDoc) Params { return Params{ - ChainID: genesisDoc.ChainID(), + ChainID: genesisDoc.GetChainID(), ProposalThreshold: genesisDoc.Params.ProposalThreshold, } } @@ -111,34 +105,42 @@ func ParamsFromGenesis(genesisDoc *genesis.GenesisDoc) Params { var _ BatchExecutor = (*executor)(nil) // Wraps a cache of what is variously known as the 'check cache' and 'mempool' -func NewBatchChecker(backend ExecutorState, params Params, blockchain contexts.Blockchain, logger *logging.Logger, - options ...ExecutionOption) BatchExecutor { +func NewBatchChecker(backend ExecutorState, params Params, blockchain engine.Blockchain, logger *logging.Logger, + options ...Option) (BatchExecutor, error) { return newExecutor("CheckCache", false, params, backend, blockchain, nil, logger.WithScope("NewBatchExecutor"), options...) } -func NewBatchCommitter(backend ExecutorState, params Params, blockchain contexts.Blockchain, emitter *event.Emitter, - logger *logging.Logger, options ...ExecutionOption) BatchCommitter { +func NewBatchCommitter(backend ExecutorState, params Params, blockchain engine.Blockchain, emitter *event.Emitter, + logger *logging.Logger, options ...Option) (BatchCommitter, error) { return newExecutor("CommitCache", true, params, backend, blockchain, emitter, logger.WithScope("NewBatchCommitter"), options...) } -func newExecutor(name string, runCall bool, params Params, backend ExecutorState, blockchain contexts.Blockchain, - emitter *event.Emitter, logger *logging.Logger, options ...ExecutionOption) *executor { +func newExecutor(name string, runCall bool, params Params, backend ExecutorState, blockchain engine.Blockchain, + emitter *event.Emitter, logger *logging.Logger, options ...Option) (*executor, error) { + // We need to track the last block stored in state + predecessor, err := backend.LastStoredHeight() + if err != nil { + return nil, err + } exe := &executor{ runCall: runCall, params: params, state: backend, stateCache: acmstate.NewCache(backend, acmstate.Named(name)), + metadataCache: acmstate.NewMetadataCache(backend), nameRegCache: names.NewCache(backend), + nodeRegCache: registry.NewCache(backend), proposalRegCache: proposal.NewCache(backend), validatorCache: validator.NewCache(backend), emitter: emitter, block: &exec.BlockExecution{ - Height: blockchain.LastBlockHeight() + 1, + Height: blockchain.LastBlockHeight() + 1, + PredecessorHeight: predecessor, }, logger: logger.With(structure.ComponentKey, "Executor"), } @@ -147,49 +149,56 @@ func newExecutor(name string, runCall bool, params Params, backend ExecutorState } baseContexts := map[payload.Type]contexts.Context{ - payload.TypeSend: &contexts.SendContext{ - StateWriter: exe.stateCache, - Logger: exe.logger, - }, payload.TypeCall: &contexts.CallContext{ - Blockchain: blockchain, - StateWriter: exe.stateCache, - RunCall: runCall, - VMOptions: exe.vmOptions, - Logger: exe.logger, + // TODO: expose WASM options to config + VMS: vms.NewConnectedVirtualMachines(exe.vmOptions), + Blockchain: blockchain, + State: exe.stateCache, + MetadataState: exe.metadataCache, + RunCall: runCall, + Logger: exe.logger, + }, + payload.TypeSend: &contexts.SendContext{ + State: exe.stateCache, + Logger: exe.logger, }, payload.TypeName: &contexts.NameContext{ - Blockchain: blockchain, - StateWriter: exe.stateCache, - NameReg: exe.nameRegCache, - Logger: exe.logger, + Blockchain: blockchain, + State: exe.stateCache, + NameReg: exe.nameRegCache, + Logger: exe.logger, }, payload.TypePermissions: &contexts.PermissionsContext{ - StateWriter: exe.stateCache, - Logger: exe.logger, + State: exe.stateCache, + Logger: exe.logger, }, payload.TypeGovernance: &contexts.GovernanceContext{ ValidatorSet: exe.validatorCache, - StateWriter: exe.stateCache, + State: exe.stateCache, Logger: exe.logger, }, payload.TypeBond: &contexts.BondContext{ ValidatorSet: exe.validatorCache, - StateWriter: exe.stateCache, + State: exe.stateCache, Logger: exe.logger, }, payload.TypeUnbond: &contexts.UnbondContext{ ValidatorSet: exe.validatorCache, - StateWriter: exe.stateCache, + State: exe.stateCache, Logger: exe.logger, }, + payload.TypeIdentify: &contexts.IdentifyContext{ + NodeWriter: exe.nodeRegCache, + StateReader: exe.stateCache, + Logger: exe.logger, + }, } exe.contexts = map[payload.Type]contexts.Context{ payload.TypeProposal: &contexts.ProposalContext{ ChainID: params.ChainID, ProposalThreshold: params.ProposalThreshold, - StateWriter: exe.stateCache, + State: exe.stateCache, ProposalReg: exe.proposalRegCache, Logger: exe.logger, Contexts: baseContexts, @@ -201,7 +210,7 @@ func newExecutor(name string, runCall bool, params Params, backend ExecutorState exe.contexts[k] = v } - return exe + return exe, nil } func (exe *executor) AddContext(ty payload.Type, ctx contexts.Context) *executor { @@ -227,7 +236,7 @@ func (exe *executor) Execute(txEnv *txs.Envelope) (txe *exec.TxExecution, err er logger.InfoMsg("Executing transaction", "tx", txEnv.String()) // Verify transaction signature against inputs - err = txEnv.Verify(exe.stateCache, exe.params.ChainID) + err = txEnv.Verify(exe.params.ChainID) if err != nil { logger.InfoMsg("Transaction Verify failed", structure.ErrorKey, err) return nil, err @@ -275,7 +284,7 @@ func (exe *executor) validateInputsAndStorePublicKeys(txEnv *txs.Envelope) error for s, in := range txEnv.Tx.GetInputs() { err := exe.updateSignatory(txEnv.Signatories[s]) if err != nil { - return fmt.Errorf("failed to update public key for input %X: %v", in.Address, err) + return fmt.Errorf("failed to update public key for input %v: %v", in.Address, err) } acc, err := exe.stateCache.GetAccount(in.Address) if err != nil { @@ -290,21 +299,25 @@ func (exe *executor) validateInputsAndStorePublicKeys(txEnv *txs.Envelope) error acc.GetAddress()) } // Check sequences - if acc.Sequence+1 != uint64(in.Sequence) { - return errors.ErrorCodef(errors.ErrorCodeInvalidSequence, "Error invalid sequence in input %v: input has sequence %d, but account has sequence %d, "+ + if acc.Sequence+1 != in.Sequence { + return errors.Errorf(errors.Codes.InvalidSequence, "Error invalid sequence in input %v: input has sequence %d, but account has sequence %d, "+ "so expected input to have sequence %d", in, in.Sequence, acc.Sequence, acc.Sequence+1) } // Check amount - if acc.Balance < uint64(in.Amount) { - return errors.ErrorCodeInsufficientFunds + if txEnv.Tx.Type() != payload.TypeUnbond && acc.Balance < in.Amount { + return errors.Codes.InsufficientFunds } // Check for Input permission - v, err := acc.Permissions.Base.Compose(acmstate.GlobalAccountPermissions(exe.stateCache).Base).Get(permission.Input) + globalPerms, err := acmstate.GlobalAccountPermissions(exe.stateCache) + if err != nil { + return err + } + v, err := acc.Permissions.Base.Compose(globalPerms.Base).Get(permission.Input) if err != nil { return err } if !v { - return errors.ErrorCodeNoInputPermission + return errors.Codes.NoInputPermission } } return nil @@ -316,19 +329,21 @@ func (exe *executor) updateSignatory(sig txs.Signatory) error { acc, err := exe.stateCache.GetAccount(*sig.Address) if err != nil { return fmt.Errorf("error getting account on which to set public key: %v", *sig.Address) + } else if acc == nil { + return fmt.Errorf("account %s does not exist", sig.Address) } // Important that verify has been run against signatories at this point if sig.PublicKey.GetAddress() != acc.Address { return fmt.Errorf("unexpected mismatch between address %v and supplied public key %v", acc.Address, sig.PublicKey) } - acc.PublicKey = *sig.PublicKey + acc.PublicKey = sig.PublicKey return exe.stateCache.UpdateAccount(acc) } // Commit the current state - optionally pass in the tendermint ABCI header for that to be included with the BeginBlock // StreamEvent -func (exe *executor) Commit(header *abciTypes.Header) (stateHash []byte, err error) { +func (exe *executor) Commit(header *types.Header) (stateHash []byte, err error) { // The write lock to the executor is controlled by the caller (e.g. abci.App) so we do not acquire it here to avoid // deadlock defer func() { @@ -348,19 +363,27 @@ func (exe *executor) Commit(header *abciTypes.Header) (stateHash []byte, err err // that nothing in the downstream commit process could have failed. At worst we go back one block. hash, version, err := exe.state.Update(func(ws state.Updatable) error { // flush the caches - err := exe.stateCache.Flush(ws, exe.state) + err := exe.stateCache.Sync(ws) + if err != nil { + return err + } + err = exe.metadataCache.Sync(ws) + if err != nil { + return err + } + err = exe.nameRegCache.Sync(ws) if err != nil { return err } - err = exe.nameRegCache.Flush(ws, exe.state) + err = exe.nodeRegCache.Sync(ws) if err != nil { return err } - err = exe.proposalRegCache.Flush(ws, exe.state) + err = exe.proposalRegCache.Sync(ws) if err != nil { return err } - err = exe.validatorCache.Flush(ws, exe.state) + err = exe.validatorCache.Sync(ws) if err != nil { return err } @@ -373,6 +396,12 @@ func (exe *executor) Commit(header *abciTypes.Header) (stateHash []byte, err err if err != nil { return nil, err } + // Complete flushing of caches by resetting them to the state we have just committed + err = exe.Reset() + if err != nil { + return nil, err + } + expectedHeight := HeightAtVersion(version) if expectedHeight != height { return nil, fmt.Errorf("expected height at state tree version %d is %d but actual height is %d", @@ -386,7 +415,9 @@ func (exe *executor) Commit(header *abciTypes.Header) (stateHash []byte, err err func (exe *executor) Reset() error { // As with Commit() we do not take the write lock here exe.stateCache.Reset(exe.state) + exe.metadataCache.Reset(exe.state) exe.nameRegCache.Reset(exe.state) + exe.nodeRegCache.Reset(exe.state) exe.proposalRegCache.Reset(exe.state) exe.validatorCache.Reset(exe.state) return nil @@ -404,12 +435,6 @@ func (exe *executor) GetAccount(address crypto.Address) (*acm.Account, error) { return exe.stateCache.GetAccount(address) } -func (exe *executor) GetMetadata(metahash acmstate.MetadataHash) (string, error) { - exe.RLock() - defer exe.RUnlock() - return exe.stateCache.GetMetadata(metahash) -} - // Storage func (exe *executor) GetStorage(address crypto.Address, key binary.Word256) ([]byte, error) { exe.RLock() @@ -421,7 +446,7 @@ func (exe *executor) PendingValidators() validator.IterableReader { return exe.validatorCache.Delta } -func (exe *executor) finaliseBlockExecution(header *abciTypes.Header) (*exec.BlockExecution, error) { +func (exe *executor) finaliseBlockExecution(header *types.Header) (*exec.BlockExecution, error) { if header != nil && uint64(header.Height) != exe.block.Height { return nil, fmt.Errorf("trying to finalise block execution with height %v but passed Tendermint"+ "block header at height %v", exe.block.Height, header.Height) @@ -430,9 +455,18 @@ func (exe *executor) finaliseBlockExecution(header *abciTypes.Header) (*exec.Blo be := exe.block // Set the header when provided be.Header = header + // My default the predecessor of the next block is the is the predecessor of the current block + // (in case the current block has no transactions - since we do not currently store empty blocks in state, see + // /execution/state/events.go) + predecessor := be.PredecessorHeight + if len(be.TxExecutions) > 0 { + // If the current block has transactions then it will be the predecessor of the next block + predecessor = be.Height + } // Start new execution for the next height exe.block = &exec.BlockExecution{ - Height: exe.block.Height + 1, + Height: exe.block.Height + 1, + PredecessorHeight: predecessor, } return be, nil } diff --git a/execution/execution_test.go b/execution/execution_test.go index 8e2d72c35..7954998c5 100644 --- a/execution/execution_test.go +++ b/execution/execution_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package execution @@ -22,16 +11,7 @@ import ( "testing" "time" - "github.com/tendermint/tendermint/abci/types" - - "github.com/hyperledger/burrow/execution/state" - - "github.com/hyperledger/burrow/event/query" - - "github.com/hyperledger/burrow/execution/evm/abi" - "golang.org/x/crypto/ripemd160" - - "github.com/stretchr/testify/assert" + "github.com/hyperledger/burrow/execution/engine" "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/acm/acmstate" @@ -39,99 +19,45 @@ import ( . "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/event" + "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/execution/evm" + "github.com/hyperledger/burrow/execution/evm/abi" . "github.com/hyperledger/burrow/execution/evm/asm" "github.com/hyperledger/burrow/execution/evm/asm/bc" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/execution/names" + "github.com/hyperledger/burrow/execution/native" + "github.com/hyperledger/burrow/execution/state" "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/permission" "github.com/hyperledger/burrow/txs" "github.com/hyperledger/burrow/txs/payload" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" hex "github.com/tmthrgd/go-hex" + "golang.org/x/crypto/ripemd160" ) var ( + permissionsContract = native.Permissions.GetByName("Permissions").(*native.Contract) dbBackend = dbm.MemDBBackend dbDir = "" - permissionsContract = evm.SNativeContracts()["Permissions"] ) -/* -Permission Tests: - -- SendTx: -x - 1 input, no perm, call perm, create perm -x - 1 input, perm -x - 2 inputs, one with perm one without - -- CallTx, CALL -x - 1 input, no perm, send perm, create perm -x - 1 input, perm -x - contract runs call but doesn't have call perm -x - contract runs call and has call perm -x - contract runs call (with perm), runs contract that runs call (without perm) -x - contract runs call (with perm), runs contract that runs call (with perm) - -- CallTx for Create, CREATE -x - 1 input, no perm, send perm, call perm -x - 1 input, perm -x - contract runs create but doesn't have create perm -x - contract runs create but has perm -x - contract runs call with empty address (has call and create perm) - -- NameTx - - no perm, send perm, call perm - - with perm - -- BondTx -x - 1 input, no perm -x - 1 input, perm -x - 1 bonder with perm, input without send or bond -x - 1 bonder with perm, input with send -x - 1 bonder with perm, input with bond -x - 2 inputs, one with perm one without - -- SendTx for new account -x - 1 input, 1 unknown ouput, input with send, not create (fail) -x - 1 input, 1 unknown ouput, input with send and create (pass) -x - 2 inputs, 1 unknown ouput, both inputs with send, one with create, one without (fail) -x - 2 inputs, 1 known output, 1 unknown ouput, one input with create, one without (fail) -x - 2 inputs, 1 unknown ouput, both inputs with send, both inputs with create (pass ) -x - 2 inputs, 1 known output, 1 unknown ouput, both inputs with create, (pass) - - -- CALL for new account -x - unknown output, without create (fail) -x - unknown output, with create (pass) - - -- SNative (CallTx, CALL): - - for each of CallTx, Call -x - call each snative without permission, fails -x - call each snative with permission, pass - - list: -x - base: has,set,unset -x - globals: set -x - roles: has, add, rm - - -*/ - // keys var users = makeUsers(10) var logger = logging.NewNoopLogger() var deterministicGenesis = genesis.NewDeterministicGenesis(34059836243380576) var testGenesisDoc, testPrivAccounts, _ = deterministicGenesis. GenesisDoc(3, 1) -var testChainID = testGenesisDoc.ChainID() +var testChainID = testGenesisDoc.GetChainID() func TestSendFails(t *testing.T) { - stateDB := dbm.NewDB("state", dbBackend, dbDir) + stateDB, err := dbm.NewDB("state", dbBackend, dbDir) + require.NoError(t, err) defer stateDB.Close() genDoc := newBaseGenDoc(permission.ZeroAccountPermissions, permission.ZeroAccountPermissions) genDoc.Accounts[1].Permissions.Base.Set(permission.Send, true) @@ -175,7 +101,7 @@ func TestSendFails(t *testing.T) { require.Error(t, err) // simple send tx to unknown account without create_account perm should fail - acc := getAccount(exe.stateCache, users[3].GetAddress()) + acc := getAccount(t, exe.stateCache, users[3].GetAddress()) err = acc.Permissions.Base.Set(permission.Send, true) require.NoError(t, err) exe.stateCache.UpdateAccount(acc) @@ -189,7 +115,8 @@ func TestSendFails(t *testing.T) { } func TestName(t *testing.T) { - stateDB := dbm.NewDB("state", dbBackend, dbDir) + stateDB, err := dbm.NewDB("state", dbBackend, dbDir) + require.NoError(t, err) defer stateDB.Close() genDoc := newBaseGenDoc(permission.ZeroAccountPermissions, permission.ZeroAccountPermissions) genDoc.Accounts[0].Permissions.Base.Set(permission.Send, true) @@ -224,7 +151,8 @@ func TestName(t *testing.T) { } func TestCallFails(t *testing.T) { - stateDB := dbm.NewDB("state", dbBackend, dbDir) + stateDB, err := dbm.NewDB("state", dbBackend, dbDir) + require.NoError(t, err) defer stateDB.Close() genDoc := newBaseGenDoc(permission.ZeroAccountPermissions, permission.ZeroAccountPermissions) genDoc.Accounts[1].Permissions.Base.Set(permission.Send, true) @@ -281,7 +209,8 @@ func TestCallFails(t *testing.T) { } func TestSendPermission(t *testing.T) { - stateDB := dbm.NewDB("state", dbBackend, dbDir) + stateDB, err := dbm.NewDB("state", dbBackend, dbDir) + require.NoError(t, err) defer stateDB.Close() genDoc := newBaseGenDoc(permission.ZeroAccountPermissions, permission.ZeroAccountPermissions) genDoc.Accounts[0].Permissions.Base.Set(permission.Send, true) // give the 0 account permission @@ -311,7 +240,8 @@ func TestSendPermission(t *testing.T) { } func TestCallPermission(t *testing.T) { - stateDB := dbm.NewDB("state", dbBackend, dbDir) + stateDB, err := dbm.NewDB("state", dbBackend, dbDir) + require.NoError(t, err) defer stateDB.Close() genDoc := newBaseGenDoc(permission.ZeroAccountPermissions, permission.ZeroAccountPermissions) genDoc.Accounts[0].Permissions.Base.Set(permission.Call, true) // give the 0 account permission @@ -454,8 +384,9 @@ func TestCreatePermission(t *testing.T) { require.NoError(t, err) // ensure the contract is there - contractAddr := crypto.NewContractAddress(tx.Input.Address, txHash(tx)) - contractAcc := getAccount(exe.stateCache, contractAddr) + hash := getTxHash(tx) + contractAddr := crypto.NewContractAddress(tx.Input.Address, hash) + contractAcc := getAccount(t, exe.stateCache, contractAddr) if contractAcc == nil { t.Fatalf("failed to create contract %s", contractAddr) } @@ -478,8 +409,9 @@ func TestCreatePermission(t *testing.T) { require.NoError(t, err) // ensure the contract is there - contractAddr = crypto.NewContractAddress(tx.Input.Address, txHash(tx)) - contractAcc = getAccount(exe.stateCache, contractAddr) + hash = getTxHash(tx) + contractAddr = crypto.NewContractAddress(tx.Input.Address, hash) + contractAcc = getAccount(t, exe.stateCache, contractAddr) if contractAcc == nil { t.Fatalf("failed to create contract %s", contractAddr) } @@ -537,14 +469,15 @@ func TestCreatePermission(t *testing.T) { // we need to subscribe to the Call event to detect the exception _, err = execTxWaitAccountCall(t, exe, txEnv, crypto.Address{}) // require.NoError(t, err) - zeroAcc := getAccount(exe.stateCache, crypto.Address{}) + zeroAcc := getAccount(t, exe.stateCache, crypto.Address{}) if len(zeroAcc.EVMCode) != 0 { t.Fatal("the zero account was given code from a CALL!") } } func TestCreateAccountPermission(t *testing.T) { - stateDB := dbm.NewDB("state", dbBackend, dbDir) + stateDB, err := dbm.NewDB("state", dbBackend, dbDir) + require.NoError(t, err) defer stateDB.Close() genDoc := newBaseGenDoc(permission.ZeroAccountPermissions, permission.ZeroAccountPermissions) genDoc.Accounts[0].Permissions.Base.Set(permission.Send, true) // give the 0 account permission @@ -596,7 +529,7 @@ func TestCreateAccountPermission(t *testing.T) { require.Error(t, err) // Two inputs, both with send, both with create, should pass - acc := getAccount(exe.stateCache, users[1].GetAddress()) + acc := getAccount(t, exe.stateCache, users[1].GetAddress()) acc.Permissions.Base.Set(permission.CreateAccount, true) exe.stateCache.UpdateAccount(acc) tx = payload.NewSendTx() @@ -626,7 +559,7 @@ func TestCreateAccountPermission(t *testing.T) { //---------------------------------------------------------- // CALL to unknown account - acc = getAccount(exe.stateCache, users[0].GetAddress()) + acc = getAccount(t, exe.stateCache, users[0].GetAddress()) acc.Permissions.Base.Set(permission.Call, true) err = exe.stateCache.UpdateAccount(acc) require.NoError(t, err) @@ -677,11 +610,12 @@ func TestCreateAccountPermission(t *testing.T) { var DougAddress crypto.Address func init() { - copy(DougAddress[:], ([]byte)("THISISDOUG")) + copy(DougAddress[:], "THISISDOUG") } func TestSNativeCALL(t *testing.T) { - stateDB := dbm.NewDB("state", dbBackend, dbDir) + stateDB, err := dbm.NewDB("state", dbBackend, dbDir) + require.NoError(t, err) defer stateDB.Close() genDoc := newBaseGenDoc(permission.ZeroAccountPermissions, permission.ZeroAccountPermissions) genDoc.Accounts[0].Permissions.Base.Set(permission.Call, true) // give the 0 account permission @@ -727,9 +661,11 @@ func TestSNativeCALL(t *testing.T) { fmt.Printf("Doug: %s\n", exe.permString(t, users[3].GetAddress())) fmt.Println("\n#### SetBase") // SetBase + snativeAddress, pF, data = snativePermTestInputCALL("setBase", users[3], permission.Bond, false) testSNativeCALLExpectFail(t, exe, doug, snativeAddress, data) testSNativeCALLExpectPass(t, exe, doug, pF, snativeAddress, data, func(ret []byte) error { return nil }) + snativeAddress, pF, data = snativePermTestInputCALL("hasBase", users[3], permission.Bond, false) testSNativeCALLExpectPass(t, exe, doug, pF, snativeAddress, data, func(ret []byte) error { // return value should be true or false as a 32 byte array... @@ -826,7 +762,8 @@ func TestSNativeCALL(t *testing.T) { } func TestSNativeTx(t *testing.T) { - stateDB := dbm.NewDB("state", dbBackend, dbDir) + stateDB, err := dbm.NewDB("state", dbBackend, dbDir) + require.NoError(t, err) defer stateDB.Close() genDoc := newBaseGenDoc(permission.ZeroAccountPermissions, permission.ZeroAccountPermissions) genDoc.Accounts[0].Permissions.Base.Set(permission.Call, true) // give the 0 account permission @@ -847,13 +784,13 @@ func TestSNativeTx(t *testing.T) { snativeArgs := snativePermTestInputTx("setBase", users[3], permission.Bond, false) testSNativeTxExpectFail(t, batchCommitter, snativeArgs) testSNativeTxExpectPass(t, batchCommitter, permission.SetBase, snativeArgs) - acc := getAccount(batchCommitter.stateCache, users[3].GetAddress()) + acc := getAccount(t, batchCommitter.stateCache, users[3].GetAddress()) if v, _ := acc.Permissions.Base.Get(permission.Bond); v { t.Fatal("expected permission to be set false") } snativeArgs = snativePermTestInputTx("setBase", users[3], permission.CreateContract, true) testSNativeTxExpectPass(t, batchCommitter, permission.SetBase, snativeArgs) - acc = getAccount(batchCommitter.stateCache, users[3].GetAddress()) + acc = getAccount(t, batchCommitter.stateCache, users[3].GetAddress()) if v, _ := acc.Permissions.Base.Get(permission.CreateContract); !v { t.Fatal("expected permission to be set true") } @@ -863,7 +800,7 @@ func TestSNativeTx(t *testing.T) { snativeArgs = snativePermTestInputTx("unsetBase", users[3], permission.CreateContract, false) testSNativeTxExpectFail(t, batchCommitter, snativeArgs) testSNativeTxExpectPass(t, batchCommitter, permission.UnsetBase, snativeArgs) - acc = getAccount(batchCommitter.stateCache, users[3].GetAddress()) + acc = getAccount(t, batchCommitter.stateCache, users[3].GetAddress()) if v, _ := acc.Permissions.Base.Get(permission.CreateContract); v { t.Fatal("expected permission to be set false") } @@ -873,7 +810,7 @@ func TestSNativeTx(t *testing.T) { snativeArgs = snativePermTestInputTx("setGlobal", users[3], permission.CreateContract, true) testSNativeTxExpectFail(t, batchCommitter, snativeArgs) testSNativeTxExpectPass(t, batchCommitter, permission.SetGlobal, snativeArgs) - acc = getAccount(batchCommitter.stateCache, acm.GlobalPermissionsAddress) + acc = getAccount(t, batchCommitter.stateCache, acm.GlobalPermissionsAddress) if v, _ := acc.Permissions.Base.Get(permission.CreateContract); !v { t.Fatal("expected permission to be set true") } @@ -883,7 +820,7 @@ func TestSNativeTx(t *testing.T) { snativeArgs = snativeRoleTestInputTx("addRole", users[3], "chuck") testSNativeTxExpectFail(t, batchCommitter, snativeArgs) testSNativeTxExpectPass(t, batchCommitter, permission.AddRole, snativeArgs) - acc = getAccount(batchCommitter.stateCache, users[3].GetAddress()) + acc = getAccount(t, batchCommitter.stateCache, users[3].GetAddress()) if v := acc.Permissions.HasRole("chuck"); !v { t.Fatal("expected role to be added") } @@ -893,17 +830,17 @@ func TestSNativeTx(t *testing.T) { snativeArgs = snativeRoleTestInputTx("removeRole", users[3], "chuck") testSNativeTxExpectFail(t, batchCommitter, snativeArgs) testSNativeTxExpectPass(t, batchCommitter, permission.RemoveRole, snativeArgs) - acc = getAccount(batchCommitter.stateCache, users[3].GetAddress()) + acc = getAccount(t, batchCommitter.stateCache, users[3].GetAddress()) if v := acc.Permissions.HasRole("chuck"); v { t.Fatal("expected role to be removed") } } func TestTxSequence(t *testing.T) { - st, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) - acc0 := getAccount(st, privAccounts[0].GetAddress()) + st, privAccounts := makeGenesisState(3, 1) + acc0 := getAccount(t, st, privAccounts[0].GetAddress()) acc0PubKey := privAccounts[0].GetPublicKey() - acc1 := getAccount(st, privAccounts[1].GetAddress()) + acc1 := getAccount(t, st, privAccounts[1].GetAddress()) // Test a variety of sequence numbers for the tx. // The tx should only pass when i == 1. @@ -921,7 +858,7 @@ func TestTxSequence(t *testing.T) { t.Errorf("Expected good sequence to pass: %v", err) } // Check acc.Sequence. - newAcc0 := getAccount(exe.state, acc0.Address) + newAcc0 := getAccount(t, exe.state, acc0.Address) if newAcc0.Sequence != sequence { t.Errorf("Expected account sequence to change to %v, got %v", sequence, newAcc0.Sequence) @@ -932,7 +869,7 @@ func TestTxSequence(t *testing.T) { t.Errorf("Expected bad sequence to fail") } // Check acc.Sequence. (shouldn't have changed) - newAcc0 := getAccount(exe.state, acc0.Address) + newAcc0 := getAccount(t, exe.state, acc0.Address) if newAcc0.Sequence != acc0.Sequence { t.Errorf("Expected account sequence to not change from %v, got %v", acc0.Sequence, newAcc0.Sequence) @@ -1131,18 +1068,18 @@ var factoryCode = hex.MustDecodeString("60606040526000357C0100000000000000000000 func TestCreates(t *testing.T) { //evm.SetDebug(true) - st, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) + st, privAccounts := makeGenesisState(3, 1) //val0 := state.GetValidatorInfo(privValidators[0].Address) - acc0 := getAccount(st, privAccounts[0].GetAddress()) - acc1 := getAccount(st, privAccounts[1].GetAddress()) - acc2 := getAccount(st, privAccounts[2].GetAddress()) + acc0 := getAccount(t, st, privAccounts[0].GetAddress()) + acc1 := getAccount(t, st, privAccounts[1].GetAddress()) + acc2 := getAccount(t, st, privAccounts[2].GetAddress()) exe := makeExecutor(st) - newAcc1 := getAccount(st, acc1.Address) + newAcc1 := getAccount(t, st, acc1.Address) newAcc1.EVMCode = preFactoryCode - newAcc2 := getAccount(st, acc2.Address) + newAcc2 := getAccount(t, st, acc2.Address) newAcc2.EVMCode = factoryCode exe.updateAccounts(t, newAcc1, newAcc2) @@ -1164,12 +1101,12 @@ func TestCreates(t *testing.T) { require.NoError(t, exe.signExecuteCommit(tx, privAccounts[0])) - acc1 = getAccount(st, acc1.Address) + acc1 = getAccount(t, st, acc1.Address) firstCreatedAddress, err := st.GetStorage(acc1.Address, LeftPadWord256(nil)) require.NoError(t, err) require.NotEqual(t, Zero256, firstCreatedAddress, "should not be zero address") - acc0 = getAccount(st, acc0.Address) + acc0 = getAccount(t, st, acc0.Address) // call the pre-factory, triggering the factory to run a create tx = &payload.CallTx{ Input: &payload.TxInput{ @@ -1184,7 +1121,7 @@ func TestCreates(t *testing.T) { require.NoError(t, exe.signExecuteCommit(tx, privAccounts[0])) - acc1 = getAccount(st, acc1.Address) + acc1 = getAccount(t, st, acc1.Address) secondCreatedAddress, err := st.GetStorage(acc1.Address, LeftPadWord256(nil)) require.NoError(t, err) require.NotEqual(t, Zero256, secondCreatedAddress, "should not be zero address") @@ -1195,7 +1132,7 @@ func TestCreates(t *testing.T) { } func TestContractSend(t *testing.T) { - st, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) + st, privAccounts := makeGenesisState(3, 1) /* contract Caller { function send(address x){ @@ -1204,13 +1141,13 @@ func TestContractSend(t *testing.T) { } */ callerCode := hex.MustDecodeString("60606040526000357c0100000000000000000000000000000000000000000000000000000000900480633e58c58c146037576035565b005b604b6004808035906020019091905050604d565b005b8073ffffffffffffffffffffffffffffffffffffffff16600034604051809050600060405180830381858888f19350505050505b5056") - sendData := hex.MustDecodeString(hex.EncodeToString(abi.GetFunctionID("send(address)").Bytes())) + sendData := abi.GetFunctionID("send(address)").Bytes() - acc0 := getAccount(st, privAccounts[0].GetAddress()) - acc1 := getAccount(st, privAccounts[1].GetAddress()) - acc2 := getAccount(st, privAccounts[2].GetAddress()) + acc0 := getAccount(t, st, privAccounts[0].GetAddress()) + acc1 := getAccount(t, st, privAccounts[1].GetAddress()) + acc2 := getAccount(t, st, privAccounts[2].GetAddress()) - newAcc1 := getAccount(st, acc1.Address) + newAcc1 := getAccount(t, st, acc1.Address) newAcc1.EVMCode = callerCode _, _, err := st.Update(func(up state.Updatable) error { return up.UpdateAccount(newAcc1) @@ -1236,8 +1173,8 @@ func TestContractSend(t *testing.T) { err = exe.signExecuteCommit(tx, privAccounts[0]) require.NoError(t, err) - acc2 = getAccount(st, acc2.Address) - assert.Equal(t, sendAmt+acc2Balance, acc2.Balance, "value should be transferred") + acc2 = getAccount(t, st, acc2.Address) + require.Equal(t, sendAmt+acc2Balance, acc2.Balance, "value should be transferred") addressNonExistent := newAddress("nobody") @@ -1256,16 +1193,15 @@ func TestContractSend(t *testing.T) { err = exe.signExecuteCommit(tx, privAccounts[0]) require.NoError(t, err) - accNonExistent := getAccount(st, addressNonExistent) + accNonExistent := getAccount(t, st, addressNonExistent) assert.Equal(t, sendAmt, accNonExistent.Balance, "value should have been transferred") } func TestMerklePanic(t *testing.T) { - st, privAccounts := makeGenesisState(3, true, 1000, 1, true, - 1000) + st, privAccounts := makeGenesisState(3, 1) - acc0 := getAccount(st, privAccounts[0].GetAddress()) - acc1 := getAccount(st, privAccounts[1].GetAddress()) + acc0 := getAccount(t, st, privAccounts[0].GetAddress()) + acc1 := getAccount(t, st, privAccounts[1].GetAddress()) // SendTx. { @@ -1292,7 +1228,7 @@ func TestMerklePanic(t *testing.T) { // CallTx. Just runs through it and checks the transfer. See vm, rpc tests for more { stateCallTx := makeExecutor(copyState(t, st)) - newAcc1 := getAccount(stateCallTx, acc1.Address) + newAcc1 := getAccount(t, stateCallTx, acc1.Address) newAcc1.EVMCode = []byte{0x60} err := stateCallTx.stateCache.UpdateAccount(newAcc1) require.NoError(t, err) @@ -1311,13 +1247,48 @@ func TestMerklePanic(t *testing.T) { } } -// TODO: test overflows. -// TODO: test for unbonding validators. +// Ensure we are setting the origin +func TestOrigin(t *testing.T) { + st, privAccounts := makeGenesisState(3, 1) + exe := makeExecutor(st) + + origin := privAccounts[2] + calleeAddress := privAccounts[1].GetAddress() + + // Set a contract that stores the origin address in storage at loc + loc := []byte{3} + err := engine.UpdateAccount(exe.stateCache, calleeAddress, func(acc *acm.Account) error { + acc.EVMCode = bc.MustSplice(ORIGIN, PUSH1, loc, SSTORE) + return nil + }) + require.NoError(t, err) + + // Call the origin-storing contract + tx := &payload.CallTx{ + Input: &payload.TxInput{ + Address: origin.GetAddress(), + Sequence: 1, + }, + Address: &calleeAddress, + GasLimit: 1000, + } + + err = exe.signExecuteCommit(tx, origin) + require.NoError(t, err) + + // Check the correct origin value is stored + val, err := st.GetStorage(calleeAddress, LeftPadWord256(loc)) + require.NoError(t, err) + + originAddress := LeftPadWord256(val) + assert.Equal(t, origin.GetAddress(), crypto.AddressFromWord256(originAddress)) +} + func TestTxs(t *testing.T) { - st, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) + st, privAccounts := makeGenesisState(3, 1) - acc0 := getAccount(st, privAccounts[0].GetAddress()) - acc1 := getAccount(st, privAccounts[1].GetAddress()) + acc0 := getAccount(t, st, privAccounts[0].GetAddress()) + acc1 := getAccount(t, st, privAccounts[1].GetAddress()) // SendTx. { @@ -1340,12 +1311,12 @@ func TestTxs(t *testing.T) { err := makeExecutor(stateSendTx).signExecuteCommit(tx, privAccounts[0]) require.NoError(t, err) - newAcc0 := getAccount(stateSendTx, acc0.Address) + newAcc0 := getAccount(t, stateSendTx, acc0.Address) if acc0.Balance-1 != newAcc0.Balance { t.Errorf("Unexpected newAcc0 balance. Expected %v, got %v", acc0.Balance-1, newAcc0.Balance) } - newAcc1 := getAccount(stateSendTx, acc1.Address) + newAcc1 := getAccount(t, stateSendTx, acc1.Address) if acc1.Balance+1 != newAcc1.Balance { t.Errorf("Unexpected newAcc1 balance. Expected %v, got %v", acc1.Balance+1, newAcc1.Balance) @@ -1355,7 +1326,7 @@ func TestTxs(t *testing.T) { // CallTx. Just runs through it and checks the transfer. See vm, rpc tests for more { stateCallTx := copyState(t, st) - newAcc1 := getAccount(stateCallTx, acc1.Address) + newAcc1 := getAccount(t, stateCallTx, acc1.Address) newAcc1.EVMCode = []byte{0x60} _, _, err := stateCallTx.Update(func(up state.Updatable) error { return up.UpdateAccount(newAcc1) @@ -1373,12 +1344,12 @@ func TestTxs(t *testing.T) { err = makeExecutor(stateCallTx).signExecuteCommit(tx, privAccounts[0]) require.NoError(t, err) - newAcc0 := getAccount(stateCallTx, acc0.Address) + newAcc0 := getAccount(t, stateCallTx, acc0.Address) if acc0.Balance-1 != newAcc0.Balance { t.Errorf("Unexpected newAcc0 balance. Expected %v, got %v", acc0.Balance-1, newAcc0.Balance) } - newAcc1 = getAccount(stateCallTx, acc1.Address) + newAcc1 = getAccount(t, stateCallTx, acc1.Address) if acc1.Balance+1 != newAcc1.Balance { t.Errorf("Unexpected newAcc1 balance. Expected %v, got %v", acc1.Balance+1, newAcc1.Balance) @@ -1420,7 +1391,7 @@ proof-of-work chain as proof of what happened while they were gone ` err := exe.signExecuteCommit(tx, privAccounts[0]) require.NoError(t, err) - newAcc0 := getAccount(stateNameTx, acc0.Address) + newAcc0 := getAccount(t, stateNameTx, acc0.Address) if acc0.Balance-entryAmount != newAcc0.Balance { t.Errorf("Unexpected newAcc0 balance. Expected %v, got %v", acc0.Balance-entryAmount, newAcc0.Balance) @@ -1437,7 +1408,7 @@ proof-of-work chain as proof of what happened while they were gone ` tx.Input.Sequence += 1 err = exe.signExecuteCommit(tx, privAccounts[0]) require.Error(t, err) - if errors.AsException(err).ErrorCode() != errors.ErrorCodeInvalidString { + if errors.AsException(err).ErrorCode() != errors.Codes.InvalidString { t.Errorf("Expected invalid string error. Got: %v", err) } } @@ -1445,15 +1416,15 @@ proof-of-work chain as proof of what happened while they were gone ` } func TestSelfDestruct(t *testing.T) { - st, privAccounts := makeGenesisState(3, true, 1000, 1, true, 1000) + st, privAccounts := makeGenesisState(3, 1) - acc0 := getAccount(st, privAccounts[0].GetAddress()) + acc0 := getAccount(t, st, privAccounts[0].GetAddress()) acc0PubKey := privAccounts[0].GetPublicKey() - acc1 := getAccount(st, privAccounts[1].GetAddress()) - acc2 := getAccount(st, privAccounts[2].GetAddress()) + acc1 := getAccount(t, st, privAccounts[1].GetAddress()) + acc2 := getAccount(t, st, privAccounts[2].GetAddress()) sendingAmount, refundedBalance, oldBalance := uint64(1), acc1.Balance, acc2.Balance - newAcc1 := getAccount(st, acc1.Address) + newAcc1 := getAccount(t, st, acc1.Address) // store 0x1 at 0x1, push an address, then self-destruct:) contractCode := []byte{0x60, 0x01, 0x60, 0x01, 0x55, 0x73} @@ -1476,27 +1447,63 @@ func TestSelfDestruct(t *testing.T) { // if we do it again the self-destruct shouldn't happen twice and the caller should lose fee tx.Input.Sequence += 1 err = exe.signExecuteCommit(tx, privAccounts[0]) - assertErrorCode(t, errors.ErrorCodeInvalidAddress, err) + assertErrorCode(t, errors.Codes.InvalidAddress, err) // commit the block _, err = exe.Commit(nil) require.NoError(t, err) // acc2 should receive the sent funds and the contracts balance - newAcc2 := getAccount(st, acc2.Address) + newAcc2 := getAccount(t, st, acc2.Address) newBalance := sendingAmount + refundedBalance + oldBalance if newAcc2.Balance != newBalance { t.Errorf("Unexpected newAcc2 balance. Expected %v, got %v", newAcc2.Balance, newBalance) } - newAcc1 = getAccount(st, acc1.Address) - if newAcc1 != nil { - t.Errorf("Expected account to be removed") + accRemoved, err := st.GetAccount(acc1.Address) + require.NoError(t, err) + require.Nil(t, accRemoved, "Expected account to be removed") +} + +func TestPredecessorTracking(t *testing.T) { + st, signers := makeGenesisState(3, 1) + exe := makeExecutor(st) + + mkTx := func() *payload.SendTx { + tx := payload.NewSendTx() + err := tx.AddInput(st, signers[0].GetPublicKey(), 100) + require.NoError(t, err) + tx.AddOutput(signers[1].GetAddress(), 100) + require.NoError(t, err) + return tx } + + // Empty block - predecessor does not advance + _, err := exe.Commit(nil) + require.NoError(t, err) + require.Equal(t, uint64(0), exe.block.PredecessorHeight) + require.Equal(t, uint64(2), exe.block.Height) + + // Tx in block - predecessor becomes this block + err = exe.signExecuteCommit(mkTx(), signers[0]) + require.NoError(t, err) + require.Equal(t, uint64(2), exe.block.PredecessorHeight) + require.Equal(t, uint64(3), exe.block.Height) + + // Empty again + _, err = exe.Commit(nil) + require.NoError(t, err) + require.Equal(t, uint64(2), exe.block.PredecessorHeight) + require.Equal(t, uint64(4), exe.block.Height) + + // Non-empty - back to consecutive predecessor + err = exe.signExecuteCommit(mkTx(), signers[0]) + require.NoError(t, err) + require.Equal(t, uint64(4), exe.block.PredecessorHeight) + require.Equal(t, uint64(5), exe.block.Height) } -//------------------------------------------------------------------------------------- -// helpers +// Helpers func makeUsers(n int) []acm.AddressableSigner { users := make([]acm.AddressableSigner, n) @@ -1507,12 +1514,6 @@ func makeUsers(n int) []acm.AddressableSigner { return users } -func newBlockchain(genesisDoc *genesis.GenesisDoc) *bcm.Blockchain { - testDB := dbm.NewDB("test", dbBackend, ".") - blockchain, _, _ := bcm.LoadOrNewBlockchain(testDB, genesisDoc, logger) - return blockchain -} - func newBaseGenDoc(globalPerm, accountPerm permission.AccountPermissions) genesis.GenesisDoc { var genAccounts []genesis.Account for _, user := range users[:5] { @@ -1545,8 +1546,7 @@ func newBaseGenDoc(globalPerm, accountPerm permission.AccountPermissions) genesi } } -func makeGenesisState(numAccounts int, randBalance bool, minBalance uint64, numValidators int, randBonded bool, - minBonded int64) (*state.State, []*acm.PrivateAccount) { +func makeGenesisState(numAccounts int, numValidators int) (*state.State, []*acm.PrivateAccount) { testGenesisDoc, privAccounts, _ := deterministicGenesis.GenesisDoc(numAccounts, numValidators) s0, err := state.MakeGenesisState(dbm.NewMemDB(), testGenesisDoc) if err != nil { @@ -1559,11 +1559,10 @@ func makeGenesisState(numAccounts int, randBalance bool, minBalance uint64, numV return s0, privAccounts } -func getAccount(accountGetter acmstate.AccountGetter, address crypto.Address) *acm.Account { +func getAccount(t testing.TB, accountGetter acmstate.AccountGetter, address crypto.Address) *acm.Account { acc, err := accountGetter.GetAccount(address) - if err != nil { - panic(err) - } + require.NoError(t, err) + require.NotNil(t, acc) return acc } @@ -1581,12 +1580,23 @@ type testExecutor struct { } func makeExecutor(state *state.State) *testExecutor { - blockchain := newBlockchain(testGenesisDoc) - blockchain.CommitBlockAtHeight(time.Now(), []byte("hashily"), state.Hash(), HeightAtVersion(state.Version())) + testDB, err := dbm.NewDB("test", dbBackend, ".") + if err != nil { + panic(err) + } + blockchain, _, _ := bcm.LoadOrNewBlockchain(testDB, testGenesisDoc, logger) + err = blockchain.CommitBlockAtHeight(time.Now(), []byte("hashily"), state.Hash(), HeightAtVersion(state.Version())) + if err != nil { + panic(err) + } + executor, err := newExecutor("makeExecutorCache", true, ParamsFromGenesis(testGenesisDoc), state, + blockchain, nil, logger) + if err != nil { + panic(err) + } return &testExecutor{ Blockchain: blockchain, - executor: newExecutor("makeExecutorCache", true, ParamsFromGenesis(testGenesisDoc), state, - blockchain, nil, logger), + executor: executor, } } @@ -1596,7 +1606,7 @@ func copyState(t testing.TB, st *state.State) *state.State { return cpy } -func (te *testExecutor) Commit(header *types.Header) ([]byte, error) { +func (te *testExecutor) Commit(header *tmproto.Header) ([]byte, error) { appHash, err := te.executor.Commit(header) if err != nil { return nil, err @@ -1630,8 +1640,9 @@ func (te *testExecutor) updateAccounts(t *testing.T, accounts ...*acm.Account) { } } -func txHash(tx payload.Payload) []byte { - return txs.Enclose(testChainID, tx).Tx.Hash() +func getTxHash(tx payload.Payload) []byte { + txEnv := txs.Enclose(testChainID, tx) + return txEnv.Tx.Hash() } func (te *testExecutor) signExecuteCommit(tx payload.Payload, signers ...acm.AddressableSigner) error { @@ -1723,7 +1734,7 @@ func testSNativeTxExpectPass(t *testing.T, batchCommitter *testExecutor, perm pe func testSNativeTx(t *testing.T, expectPass bool, batchCommitter *testExecutor, perm permission.PermFlag, snativeArgs permission.PermArgs) { - acc := getAccount(batchCommitter.stateCache, users[0].GetAddress()) + acc := getAccount(t, batchCommitter.stateCache, users[0].GetAddress()) if expectPass { acc.Permissions.Base.Set(perm, true) } @@ -1755,17 +1766,17 @@ func boolToWord256(v bool) Word256 { } func permNameToFuncID(name string) []byte { - function, err := permissionsContract.FunctionByName(name) - if err != nil { - panic("didn't find snative function signature!") + function := permissionsContract.FunctionByName(name) + if function == nil { + panic(fmt.Errorf("could not find permission function %s", name)) } - id := function.Abi.FunctionID + id := function.Abi().FunctionID return id[:] } func snativePermTestInputCALL(name string, user acm.AddressableSigner, perm permission.PermFlag, val bool) (addr crypto.Address, pF permission.PermFlag, data []byte) { - addr = permissionsContract.Address() + addr = native.Permissions.GetByName("Permissions").Address() switch name { case "hasBase", "unsetBase": data = user.GetAddress().Word256().Bytes() @@ -1834,7 +1845,7 @@ func snativeRoleTestInputTx(name string, user acm.AddressableSigner, role string func callContractCode(contractAddr crypto.Address) []byte { // calldatacopy into mem and use as input to call memOff, inputOff := byte(0x0), byte(0x0) - value := byte(0x1) + value := byte(0x0) inOff := byte(0x0) retOff, retSize := byte(0x0), byte(0x20) @@ -1875,9 +1886,9 @@ func wrapContractForCreate(contractCode []byte) []byte { return code } -func assertErrorCode(t *testing.T, expectedCode errors.Code, err error, msgAndArgs ...interface{}) { +func assertErrorCode(t *testing.T, expectedCode *errors.Code, err error, msgAndArgs ...interface{}) { if assert.Error(t, err, msgAndArgs...) { - actualCode := errors.AsException(err).Code + actualCode := errors.AsException(err).ErrorCode() if !assert.Equal(t, expectedCode, actualCode, "expected error code %v", expectedCode) { t.Logf("Expected '%v' but got '%v'", expectedCode, actualCode) } diff --git a/execution/names/cache.go b/execution/names/cache.go index 6513f702e..81dc72517 100644 --- a/execution/names/cache.go +++ b/execution/names/cache.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package names @@ -37,8 +26,7 @@ type nameInfo struct { var _ Writer = &Cache{} // Returns a Cache that wraps an underlying NameRegCacheGetter to use on a cache miss, can write to an -// output Writer via Sync. -// Not goroutine safe, use syncStateCache if you need concurrent access +// output Writer via Sync. Not goroutine safe, use syncStateCache if you need concurrent access func NewCache(backend Reader) *Cache { return &Cache{ backend: backend, @@ -90,7 +78,7 @@ func (cache *Cache) RemoveName(name string) error { } // Writes whatever is in the cache to the output Writer state. Does not flush the cache, to do that call Reset() -// after Sync or use Flusth if your wish to use the output state as your next backend +// after Sync or use Flush if your wish to use the output state as your next backend func (cache *Cache) Sync(state Writer) error { cache.Lock() defer cache.Unlock() @@ -102,7 +90,7 @@ func (cache *Cache) Sync(state Writer) error { } sort.Stable(names) - // Update or delete names. + // Update or delete names for _, name := range names { nameInfo := cache.names[name] nameInfo.RLock() @@ -124,7 +112,7 @@ func (cache *Cache) Sync(state Writer) error { return nil } -// Resets the cache to empty initialising the backing map to the same size as the previous iteration. +// Resets the cache to empty initialising the backing map to the same size as the previous iteration func (cache *Cache) Reset(backend Reader) { cache.Lock() defer cache.Unlock() @@ -132,16 +120,6 @@ func (cache *Cache) Reset(backend Reader) { cache.names = make(map[string]*nameInfo) } -// Syncs the Cache and Resets it to use Writer as the backend Reader -func (cache *Cache) Flush(output Writer, backend Reader) error { - err := cache.Sync(output) - if err != nil { - return err - } - cache.Reset(backend) - return nil -} - func (cache *Cache) Backend() Reader { return cache.backend } diff --git a/execution/names/cache_test.go b/execution/names/cache_test.go index 7b52912c9..1a5b4d77b 100644 --- a/execution/names/cache_test.go +++ b/execution/names/cache_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package names diff --git a/execution/names/names.go b/execution/names/names.go index fd04f44fd..652f18154 100644 --- a/execution/names/names.go +++ b/execution/names/names.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package names diff --git a/execution/names/names.pb.go b/execution/names/names.pb.go index e722ee6e0..f44ebb9c0 100644 --- a/execution/names/names.pb.go +++ b/execution/names/names.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -24,7 +25,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 // NameReg provides a global key value store based on Name, Data pairs that are subject to expiry and ownership by an // account. @@ -52,7 +53,7 @@ func (m *Entry) XXX_Unmarshal(b []byte) error { } func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -103,29 +104,28 @@ func init() { proto.RegisterFile("names.proto", fileDescriptor_f4268625867c617c) func init() { golang_proto.RegisterFile("names.proto", fileDescriptor_f4268625867c617c) } var fileDescriptor_f4268625867c617c = []byte{ - // 249 bytes of a gzipped FileDescriptorProto + // 240 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xce, 0x4b, 0xcc, 0x4d, - 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x73, 0xa4, 0x74, 0xd3, 0x33, 0x4b, - 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0xb2, 0x49, - 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x74, 0x29, 0xcd, 0x66, 0xe4, 0x62, 0x75, 0xcd, - 0x2b, 0x29, 0xaa, 0x14, 0x12, 0xe2, 0x62, 0xf1, 0x4b, 0xcc, 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd4, - 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0xbc, 0xb8, 0x58, 0xfd, 0xcb, 0xf3, 0x52, 0x8b, 0x24, 0x98, 0x14, - 0x18, 0x35, 0x78, 0x9c, 0x4c, 0x4e, 0xdc, 0x93, 0x67, 0xb8, 0x75, 0x4f, 0x5e, 0x07, 0xc9, 0x8e, - 0x8c, 0xca, 0x82, 0xd4, 0xa2, 0x9c, 0xd4, 0x94, 0xf4, 0xd4, 0x22, 0xfd, 0xa4, 0xd2, 0xa2, 0xa2, - 0xfc, 0x72, 0xfd, 0xe4, 0xa2, 0xca, 0x82, 0x92, 0x7c, 0x3d, 0xc7, 0x94, 0x94, 0xa2, 0xd4, 0xe2, - 0xe2, 0x20, 0x88, 0x11, 0x20, 0xf3, 0x5d, 0x12, 0x4b, 0x12, 0x25, 0x98, 0x21, 0xe6, 0x83, 0xd8, - 0x42, 0x12, 0x5c, 0xec, 0xae, 0x15, 0x05, 0x99, 0x45, 0xa9, 0xc5, 0x12, 0x2c, 0x0a, 0x8c, 0x1a, - 0x2c, 0x41, 0x30, 0xae, 0x15, 0xcb, 0x8c, 0x05, 0xf2, 0x0c, 0x4e, 0xee, 0x27, 0x1e, 0xc9, 0x31, - 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x07, 0x1e, 0xcb, - 0x31, 0x9e, 0x78, 0x2c, 0xc7, 0x18, 0xa5, 0x8b, 0xdf, 0x09, 0xa9, 0x15, 0xa9, 0xc9, 0xa5, 0x25, - 0x99, 0xf9, 0x79, 0xfa, 0xe0, 0x50, 0x49, 0x62, 0x03, 0xfb, 0xd6, 0x18, 0x10, 0x00, 0x00, 0xff, - 0xff, 0x3c, 0xd9, 0x3b, 0x5f, 0x32, 0x01, 0x00, 0x00, + 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x73, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, + 0xf3, 0xc1, 0x22, 0xfa, 0x20, 0x16, 0x44, 0x52, 0x69, 0x36, 0x23, 0x17, 0xab, 0x6b, 0x5e, 0x49, + 0x51, 0xa5, 0x90, 0x10, 0x17, 0x8b, 0x5f, 0x62, 0x6e, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, + 0x10, 0x98, 0x2d, 0xe4, 0xc5, 0xc5, 0xea, 0x5f, 0x9e, 0x97, 0x5a, 0x24, 0xc1, 0xa4, 0xc0, 0xa8, + 0xc1, 0xe3, 0x64, 0x72, 0xe2, 0x9e, 0x3c, 0xc3, 0xad, 0x7b, 0xf2, 0x3a, 0xe9, 0x99, 0x25, 0x19, + 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x19, 0x95, 0x05, 0xa9, 0x45, 0x39, 0xa9, 0x29, 0xe9, + 0xa9, 0x45, 0xfa, 0x49, 0xa5, 0x45, 0x45, 0xf9, 0xe5, 0xfa, 0xc9, 0x45, 0x95, 0x05, 0x25, 0xf9, + 0x7a, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0x41, 0x10, 0x23, 0x40, 0xe6, 0xbb, 0x24, 0x96, + 0x24, 0x4a, 0x30, 0x43, 0xcc, 0x07, 0xb1, 0x85, 0x24, 0xb8, 0xd8, 0x5d, 0x2b, 0x0a, 0x32, 0x8b, + 0x52, 0x8b, 0x25, 0x58, 0x14, 0x18, 0x35, 0x58, 0x82, 0x60, 0x5c, 0x2b, 0x96, 0x19, 0x0b, 0xe4, + 0x19, 0x9c, 0xdc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, + 0x07, 0x8f, 0xe4, 0x18, 0x0f, 0x3c, 0x96, 0x63, 0x3c, 0xf1, 0x58, 0x8e, 0x31, 0x4a, 0x17, 0xbf, + 0x13, 0x52, 0x2b, 0x52, 0x93, 0x4b, 0x4b, 0x32, 0xf3, 0xf3, 0xf4, 0xc1, 0x9e, 0x4f, 0x62, 0x03, + 0xfb, 0xd6, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x78, 0xc9, 0x3e, 0x19, 0x01, 0x00, 0x00, } func (m *Entry) 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 } @@ -133,49 +133,61 @@ func (m *Entry) Marshal() (dAtA []byte, err error) { } func (m *Entry) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintNames(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x12 - i++ - i = encodeVarintNames(dAtA, i, uint64(m.Owner.Size())) - n1, err := m.Owner.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Expires != 0 { + i = encodeVarintNames(dAtA, i, uint64(m.Expires)) + i-- + dAtA[i] = 0x20 } - i += n1 if len(m.Data) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintNames(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + i-- + dAtA[i] = 0x1a } - if m.Expires != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintNames(dAtA, i, uint64(m.Expires)) + { + size := m.Owner.Size() + i -= size + if _, err := m.Owner.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintNames(dAtA, i, uint64(size)) } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintNames(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintNames(dAtA []byte, offset int, v uint64) int { + offset -= sovNames(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 (m *Entry) Size() (n int) { if m == nil { @@ -203,14 +215,7 @@ func (m *Entry) Size() (n int) { } func sovNames(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozNames(x uint64) (n int) { return sovNames(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -366,10 +371,7 @@ func (m *Entry) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthNames - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthNames } if (iNdEx + skippy) > l { @@ -388,6 +390,7 @@ func (m *Entry) Unmarshal(dAtA []byte) error { func skipNames(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -419,10 +422,8 @@ func skipNames(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -443,55 +444,30 @@ func skipNames(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthNames } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthNames - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNames - } - 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 := skipNames(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthNames - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNames + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthNames + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthNames = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowNames = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthNames = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNames = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNames = fmt.Errorf("proto: unexpected end of group") ) diff --git a/execution/native/contract.go b/execution/native/contract.go new file mode 100644 index 000000000..a4e2320e9 --- /dev/null +++ b/execution/native/contract.go @@ -0,0 +1,170 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package native + +import ( + "fmt" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/evm/abi" + "github.com/hyperledger/burrow/logging" +) + +// +// Native (go) contracts are dispatched based on account permissions and can access +// and modify an account's permissions +// + +// Instructions on adding an native function. First declare a function like so: +// +// func unsetBase(context Context, args unsetBaseArgs) (unsetBaseRets, error) { +// } +// +// The name of the function will be used as the name of the function in solidity. The +// first arguments is Context; this will give you access to state, and the logger +// etc. The second arguments must be a struct type. The members of this struct must be +// exported (start with uppercase letter), and they will be converted into arguments +// for the solidity function, with the same types. The first return value is a struct +// which defines the return values from solidity just like the arguments. +// +// The second return value must be error. If non-nil is returned for error, then +// the current transaction will be aborted and the execution will stop. +// +// For each contract you will need to create a Contract{} struct, +// with the function listed. Only the PermFlag and the function F needs to be filled +// in for each Function. Add this to the SNativeContracts() function. + +// Contract is metadata for native contract. Acts as a call target +// from the EVM. Can be used to generate bindings in a smart contract languages. +type Contract struct { + // Comment describing purpose of native contract and reason for assembling + // the particular functions + Comment string + // Name of the native contract + Name string + functionsByID map[abi.FunctionID]*Function + functions []*Function + address crypto.Address + logger *logging.Logger +} + +var _ engine.Native = &Contract{} + +// Create a new native contract description object by passing a comment, name +// and a list of member functions descriptions +func NewContract(name string, comment string, logger *logging.Logger, fs ...Function) (*Contract, error) { + address := engine.AddressFromName(name) + functionsByID := make(map[abi.FunctionID]*Function, len(fs)) + functions := make([]*Function, len(fs)) + logger = logger.WithScope("NativeContract") + for i, f := range fs { + function := f + err := function.init(address) + if err != nil { + return nil, err + } + if function.abi == nil { + return nil, fmt.Errorf("could not establish ABI for function - contract functions must have a " + + "struct second argument in order to establish ABI") + } + function.contractName = name + function.logger = logger + fid := function.abi.FunctionID + otherF, ok := functionsByID[fid] + if ok { + return nil, fmt.Errorf("function with ID %x already defined: %s", fid, otherF.Signature()) + } + functionsByID[fid] = &function + functions[i] = &function + } + return &Contract{ + Comment: comment, + Name: name, + functionsByID: functionsByID, + functions: functions, + address: address, + logger: logger, + }, nil +} + +// Dispatch is designed to be called from the EVM once a native contract +// has been selected. +func (c *Contract) Call(state engine.State, params engine.CallParams) (output []byte, err error) { + if len(params.Input) < abi.FunctionIDSize { + return nil, errors.Errorf(errors.Codes.NativeFunction, + "Burrow Native dispatch requires a 4-byte function identifier but arguments are only %v bytes long", + len(params.Input)) + } + + var id abi.FunctionID + copy(id[:], params.Input) + function, err := c.FunctionByID(id) + if err != nil { + return nil, err + } + + params.Input = params.Input[abi.FunctionIDSize:] + + return function.Call(state, params) +} + +func (c *Contract) SetExternals(externals engine.Dispatcher) { + for _, f := range c.functions { + f.SetExternals(externals) + } +} + +func (c *Contract) FullName() string { + return c.Name +} + +// We define the address of an native contact as the last 20 bytes of the sha3 +// hash of its name +func (c *Contract) Address() crypto.Address { + return c.address +} + +// Get function by calling identifier FunctionSelector +func (c *Contract) FunctionByID(id abi.FunctionID) (*Function, errors.CodedError) { + f, ok := c.functionsByID[id] + if !ok { + return nil, + errors.Errorf(errors.Codes.NativeFunction, "unknown native function with ID %x", id) + } + return f, nil +} + +// Get function by name +func (c *Contract) FunctionByName(name string) *Function { + for _, f := range c.functions { + if f.name == name { + return f + } + } + return nil +} + +// Get functions in order of declaration +func (c *Contract) Functions() []*Function { + functions := make([]*Function, len(c.functions)) + copy(functions, c.functions) + return functions +} + +func (c *Contract) ContractMeta() []*acm.ContractMeta { + // FIXME: make this return actual ABI metadata + metadata := "{}" + metadataHash := acmstate.GetMetadataHash(metadata) + return []*acm.ContractMeta{ + { + CodeHash: []byte(c.Name), + MetadataHash: metadataHash[:], + Metadata: metadata, + }, + } +} diff --git a/execution/native/function.go b/execution/native/function.go new file mode 100644 index 000000000..4b40dfca6 --- /dev/null +++ b/execution/native/function.go @@ -0,0 +1,196 @@ +package native + +import ( + "fmt" + "reflect" + "runtime" + "strings" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/evm/abi" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/permission" +) + +// Function is metadata for native functions. Act as call targets +// for the EVM when collected into an Contract. Can be used to generate +// bindings in a smart contract languages. +type Function struct { + // Comment describing function's purpose, parameters, and return value + Comment string + // Permissions required to call function + PermFlag permission.PermFlag + // Whether this function writes to state + Pure bool + // Native function to which calls will be dispatched when a containing + F interface{} + // Following fields are for only for memoization + // The name of the contract to which this function belongs (if any) + contractName string + // Function name (used to form signature) + name string + // The abi + abi *abi.FunctionSpec + // Address of containing contract + address crypto.Address + externals engine.Dispatcher + logger *logging.Logger +} + +var _ engine.Native = &Function{} + +// Context is the first argument to any native function. This struct carries +// all the context an native needs to access e.g. state in burrow. +type Context struct { + State engine.State + engine.CallParams + // TODO: this allows us to call back to EVM contracts if we wish - make use of it somewhere... + externals engine.Dispatcher + Logger *logging.Logger +} + +// Created a new function mounted directly at address (i.e. no Solidity contract or function selection) +func NewFunction(comment string, address crypto.Address, permFlag permission.PermFlag, f interface{}) (*Function, error) { + function := &Function{ + Comment: comment, + PermFlag: permFlag, + F: f, + } + err := function.init(address) + if err != nil { + return nil, err + } + return function, nil +} + +func (f *Function) SetExternals(externals engine.Dispatcher) { + // Wrap it to treat nil dispatcher as empty list + f.externals = engine.NewDispatchers(externals) +} + +func (f *Function) Call(state engine.State, params engine.CallParams) ([]byte, error) { + return engine.Call(state, params, f.execute) +} + +func (f *Function) execute(state engine.State, params engine.CallParams) ([]byte, error) { + // check if we have permission to call this function + hasPermission, err := engine.HasPermission(state.CallFrame, params.Caller, f.PermFlag) + if err != nil { + return nil, err + } + if !hasPermission { + return nil, &errors.LacksNativePermission{Address: params.Caller, NativeName: f.name} + } + + ctx := Context{ + State: state, + CallParams: params, + externals: f.externals, + Logger: f.logger, + } + fnv := reflect.ValueOf(f.F) + fnt := fnv.Type() + + args := []reflect.Value{reflect.ValueOf(ctx)} + + if f.abi != nil { + arguments := reflect.New(fnt.In(1)) + err = abi.Unpack(f.abi.Inputs, params.Input, arguments.Interface()) + if err != nil { + return nil, err + } + args = append(args, arguments.Elem()) + } + + rets := fnv.Call(args) + if !rets[1].IsNil() { + return nil, rets[1].Interface().(error) + } + + ret := rets[0].Interface() + if f.abi != nil { + return abi.Pack(f.abi.Outputs, ret) + } + + output, ok := ret.([]byte) + if !ok { + return nil, fmt.Errorf("function has no associated ABI but returns %T instead of []byte", ret) + } + return output, nil +} + +func (f *Function) FullName() string { + if f.contractName != "" { + return f.contractName + "." + f.name + } + return f.name +} + +func (f *Function) Address() crypto.Address { + return f.address +} + +// Signature returns the function signature as would be used for ABI hashing +func (f *Function) Signature() string { + argTypeNames := make([]string, len(f.abi.Inputs)) + for i, arg := range f.abi.Inputs { + argTypeNames[i] = arg.EVM.GetSignature() + } + return fmt.Sprintf("%s(%s)", f.name, strings.Join(argTypeNames, ",")) +} + +// For templates +func (f *Function) Name() string { + return f.name +} + +// NArgs returns the number of function arguments +func (f *Function) NArgs() int { + return len(f.abi.Inputs) +} + +// Abi returns the FunctionSpec for this function +func (f *Function) Abi() *abi.FunctionSpec { + return f.abi +} + +func (f *Function) ContractMeta() []*acm.ContractMeta { + // FIXME: can we do something here - a function is not a contract... + return nil +} + +func (f *Function) String() string { + return fmt.Sprintf("SNativeFunction{Name: %s; Inputs: %d; Outputs: %d}", + f.name, len(f.abi.Inputs), len(f.abi.Outputs)) +} + +func (f *Function) init(address crypto.Address) error { + // Get name of function + t := reflect.TypeOf(f.F) + v := reflect.ValueOf(f.F) + // v.String() for functions returns the empty string + fullyQualifiedName := runtime.FuncForPC(v.Pointer()).Name() + a := strings.Split(fullyQualifiedName, ".") + f.name = a[len(a)-1] + + if t.NumIn() != 1 && t.NumIn() != 2 { + return fmt.Errorf("native function %s must have a one or two arguments", fullyQualifiedName) + } + + if t.NumOut() != 2 { + return fmt.Errorf("native function %s must return a single struct and an error", fullyQualifiedName) + } + + if t.In(0) != reflect.TypeOf(Context{}) { + return fmt.Errorf("first agument of %s must be struct Context", fullyQualifiedName) + } + + if t.NumIn() == 2 { + f.abi = abi.SpecFromStructReflect(f.name, t.In(1), t.Out(0)) + } + f.address = address + return nil +} diff --git a/execution/native/native.go b/execution/native/native.go new file mode 100644 index 000000000..babba8f3e --- /dev/null +++ b/execution/native/native.go @@ -0,0 +1,17 @@ +package native + +func MustDefaultNatives() *Natives { + ns, err := DefaultNatives() + if err != nil { + panic(err) + } + return ns +} + +func DefaultNatives() (*Natives, error) { + ns, err := Merge(Permissions, Precompiles) + if err != nil { + return nil, err + } + return ns, nil +} diff --git a/execution/native/native_test.go b/execution/native/native_test.go new file mode 100644 index 000000000..4142e8fc4 --- /dev/null +++ b/execution/native/native_test.go @@ -0,0 +1,12 @@ +package native + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDefaultNatives(t *testing.T) { + _, err := DefaultNatives() + require.NoError(t, err) +} diff --git a/execution/native/natives.go b/execution/native/natives.go new file mode 100644 index 000000000..c9d4e99e3 --- /dev/null +++ b/execution/native/natives.go @@ -0,0 +1,143 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package native + +import ( + "fmt" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/permission" +) + +type Natives struct { + callableByAddress map[crypto.Address]engine.Native + callableByName map[string]engine.Native + logger *logging.Logger +} + +func New() *Natives { + return &Natives{ + callableByAddress: make(map[crypto.Address]engine.Native), + callableByName: make(map[string]engine.Native), + logger: logging.NewNoopLogger(), + } +} + +func Merge(nss ...*Natives) (*Natives, error) { + n := New() + for _, ns := range nss { + for _, contract := range ns.callableByName { + err := n.register(contract) + if err != nil { + return nil, err + } + } + } + return n, nil +} + +func (ns *Natives) WithLogger(logger *logging.Logger) *Natives { + ns.logger = logger + return ns +} + +func (ns *Natives) Dispatch(acc *acm.Account) engine.Callable { + return ns.GetByAddress(acc.Address) +} + +func (ns *Natives) SetExternals(externals engine.Dispatcher) { + for _, c := range ns.callableByAddress { + c.SetExternals(externals) + } +} + +func (ns *Natives) Callables() []engine.Callable { + callables := make([]engine.Callable, 0, len(ns.callableByAddress)) + for _, c := range ns.callableByAddress { + callables = append(callables, c) + } + return callables +} + +func (ns *Natives) GetByName(name string) engine.Native { + return ns.callableByName[name] +} + +func (ns *Natives) GetContract(name string) *Contract { + c, _ := ns.GetByName(name).(*Contract) + return c +} + +func (ns *Natives) GetFunction(name string) *Function { + f, _ := ns.GetByName(name).(*Function) + return f +} + +func (ns *Natives) GetByAddress(address crypto.Address) engine.Native { + return ns.callableByAddress[address] +} + +func (ns *Natives) IsRegistered(address crypto.Address) bool { + _, ok := ns.callableByAddress[address] + return ok +} + +func (ns *Natives) MustContract(name, comment string, functions ...Function) *Natives { + ns, err := ns.Contract(name, comment, functions...) + if err != nil { + panic(err) + } + return ns +} + +func (ns *Natives) Contract(name, comment string, functions ...Function) (*Natives, error) { + contract, err := NewContract(name, comment, ns.logger, functions...) + if err != nil { + return nil, err + } + err = ns.register(contract) + if err != nil { + return nil, err + } + return ns, nil +} + +func (ns *Natives) MustFunction(comment string, address crypto.Address, permFlag permission.PermFlag, f interface{}) *Natives { + ns, err := ns.Function(comment, address, permFlag, f) + if err != nil { + panic(err) + } + return ns +} + +func (ns *Natives) Function(comment string, address crypto.Address, permFlag permission.PermFlag, f interface{}) (*Natives, error) { + function, err := NewFunction(comment, address, permFlag, f) + if err != nil { + return nil, err + } + err = ns.register(function) + if err != nil { + return nil, err + } + return ns, nil +} + +func (ns *Natives) register(callable engine.Native) error { + name := callable.FullName() + address := callable.Address() + _, ok := ns.callableByName[name] + if ok { + return fmt.Errorf("cannot redeclare contract with name %s", name) + } + _, ok = ns.callableByAddress[address] + if ok { + return fmt.Errorf("cannot redeclare contract with address %v", address) + } + ns.callableByName[name] = callable + ns.callableByAddress[address] = callable + return nil +} diff --git a/execution/native/permissions.go b/execution/native/permissions.go new file mode 100644 index 000000000..98aa29d69 --- /dev/null +++ b/execution/native/permissions.go @@ -0,0 +1,262 @@ +package native + +import ( + "fmt" + + "github.com/hyperledger/burrow/execution/engine" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/permission" +) + +var Permissions = New().MustContract("Permissions", + `* Interface for managing Secure Native authorizations. + * @dev This interface describes the functions exposed by the native permissions layer in burrow. + `, + Function{ + Comment: ` + * @notice Adds a role to an account + * @param _account account address + * @param _role role name + * @return _result whether role was added + `, + PermFlag: permission.AddRole, + F: addRole, + }, + Function{ + Comment: ` + * @notice Removes a role from an account + * @param _account account address + * @param _role role name + * @return _result whether role was removed + `, + PermFlag: permission.RemoveRole, + F: removeRole, + }, + Function{ + Comment: ` + * @notice Indicates whether an account has a role + * @param _account account address + * @param _role role name + * @return _result whether account has role + `, + PermFlag: permission.HasRole, + F: hasRole, + }, + Function{ + Comment: ` + * @notice Sets the permission flags for an account. Makes them explicitly set (on or off). + * @param _account account address + * @param _permission the base permissions flags to set for the account + * @param _set whether to set or unset the permissions flags at the account level + * @return _result is the permission flag that was set as uint64 + `, + PermFlag: permission.SetBase, + F: setBase, + }, + Function{ + Comment: ` + * @notice Unsets the permissions flags for an account. Causes permissions being unset to fall through to global permissions. + * @param _account account address + * @param _permission the permissions flags to unset for the account + * @return _result is the permission flag that was unset as uint64 + `, + PermFlag: permission.UnsetBase, + F: unsetBase, + }, + Function{ + Comment: ` + * @notice Indicates whether an account has a subset of permissions set + * @param _account account address + * @param _permission the permissions flags (mask) to check whether enabled against base permissions for the account + * @return _result is whether account has the passed permissions flags set + `, + PermFlag: permission.HasBase, + F: hasBase, + }, + Function{Comment: ` + * @notice Sets the global (default) permissions flags for the entire chain + * @param _permission the permissions flags to set + * @param _set whether to set (or unset) the permissions flags + * @return _result is the permission flag that was set as uint64 + `, + PermFlag: permission.SetGlobal, + F: setGlobal, + }, +) + +type hasBaseArgs struct { + Account crypto.Address + Permission uint64 +} + +type hasBaseRets struct { + Result bool +} + +func hasBase(ctx Context, args hasBaseArgs) (hasBaseRets, error) { + permN := permission.PermFlag(args.Permission) // already shifted + if !permN.IsValid() { + return hasBaseRets{}, permission.ErrInvalidPermission(permN) + } + hasPermission, err := engine.HasPermission(ctx.State, args.Account, permN) + if err != nil { + return hasBaseRets{}, err + } + ctx.Logger.Trace.Log("function", "hasBase", + "address", args.Account.String(), + "perm_flag", fmt.Sprintf("%b", permN), + "has_permission", hasPermission) + return hasBaseRets{Result: hasPermission}, nil +} + +type setBaseArgs struct { + Account crypto.Address + Permission uint64 + Set bool +} + +type setBaseRets struct { + Result uint64 +} + +func setBase(ctx Context, args setBaseArgs) (setBaseRets, error) { + permFlag := permission.PermFlag(args.Permission) + if !permFlag.IsValid() { + return setBaseRets{}, permission.ErrInvalidPermission(permFlag) + } + err := engine.UpdateAccount(ctx.State, args.Account, func(acc *acm.Account) error { + err := acc.Permissions.Base.Set(permFlag, args.Set) + return err + }) + if err != nil { + return setBaseRets{}, err + } + ctx.Logger.Trace.Log("function", "setBase", "address", args.Account.String(), + "permission_flag", fmt.Sprintf("%b", permFlag), + "permission_value", args.Permission) + return setBaseRets{Result: uint64(permFlag)}, nil +} + +type unsetBaseArgs struct { + Account crypto.Address + Permission uint64 +} + +type unsetBaseRets struct { + Result uint64 +} + +func unsetBase(ctx Context, args unsetBaseArgs) (unsetBaseRets, error) { + permFlag := permission.PermFlag(args.Permission) + if !permFlag.IsValid() { + return unsetBaseRets{}, permission.ErrInvalidPermission(permFlag) + } + err := engine.UpdateAccount(ctx.State, args.Account, func(acc *acm.Account) error { + return acc.Permissions.Base.Unset(permFlag) + }) + if err != nil { + return unsetBaseRets{}, err + } + ctx.Logger.Trace.Log("function", "unsetBase", "address", args.Account.String(), + "perm_flag", fmt.Sprintf("%b", permFlag), + "permission_flag", fmt.Sprintf("%b", permFlag)) + + return unsetBaseRets{Result: uint64(permFlag)}, nil +} + +type setGlobalArgs struct { + Permission uint64 + Set bool +} + +type setGlobalRets struct { + Result uint64 +} + +func setGlobal(ctx Context, args setGlobalArgs) (setGlobalRets, error) { + permFlag := permission.PermFlag(args.Permission) + if !permFlag.IsValid() { + return setGlobalRets{}, permission.ErrInvalidPermission(permFlag) + } + err := engine.UpdateAccount(ctx.State, acm.GlobalPermissionsAddress, func(acc *acm.Account) error { + return acc.Permissions.Base.Set(permFlag, args.Set) + }) + if err != nil { + return setGlobalRets{}, err + } + ctx.Logger.Trace.Log("function", "setGlobal", + "permission_flag", fmt.Sprintf("%b", permFlag), + "permission_value", args.Set) + return setGlobalRets{Result: uint64(permFlag)}, nil +} + +type hasRoleArgs struct { + Account crypto.Address + Role string +} + +type hasRoleRets struct { + Result bool +} + +func hasRole(ctx Context, args hasRoleArgs) (hasRoleRets, error) { + acc, err := engine.MustAccount(ctx.State, args.Account) + if err != nil { + return hasRoleRets{}, err + } + hasRole := acc.Permissions.HasRole(args.Role) + ctx.Logger.Trace.Log("function", "hasRole", "address", args.Account.String(), + "role", args.Role, + "has_role", hasRole) + return hasRoleRets{Result: hasRole}, nil +} + +type addRoleArgs struct { + Account crypto.Address + Role string +} + +type addRoleRets struct { + Result bool +} + +func addRole(ctx Context, args addRoleArgs) (addRoleRets, error) { + ret := addRoleRets{} + err := engine.UpdateAccount(ctx.State, args.Account, func(account *acm.Account) error { + ret.Result = account.Permissions.AddRole(args.Role) + return nil + }) + if err != nil { + return ret, err + } + ctx.Logger.Trace.Log("function", "addRole", "address", args.Account.String(), + "role", args.Role, + "role_added", ret.Result) + return ret, nil +} + +type removeRoleArgs struct { + Account crypto.Address + Role string +} + +type removeRoleRets struct { + Result bool +} + +func removeRole(ctx Context, args removeRoleArgs) (removeRoleRets, error) { + ret := removeRoleRets{} + err := engine.UpdateAccount(ctx.State, args.Account, func(account *acm.Account) error { + ret.Result = account.Permissions.RemoveRole(args.Role) + return nil + }) + if err != nil { + return ret, err + } + ctx.Logger.Trace.Log("function", "removeRole", "address", args.Account.String(), + "role", args.Role, + "role_removed", ret.Result) + return ret, nil +} diff --git a/execution/native/permissions_test.go b/execution/native/permissions_test.go new file mode 100644 index 000000000..ebe38fa96 --- /dev/null +++ b/execution/native/permissions_test.go @@ -0,0 +1,192 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package native + +import ( + "encoding/hex" + "math/big" + "strconv" + "strings" + "testing" + + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/logging" + "github.com/stretchr/testify/require" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/crypto" + + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/evm/abi" + "github.com/hyperledger/burrow/execution/evm/asm/bc" + "github.com/hyperledger/burrow/permission" + "github.com/stretchr/testify/assert" +) + +// Compiling the Permissions solidity contract at +// (generated by 'burrow natives' command) and passing to +// https://ethereum.github.io/browser-solidity (toggle details to get list) +// yields: +// Keep this updated to drive TestPermissionsContractSignatures +const compiledSigs = ` +7d72aa65 addRole(address,string) +1bfe0308 removeRole(address,string) +217fe6c6 hasRole(address,string) +dbd4a8ea setBase(address,uint64,bool) +b7d4dc0d unsetBase(address,uint64) +225b6574 hasBase(address,uint64) +c4bc7b70 setGlobal(uint64,bool) +` + +var logger = logging.NewNoopLogger() + +func TestPermissionsContractSignatures(t *testing.T) { + contract := Permissions.GetByName("Permissions").(*Contract) + + nFuncs := len(contract.functions) + + sigMap := idToSignatureMap() + + assert.Len(t, sigMap, nFuncs, + "Permissions contract defines %s functions so we need %s "+ + "signatures in compiledSigs", + nFuncs, nFuncs) + + for funcID, signature := range sigMap { + assertFunctionIDSignature(t, contract, funcID, signature) + } +} + +func TestSNativeContractDescription_Dispatch(t *testing.T) { + contract := Permissions.GetByName("Permissions").(*Contract) + st := acmstate.NewMemoryState() + caller := &acm.Account{ + Address: crypto.Address{1, 1, 1}, + } + grantee := &acm.Account{ + Address: crypto.Address{2, 2, 2}, + } + require.NoError(t, st.UpdateAccount(caller)) + require.NoError(t, st.UpdateAccount(grantee)) + state := engine.State{ + CallFrame: engine.NewCallFrame(st), + EventSink: exec.NewNoopEventSink(), + } + + function := contract.FunctionByName("setBase") + require.NotNil(t, function, "Could not get function: %s") + funcID := function.Abi().FunctionID + // Should fail since we have no permissions + input := bc.MustSplice(funcID[:], grantee.Address, permFlagToWord256(permission.CreateAccount)) + params := engine.CallParams{ + Caller: caller.Address, + Input: input, + Gas: big.NewInt(1000), + } + _, err := contract.Call(state, params) + if !assert.Error(t, err, "Should fail due to lack of permissions") { + return + } + assert.Equal(t, errors.Codes.NativeFunction, errors.GetCode(err)) + + // Grant all permissions and dispatch should success + err = engine.UpdateAccount(state, caller.Address, func(acc *acm.Account) error { + return acc.Permissions.Base.Set(permission.SetBase, true) + }) + require.NoError(t, err) + bondFlagWord := permFlagToWord256(permission.Bond) + params.Input = bc.MustSplice(funcID[:], grantee.Address.Word256(), bondFlagWord, binary.One256) + + retValue, err := contract.Call(state, params) + require.NoError(t, err) + assert.Equal(t, bondFlagWord[:], retValue) +} + +func TestSNativeContractDescription_Address(t *testing.T) { + contract, err := NewContract("CoolButVeryLongNamedContractOfDoom", "A comment", logger) + require.NoError(t, err) + assert.Equal(t, crypto.Keccak256(([]byte)(contract.Name))[12:], contract.Address().Bytes()) +} + +func TestHasPermission(t *testing.T) { + cache := acmstate.NewMemoryState() + + base, err := permission.BasePermissionsFromStringList([]string{"createContract", "createAccount", "bond", "proposal", "setBase", "unsetBase", "setGlobal", "addRole", "removeRole"}) + require.NoError(t, err) + + acc := &acm.Account{ + Address: engine.AddressFromName("frog"), + Permissions: permission.AccountPermissions{ + Base: base, + }, + } + + require.NoError(t, cache.UpdateAccount(acc)) + // Ensure we are falling through to global permissions on those bits not set + + flag := permission.Send | permission.Call | permission.Name | permission.HasRole + hasPermission, err := engine.HasPermission(cache, acc.Address, flag) + require.NoError(t, err) + assert.True(t, hasPermission) +} + +// +// Helpers +// +func BasePermissionsFromStrings(t *testing.T, perms, setBit string) permission.BasePermissions { + return permission.BasePermissions{ + Perms: PermFlagFromString(t, perms), + SetBit: PermFlagFromString(t, setBit), + } +} + +func PermFlagFromString(t *testing.T, binaryString string) permission.PermFlag { + permFlag, err := strconv.ParseUint(binaryString, 2, 64) + require.NoError(t, err) + return permission.PermFlag(permFlag) +} + +func assertFunctionIDSignature(t *testing.T, contract *Contract, + funcIDHex string, expectedSignature string) { + fromHex := funcIDFromHex(t, funcIDHex) + function, err := contract.FunctionByID(fromHex) + assert.NoError(t, err, + "Error retrieving Function with ID %s", funcIDHex) + if err == nil { + assert.Equal(t, expectedSignature, function.Signature()) + } +} + +func funcIDFromHex(t *testing.T, hexString string) (funcID abi.FunctionID) { + bs, err := hex.DecodeString(hexString) + assert.NoError(t, err, "Could not decode hex string '%s'", hexString) + if len(bs) != 4 { + t.Fatalf("FunctionSelector must be 4 bytes but '%s' is %v bytes", hexString, + len(bs)) + } + copy(funcID[:], bs) + return +} + +func permFlagToWord256(permFlag permission.PermFlag) binary.Word256 { + return binary.Uint64ToWord256(uint64(permFlag)) +} + +// turns the solidity compiler function summary into a map to drive signature +// test +func idToSignatureMap() map[string]string { + sigMap := make(map[string]string) + lines := strings.Split(compiledSigs, "\n") + for _, line := range lines { + trimmed := strings.Trim(line, " \t") + if trimmed != "" { + idSig := strings.Split(trimmed, " ") + sigMap[idSig[0]] = idSig[1] + } + } + return sigMap +} diff --git a/execution/native/precompiles.go b/execution/native/precompiles.go new file mode 100644 index 000000000..f4951bdf9 --- /dev/null +++ b/execution/native/precompiles.go @@ -0,0 +1,223 @@ +package native + +import ( + cryptoSha256 "crypto/sha256" + "fmt" + "math/big" + + "github.com/hyperledger/burrow/execution/engine" + + "github.com/btcsuite/btcd/btcec" + + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/permission" + "golang.org/x/crypto/ripemd160" + "golang.org/x/crypto/sha3" +) + +var Precompiles = New(). + MustFunction(`Recover public key/address of account that signed the data`, + leftPadAddress(1), + permission.None, + ecrecover). + MustFunction(`Compute the sha256 hash of input`, + leftPadAddress(2), + permission.None, + sha256). + MustFunction(`Compute the ripemd160 hash of input`, + leftPadAddress(3), + permission.None, + ripemd160Func). + MustFunction(`Return an output identical to the input`, + leftPadAddress(4), + permission.None, + identity). + MustFunction(`Compute the operation base**exp % mod where the values are big ints`, + leftPadAddress(5), + permission.None, + expMod). + MustFunction(`Compute the keccak256 hash of input`, + leftPadAddress(20), + permission.None, + keccak256Func) + +func leftPadAddress(bs ...byte) crypto.Address { + return crypto.AddressFromWord256(binary.LeftPadWord256(bs)) +} + +// SECP256K1 Recovery +func ecrecover(ctx Context) ([]byte, error) { + // Deduct gas + gasRequired := engine.GasEcRecover + var err error = engine.UseGasNegative(ctx.Gas, gasRequired) + if err != nil { + return nil, err + } + + // layout is: + // input: [ hash | v | r | s ] + // bytes: [ 32 | 32 | 32 | 32 ] + // Where: + // hash = message digest + // v = 27 + recovery id (which of 4 possible x coords do we take as public key) (single byte but padded) + // r = encrypted random point + // s = signature proof + + // Signature layout required by ethereum: + // sig: [ r | s | v ] + // bytes: [ 32 | 32 | 1 ] + hash := ctx.Input[:32] + + const compactSigLength = 2*binary.Word256Bytes + 1 + sig := make([]byte, compactSigLength) + // Copy in r, s + copy(sig, ctx.Input[2*binary.Word256Bytes:4*binary.Word256Bytes]) + // Check v is single byte + v := ctx.Input[binary.Word256Bytes : 2*binary.Word256Bytes] + if !binary.IsZeros(v[:len(v)-1]) { + return nil, fmt.Errorf("ecrecover: recovery ID is larger than one byte") + } + // Copy in v to last element of sig + sig[2*binary.Word256Bytes] = v[len(v)-1] + + publicKey, isCompressed, err := btcec.RecoverCompact(btcec.S256(), sig, hash) + if err != nil { + return nil, err + } + + var serializedPublicKey []byte + if isCompressed { + serializedPublicKey = publicKey.SerializeCompressed() + } else { + serializedPublicKey = publicKey.SerializeUncompressed() + } + // First byte is a length-prefix + hashed := crypto.Keccak256(serializedPublicKey[1:]) + hashed = hashed[len(hashed)-crypto.AddressLength:] + return binary.LeftPadBytes(hashed, binary.Word256Bytes), nil +} + +func sha256(ctx Context) (output []byte, err error) { + // Deduct gas + gasRequired := wordsIn(uint64(len(ctx.Input)))*engine.GasSha256Word + engine.GasSha256Base + err = engine.UseGasNegative(ctx.Gas, gasRequired) + if err != nil { + return nil, err + } + // Hash + hasher := cryptoSha256.New() + // CONTRACT: this does not err + hasher.Write(ctx.Input) + return hasher.Sum(nil), nil +} + +func ripemd160Func(ctx Context) (output []byte, err error) { + // Deduct gas + gasRequired := wordsIn(uint64(len(ctx.Input)))*engine.GasRipemd160Word + engine.GasRipemd160Base + err = engine.UseGasNegative(ctx.Gas, gasRequired) + if err != nil { + return nil, err + } + // Hash + hasher := ripemd160.New() + // CONTRACT: this does not err + hasher.Write(ctx.Input) + return binary.LeftPadBytes(hasher.Sum(nil), 32), nil +} + +func keccak256Func(ctx Context) (output []byte, err error) { + // Deduct gas + gasRequired := wordsIn(uint64(len(ctx.Input)))*engine.GasRipemd160Word + engine.GasRipemd160Base + err = engine.UseGasNegative(ctx.Gas, gasRequired) + if err != nil { + return nil, err + } + // Hash + hasher := sha3.NewLegacyKeccak256() + // CONTRACT: this does not err + hasher.Write(ctx.Input) + return binary.LeftPadBytes(hasher.Sum(nil), 32), nil +} + +func identity(ctx Context) (output []byte, err error) { + // Deduct gas + gasRequired := wordsIn(uint64(len(ctx.Input)))*engine.GasIdentityWord + engine.GasIdentityBase + err = engine.UseGasNegative(ctx.Gas, gasRequired) + if err != nil { + return nil, err + } + // Return identity + return ctx.Input, nil +} + +// expMod: function that implements the EIP 198 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-198.md with +// a fixed gas requirement) +func expMod(ctx Context) (output []byte, err error) { + const errHeader = "expMod" + + input, segments, err := cut(ctx.Input, binary.Word256Bytes, binary.Word256Bytes, binary.Word256Bytes) + if err != nil { + return nil, fmt.Errorf("%s: %v", errHeader, err) + } + + // get the lengths of base, exp and mod + baseLength := getUint64(segments[0]) + expLength := getUint64(segments[1]) + modLength := getUint64(segments[2]) + + // TODO: implement non-trivial gas schedule for this operation. Probably a parameterised version of the one + // described in EIP though that one seems like a bit of a complicated fudge + gasRequired := engine.GasExpModBase + engine.GasExpModWord*(wordsIn(baseLength)*wordsIn(expLength)*wordsIn(modLength)) + + err = engine.UseGasNegative(ctx.Gas, gasRequired) + if err != nil { + return nil, err + } + + input, segments, err = cut(input, baseLength, expLength, modLength) + if err != nil { + return nil, fmt.Errorf("%s: %v", errHeader, err) + } + + // get the values of base, exp and mod + base := getBigInt(segments[0], baseLength) + exp := getBigInt(segments[1], expLength) + mod := getBigInt(segments[2], modLength) + + // handle mod 0 + if mod.Sign() == 0 { + return binary.LeftPadBytes([]byte{}, int(modLength)), nil + } + + // return base**exp % mod left padded + return binary.LeftPadBytes(new(big.Int).Exp(base, exp, mod).Bytes(), int(modLength)), nil +} + +// Partition the head of input into segments for each length in lengths. The first return value is the unconsumed tail +// of input and the seconds is the segments. Returns an error if input is of insufficient length to establish each segment. +func cut(input []byte, lengths ...uint64) ([]byte, [][]byte, error) { + segments := make([][]byte, len(lengths)) + for i, length := range lengths { + if uint64(len(input)) < length { + return nil, nil, fmt.Errorf("input is not long enough") + } + segments[i] = input[:length] + input = input[length:] + } + return input, segments, nil +} + +func getBigInt(bs []byte, numBytes uint64) *big.Int { + bits := uint(numBytes) * 8 + // Push bytes into big.Int and interpret as twos complement encoding with of bits width + return binary.FromTwosComplement(new(big.Int).SetBytes(bs), bits) +} + +func getUint64(bs []byte) uint64 { + return binary.Uint64FromWord256(binary.LeftPadWord256(bs)) +} + +func wordsIn(numBytes uint64) uint64 { + return numBytes + binary.Word256Bytes - 1/binary.Word256Bytes +} diff --git a/execution/native/state.go b/execution/native/state.go new file mode 100644 index 000000000..1e52762bf --- /dev/null +++ b/execution/native/state.go @@ -0,0 +1,85 @@ +package native + +import ( + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/errors" +) + +// This wrapper provides a state that behaves 'as if' the natives were stored directly in state. +// TODO: we may want to actually store native account sentinel values (and their metadata) in on-disk state down the line +type State struct { + natives engine.Natives + backend acmstate.ReaderWriter +} + +// Get a new state that wraps the backend but intercepts any calls to natives returning appropriate errors message +// or an Account sentinel for the particular native +func NewState(natives engine.Natives, backend acmstate.ReaderWriter) *State { + return &State{ + natives: natives, + backend: backend, + } +} + +func (s *State) UpdateAccount(updatedAccount *acm.Account) error { + err := s.ensureNonNative(updatedAccount.Address, "update account") + if err != nil { + return err + } + return s.backend.UpdateAccount(updatedAccount) +} + +func (s *State) GetAccount(address crypto.Address) (*acm.Account, error) { + contract := s.natives.GetByAddress(address) + if contract != nil { + return account(contract), nil + } + return s.backend.GetAccount(address) +} + +func (s *State) RemoveAccount(address crypto.Address) error { + err := s.ensureNonNative(address, "remove account") + if err != nil { + return err + } + return s.backend.RemoveAccount(address) +} + +func (s *State) GetStorage(address crypto.Address, key binary.Word256) ([]byte, error) { + err := s.ensureNonNative(address, "get storage") + if err != nil { + return nil, err + } + return s.backend.GetStorage(address, key) +} + +func (s *State) SetStorage(address crypto.Address, key binary.Word256, value []byte) error { + err := s.ensureNonNative(address, "set storage") + if err != nil { + return err + } + return s.backend.SetStorage(address, key, value) +} + +func (s *State) ensureNonNative(address crypto.Address, action string) error { + contract := s.natives.GetByAddress(address) + if contract != nil { + return errors.Errorf(errors.Codes.ReservedAddress, + "cannot %s at %v because that address is reserved for a native contract '%s'", + action, address, contract.FullName()) + } + return nil +} + +func account(callable engine.Native) *acm.Account { + return &acm.Account{ + Address: callable.Address(), + NativeName: callable.FullName(), + // TODO: this is not populated yet, see FIXME note on native.Contract + ContractMeta: callable.ContractMeta(), + } +} diff --git a/execution/proposal/cache.go b/execution/proposal/cache.go index 1e59aac16..7784582a9 100644 --- a/execution/proposal/cache.go +++ b/execution/proposal/cache.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package proposal @@ -24,7 +13,7 @@ import ( "github.com/hyperledger/burrow/txs/payload" ) -// The Cache helps prevent unnecessary IAVLTree updates and garbage generation. +// Cache helps prevent unnecessary IAVLTree updates and garbage generation. type Cache struct { sync.RWMutex backend Reader @@ -63,8 +52,7 @@ func (p ProposalHashArray) Less(i, j int) bool { var _ Writer = &Cache{} -// Returns a Cache that wraps an underlying NameRegCacheGetter to use on a cache miss, can write to an -// output Writer via Sync. +// Returns a Cache, can write to an output Writer via Sync. // Not goroutine safe, use syncStateCache if you need concurrent access func NewCache(backend Reader) *Cache { return &Cache{ @@ -117,19 +105,17 @@ func (cache *Cache) RemoveProposal(proposalHash []byte) error { } // Writes whatever is in the cache to the output Writer state. Does not flush the cache, to do that call Reset() -// after Sync or use Flusth if your wish to use the output state as your next backend +// after Sync or use Flush if your wish to use the output state as your next backend func (cache *Cache) Sync(state Writer) error { cache.Lock() defer cache.Unlock() - // Determine order for names - // note names may be of any length less than some limit var hashes ProposalHashArray for hash := range cache.proposals { hashes = append(hashes, hash) } sort.Stable(hashes) - // Update or delete names. + // Update or delete proposals for _, hash := range hashes { proposalInfo := cache.proposals[hash] proposalInfo.RLock() @@ -151,7 +137,7 @@ func (cache *Cache) Sync(state Writer) error { return nil } -// Resets the cache to empty initialising the backing map to the same size as the previous iteration. +// Resets the cache to empty initialising the backing map to the same size as the previous iteration func (cache *Cache) Reset(backend Reader) { cache.Lock() defer cache.Unlock() @@ -159,16 +145,6 @@ func (cache *Cache) Reset(backend Reader) { cache.proposals = make(map[[sha256.Size]byte]*proposalInfo) } -// Syncs the Cache and Resets it to use Writer as the backend Reader -func (cache *Cache) Flush(output Writer, backend Reader) error { - err := cache.Sync(output) - if err != nil { - return err - } - cache.Reset(backend) - return nil -} - func (cache *Cache) Backend() Reader { return cache.backend } diff --git a/execution/proposal/proposal.go b/execution/proposal/proposal.go index b857d55e4..c7d22dae0 100644 --- a/execution/proposal/proposal.go +++ b/execution/proposal/proposal.go @@ -9,9 +9,9 @@ type Reader interface { } type Writer interface { - // Updates the name entry creating it if it does not exist + // Updates the proposal, creating it if it does not exist UpdateProposal(proposalHash []byte, proposal *payload.Ballot) error - // Remove the name entry + // Remove the proposal by hash RemoveProposal(proposalHash []byte) error } diff --git a/execution/registry/cache.go b/execution/registry/cache.go new file mode 100644 index 000000000..8dbb1099e --- /dev/null +++ b/execution/registry/cache.go @@ -0,0 +1,152 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package registry + +import ( + "fmt" + "sync" + + "github.com/hyperledger/burrow/crypto" +) + +// Cache helps prevent unnecessary IAVLTree updates and garbage generation. +type Cache struct { + sync.RWMutex + backend Reader + registry map[crypto.Address]*nodeInfo + stats NodeStats +} + +type nodeInfo struct { + sync.RWMutex + node *NodeIdentity + removed bool + updated bool +} + +var _ Writer = &Cache{} + +// NewCache returns a Cache which can write to an output Writer via Sync. +// Not goroutine safe, use syncStateCache if you need concurrent access +func NewCache(backend Reader) *Cache { + return &Cache{ + backend: backend, + registry: make(map[crypto.Address]*nodeInfo), + stats: NewNodeStats(), + } +} + +func (cache *Cache) GetNodeByID(id crypto.Address) (*NodeIdentity, error) { + info, err := cache.get(id) + if err != nil { + return nil, err + } + info.RLock() + defer info.RUnlock() + if info.removed { + return nil, nil + } + return info.node, nil +} + +func (cache *Cache) GetNodeIDsByAddress(net string) ([]crypto.Address, error) { + return cache.stats.GetAddresses(net), nil +} + +func (cache *Cache) GetNumPeers() int { + return len(cache.registry) +} + +func (cache *Cache) UpdateNode(id crypto.Address, node *NodeIdentity) error { + info, err := cache.get(id) + if err != nil { + return err + } + info.Lock() + defer info.Unlock() + if info.removed { + return fmt.Errorf("UpdateNode on a removed node: %x", id) + } + + info.node = node + info.updated = true + cache.stats.Remove(info.node) + cache.stats.Insert(node.GetNetworkAddress(), id) + return nil +} + +func (cache *Cache) RemoveNode(id crypto.Address) error { + info, err := cache.get(id) + if err != nil { + return err + } + info.Lock() + defer info.Unlock() + if info.removed { + return fmt.Errorf("RemoveNode on removed node: %x", id) + } + cache.stats.Remove(info.node) + info.removed = true + return nil +} + +// Sync writes whatever is in the cache to the output state. Does not flush the cache, to do that call Reset() +// after Sync or use Flush if your wish to use the output state as your next backend +func (cache *Cache) Sync(state Writer) error { + cache.Lock() + defer cache.Unlock() + + for id, info := range cache.registry { + info.RLock() + if info.removed { + err := state.RemoveNode(id) + if err != nil { + info.RUnlock() + return err + } + } else if info.updated { + err := state.UpdateNode(id, info.node) + if err != nil { + info.RUnlock() + return err + } + } + info.RUnlock() + } + return nil +} + +// Reset the cache to empty initialising the backing map to the same size as the previous iteration +func (cache *Cache) Reset(backend Reader) { + cache.Lock() + defer cache.Unlock() + cache.backend = backend + cache.registry = make(map[crypto.Address]*nodeInfo) +} + +func (cache *Cache) Backend() Reader { + return cache.backend +} + +func (cache *Cache) get(id crypto.Address) (*nodeInfo, error) { + cache.RLock() + info := cache.registry[id] + cache.RUnlock() + if info == nil { + cache.Lock() + defer cache.Unlock() + info = cache.registry[id] + if info == nil { + node, err := cache.backend.GetNodeByID(id) + if err != nil { + return nil, err + } + info = &nodeInfo{ + node: node, + } + cache.registry[id] = info + } + } + return info, nil +} diff --git a/execution/registry/registry.go b/execution/registry/registry.go new file mode 100644 index 000000000..c3cd8062f --- /dev/null +++ b/execution/registry/registry.go @@ -0,0 +1,134 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package registry + +import ( + "fmt" + "net" + + "github.com/hyperledger/burrow/crypto" +) + +type NodeStats struct { + Addresses map[string]map[crypto.Address]struct{} +} + +func NewNodeStats() NodeStats { + return NodeStats{ + Addresses: make(map[string]map[crypto.Address]struct{}), + } +} + +func (ns *NodeStats) GetAddresses(net string) []crypto.Address { + nodes := ns.Addresses[net] + addrs := make([]crypto.Address, 0, len(nodes)) + for id := range nodes { + addrs = append(addrs, id) + } + return addrs +} + +func (ns *NodeStats) Insert(net string, id crypto.Address) { + _, ok := ns.Addresses[net] + if !ok { + ns.Addresses[net] = make(map[crypto.Address]struct{}) + } + ns.Addresses[net][id] = struct{}{} +} + +func (ns *NodeStats) Remove(node *NodeIdentity) bool { + _, ok := ns.Addresses[node.GetNetworkAddress()] + if !ok { + return false + } + _, ok = ns.Addresses[node.GetNetworkAddress()][node.TendermintNodeID] + if ok { + delete(ns.Addresses[node.GetNetworkAddress()], node.TendermintNodeID) + return true + } + return false +} + +type NodeFilter struct { + state IterableReader +} + +func NewNodeFilter(state IterableReader) *NodeFilter { + return &NodeFilter{ + state: state, + } +} + +func (nf *NodeFilter) QueryPeerByID(id string) bool { + addr, err := crypto.AddressFromHexString(id) + if err != nil { + return false + } + + node, err := nf.state.GetNodeByID(addr) + if err != nil || node == nil { + return false + } + return true +} + +func (nf *NodeFilter) findByAddress(addr string) bool { + nodes, err := nf.state.GetNodeIDsByAddress(addr) + if err != nil { + panic(err) + } else if len(nodes) == 0 { + return false + } + return true +} + +func (nf *NodeFilter) QueryPeerByAddress(addr string) bool { + // may have different outbound port in address, so fallback to host + ok := nf.findByAddress(addr) + if ok { + return ok + } + host, _, _ := net.SplitHostPort(addr) + return nf.findByAddress(host) +} + +func (nf *NodeFilter) NumPeers() int { + return nf.state.GetNumPeers() +} + +func (rn *NodeIdentity) String() string { + return fmt.Sprintf("RegisterNode{%v -> %v @ %v}", rn.ValidatorPublicKey, rn.TendermintNodeID, rn.NetworkAddress) +} + +type Reader interface { + GetNodeByID(crypto.Address) (*NodeIdentity, error) + GetNodeIDsByAddress(net string) ([]crypto.Address, error) + GetNumPeers() int +} + +type Writer interface { + // Updates the node, creating it if it does not exist + UpdateNode(crypto.Address, *NodeIdentity) error + // Remove the node by address + RemoveNode(crypto.Address) error +} + +type ReaderWriter interface { + Reader + Writer +} + +type Iterable interface { + IterateNodes(consumer func(crypto.Address, *NodeIdentity) error) (err error) +} + +type IterableReader interface { + Iterable + Reader +} + +type IterableReaderWriter interface { + Iterable + ReaderWriter +} diff --git a/execution/registry/registry.pb.go b/execution/registry/registry.pb.go new file mode 100644 index 000000000..8f219d73d --- /dev/null +++ b/execution/registry/registry.pb.go @@ -0,0 +1,495 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: registry.proto + +package registry + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + golang_proto "github.com/golang/protobuf/proto" + github_com_hyperledger_burrow_crypto "github.com/hyperledger/burrow/crypto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = golang_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.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// NodeIdentity stores and establishes a binding between 4 different types of identifiers, a human readable name, +// a advertised network address, a p2p station-to-station key, and a validator key. Updates must be signed +// by the node key and the validator key to prove the update is consensual. +type NodeIdentity struct { + // Peer moniker name + Moniker string `protobuf:"bytes,1,opt,name=Moniker,proto3" json:"Moniker,omitempty"` + // Peer network address + NetworkAddress string `protobuf:"bytes,2,opt,name=NetworkAddress,proto3" json:"NetworkAddress,omitempty"` + // The Tendermint p2p node ID + TendermintNodeID github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,3,opt,name=TendermintNodeID,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"TendermintNodeID"` + // The public key that this node will validate with if it becomes a validator + // (use this to create a binding between p2p node ID and validator) + ValidatorPublicKey *github_com_hyperledger_burrow_crypto.PublicKey `protobuf:"bytes,4,opt,name=ValidatorPublicKey,proto3,customtype=github.com/hyperledger/burrow/crypto.PublicKey" json:"ValidatorPublicKey,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeIdentity) Reset() { *m = NodeIdentity{} } +func (*NodeIdentity) ProtoMessage() {} +func (*NodeIdentity) Descriptor() ([]byte, []int) { + return fileDescriptor_41af05d40a615591, []int{0} +} +func (m *NodeIdentity) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeIdentity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *NodeIdentity) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeIdentity.Merge(m, src) +} +func (m *NodeIdentity) XXX_Size() int { + return m.Size() +} +func (m *NodeIdentity) XXX_DiscardUnknown() { + xxx_messageInfo_NodeIdentity.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeIdentity proto.InternalMessageInfo + +func (m *NodeIdentity) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *NodeIdentity) GetNetworkAddress() string { + if m != nil { + return m.NetworkAddress + } + return "" +} + +func (*NodeIdentity) XXX_MessageName() string { + return "registry.NodeIdentity" +} +func init() { + proto.RegisterType((*NodeIdentity)(nil), "registry.NodeIdentity") + golang_proto.RegisterType((*NodeIdentity)(nil), "registry.NodeIdentity") +} + +func init() { proto.RegisterFile("registry.proto", fileDescriptor_41af05d40a615591) } +func init() { golang_proto.RegisterFile("registry.proto", fileDescriptor_41af05d40a615591) } + +var fileDescriptor_41af05d40a615591 = []byte{ + // 288 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x4a, 0x4d, 0xcf, + 0x2c, 0x2e, 0x29, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x44, + 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x82, 0xfa, 0x20, 0x16, 0x44, 0x5e, 0x69, 0x0e, 0x13, 0x17, 0x8f, + 0x5f, 0x7e, 0x4a, 0xaa, 0x67, 0x4a, 0x6a, 0x5e, 0x49, 0x66, 0x49, 0xa5, 0x90, 0x04, 0x17, 0xbb, + 0x6f, 0x7e, 0x5e, 0x66, 0x76, 0x6a, 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x8c, 0x2b, + 0xa4, 0xc6, 0xc5, 0xe7, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xed, 0x98, 0x92, 0x52, 0x94, 0x5a, + 0x5c, 0x2c, 0xc1, 0x04, 0x56, 0x80, 0x26, 0x2a, 0x94, 0xc0, 0x25, 0x10, 0x92, 0x9a, 0x97, 0x92, + 0x5a, 0x94, 0x9b, 0x99, 0x57, 0x02, 0x36, 0xdb, 0x45, 0x82, 0x59, 0x81, 0x51, 0x83, 0xc7, 0xc9, + 0xe4, 0xc4, 0x3d, 0x79, 0x86, 0x5b, 0xf7, 0xe4, 0x75, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, + 0x92, 0xf3, 0x73, 0xf5, 0x33, 0x2a, 0x0b, 0x52, 0x8b, 0x72, 0x52, 0x53, 0xd2, 0x53, 0x8b, 0xf4, + 0x93, 0x4a, 0x8b, 0x8a, 0xf2, 0xcb, 0xf5, 0x93, 0x8b, 0x2a, 0x0b, 0x4a, 0xf2, 0xf5, 0xa0, 0xe6, + 0x05, 0x61, 0x98, 0x26, 0x94, 0xc4, 0x25, 0x14, 0x96, 0x98, 0x93, 0x99, 0x92, 0x58, 0x92, 0x5f, + 0x14, 0x50, 0x9a, 0x94, 0x93, 0x99, 0xec, 0x9d, 0x5a, 0x29, 0xc1, 0x02, 0xb6, 0xc3, 0xe8, 0xd6, + 0x3d, 0x79, 0x3d, 0xa2, 0xcc, 0x87, 0xeb, 0x0c, 0xc2, 0x62, 0x9a, 0x15, 0xcb, 0x8c, 0x05, 0xf2, + 0x0c, 0x4e, 0x5e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, 0xe3, + 0x83, 0x47, 0x72, 0x8c, 0x07, 0x1e, 0xcb, 0x31, 0x9e, 0x78, 0x2c, 0xc7, 0x18, 0x65, 0x80, 0xdf, + 0x8e, 0xd4, 0x8a, 0xd4, 0xe4, 0xd2, 0x92, 0xcc, 0xfc, 0x3c, 0x7d, 0x58, 0x04, 0x24, 0xb1, 0x81, + 0x43, 0xdc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x64, 0xf6, 0x36, 0xa3, 0x01, 0x00, 0x00, +} + +func (m *NodeIdentity) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeIdentity) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeIdentity) 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 m.ValidatorPublicKey != nil { + { + size := m.ValidatorPublicKey.Size() + i -= size + if _, err := m.ValidatorPublicKey.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRegistry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + { + size := m.TendermintNodeID.Size() + i -= size + if _, err := m.TendermintNodeID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRegistry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintRegistry(dAtA, i, uint64(len(m.NetworkAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintRegistry(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRegistry(dAtA []byte, offset int, v uint64) int { + offset -= sovRegistry(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NodeIdentity) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovRegistry(uint64(l)) + } + l = len(m.NetworkAddress) + if l > 0 { + n += 1 + l + sovRegistry(uint64(l)) + } + l = m.TendermintNodeID.Size() + n += 1 + l + sovRegistry(uint64(l)) + if m.ValidatorPublicKey != nil { + l = m.ValidatorPublicKey.Size() + n += 1 + l + sovRegistry(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovRegistry(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRegistry(x uint64) (n int) { + return sovRegistry(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NodeIdentity) 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 ErrIntOverflowRegistry + } + 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: NodeIdentity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeIdentity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowRegistry + } + 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 ErrInvalidLengthRegistry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegistry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegistry + } + 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 ErrInvalidLengthRegistry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegistry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TendermintNodeID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegistry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRegistry + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRegistry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TendermintNodeID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorPublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegistry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRegistry + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRegistry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_hyperledger_burrow_crypto.PublicKey + m.ValidatorPublicKey = &v + if err := m.ValidatorPublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegistry(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegistry + } + 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 skipRegistry(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRegistry + } + 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, ErrIntOverflowRegistry + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRegistry + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRegistry + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRegistry + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRegistry + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRegistry = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRegistry = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRegistry = fmt.Errorf("proto: unexpected end of group") +) diff --git a/execution/registry/registry_test.go b/execution/registry/registry_test.go new file mode 100644 index 000000000..12313b461 --- /dev/null +++ b/execution/registry/registry_test.go @@ -0,0 +1,29 @@ +package registry + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestEncodeProtobuf(t *testing.T) { + entry := &NodeIdentity{ + Moniker: "test", + TendermintNodeID: crypto.Address{}, + ValidatorPublicKey: &crypto.PublicKey{ + CurveType: crypto.CurveTypeEd25519, + PublicKey: binary.HexBytes{1, 2, 3, 4, 5}, + }, + NetworkAddress: "localhost", + } + encoded, err := proto.Marshal(entry) + require.NoError(t, err) + entryOut := new(NodeIdentity) + err = proto.Unmarshal(encoded, entryOut) + require.NoError(t, err) + assert.Equal(t, entry, entryOut) +} diff --git a/execution/simulated_call.go b/execution/simulated_call.go index ac7e877a5..0f5e25971 100644 --- a/execution/simulated_call.go +++ b/execution/simulated_call.go @@ -6,7 +6,9 @@ import ( "github.com/hyperledger/burrow/bcm" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/contexts" + "github.com/hyperledger/burrow/execution/engine" "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/execution/vms" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/txs" "github.com/hyperledger/burrow/txs/payload" @@ -19,10 +21,12 @@ func CallSim(reader acmstate.Reader, blockchain bcm.BlockchainInfo, fromAddress, cache := acmstate.NewCache(reader) exe := contexts.CallContext{ - RunCall: true, - StateWriter: cache, - Blockchain: blockchain, - Logger: logger, + VMS: vms.NewConnectedVirtualMachines(engine.Options{}), + RunCall: true, + State: cache, + MetadataState: acmstate.NewMemoryState(), + Blockchain: blockchain, + Logger: logger, } txe := exec.NewTxExecution(txs.Enclose(blockchain.ChainID(), &payload.CallTx{ @@ -33,6 +37,9 @@ func CallSim(reader acmstate.Reader, blockchain bcm.BlockchainInfo, fromAddress, Data: data, GasLimit: contexts.GasLimit, })) + + // Set height for downstream synchronisation purposes + txe.Height = blockchain.LastBlockHeight() err := exe.Execute(txe, txe.Envelope.Tx.Payload) if err != nil { return nil, err diff --git a/execution/solidity/abi_tester.sol b/execution/solidity/abi_tester.sol index 2e66e62bf..14d8eda6f 100644 --- a/execution/solidity/abi_tester.sol +++ b/execution/solidity/abi_tester.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract A { function createB() public returns (B) { diff --git a/execution/solidity/abi_tester.sol.go b/execution/solidity/abi_tester.sol.go index dd51c61ec..59d833204 100644 --- a/execution/solidity/abi_tester.sol.go +++ b/execution/solidity/abi_tester.sol.go @@ -2,12 +2,12 @@ package solidity import hex "github.com/tmthrgd/go-hex" -var Bytecode_A = hex.MustDecodeString("608060405234801561001057600080fd5b506102d5806100206000396000f3fe608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063dbdc275d1461004d575b600080fd5b610055610097565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006040516100a5906100c7565b604051809103906000f0801580156100c1573d6000803e3d6000fd5b50905090565b6101d5806100d58339019056fe608060405234801561001057600080fd5b506101b5806100206000396000f3fe608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063eadf91e31461004d575b600080fd5b610055610097565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006040516100a5906100c7565b604051809103906000f0801580156100c1573d6000803e3d6000fd5b50905090565b60b6806100d48339019056fe6080604052348015600f57600080fd5b5060988061001e6000396000f3fe6080604052348015600f57600080fd5b50600436106045576000357c010000000000000000000000000000000000000000000000000000000090048063ce15daec14604a575b600080fd5b60506066565b6040518082815260200191505060405180910390f35b6000548156fea165627a7a72305820a46c6c19158be05dcccde6ca95b6d92d08b9a1a7b3c5e8f84a26a49628c351600029a165627a7a7230582078d4ba52f8aab390e3df659d41312bbfda3a9db9681cbe604adc461c44b26c8c0029a165627a7a723058205069226ef56be4806b4221a0e82bb89b45e22e56d6e62696cf4bb606c77156390029") -var DeployedBytecode_A = hex.MustDecodeString("608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063dbdc275d1461004d575b600080fd5b610055610097565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006040516100a5906100c7565b604051809103906000f0801580156100c1573d6000803e3d6000fd5b50905090565b6101d5806100d58339019056fe608060405234801561001057600080fd5b506101b5806100206000396000f3fe608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063eadf91e31461004d575b600080fd5b610055610097565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006040516100a5906100c7565b604051809103906000f0801580156100c1573d6000803e3d6000fd5b50905090565b60b6806100d48339019056fe6080604052348015600f57600080fd5b5060988061001e6000396000f3fe6080604052348015600f57600080fd5b50600436106045576000357c010000000000000000000000000000000000000000000000000000000090048063ce15daec14604a575b600080fd5b60506066565b6040518082815260200191505060405180910390f35b6000548156fea165627a7a72305820a46c6c19158be05dcccde6ca95b6d92d08b9a1a7b3c5e8f84a26a49628c351600029a165627a7a7230582078d4ba52f8aab390e3df659d41312bbfda3a9db9681cbe604adc461c44b26c8c0029a165627a7a723058205069226ef56be4806b4221a0e82bb89b45e22e56d6e62696cf4bb606c77156390029") -var Abi_A = []byte(`[{"constant":false,"inputs":[],"name":"createB","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) -var Bytecode_B = hex.MustDecodeString("608060405234801561001057600080fd5b506101b5806100206000396000f3fe608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063eadf91e31461004d575b600080fd5b610055610097565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006040516100a5906100c7565b604051809103906000f0801580156100c1573d6000803e3d6000fd5b50905090565b60b6806100d48339019056fe6080604052348015600f57600080fd5b5060988061001e6000396000f3fe6080604052348015600f57600080fd5b50600436106045576000357c010000000000000000000000000000000000000000000000000000000090048063ce15daec14604a575b600080fd5b60506066565b6040518082815260200191505060405180910390f35b6000548156fea165627a7a72305820a46c6c19158be05dcccde6ca95b6d92d08b9a1a7b3c5e8f84a26a49628c351600029a165627a7a7230582078d4ba52f8aab390e3df659d41312bbfda3a9db9681cbe604adc461c44b26c8c0029") -var DeployedBytecode_B = hex.MustDecodeString("608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063eadf91e31461004d575b600080fd5b610055610097565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006040516100a5906100c7565b604051809103906000f0801580156100c1573d6000803e3d6000fd5b50905090565b60b6806100d48339019056fe6080604052348015600f57600080fd5b5060988061001e6000396000f3fe6080604052348015600f57600080fd5b50600436106045576000357c010000000000000000000000000000000000000000000000000000000090048063ce15daec14604a575b600080fd5b60506066565b6040518082815260200191505060405180910390f35b6000548156fea165627a7a72305820a46c6c19158be05dcccde6ca95b6d92d08b9a1a7b3c5e8f84a26a49628c351600029a165627a7a7230582078d4ba52f8aab390e3df659d41312bbfda3a9db9681cbe604adc461c44b26c8c0029") -var Abi_B = []byte(`[{"constant":false,"inputs":[],"name":"createC","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) -var Bytecode_C = hex.MustDecodeString("6080604052348015600f57600080fd5b5060988061001e6000396000f3fe6080604052348015600f57600080fd5b50600436106045576000357c010000000000000000000000000000000000000000000000000000000090048063ce15daec14604a575b600080fd5b60506066565b6040518082815260200191505060405180910390f35b6000548156fea165627a7a72305820a46c6c19158be05dcccde6ca95b6d92d08b9a1a7b3c5e8f84a26a49628c351600029") -var DeployedBytecode_C = hex.MustDecodeString("6080604052348015600f57600080fd5b50600436106045576000357c010000000000000000000000000000000000000000000000000000000090048063ce15daec14604a575b600080fd5b60506066565b6040518082815260200191505060405180910390f35b6000548156fea165627a7a72305820a46c6c19158be05dcccde6ca95b6d92d08b9a1a7b3c5e8f84a26a49628c351600029") -var Abi_C = []byte(`[{"constant":true,"inputs":[],"name":"this_is_c","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]`) +var Bytecode_A = hex.MustDecodeString("608060405234801561001057600080fd5b50610299806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063dbdc275d14610030575b600080fd5b61003861007a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000604051610088906100aa565b604051809103906000f0801580156100a4573d6000803e3d6000fd5b50905090565b6101ad806100b88339019056fe608060405234801561001057600080fd5b5061018d806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063eadf91e314610030575b600080fd5b61003861007a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000604051610088906100aa565b604051809103906000f0801580156100a4573d6000803e3d6000fd5b50905090565b60a2806100b78339019056fe6080604052348015600f57600080fd5b5060848061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063ce15daec14602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000548156fea265627a7a7231582070be037172c1568fc1a690737b372cb36a7c007ab27c2501d3652108b95b1c1064736f6c634300050b0032a265627a7a7231582050636f88296326e5c37becbbdb92bfc056b4db495a75962c52baaeb6b09bdd6164736f6c634300050b0032a265627a7a723158202b4acb837633f6d1282d56953bec7eda4b6a4cc6220b3f74db18eb9d52cbd59664736f6c634300050b0032") +var DeployedBytecode_A = hex.MustDecodeString("608060405234801561001057600080fd5b506004361061002b5760003560e01c8063dbdc275d14610030575b600080fd5b61003861007a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000604051610088906100aa565b604051809103906000f0801580156100a4573d6000803e3d6000fd5b50905090565b6101ad806100b88339019056fe608060405234801561001057600080fd5b5061018d806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063eadf91e314610030575b600080fd5b61003861007a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000604051610088906100aa565b604051809103906000f0801580156100a4573d6000803e3d6000fd5b50905090565b60a2806100b78339019056fe6080604052348015600f57600080fd5b5060848061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063ce15daec14602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000548156fea265627a7a7231582070be037172c1568fc1a690737b372cb36a7c007ab27c2501d3652108b95b1c1064736f6c634300050b0032a265627a7a7231582050636f88296326e5c37becbbdb92bfc056b4db495a75962c52baaeb6b09bdd6164736f6c634300050b0032a265627a7a723158202b4acb837633f6d1282d56953bec7eda4b6a4cc6220b3f74db18eb9d52cbd59664736f6c634300050b0032") +var Abi_A = []byte(`[{"constant":false,"inputs":[],"name":"createB","outputs":[{"internalType":"contract B","name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) +var Bytecode_B = hex.MustDecodeString("608060405234801561001057600080fd5b5061018d806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063eadf91e314610030575b600080fd5b61003861007a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000604051610088906100aa565b604051809103906000f0801580156100a4573d6000803e3d6000fd5b50905090565b60a2806100b78339019056fe6080604052348015600f57600080fd5b5060848061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063ce15daec14602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000548156fea265627a7a7231582070be037172c1568fc1a690737b372cb36a7c007ab27c2501d3652108b95b1c1064736f6c634300050b0032a265627a7a7231582050636f88296326e5c37becbbdb92bfc056b4db495a75962c52baaeb6b09bdd6164736f6c634300050b0032") +var DeployedBytecode_B = hex.MustDecodeString("608060405234801561001057600080fd5b506004361061002b5760003560e01c8063eadf91e314610030575b600080fd5b61003861007a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000604051610088906100aa565b604051809103906000f0801580156100a4573d6000803e3d6000fd5b50905090565b60a2806100b78339019056fe6080604052348015600f57600080fd5b5060848061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063ce15daec14602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000548156fea265627a7a7231582070be037172c1568fc1a690737b372cb36a7c007ab27c2501d3652108b95b1c1064736f6c634300050b0032a265627a7a7231582050636f88296326e5c37becbbdb92bfc056b4db495a75962c52baaeb6b09bdd6164736f6c634300050b0032") +var Abi_B = []byte(`[{"constant":false,"inputs":[],"name":"createC","outputs":[{"internalType":"contract C","name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) +var Bytecode_C = hex.MustDecodeString("6080604052348015600f57600080fd5b5060848061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063ce15daec14602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000548156fea265627a7a7231582070be037172c1568fc1a690737b372cb36a7c007ab27c2501d3652108b95b1c1064736f6c634300050b0032") +var DeployedBytecode_C = hex.MustDecodeString("6080604052348015600f57600080fd5b506004361060285760003560e01c8063ce15daec14602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000548156fea265627a7a7231582070be037172c1568fc1a690737b372cb36a7c007ab27c2501d3652108b95b1c1064736f6c634300050b0032") +var Abi_C = []byte(`[{"constant":true,"inputs":[],"name":"this_is_c","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]`) diff --git a/execution/solidity/big_mod.sol b/execution/solidity/big_mod.sol new file mode 100644 index 000000000..6600ef29e --- /dev/null +++ b/execution/solidity/big_mod.sol @@ -0,0 +1,31 @@ +pragma solidity ^0.5; + +contract BigMod { + function expmod(int256 base, int256 e, int256 m, int256 proof) public returns (uint256) { + bool success; + int256 o; + + assembly { + + let p := mload(0x40) + // store data assembly-favouring ways + mstore(p, 0x20) // Length of Base + mstore(add(p, 0x20), 0x20) // Length of Exponent + mstore(add(p, 0x40), 0x20) // Length of Modulus + mstore(add(p, 0x60), base) // Base + mstore(add(p, 0x80), e) // Exponent + mstore(add(p, 0xa0), m) // Modulus + // call modexp precompile + success := call(sub(gas, 2000), 0x05, 0, p, 0xc0, p, 0x20) + // gas fiddling + + o := mload(p) + + } + require(success); + if (proof == o) { + return 1; + } + return 0; + } +} diff --git a/execution/solidity/big_mod.sol.go b/execution/solidity/big_mod.sol.go new file mode 100644 index 000000000..7a1a2b6d3 --- /dev/null +++ b/execution/solidity/big_mod.sol.go @@ -0,0 +1,7 @@ +package solidity + +import hex "github.com/tmthrgd/go-hex" + +var Bytecode_BigMod = hex.MustDecodeString("608060405234801561001057600080fd5b5061012a806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063a841705414602d575b600080fd5b607460048036036080811015604157600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050608a565b6040518082815260200191505060405180910390f35b600080600060405160208152602080820152602060408201528760608201528660808201528560a082015260208160c083600060056107d05a03f1925080519150508160d557600080fd5b8084141560e65760019250505060ed565b6000925050505b94935050505056fea265627a7a72315820636fd56ce071c30b9389006e4ac7d726a569ba9619e4fdc457532cee13b20c0464736f6c634300050c0032") +var DeployedBytecode_BigMod = hex.MustDecodeString("6080604052348015600f57600080fd5b506004361060285760003560e01c8063a841705414602d575b600080fd5b607460048036036080811015604157600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050608a565b6040518082815260200191505060405180910390f35b600080600060405160208152602080820152602060408201528760608201528660808201528560a082015260208160c083600060056107d05a03f1925080519150508160d557600080fd5b8084141560e65760019250505060ed565b6000925050505b94935050505056fea265627a7a72315820636fd56ce071c30b9389006e4ac7d726a569ba9619e4fdc457532cee13b20c0464736f6c634300050c0032") +var Abi_BigMod = []byte(`[{"constant":false,"inputs":[{"internalType":"int256","name":"base","type":"int256"},{"internalType":"int256","name":"e","type":"int256"},{"internalType":"int256","name":"m","type":"int256"},{"internalType":"int256","name":"proof","type":"int256"}],"name":"expmod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) diff --git a/execution/solidity/ecrecover.sol b/execution/solidity/ecrecover.sol new file mode 100644 index 000000000..ea2fe1063 --- /dev/null +++ b/execution/solidity/ecrecover.sol @@ -0,0 +1,9 @@ +pragma solidity ^0.5; + +contract ECRecover { + + function recoverSigningAddress(bytes32 msgDigest, uint8 v, bytes32 r, bytes32 s) pure public returns (address) { + return ecrecover(msgDigest, v, r, s); + } + +} diff --git a/execution/solidity/ecrecover.sol.go b/execution/solidity/ecrecover.sol.go new file mode 100644 index 000000000..041b4a6c8 --- /dev/null +++ b/execution/solidity/ecrecover.sol.go @@ -0,0 +1,7 @@ +package solidity + +import hex "github.com/tmthrgd/go-hex" + +var Bytecode_ECRecover = hex.MustDecodeString("608060405234801561001057600080fd5b50610167806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80636a267aeb14610030575b600080fd5b61007d6004803603608081101561004657600080fd5b8101908080359060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506100bf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600060018585858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561011e573d6000803e3d6000fd5b50505060206040510351905094935050505056fea265627a7a72315820efc8c28d65a1b0ed5069d6f88e4f1fe720663041a0c58bfa6dbb4c500babea1964736f6c63430005110032") +var DeployedBytecode_ECRecover = hex.MustDecodeString("608060405234801561001057600080fd5b506004361061002b5760003560e01c80636a267aeb14610030575b600080fd5b61007d6004803603608081101561004657600080fd5b8101908080359060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506100bf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600060018585858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561011e573d6000803e3d6000fd5b50505060206040510351905094935050505056fea265627a7a72315820efc8c28d65a1b0ed5069d6f88e4f1fe720663041a0c58bfa6dbb4c500babea1964736f6c63430005110032") +var Abi_ECRecover = []byte(`[{"constant":true,"inputs":[{"internalType":"bytes32","name":"msgDigest","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"recoverSigningAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"pure","type":"function"}]`) diff --git a/execution/solidity/event_emitter.sol b/execution/solidity/event_emitter.sol index 0af29d9f7..81d967034 100644 --- a/execution/solidity/event_emitter.sol +++ b/execution/solidity/event_emitter.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract EventEmitter { // indexed puts it in topic diff --git a/execution/solidity/event_emitter.sol.go b/execution/solidity/event_emitter.sol.go index d07a98c37..3ddd330f7 100644 --- a/execution/solidity/event_emitter.sol.go +++ b/execution/solidity/event_emitter.sol.go @@ -2,6 +2,6 @@ package solidity import hex "github.com/tmthrgd/go-hex" -var Bytecode_EventEmitter = hex.MustDecodeString("608060405234801561001057600080fd5b50610264806100206000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c010000000000000000000000000000000000000000000000000000000090048063508ed79914610058578063e8e49a7114610062575b600080fd5b61006061006c565b005b61006a61012b565b005b60405180807f68617368000000000000000000000000000000000000000000000000000000008152506004019050604051809103902060667f446f776e736965210000000000000000000000000000000000000000000000007f2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca6001602a6040518083151515158152602001806020018360000b8152602001828103825260518152602001806101e860519139606001935050505060405180910390a4565b60405180807f68617368000000000000000000000000000000000000000000000000000000008152506004019050604051809103902060667f446f776e736965210000000000000000000000000000000000000000000000007f20aec2a3bcd8050a3a9e852e9d424805bad75ba33b57077464c73ae98d0582696001602a604051808315151515815260200180602001838152602001828103825260518152602001806101e860519139606001935050505060405180910390a456fe446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674a165627a7a72305820b11ba06d97e4448c1d8bf72e259b4d14daf0355f8aae146b40a708406fe037dd0029") -var DeployedBytecode_EventEmitter = hex.MustDecodeString("608060405234801561001057600080fd5b5060043610610053576000357c010000000000000000000000000000000000000000000000000000000090048063508ed79914610058578063e8e49a7114610062575b600080fd5b61006061006c565b005b61006a61012b565b005b60405180807f68617368000000000000000000000000000000000000000000000000000000008152506004019050604051809103902060667f446f776e736965210000000000000000000000000000000000000000000000007f2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca6001602a6040518083151515158152602001806020018360000b8152602001828103825260518152602001806101e860519139606001935050505060405180910390a4565b60405180807f68617368000000000000000000000000000000000000000000000000000000008152506004019050604051809103902060667f446f776e736965210000000000000000000000000000000000000000000000007f20aec2a3bcd8050a3a9e852e9d424805bad75ba33b57077464c73ae98d0582696001602a604051808315151515815260200180602001838152602001828103825260518152602001806101e860519139606001935050505060405180910390a456fe446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674a165627a7a72305820b11ba06d97e4448c1d8bf72e259b4d14daf0355f8aae146b40a708406fe037dd0029") -var Abi_EventEmitter = []byte(`[{"constant":false,"inputs":[],"name":"EmitTwo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"EmitOne","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"direction","type":"bytes32"},{"indexed":false,"name":"trueism","type":"bool"},{"indexed":false,"name":"german","type":"string"},{"indexed":true,"name":"newDepth","type":"int64"},{"indexed":false,"name":"bignum","type":"int256"},{"indexed":true,"name":"hash","type":"string"}],"name":"ManyTypes","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"direction","type":"bytes32"},{"indexed":false,"name":"trueism","type":"bool"},{"indexed":false,"name":"german","type":"string"},{"indexed":true,"name":"newDepth","type":"int128"},{"indexed":false,"name":"bignum","type":"int8"},{"indexed":true,"name":"hash","type":"string"}],"name":"ManyTypes2","type":"event"}]`) +var Bytecode_EventEmitter = hex.MustDecodeString("608060405234801561001057600080fd5b50610250806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063508ed7991461003b578063e8e49a7114610045575b600080fd5b61004361004f565b005b61004d61010e565b005b60405180807f68617368000000000000000000000000000000000000000000000000000000008152506004019050604051809103902060667f446f776e736965210000000000000000000000000000000000000000000000007f2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca6001602a6040518083151515158152602001806020018360000b8152602001828103825260518152602001806101cb60519139606001935050505060405180910390a4565b60405180807f68617368000000000000000000000000000000000000000000000000000000008152506004019050604051809103902060667f446f776e736965210000000000000000000000000000000000000000000000007f20aec2a3bcd8050a3a9e852e9d424805bad75ba33b57077464c73ae98d0582696001602a604051808315151515815260200180602001838152602001828103825260518152602001806101cb60519139606001935050505060405180910390a456fe446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674a265627a7a723158203c195a0643bb2f371aa1fbbe9e0b8eb41cb92b22a544a5f9ea322b5c806143bf64736f6c634300050b0032") +var DeployedBytecode_EventEmitter = hex.MustDecodeString("608060405234801561001057600080fd5b50600436106100365760003560e01c8063508ed7991461003b578063e8e49a7114610045575b600080fd5b61004361004f565b005b61004d61010e565b005b60405180807f68617368000000000000000000000000000000000000000000000000000000008152506004019050604051809103902060667f446f776e736965210000000000000000000000000000000000000000000000007f2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca6001602a6040518083151515158152602001806020018360000b8152602001828103825260518152602001806101cb60519139606001935050505060405180910390a4565b60405180807f68617368000000000000000000000000000000000000000000000000000000008152506004019050604051809103902060667f446f776e736965210000000000000000000000000000000000000000000000007f20aec2a3bcd8050a3a9e852e9d424805bad75ba33b57077464c73ae98d0582696001602a604051808315151515815260200180602001838152602001828103825260518152602001806101cb60519139606001935050505060405180910390a456fe446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674a265627a7a723158203c195a0643bb2f371aa1fbbe9e0b8eb41cb92b22a544a5f9ea322b5c806143bf64736f6c634300050b0032") +var Abi_EventEmitter = []byte(`[{"constant":false,"inputs":[],"name":"EmitTwo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"EmitOne","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"direction","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"trueism","type":"bool"},{"indexed":false,"internalType":"string","name":"german","type":"string"},{"indexed":true,"internalType":"int64","name":"newDepth","type":"int64"},{"indexed":false,"internalType":"int256","name":"bignum","type":"int256"},{"indexed":true,"internalType":"string","name":"hash","type":"string"}],"name":"ManyTypes","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"direction","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"trueism","type":"bool"},{"indexed":false,"internalType":"string","name":"german","type":"string"},{"indexed":true,"internalType":"int128","name":"newDepth","type":"int128"},{"indexed":false,"internalType":"int8","name":"bignum","type":"int8"},{"indexed":true,"internalType":"string","name":"hash","type":"string"}],"name":"ManyTypes2","type":"event"}]`) diff --git a/execution/solidity/evm.sol b/execution/solidity/evm.sol new file mode 100644 index 000000000..56f073a7a --- /dev/null +++ b/execution/solidity/evm.sol @@ -0,0 +1,22 @@ +interface E { + function get_vm() external returns (string memory); + function get_number() external returns (int); +} + +contract evm is E { + function get_vm() public returns (string memory) { + return "evm"; + } + + function get_number() public returns (int) { + return 102; + } + + function call_get_vm(E e) public returns (string memory) { + return string(abi.encodePacked("evm called ", e.get_vm())); + } + + function call_get_number(E e) public returns (int) { + return e.get_number(); + } +} diff --git a/execution/solidity/evm.sol.go b/execution/solidity/evm.sol.go new file mode 100644 index 000000000..e056cbaf7 --- /dev/null +++ b/execution/solidity/evm.sol.go @@ -0,0 +1,9 @@ +package solidity + +import hex "github.com/tmthrgd/go-hex" + +var Bytecode_E = hex.MustDecodeString("") +var Abi_E = []byte(`[{"constant":false,"inputs":[],"name":"get_number","outputs":[{"internalType":"int256","name":"","type":"int256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"get_vm","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) +var Bytecode_evm = hex.MustDecodeString("608060405234801561001057600080fd5b506104ea806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806364418e791461005157806397cb92681461010e5780639bbc114014610191578063eeb4e367146101e9575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610207565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100d35780820151818401526020810190506100b8565b50505050905090810190601f1680156101005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101166103e3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d3600480360360208110156101a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610420565b6040518082815260200191505060405180910390f35b6101f16104ac565b6040518082815260200191505060405180910390f35b60608173ffffffffffffffffffffffffffffffffffffffff166397cb92686040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561025157600080fd5b505af1158015610265573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561028f57600080fd5b81019080805160405193929190846401000000008211156102af57600080fd5b838201915060208201858111156102c557600080fd5b82518660018202830111640100000000821117156102e257600080fd5b8083526020830192505050908051906020019080838360005b838110156103165780820151818401526020810190506102fb565b50505050905090810190601f1680156103435780820380516001836020036101000a031916815260200191505b5060405250505060405160200180807f65766d2063616c6c656420000000000000000000000000000000000000000000815250600b0182805190602001908083835b602083106103a85780518252602082019150602081019050602083039250610385565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040529050919050565b60606040518060400160405280600381526020017f65766d0000000000000000000000000000000000000000000000000000000000815250905090565b60008173ffffffffffffffffffffffffffffffffffffffff1663eeb4e3676040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561046a57600080fd5b505af115801561047e573d6000803e3d6000fd5b505050506040513d602081101561049457600080fd5b81019080805190602001909291905050509050919050565b6000606690509056fea265627a7a72315820d711eff257c8b2cf7fb13a13f3dd7d3a9d66c8fbee3941a68b343b42d31bb7de64736f6c634300050c0032") +var DeployedBytecode_evm = hex.MustDecodeString("608060405234801561001057600080fd5b506004361061004c5760003560e01c806364418e791461005157806397cb92681461010e5780639bbc114014610191578063eeb4e367146101e9575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610207565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100d35780820151818401526020810190506100b8565b50505050905090810190601f1680156101005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101166103e3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d3600480360360208110156101a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610420565b6040518082815260200191505060405180910390f35b6101f16104ac565b6040518082815260200191505060405180910390f35b60608173ffffffffffffffffffffffffffffffffffffffff166397cb92686040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561025157600080fd5b505af1158015610265573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561028f57600080fd5b81019080805160405193929190846401000000008211156102af57600080fd5b838201915060208201858111156102c557600080fd5b82518660018202830111640100000000821117156102e257600080fd5b8083526020830192505050908051906020019080838360005b838110156103165780820151818401526020810190506102fb565b50505050905090810190601f1680156103435780820380516001836020036101000a031916815260200191505b5060405250505060405160200180807f65766d2063616c6c656420000000000000000000000000000000000000000000815250600b0182805190602001908083835b602083106103a85780518252602082019150602081019050602083039250610385565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040529050919050565b60606040518060400160405280600381526020017f65766d0000000000000000000000000000000000000000000000000000000000815250905090565b60008173ffffffffffffffffffffffffffffffffffffffff1663eeb4e3676040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561046a57600080fd5b505af115801561047e573d6000803e3d6000fd5b505050506040513d602081101561049457600080fd5b81019080805190602001909291905050509050919050565b6000606690509056fea265627a7a72315820d711eff257c8b2cf7fb13a13f3dd7d3a9d66c8fbee3941a68b343b42d31bb7de64736f6c634300050c0032") +var Abi_evm = []byte(`[{"constant":false,"inputs":[{"internalType":"contract E","name":"e","type":"address"}],"name":"call_get_number","outputs":[{"internalType":"int256","name":"","type":"int256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract E","name":"e","type":"address"}],"name":"call_get_vm","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"get_number","outputs":[{"internalType":"int256","name":"","type":"int256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"get_vm","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) diff --git a/execution/solidity/ewasm.solang b/execution/solidity/ewasm.solang new file mode 100644 index 000000000..33ec2f25f --- /dev/null +++ b/execution/solidity/ewasm.solang @@ -0,0 +1,55 @@ +interface E { + function get_vm() external returns (string memory); + function get_number() external returns (int); +} + +event L ( + int indexed f1, + string f2, + bool f3 +); + +contract ewasm is E { + function get_vm() public override pure returns (string memory) { + return "ewasm"; + } + + function get_number() public pure override returns (int) { + return 54321; + } + + function call_get_vm(E e) public returns (string memory) { + // solc can't do this + return "ewasm called " + e.get_vm(); + } + + function call_get_number(E e) public returns (int) { + return e.get_number(); + } + + function try_revert() public pure { + revert(); + } + + function hash_tests() public pure { + bytes32 hash1 = keccak256("Hello, World!"); + + assert(hash1 == hex"acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f"); + + bytes32 hash2 = sha256("Hello, World!"); + + assert(hash2 == hex"dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f"); + + bytes20 hash3 = ripemd160("Hello, World!"); + + assert(hash3 == hex"527a6a4b9a6da75607546842e0e00105350b1aaf"); + } + + function test_events() public { + emit L(102, "Hello from wasm", true); + } + + function test_print(int64 arg1, string arg2) public { + print("arg1:{} arg2:{}".format(arg1, arg2)); + } +} diff --git a/execution/solidity/ewasm.solang.go b/execution/solidity/ewasm.solang.go new file mode 100644 index 000000000..5ce8f0932 --- /dev/null +++ b/execution/solidity/ewasm.solang.go @@ -0,0 +1,6 @@ +package solidity + +import hex "github.com/tmthrgd/go-hex" + +var Bytecode_ewasm = hex.MustDecodeString("0061736D01000000011C0660017F006000017F60037F7F7F0060027F7F0060017F017F60000002680508657468657265756D0C67657443616C6C56616C7565000008657468657265756D0B676574436F646553697A65000108657468657265756D08636F6465436F7079000208657468657265756D0666696E697368000308657468657265756D0672657665727400030304030405050405017001010105030100020608017F01418080040B071102066D656D6F72790200046D61696E00070AB40203A60101047F418080042101024003400240200128020C0D002001280208220220004F0D020B200128020022010D000B41002101410028020821020B02402002200041076A41787122036B22024118490D00200120036A41106A22002001280200220436020002402004450D00200420003602040B2000200241706A3602082000410036020C2000200136020420012000360200200120033602080B2001410136020C200141106A0B2E004100410036028080044100410036028480044100410036028C800441003F0041107441F0FF7B6A36028880040B5B01027F230041106B220024002000100002402000290300200041086A290300844200520D0010064100100141F7626A220036028C19410020001005220136029019200141891D2000100241004189191003000B410041001004000B0B9019010041000B89190061736D0100000001440B60017F006000017F60037F7F7F0060077F7F7F7F7F7F7F0060027F7F0060057E7F7F7F7F017F60037F7F7F017F60017F017F60047F7F7F7F017F60000060027F7E017F02D7010A08657468657265756D0C67657443616C6C56616C7565000008657468657265756D0F67657443616C6C4461746153697A65000108657468657265756D0C63616C6C44617461436F7079000208657468657265756D036C6F67000308657468657265756D06726576657274000408657468657265756D0463616C6C000508657468657265756D1167657452657475726E4461746153697A65000108657468657265756D0E72657475726E44617461436F70790002056465627567087072696E744D656D000408657468657265756D0666696E6973680004030C0B0204020202060708090A090405017001010105030100020608017F01418080040B071102066D656D6F72790200046D61696E00140ACF150B2E0002402002450D000340200020012D00003A0000200041016A2100200141016A21012002417F6A22020D000B0B0B240002402001450D00034020004200370300200041086A21002001417F6A22010D000B0B0B2D002000411F6A21000340200120002D00003A0000200141016A21012000417F6A21002002417F6A22020D000B0B2D002001411F6A21010340200120002D00003A00002001417F6A2101200041016A21002002417F6A22020D000B0B29002001417F6A21010340200120026A20002D00003A0000200041016A21002002417F6A22020D000B0B7E01017F200120006C220141086A10102203200036020420032000360200200341086A2100024002402002417F460D002001450D010340200020022D00003A0000200041016A2100200241016A21022001417F6A22010D000C020B0B2001450D000340200041003A0000200041016A21002001417F6A22010D000B0B20030BA60101047F418080042101024003400240200128020C0D002001280208220220004F0D020B200128020022010D000B41002101410028020821020B02402002200041076A41787122036B22024118490D00200120036A41106A22002001280200220436020002402004450D00200420003602040B2000200241706A3602082000410036020C2000200136020420012000360200200120033602080B2001410136020C200141106A0B7F01027F200320016A220441086A10102205200436020420052004360200200541086A210402402001450D000340200420002D00003A0000200441016A2104200041016A21002001417F6A22010D000B0B02402003450D000340200420022D00003A0000200441016A2104200241016A21022003417F6A22030D000B0B20050B2E004100410036028080044100410036028480044100410036028C800441003F0041107441F0FF7B6A36028880040B8E0103027F017E027F230041206B2102410021030340200220036A20012001420A802204420A7E7DA722053A0000200341016A2103200142095621062004210120060D000B200020054130723A0000200041016A2106024020034101460D002002417E6A210203402006200220036A2D000041306A3A0000200641016A21062003417F6A22034101470D000B0B20060B8C0F03057F047E017F23004180026B220024002000220110000240024002400240024002400240024002400240024002400240024002402001290300200141086A290300844200520D00101241001001220236025441002002101022033602582003410020021002200241034D0D0E4100200328020022043602502002417C6A2102200341046A210302400240024002402004419FBFE9E6054A0D0002402004419CB3A4957D4A0D00200441C99B8FF079460D02200441A89B8AAA7A470D13410F4101410D100F2203280200413F6A41607141C0006A2204101022022004410376100B200141C0003602A001200141A0016A20024104100D2001200328020022003602C801200141C8016A200241C0006A4104100D200241E0006A200341086A2000100A2002413F6A41013A00004120101022034104100B200141F8016A4200370300200142003703F001200142003703E801200142E6003703E001200141E0016A20034120100D200220044102412020034100410010034100450D07410041001004000B2004419BF9C68004460D022004419DB3A4957D470D124100450D0E410041001004000B024002400240200441E382B9CC074A0D00200441A0BFE9E605460D01200441EEE98EBF06460D022004419797CBC406460D050C140B200441E482B9CC07470D13024002400240024020024120490D002003200141106A4118100C200141206A3502002105200141106A41086A290300210620012903102107410810101A410810101A410410102202419797CBC406360200200241046A4100100B200142003703D001200142003703C801200120063703A801200120073703A001200120053E02B001200141A0016A200141E0016A4114100E42FFFFFFFFFFFFFFFFFF00200141E0016A200141C8016A2002410410050D0A1006220241086A101022032002360200200341046A2002360200200341086A220441002002100720033502002205421F580D0120042001419C016A4104100C200135029C01220742207C22062005560D0220042007A76A200141B8016A4104100C0240200620012802B8012202AD7C2005560D0020014100410D2002410120042006A76A100F220241086A2002280200101136022C4100450D170C040B4102450D160C030B20014180026A240041020F0B41020D010C140B4102450D130B410041001004000B41004100100400000B200141C8006A42003703002001420037034020014200370338200142B1A8033703304100450D06410041001004000B20024120490D062003200141D0006A4108100C2002AD2205423F580D0720012903502108200341206A200141D8006A4104100C2001350258220642207C22072005560D0820032006A76A200141DC006A4104100C2007200135025C22067C2005560D092006A7410120032007A76A100F2102410810101A200228020041216A4101417F100F220341086A220441C0004105100A2003410D6A210102402008427F550D002001412D3A0000420020087D2108200141016A21010B200120081013220141C5004106100A200141066A2201200241086A20022802002202100A2003200120026A20046B220236020020042002100841010D0A410041001004000B02400240024020024120490D002003200141E0006A4118100C200141F0006A3502002105200141E0006A41086A29030021062001290360210741041010220241EEE98EBF06360200200241046A4100100B200142003703C001200142003703B801200120063703D001200120073703C801200120053E02D801200141C8016A200141A0016A4114100E42FFFFFFFFFFFFFFFFFF00200141A0016A200141B8016A2002410410050D0D1006220241086A101022032002360200200341046A2002360200200341086A22044100200210072003280200411F4D0D012004200141E0016A4120100C200141F8006A41186A200141E0016A41186A2903003703002001200141F0016A290300370388012001200141E8016A29030037038001200120012903E00137037841000D020C100B20014180026A240041020F0B4102450D0E0B410041001004000B410810101A20014105410141CB00100F360298014100450D0B410041001004000B410041001004000B410041001004000B410041001009000B4120101022024104100B200141306A20024120100D200241201009000B20014180026A240041020F0B20014180026A240041020F0B20014180026A240041020F0B20014180026A240041020F0B410041001009000B410041001004000B410041001009000B200128029801280200413F6A41607141206A2203101022022003410376100B200041706A22042200240020044120360200200420024104100D20012802980122092802002101200041706A22042400200420013602002004200241206A4104100D200241C0006A200941086A2001100A200220031009000B4120101022024104100B200141F8006A20024120100D200241201009000B200128022C280200413F6A41607141206A2203101022022003410376100B200041706A22042200240020044120360200200420024104100D200128022C22092802002101200041706A22042400200420013602002004200241206A4104100D200241C0006A200941086A2001100A200220031009000B410041001004000B0B56010041000B50657761736D2063616C6C65642048656C6C6F2066726F6D207761736D000000007177213B393C76BAF374B5A91F5A8E4A972270CEFDDA6375DF53FB1A3CAC11C9617267313A20617267323A657761736D") +var Abi_ewasm = []byte(`[{"name":"get_vm","type":"function","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"pure"},{"name":"get_number","type":"function","inputs":[],"outputs":[{"name":"","type":"int256","internalType":"int256"}],"stateMutability":"pure"},{"name":"call_get_vm","type":"function","inputs":[{"name":"e","type":"address","internalType":"contract E"}],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"nonpayable"},{"name":"call_get_number","type":"function","inputs":[{"name":"e","type":"address","internalType":"contract E"}],"outputs":[{"name":"","type":"int256","internalType":"int256"}],"stateMutability":"nonpayable"},{"name":"try_revert","type":"function","inputs":[],"outputs":[],"stateMutability":"pure"},{"name":"hash_tests","type":"function","inputs":[],"outputs":[],"stateMutability":"pure"},{"name":"test_events","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"test_print","type":"function","inputs":[{"name":"arg1","type":"int64","internalType":"int64"},{"name":"arg2","type":"string","internalType":"string"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"L","type":"event","inputs":[{"name":"f1","type":"int256","internalType":"int256","indexed":true},{"name":"f2","type":"string","internalType":"string"},{"name":"f3","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":""}]`) diff --git a/execution/solidity/revert.sol b/execution/solidity/revert.sol index cc88e89e2..e976e06ac 100644 --- a/execution/solidity/revert.sol +++ b/execution/solidity/revert.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract Revert { event NotReverting(uint32 indexed i); diff --git a/execution/solidity/revert.sol.go b/execution/solidity/revert.sol.go index bd6339c07..bc18a2e65 100644 --- a/execution/solidity/revert.sol.go +++ b/execution/solidity/revert.sol.go @@ -2,6 +2,6 @@ package solidity import hex "github.com/tmthrgd/go-hex" -var Bytecode_Revert = hex.MustDecodeString("608060405234801561001057600080fd5b50610216806100206000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c0100000000000000000000000000000000000000000000000000000000900480635b202afb146100585780636037b04c1461008c575b600080fd5b61008a6004803603602081101561006e57600080fd5b81019080803563ffffffff169060200190929190505050610096565b005b6100946101e5565b005b60008163ffffffff161415610113576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f492068617665207265766572746564000000000000000000000000000000000081525060200191505060405180910390fd5b8080600190039150508063ffffffff167ff7f0feb5b4ac5276c55faa8936d962de931ebe8333a2efdc0506878de3979ba960405160405180910390a23073ffffffffffffffffffffffffffffffffffffffff16635b202afb826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808263ffffffff1663ffffffff168152602001915050600060405180830381600087803b1580156101ca57600080fd5b505af11580156101de573d6000803e3d6000fd5b5050505050565b600080fdfea165627a7a7230582021dc462608e362c1ab12bfca9c326514ec64ff6bbe411b6a3b1c41e20a82a8ac0029") -var DeployedBytecode_Revert = hex.MustDecodeString("608060405234801561001057600080fd5b5060043610610053576000357c0100000000000000000000000000000000000000000000000000000000900480635b202afb146100585780636037b04c1461008c575b600080fd5b61008a6004803603602081101561006e57600080fd5b81019080803563ffffffff169060200190929190505050610096565b005b6100946101e5565b005b60008163ffffffff161415610113576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f492068617665207265766572746564000000000000000000000000000000000081525060200191505060405180910390fd5b8080600190039150508063ffffffff167ff7f0feb5b4ac5276c55faa8936d962de931ebe8333a2efdc0506878de3979ba960405160405180910390a23073ffffffffffffffffffffffffffffffffffffffff16635b202afb826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808263ffffffff1663ffffffff168152602001915050600060405180830381600087803b1580156101ca57600080fd5b505af11580156101de573d6000803e3d6000fd5b5050505050565b600080fdfea165627a7a7230582021dc462608e362c1ab12bfca9c326514ec64ff6bbe411b6a3b1c41e20a82a8ac0029") -var Abi_Revert = []byte(`[{"constant":false,"inputs":[{"name":"i","type":"uint32"}],"name":"RevertAt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"RevertNoReason","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"i","type":"uint32"}],"name":"NotReverting","type":"event"}]`) +var Bytecode_Revert = hex.MustDecodeString("608060405234801561001057600080fd5b506101e6806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80635b202afb1461003b5780636037b04c1461006f575b600080fd5b61006d6004803603602081101561005157600080fd5b81019080803563ffffffff169060200190929190505050610079565b005b6100776101ac565b005b60008163ffffffff1614156100f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f492068617665207265766572746564000000000000000000000000000000000081525060200191505060405180910390fd5b8080600190039150508063ffffffff167ff7f0feb5b4ac5276c55faa8936d962de931ebe8333a2efdc0506878de3979ba960405160405180910390a23073ffffffffffffffffffffffffffffffffffffffff16635b202afb826040518263ffffffff1660e01b8152600401808263ffffffff1663ffffffff168152602001915050600060405180830381600087803b15801561019157600080fd5b505af11580156101a5573d6000803e3d6000fd5b5050505050565b600080fdfea265627a7a72315820a7b5572a98bc7a4e296bf1ce2bbff026434c6f440f8f2cdbee3a6b121b7df20464736f6c634300050b0032") +var DeployedBytecode_Revert = hex.MustDecodeString("608060405234801561001057600080fd5b50600436106100365760003560e01c80635b202afb1461003b5780636037b04c1461006f575b600080fd5b61006d6004803603602081101561005157600080fd5b81019080803563ffffffff169060200190929190505050610079565b005b6100776101ac565b005b60008163ffffffff1614156100f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f492068617665207265766572746564000000000000000000000000000000000081525060200191505060405180910390fd5b8080600190039150508063ffffffff167ff7f0feb5b4ac5276c55faa8936d962de931ebe8333a2efdc0506878de3979ba960405160405180910390a23073ffffffffffffffffffffffffffffffffffffffff16635b202afb826040518263ffffffff1660e01b8152600401808263ffffffff1663ffffffff168152602001915050600060405180830381600087803b15801561019157600080fd5b505af11580156101a5573d6000803e3d6000fd5b5050505050565b600080fdfea265627a7a72315820a7b5572a98bc7a4e296bf1ce2bbff026434c6f440f8f2cdbee3a6b121b7df20464736f6c634300050b0032") +var Abi_Revert = []byte(`[{"constant":false,"inputs":[{"internalType":"uint32","name":"i","type":"uint32"}],"name":"RevertAt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"RevertNoReason","outputs":[],"payable":false,"stateMutability":"pure","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"i","type":"uint32"}],"name":"NotReverting","type":"event"}]`) diff --git a/execution/solidity/strange_loop.sol b/execution/solidity/strange_loop.sol index 765edac81..7d9f711e9 100644 --- a/execution/solidity/strange_loop.sol +++ b/execution/solidity/strange_loop.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract StrangeLoop { int top = 23; diff --git a/execution/solidity/strange_loop.sol.go b/execution/solidity/strange_loop.sol.go index e9a9f9ee9..5dca076a1 100644 --- a/execution/solidity/strange_loop.sol.go +++ b/execution/solidity/strange_loop.sol.go @@ -2,6 +2,6 @@ package solidity import hex "github.com/tmthrgd/go-hex" -var Bytecode_StrangeLoop = hex.MustDecodeString("60806040526017600055602260015560116002556001600360006101000a81548160ff02191690831515021790555034801561003a57600080fd5b506103d88061004a6000396000f3fe608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063ebb384dd1461004d575b600080fd5b61005561006b565b6040518082815260200191505060405180910390f35b60006002549050600360009054906101000a900460ff161561026557600154600254121561019f576002600081548092919060010191905055506002547f55707369652100000000000000000000000000000000000000000000000000007f3ff0b1eac80ecf8e93d1a2d7982a9230f8ea7693439fd548687b08a5e292b09760405160405180910390a360025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561015e57600080fd5b505af1158015610172573d6000803e3d6000fd5b505050506040513d602081101561018857600080fd5b810190808051906020019092919050505050610260565b6000600360006101000a81548160ff02191690831515021790555060025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561022357600080fd5b505af1158015610237573d6000803e3d6000fd5b505050506040513d602081101561024d57600080fd5b8101908080519060200190929190505050505b6103a8565b600054600254131561037e57600260008154809291906001900391905055506002547f446f776e736965210000000000000000000000000000000000000000000000007f3ff0b1eac80ecf8e93d1a2d7982a9230f8ea7693439fd548687b08a5e292b09760405160405180910390a360025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561033d57600080fd5b505af1158015610351573d6000803e3d6000fd5b505050506040513d602081101561036757600080fd5b8101908080519060200190929190505050506103a7565b6001600360006101000a81548160ff0219169083151502179055506002549050600090506103a9565b5b5b9056fea165627a7a7230582077bccbcca142d5874668a8185b0909f13f771e47714a970862df714f970211aa0029") -var DeployedBytecode_StrangeLoop = hex.MustDecodeString("608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063ebb384dd1461004d575b600080fd5b61005561006b565b6040518082815260200191505060405180910390f35b60006002549050600360009054906101000a900460ff161561026557600154600254121561019f576002600081548092919060010191905055506002547f55707369652100000000000000000000000000000000000000000000000000007f3ff0b1eac80ecf8e93d1a2d7982a9230f8ea7693439fd548687b08a5e292b09760405160405180910390a360025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561015e57600080fd5b505af1158015610172573d6000803e3d6000fd5b505050506040513d602081101561018857600080fd5b810190808051906020019092919050505050610260565b6000600360006101000a81548160ff02191690831515021790555060025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561022357600080fd5b505af1158015610237573d6000803e3d6000fd5b505050506040513d602081101561024d57600080fd5b8101908080519060200190929190505050505b6103a8565b600054600254131561037e57600260008154809291906001900391905055506002547f446f776e736965210000000000000000000000000000000000000000000000007f3ff0b1eac80ecf8e93d1a2d7982a9230f8ea7693439fd548687b08a5e292b09760405160405180910390a360025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561033d57600080fd5b505af1158015610351573d6000803e3d6000fd5b505050506040513d602081101561036757600080fd5b8101908080519060200190929190505050506103a7565b6001600360006101000a81548160ff0219169083151502179055506002549050600090506103a9565b5b5b9056fea165627a7a7230582077bccbcca142d5874668a8185b0909f13f771e47714a970862df714f970211aa0029") -var Abi_StrangeLoop = []byte(`[{"constant":false,"inputs":[],"name":"UpsieDownsie","outputs":[{"name":"i","type":"int256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"direction","type":"bytes32"},{"indexed":true,"name":"newDepth","type":"int256"}],"name":"ChangeLevel","type":"event"}]`) +var Bytecode_StrangeLoop = hex.MustDecodeString("60806040526017600055602260015560116002556001600360006101000a81548160ff02191690831515021790555034801561003a57600080fd5b506103708061004a6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063ebb384dd14610030575b600080fd5b61003861004e565b6040518082815260200191505060405180910390f35b60006002549050600360009054906101000a900460ff1615610210576001546002541215610166576002600081548092919060010191905055506002547f55707369652100000000000000000000000000000000000000000000000000007f3ff0b1eac80ecf8e93d1a2d7982a9230f8ea7693439fd548687b08a5e292b09760405160405180910390a360025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561012557600080fd5b505af1158015610139573d6000803e3d6000fd5b505050506040513d602081101561014f57600080fd5b81019080805190602001909291905050505061020b565b6000600360006101000a81548160ff02191690831515021790555060025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156101ce57600080fd5b505af11580156101e2573d6000803e3d6000fd5b505050506040513d60208110156101f857600080fd5b8101908080519060200190929190505050505b610337565b600054600254131561030d57600260008154809291906001900391905055506002547f446f776e736965210000000000000000000000000000000000000000000000007f3ff0b1eac80ecf8e93d1a2d7982a9230f8ea7693439fd548687b08a5e292b09760405160405180910390a360025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156102cc57600080fd5b505af11580156102e0573d6000803e3d6000fd5b505050506040513d60208110156102f657600080fd5b810190808051906020019092919050505050610336565b6001600360006101000a81548160ff021916908315150217905550600254905060009050610338565b5b5b9056fea265627a7a72315820af2e5459a7afcdb6fb21261c4f85e2f492ea013440e8c5677da356f6f95542f264736f6c634300050b0032") +var DeployedBytecode_StrangeLoop = hex.MustDecodeString("608060405234801561001057600080fd5b506004361061002b5760003560e01c8063ebb384dd14610030575b600080fd5b61003861004e565b6040518082815260200191505060405180910390f35b60006002549050600360009054906101000a900460ff1615610210576001546002541215610166576002600081548092919060010191905055506002547f55707369652100000000000000000000000000000000000000000000000000007f3ff0b1eac80ecf8e93d1a2d7982a9230f8ea7693439fd548687b08a5e292b09760405160405180910390a360025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561012557600080fd5b505af1158015610139573d6000803e3d6000fd5b505050506040513d602081101561014f57600080fd5b81019080805190602001909291905050505061020b565b6000600360006101000a81548160ff02191690831515021790555060025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156101ce57600080fd5b505af11580156101e2573d6000803e3d6000fd5b505050506040513d60208110156101f857600080fd5b8101908080519060200190929190505050505b610337565b600054600254131561030d57600260008154809291906001900391905055506002547f446f776e736965210000000000000000000000000000000000000000000000007f3ff0b1eac80ecf8e93d1a2d7982a9230f8ea7693439fd548687b08a5e292b09760405160405180910390a360025490503073ffffffffffffffffffffffffffffffffffffffff1663ebb384dd6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156102cc57600080fd5b505af11580156102e0573d6000803e3d6000fd5b505050506040513d60208110156102f657600080fd5b810190808051906020019092919050505050610336565b6001600360006101000a81548160ff021916908315150217905550600254905060009050610338565b5b5b9056fea265627a7a72315820af2e5459a7afcdb6fb21261c4f85e2f492ea013440e8c5677da356f6f95542f264736f6c634300050b0032") +var Abi_StrangeLoop = []byte(`[{"constant":false,"inputs":[],"name":"UpsieDownsie","outputs":[{"internalType":"int256","name":"i","type":"int256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"direction","type":"bytes32"},{"indexed":true,"internalType":"int256","name":"newDepth","type":"int256"}],"name":"ChangeLevel","type":"event"}]`) diff --git a/execution/solidity/zero_reset.sol b/execution/solidity/zero_reset.sol index 7c23b7bf0..f4c4c89b3 100644 --- a/execution/solidity/zero_reset.sol +++ b/execution/solidity/zero_reset.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; // Originally taken from: https://github.com/hyperledger/burrow/issues/847 contract ZeroReset { diff --git a/execution/solidity/zero_reset.sol.go b/execution/solidity/zero_reset.sol.go index d54770e5e..2e7481874 100644 --- a/execution/solidity/zero_reset.sol.go +++ b/execution/solidity/zero_reset.sol.go @@ -2,6 +2,6 @@ package solidity import hex "github.com/tmthrgd/go-hex" -var Bytecode_ZeroReset = hex.MustDecodeString("608060405234801561001057600080fd5b50610195806100206000396000f3fe608060405234801561001057600080fd5b506004361061007e576000357c0100000000000000000000000000000000000000000000000000000000900480620267a4146100835780634ef65c3b146100a157806362738998146100cf578063747586b8146100ed578063987dc8201461011b578063b15a0d5f14610125575b600080fd5b61008b61012f565b6040518082815260200191505060405180910390f35b6100cd600480360360208110156100b757600080fd5b8101908080359060200190929190505050610139565b005b6100d7610143565b6040518082815260200191505060405180910390f35b6101196004803603602081101561010357600080fd5b810190808035906020019092919050505061014c565b005b610123610156565b005b61012d61015f565b005b6000600154905090565b8060018190555050565b60008054905090565b8060008190555050565b60008081905550565b600060018190555056fea165627a7a72305820f425681ba5df6ad8326c87681bfe7f8a84f407dc25e79a4cb790063ac3a8ba1f0029") -var DeployedBytecode_ZeroReset = hex.MustDecodeString("608060405234801561001057600080fd5b506004361061007e576000357c0100000000000000000000000000000000000000000000000000000000900480620267a4146100835780634ef65c3b146100a157806362738998146100cf578063747586b8146100ed578063987dc8201461011b578063b15a0d5f14610125575b600080fd5b61008b61012f565b6040518082815260200191505060405180910390f35b6100cd600480360360208110156100b757600080fd5b8101908080359060200190929190505050610139565b005b6100d7610143565b6040518082815260200191505060405180910390f35b6101196004803603602081101561010357600080fd5b810190808035906020019092919050505061014c565b005b610123610156565b005b61012d61015f565b005b6000600154905090565b8060018190555050565b60008054905090565b8060008190555050565b60008081905550565b600060018190555056fea165627a7a72305820f425681ba5df6ad8326c87681bfe7f8a84f407dc25e79a4cb790063ac3a8ba1f0029") -var Abi_ZeroReset = []byte(`[{"constant":true,"inputs":[],"name":"getUint","outputs":[{"name":"retUint","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"setUint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getInt","outputs":[{"name":"retInt","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"x","type":"int256"}],"name":"setInt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"setIntToZero","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"setUintToZero","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) +var Bytecode_ZeroReset = hex.MustDecodeString("608060405234801561001057600080fd5b50610181806100206000396000f3fe608060405234801561001057600080fd5b50600436106100615760003560e01c80620267a4146100665780634ef65c3b1461008457806362738998146100b2578063747586b8146100d0578063987dc820146100fe578063b15a0d5f14610108575b600080fd5b61006e610112565b6040518082815260200191505060405180910390f35b6100b06004803603602081101561009a57600080fd5b810190808035906020019092919050505061011c565b005b6100ba610126565b6040518082815260200191505060405180910390f35b6100fc600480360360208110156100e657600080fd5b810190808035906020019092919050505061012f565b005b610106610139565b005b610110610142565b005b6000600154905090565b8060018190555050565b60008054905090565b8060008190555050565b60008081905550565b600060018190555056fea265627a7a72315820b0d053920fc2777157df814d54282ef8e079d98aebf917dc83eeab6c6623e49364736f6c634300050b0032") +var DeployedBytecode_ZeroReset = hex.MustDecodeString("608060405234801561001057600080fd5b50600436106100615760003560e01c80620267a4146100665780634ef65c3b1461008457806362738998146100b2578063747586b8146100d0578063987dc820146100fe578063b15a0d5f14610108575b600080fd5b61006e610112565b6040518082815260200191505060405180910390f35b6100b06004803603602081101561009a57600080fd5b810190808035906020019092919050505061011c565b005b6100ba610126565b6040518082815260200191505060405180910390f35b6100fc600480360360208110156100e657600080fd5b810190808035906020019092919050505061012f565b005b610106610139565b005b610110610142565b005b6000600154905090565b8060018190555050565b60008054905090565b8060008190555050565b60008081905550565b600060018190555056fea265627a7a72315820b0d053920fc2777157df814d54282ef8e079d98aebf917dc83eeab6c6623e49364736f6c634300050b0032") +var Abi_ZeroReset = []byte(`[{"constant":true,"inputs":[],"name":"getUint","outputs":[{"internalType":"uint256","name":"retUint","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"setUint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getInt","outputs":[{"internalType":"int256","name":"retInt","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"int256","name":"x","type":"int256"}],"name":"setInt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"setIntToZero","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"setUintToZero","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) diff --git a/execution/state/abi.go b/execution/state/abi.go index a4fb1fe20..cd72a1fd1 100644 --- a/execution/state/abi.go +++ b/execution/state/abi.go @@ -5,10 +5,10 @@ import ( ) func (s *ReadState) GetMetadata(metahash acmstate.MetadataHash) (string, error) { - return string(s.Plain.Get(keys.Abi.Key(metahash.Bytes()))), nil + data, err := s.Plain.Get(keys.Abi.Key(metahash.Bytes())) + return string(data), err } func (ws *writeState) SetMetadata(metahash acmstate.MetadataHash, abi string) error { - ws.plain.Set(keys.Abi.Key(metahash.Bytes()), []byte(abi)) - return nil + return ws.plain.Set(keys.Abi.Key(metahash.Bytes()), []byte(abi)) } diff --git a/execution/state/accounts.go b/execution/state/accounts.go index 6524e5486..10b7173c1 100644 --- a/execution/state/accounts.go +++ b/execution/state/accounts.go @@ -16,8 +16,10 @@ func (s *ReadState) GetAccount(address crypto.Address) (*acm.Account, error) { if err != nil { return nil, err } - accBytes := tree.Get(keys.Account.KeyNoPrefix(address)) - if accBytes == nil { + accBytes, err := tree.Get(keys.Account.KeyNoPrefix(address)) + if err != nil { + return nil, err + } else if accBytes == nil { return nil, nil } account := new(acm.Account) @@ -116,7 +118,7 @@ func (s *ReadState) GetStorage(address crypto.Address, key binary.Word256) ([]by if err != nil { return []byte{}, err } - return tree.Get(keyFormat.KeyNoPrefix(key)), nil + return tree.Get(keyFormat.KeyNoPrefix(key)) } func (ws *writeState) SetStorage(address crypto.Address, key binary.Word256, value []byte) error { @@ -149,13 +151,13 @@ func (s *ReadState) IterateStorage(address crypto.Address, consumer func(key bin return tree.Iterate(nil, nil, true, func(key []byte, value []byte) error { - if len(key) != binary.Word256Length { + if len(key) != binary.Word256Bytes { return fmt.Errorf("key '%X' stored for account %s is not a %v-byte word", - key, address, binary.Word256Length) + key, address, binary.Word256Bytes) } - if len(value) != binary.Word256Length { + if len(value) != binary.Word256Bytes { return fmt.Errorf("value '%X' stored for account %s is not a %v-byte word", - key, address, binary.Word256Length) + key, address, binary.Word256Bytes) } return consumer(binary.LeftPadWord256(key), value) }) diff --git a/execution/state/events.go b/execution/state/events.go index aa422f17c..b547006d0 100644 --- a/execution/state/events.go +++ b/execution/state/events.go @@ -7,26 +7,35 @@ import ( "github.com/hyperledger/burrow/encoding" "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/storage" ) func (ws *writeState) AddBlock(be *exec.BlockExecution) error { // If there are no transactions, do not store anything. This reduces the amount of data we store and - // prevents the iavl tree from changing, which means the AppHash does not change. + // prevents the iavl tree from changing, which means the AppHash does not change. If the AppHash changes then + // Tendermint will always produce another block. If we change the AppHash on empty blocks then we will continue + // creating empty blocks even if we have been configure to not do so. + // TODO: we would prefer not to do this and instead store sequential monotonic blocks, once this: + // https://github.com/tendermint/tendermint/issues/1909 is resolved we should be able to suppress empty blocks + // even when the AppHash changes if len(be.TxExecutions) == 0 { return nil } - buf := new(bytes.Buffer) var offset int for _, ev := range be.StreamEvents() { - if ev.BeginTx != nil { + switch { + case ev.BeginTx != nil: val := &exec.TxExecutionKey{Height: be.Height, Offset: uint64(offset)} bs, err := encoding.Encode(val) if err != nil { return err } // Set reference to TxExecution - ws.plain.Set(keys.TxHash.Key(ev.BeginTx.TxHeader.TxHash), bs) + err = ws.plain.Set(keys.TxHash.Key(ev.BeginTx.TxHeader.TxHash), bs) + if err != nil { + return err + } } n, err := encoding.WriteMessage(buf, ev) @@ -47,7 +56,8 @@ func (ws *writeState) AddBlock(be *exec.BlockExecution) error { } // Iterate SteamEvents over the closed interval [startHeight, endHeight] - i.e. startHeight and endHeight inclusive -func (s *ReadState) IterateStreamEvents(startHeight, endHeight *uint64, consumer func(*exec.StreamEvent) error) error { +func (s *ReadState) IterateStreamEvents(startHeight, endHeight *uint64, sortOrder storage.SortOrder, + consumer func(*exec.StreamEvent) error) error { tree, err := s.Forest.Reader(keys.Event.Prefix()) if err != nil { return err @@ -60,7 +70,7 @@ func (s *ReadState) IterateStreamEvents(startHeight, endHeight *uint64, consumer // Convert to inclusive end bounds since this generally makes more sense for block height endKey = keys.Event.KeyNoPrefix(*endHeight + 1) } - return tree.Iterate(startKey, endKey, true, func(_, value []byte) error { + return tree.Iterate(startKey, endKey, sortOrder == storage.AscendingSort, func(_, value []byte) error { buf := bytes.NewBuffer(value) for { @@ -85,18 +95,17 @@ func (s *ReadState) TxsAtHeight(height uint64) ([]*exec.TxExecution, error) { const errHeader = "TxAtHeight():" var stack exec.TxStack var txExecutions []*exec.TxExecution - err := s.IterateStreamEvents(&height, &height, - func(ev *exec.StreamEvent) error { - // Keep trying to consume TxExecutions at from events at this height - txe, err := stack.Consume(ev) - if err != nil { - return fmt.Errorf("%s %v", errHeader, err) - } - if txe != nil { - txExecutions = append(txExecutions, txe) - } - return nil - }) + err := s.IterateStreamEvents(&height, &height, storage.AscendingSort, func(ev *exec.StreamEvent) error { + // Keep trying to consume TxExecutions at from events at this height + txe, err := stack.Consume(ev) + if err != nil { + return err + } + if txe != nil { + txExecutions = append(txExecutions, txe) + } + return nil + }) if err != nil && err != io.EOF { return nil, fmt.Errorf("%s %v", errHeader, err) } @@ -105,13 +114,16 @@ func (s *ReadState) TxsAtHeight(height uint64) ([]*exec.TxExecution, error) { func (s *ReadState) TxByHash(txHash []byte) (*exec.TxExecution, error) { const errHeader = "TxByHash():" - bs := s.Plain.Get(keys.TxHash.Key(txHash)) + bs, err := s.Plain.Get(keys.TxHash.Key(txHash)) + if err != nil { + return nil, err + } if len(bs) == 0 { return nil, nil } key := new(exec.TxExecutionKey) - err := encoding.Decode(bs, key) + err = encoding.Decode(bs, key) if err != nil { return nil, err } @@ -121,8 +133,10 @@ func (s *ReadState) TxByHash(txHash []byte) (*exec.TxExecution, error) { return nil, err } - bs = blockTree.Get(keys.Event.KeyNoPrefix(key.Height)) - if len(bs) == 0 { + bs, err = blockTree.Get(keys.Event.KeyNoPrefix(key.Height)) + if err != nil { + return nil, err + } else if len(bs) == 0 { return nil, fmt.Errorf("%s could not retrieve transaction with TxHash %X despite finding reference", errHeader, txHash) } @@ -146,3 +160,20 @@ func (s *ReadState) TxByHash(txHash []byte) (*exec.TxExecution, error) { } } } + +// Get the last block height we stored in state +func (s *ReadState) LastStoredHeight() (uint64, error) { + var height uint64 + err := s.IterateStreamEvents(nil, nil, storage.DescendingSort, + func(event *exec.StreamEvent) error { + if event.EndBlock != nil { + height = event.EndBlock.Height + return io.EOF + } + return nil + }) + if err != nil && err != io.EOF { + return 0, fmt.Errorf("LastStoredHeight: %w", err) + } + return height, nil +} diff --git a/execution/state/events_test.go b/execution/state/events_test.go index fe6b58331..1fc0de70e 100644 --- a/execution/state/events_test.go +++ b/execution/state/events_test.go @@ -8,8 +8,10 @@ import ( "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/config/source" "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/storage" + "github.com/hyperledger/burrow/txs" + "github.com/hyperledger/burrow/txs/payload" "github.com/stretchr/testify/require" dbm "github.com/tendermint/tm-db" ) @@ -19,29 +21,24 @@ func TestWriteState_AddBlock(t *testing.T) { height := uint64(100) numTxs := uint64(5) events := uint64(10) - block := mkBlock(height, numTxs, events) - _, _, err := s.Update(func(ws Updatable) error { - return ws.AddBlock(block) - }) - require.NoError(t, err) + addBlock(t, s, height, numTxs, events) txIndex := uint64(0) eventIndex := uint64(0) - err = s.IterateStreamEvents(&height, &height, - func(ev *exec.StreamEvent) error { - switch { - case ev.BeginTx != nil: - eventIndex = 0 - case ev.Event != nil: - require.Equal(t, mkEvent(height, txIndex, eventIndex).Header.TxHash.String(), - ev.Event.Header.TxHash.String(), "event TxHash mismatch at tx #%d event #%d", - txIndex, eventIndex) - eventIndex++ - case ev.EndTx != nil: - txIndex++ - } - return nil - }) + err := s.IterateStreamEvents(&height, &height, storage.AscendingSort, func(ev *exec.StreamEvent) error { + switch { + case ev.BeginTx != nil: + eventIndex = 0 + case ev.Event != nil: + require.Equal(t, mkEvent(height, txIndex, eventIndex).Header.TxHash.String(), + ev.Event.Header.TxHash.String(), "event TxHash mismatch at tx #%d event #%d", + txIndex, eventIndex) + eventIndex++ + case ev.EndTx != nil: + txIndex++ + } + return nil + }) require.NoError(t, err) require.Equal(t, numTxs, txIndex, "should have observed all txs") // non-increasing events @@ -101,7 +98,7 @@ func TestReadState_TxByHash(t *testing.T) { for height := uint64(0); height < maxHeight; height++ { for txIndex := uint64(0); txIndex < numTxs; txIndex++ { // Find this tx - tx := mkTx(height, txIndex, events) + tx := mkTxExecution(height, txIndex, events) txHash := tx.TxHash.String() // Check we have no duplicates (indicates problem with how we are generating hashes for these tests require.False(t, hashSet[txHash], "should be no duplicate tx hashes") @@ -117,6 +114,54 @@ func TestReadState_TxByHash(t *testing.T) { } } +func TestLastBlockStored(t *testing.T) { + s := NewState(dbm.NewMemDB()) + // Add first block + addBlock(t, s, uint64(1), 2, 3) + lastStoredHeight, err := s.LastStoredHeight() + require.NoError(t, err) + require.Equal(t, lastStoredHeight, uint64(1)) + + // Add empty block + addBlock(t, s, uint64(2), 0, 0) + lastStoredHeight, err = s.LastStoredHeight() + require.NoError(t, err) + // Same last stored height + require.Equal(t, lastStoredHeight, uint64(1)) + + // Add non-empty block + addBlock(t, s, uint64(3), 1, 0) + lastStoredHeight, err = s.LastStoredHeight() + require.NoError(t, err) + // Same last stored height + require.Equal(t, lastStoredHeight, uint64(3)) +} + +func BenchmarkAddBlockAndIterator(b *testing.B) { + s := NewState(dbm.NewMemDB()) + numTxs := uint64(5) + events := uint64(10) + for height := uint64(0); height < 2000; height++ { + block := mkBlock(height, numTxs, events) + _, _, err := s.Update(func(ws Updatable) error { + return ws.AddBlock(block) + }) + require.NoError(b, err) + } + err := s.IterateStreamEvents(nil, nil, storage.AscendingSort, func(ev *exec.StreamEvent) error { + return nil + }) + require.NoError(b, err) +} + +func addBlock(t testing.TB, s *State, height, numTxs, events uint64) { + block := mkBlock(height, numTxs, events) + _, _, err := s.Update(func(ws Updatable) error { + return ws.AddBlock(block) + }) + require.NoError(t, err) +} + func deepCountTxs(txes []*exec.TxExecution) int { sum := len(txes) for _, txe := range txes { @@ -128,7 +173,7 @@ func deepCountTxs(txes []*exec.TxExecution) int { func nestTxs(txe *exec.TxExecution, height, events, numTxs uint64) []*exec.TxExecution { txes := make([]*exec.TxExecution, numTxs) for i := uint64(0); i < numTxs; i++ { - txes[i] = mkTx(height, i, events) + txes[i] = mkTxExecution(height, i, events) txe.TxExecutions = append(txe.TxExecutions, txes[i]) } return txes @@ -139,23 +184,26 @@ func mkBlock(height, numTxs, events uint64) *exec.BlockExecution { Height: height, } for ti := uint64(0); ti < numTxs; ti++ { - txe := mkTx(height, ti, events) + txe := mkTxExecution(height, ti, events) be.TxExecutions = append(be.TxExecutions, txe) } return be } -func mkTx(height, txIndex, events uint64) *exec.TxExecution { +func mkTxExecution(height, txIndex, events uint64) *exec.TxExecution { hash := make([]byte, 32) bin.BigEndian.PutUint64(hash[:8], height) bin.BigEndian.PutUint64(hash[8:16], txIndex) bin.BigEndian.PutUint64(hash[16:24], events) + txEnv := txs.Enclose("ChainTheFirst", mkTx()) txe := &exec.TxExecution{ TxHeader: &exec.TxHeader{ TxHash: hash, Height: height, Index: txIndex, }, + Envelope: txEnv, + Receipt: txEnv.Tx.GenerateReceipt(), } for e := uint64(0); e < events; e++ { txe.Events = append(txe.Events, mkEvent(height, txIndex, e)) @@ -163,12 +211,25 @@ func mkTx(height, txIndex, events uint64) *exec.TxExecution { return txe } +func mkTx() payload.Payload { + return &payload.CallTx{ + Input: &payload.TxInput{ + Address: crypto.Address{1, 2, 3}, + Amount: 12345, + Sequence: 67890, + }, + GasLimit: 111, + Fee: 222, + Data: []byte("data1"), + } +} + func mkEvent(height, tx, index uint64) *exec.Event { return &exec.Event{ Header: &exec.Header{ Height: height, Index: index, - TxHash: sha3.Sha3([]byte(fmt.Sprintf("txhash%v%v%v", height, tx, index))), + TxHash: crypto.Keccak256([]byte(fmt.Sprintf("txhash%v%v%v", height, tx, index))), EventID: fmt.Sprintf("eventID: %v%v%v", height, tx, index), }, Log: &exec.LogEvent{ @@ -177,21 +238,3 @@ func mkEvent(height, tx, index uint64) *exec.Event { }, } } - -func BenchmarkAddBlockAndIterator(b *testing.B) { - s := NewState(dbm.NewMemDB()) - numTxs := uint64(5) - events := uint64(10) - for height := uint64(0); height < 2000; height++ { - block := mkBlock(height, numTxs, events) - _, _, err := s.Update(func(ws Updatable) error { - return ws.AddBlock(block) - }) - require.NoError(b, err) - } - err := s.IterateStreamEvents(nil, nil, - func(ev *exec.StreamEvent) error { - return nil - }) - require.NoError(b, err) -} diff --git a/execution/state/names.go b/execution/state/names.go index bcf135af0..25d8e714a 100644 --- a/execution/state/names.go +++ b/execution/state/names.go @@ -14,8 +14,10 @@ func (s *ReadState) GetName(name string) (*names.Entry, error) { if err != nil { return nil, err } - entryBytes := tree.Get(keys.Name.KeyNoPrefix(name)) - if entryBytes == nil { + entryBytes, err := tree.Get(keys.Name.KeyNoPrefix(name)) + if err != nil { + return nil, err + } else if entryBytes == nil { return nil, nil } diff --git a/execution/state/proposals.go b/execution/state/proposals.go index 80eaae409..a2e37128c 100644 --- a/execution/state/proposals.go +++ b/execution/state/proposals.go @@ -1,7 +1,7 @@ package state import ( - "fmt" + "github.com/hyperledger/burrow/encoding" "github.com/hyperledger/burrow/execution/proposal" "github.com/hyperledger/burrow/txs/payload" @@ -14,12 +14,19 @@ func (s *ReadState) GetProposal(proposalHash []byte) (*payload.Ballot, error) { if err != nil { return nil, err } - bs := tree.Get(keys.Proposal.KeyNoPrefix(proposalHash)) - if len(bs) == 0 { + bs, err := tree.Get(keys.Proposal.KeyNoPrefix(proposalHash)) + if err != nil { + return nil, err + } else if len(bs) == 0 { return nil, nil } - return payload.DecodeBallot(bs) + ballot := new(payload.Ballot) + err = encoding.Decode(bs, ballot) + if err != nil { + return nil, err + } + return ballot, nil } func (ws *writeState) UpdateProposal(proposalHash []byte, p *payload.Ballot) error { @@ -27,7 +34,7 @@ func (ws *writeState) UpdateProposal(proposalHash []byte, p *payload.Ballot) err if err != nil { return err } - bs, err := p.Encode() + bs, err := encoding.Encode(p) if err != nil { return err } @@ -51,10 +58,11 @@ func (s *ReadState) IterateProposals(consumer func(proposalHash []byte, proposal return err } return tree.Iterate(nil, nil, true, func(key []byte, value []byte) error { - entry, err := payload.DecodeBallot(value) + ballot := new(payload.Ballot) + err := encoding.Decode(value, ballot) if err != nil { - return fmt.Errorf("State.IterateProposal() could not iterate over proposals: %v", err) + return err } - return consumer(key, entry) + return consumer(key, ballot) }) } diff --git a/execution/state/registry.go b/execution/state/registry.go new file mode 100644 index 000000000..1e30a609b --- /dev/null +++ b/execution/state/registry.go @@ -0,0 +1,101 @@ +package state + +import ( + "fmt" + + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/execution/registry" + "github.com/hyperledger/burrow/storage" +) + +var _ registry.IterableReader = &State{} + +func getNode(forest storage.ForestReader, id crypto.Address) (*registry.NodeIdentity, error) { + tree, err := forest.Reader(keys.Registry.Prefix()) + if err != nil { + return nil, err + } + nodeBytes, err := tree.Get(keys.Registry.KeyNoPrefix(id)) + if err != nil { + return nil, err + } else if nodeBytes == nil { + return nil, nil + } + + regNode := new(registry.NodeIdentity) + return regNode, encoding.Decode(nodeBytes, regNode) + +} + +func (s *ReadState) GetNodeByID(id crypto.Address) (*registry.NodeIdentity, error) { + return getNode(s.Forest, id) +} + +func (s *State) GetNodeIDsByAddress(net string) ([]crypto.Address, error) { + return s.writeState.nodeStats.GetAddresses(net), nil +} + +func (ws *writeState) UpdateNode(id crypto.Address, node *registry.NodeIdentity) error { + if node == nil { + return fmt.Errorf("RegisterNode passed nil node in State") + } + + bs, err := encoding.Encode(node) + if err != nil { + return fmt.Errorf("RegisterNode could not encode node: %v", err) + } + tree, err := ws.forest.Writer(keys.Registry.Prefix()) + if err != nil { + return err + } + + prev, err := getNode(ws.forest, id) + if err != nil { + return err + } + + ws.nodeStats.Remove(prev) + ws.nodeStats.Insert(node.GetNetworkAddress(), id) + tree.Set(keys.Registry.KeyNoPrefix(id), bs) + return nil +} + +func (ws *writeState) RemoveNode(id crypto.Address) error { + tree, err := ws.forest.Writer(keys.Registry.Prefix()) + if err != nil { + return err + } + + prev, err := getNode(ws.forest, id) + if err != nil { + return err + } + + ws.nodeStats.Remove(prev) + tree.Delete(keys.Registry.KeyNoPrefix(id)) + return nil +} + +func (s *ReadState) IterateNodes(consumer func(crypto.Address, *registry.NodeIdentity) error) error { + tree, err := s.Forest.Reader(keys.Registry.Prefix()) + if err != nil { + return err + } + return tree.Iterate(nil, nil, true, func(key []byte, value []byte) error { + rn := new(registry.NodeIdentity) + err := encoding.Decode(value, rn) + if err != nil { + return fmt.Errorf("State.IterateNodes() could not iterate over nodes: %v", err) + } + address, err := crypto.AddressFromBytes(key) + if err != nil { + return fmt.Errorf("could not decode key: %v", err) + } + return consumer(address, rn) + }) +} + +func (s *State) GetNumPeers() int { + return len(s.writeState.nodeStats.Addresses) +} diff --git a/execution/state/state.go b/execution/state/state.go index 5c0076b1a..538e598f2 100644 --- a/execution/state/state.go +++ b/execution/state/state.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package state @@ -19,6 +8,8 @@ import ( "fmt" "sync" + "github.com/hyperledger/burrow/execution/registry" + "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/acm/acmstate" "github.com/hyperledger/burrow/acm/validator" @@ -57,6 +48,7 @@ type KeyFormatStore struct { Proposal *storage.MustKeyFormat Validator *storage.MustKeyFormat Event *storage.MustKeyFormat + Registry *storage.MustKeyFormat TxHash *storage.MustKeyFormat Abi *storage.MustKeyFormat } @@ -66,7 +58,7 @@ var keys = KeyFormatStore{ // AccountAddress -> Account Account: storage.NewMustKeyFormat("a", crypto.AddressLength), // AccountAddress, Key -> Value - Storage: storage.NewMustKeyFormat("s", crypto.AddressLength, binary.Word256Length), + Storage: storage.NewMustKeyFormat("s", crypto.AddressLength, binary.Word256Bytes), // Name -> Entry Name: storage.NewMustKeyFormat("n", storage.VariadicSegmentLength), // ProposalHash -> Proposal @@ -75,6 +67,8 @@ var keys = KeyFormatStore{ Validator: storage.NewMustKeyFormat("v", crypto.AddressLength), // Height -> StreamEvent Event: storage.NewMustKeyFormat("e", uint64Length), + // Validator -> NodeIdentity + Registry: storage.NewMustKeyFormat("r", crypto.AddressLength), // Stored on the plain // TxHash -> TxHeight, TxIndex @@ -97,7 +91,9 @@ type Updatable interface { acmstate.Writer names.Writer proposal.Writer + registry.Writer validator.Writer + acmstate.MetadataWriter AddBlock(blockExecution *exec.BlockExecution) error } @@ -105,8 +101,9 @@ type Updatable interface { type writeState struct { forest *storage.MutableForest plain *storage.PrefixDB - accountStats acmstate.AccountStats ring *validator.Ring + accountStats acmstate.AccountStats + nodeStats registry.NodeStats } type ReadState struct { @@ -124,7 +121,7 @@ type State struct { logger *logging.Logger } -// Create a new State object +// NewState creates a new State object func NewState(db dbm.DB) *State { forest, err := storage.NewMutableForest(storage.NewPrefixDB(db, forestPrefix), defaultCacheCapacity) if err != nil { @@ -141,9 +138,10 @@ func NewState(db dbm.DB) *State { History: ring, }, writeState: writeState{ - forest: forest, - plain: plain, - ring: ring, + forest: forest, + plain: plain, + ring: ring, + nodeStats: registry.NewNodeStats(), }, logger: logging.NewNoopLogger(), } @@ -200,18 +198,18 @@ func LoadState(db dbm.DB, version int64) (*State, error) { if err != nil { return nil, fmt.Errorf("could not load MutableForest at version %d: %v", version, err) } + // Populate stats. If this starts taking too long, store the value rather than the full scan at startup - err = s.IterateAccounts(func(acc *acm.Account) error { - if len(acc.EVMCode) > 0 || len(acc.WASMCode) > 0 { - s.writeState.accountStats.AccountsWithCode++ - } else { - s.writeState.accountStats.AccountsWithoutCode++ - } - return nil - }) + err = s.loadAccountStats() + if err != nil { + return nil, err + } + + err = s.loadNodeStats() if err != nil { return nil, err } + // load the validator ring ring, err := LoadValidatorRing(version, DefaultValidatorsWindowSize, s.writeState.forest.GetImmutable) if err != nil { @@ -223,6 +221,24 @@ func LoadState(db dbm.DB, version int64) (*State, error) { return s, nil } +func (s *State) loadAccountStats() error { + return s.IterateAccounts(func(acc *acm.Account) error { + if len(acc.EVMCode) > 0 || len(acc.WASMCode) > 0 { + s.writeState.accountStats.AccountsWithCode++ + } else { + s.writeState.accountStats.AccountsWithoutCode++ + } + return nil + }) +} + +func (s *State) loadNodeStats() error { + return s.IterateNodes(func(id crypto.Address, node *registry.NodeIdentity) error { + s.writeState.nodeStats.Addresses[node.GetNetworkAddress()][id] = struct{}{} + return nil + }) +} + func (s *State) Version() int64 { return s.writeState.forest.Version() } diff --git a/execution/state/validators.go b/execution/state/validators.go index 56945de9c..d0f4461a1 100644 --- a/execution/state/validators.go +++ b/execution/state/validators.go @@ -95,8 +95,10 @@ func (s *ReadState) Power(id crypto.Address) (*big.Int, error) { if err != nil { return nil, err } - bs := tree.Get(keys.Validator.KeyNoPrefix(id)) - if len(bs) == 0 { + bs, err := tree.Get(keys.Validator.KeyNoPrefix(id)) + if err != nil { + return nil, err + } else if len(bs) == 0 { return new(big.Int), nil } v := new(validator.Validator) @@ -122,7 +124,7 @@ func (s *ReadState) IterateValidators(fn func(id crypto.Addressable, power *big. }) } -func (ws *writeState) SetPower(id crypto.PublicKey, power *big.Int) (*big.Int, error) { +func (ws *writeState) SetPower(id *crypto.PublicKey, power *big.Int) (*big.Int, error) { // SetPower in ring flow, err := ws.ring.SetPower(id, power) if err != nil { @@ -132,7 +134,7 @@ func (ws *writeState) SetPower(id crypto.PublicKey, power *big.Int) (*big.Int, e return flow, ws.setPower(id, power) } -func (ws *writeState) setPower(id crypto.PublicKey, power *big.Int) error { +func (ws *writeState) setPower(id *crypto.PublicKey, power *big.Int) error { tree, err := ws.forest.Writer(keys.Validator.Prefix()) if err != nil { return err diff --git a/execution/state/validators_test.go b/execution/state/validators_test.go index 184c7d030..6073ef12b 100644 --- a/execution/state/validators_test.go +++ b/execution/state/validators_test.go @@ -85,6 +85,6 @@ func pow(p int) *big.Int { return big.NewInt(int64(p)) } -func pub(secret interface{}) crypto.PublicKey { +func pub(secret interface{}) *crypto.PublicKey { return acm.NewAccountFromSecret(fmt.Sprintf("%v", secret)).PublicKey } diff --git a/execution/transactor.go b/execution/transactor.go index 944588447..7fb46276b 100644 --- a/execution/transactor.go +++ b/execution/transactor.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package execution @@ -30,6 +19,8 @@ import ( "github.com/hyperledger/burrow/logging/structure" "github.com/hyperledger/burrow/txs" abciTypes "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/mempool" + "github.com/tendermint/tendermint/p2p" tmTypes "github.com/tendermint/tendermint/types" ) @@ -37,6 +28,8 @@ const ( SubscribeBufferSize = 10 ) +type txChecker func(tx tmTypes.Tx, callback func(*abciTypes.Response), txInfo mempool.TxInfo) error + // Transactor is responsible for helping to formulate, sign, and broadcast transactions to tendermint // // The BroadcastTx* methods are able to work against the mempool Accounts (pending) state rather than the @@ -49,20 +42,21 @@ type Transactor struct { BlockchainInfo bcm.BlockchainInfo Emitter *event.Emitter MempoolAccounts *Accounts - checkTxAsync func(tx tmTypes.Tx, cb func(*abciTypes.Response)) error + checkTxAsync txChecker + nodeID p2p.ID txEncoder txs.Encoder logger *logging.Logger } func NewTransactor(tip bcm.BlockchainInfo, emitter *event.Emitter, mempoolAccounts *Accounts, - checkTxAsync func(tx tmTypes.Tx, cb func(*abciTypes.Response)) error, txEncoder txs.Encoder, - logger *logging.Logger) *Transactor { + checkTxAsync txChecker, id p2p.ID, txEncoder txs.Encoder, logger *logging.Logger) *Transactor { return &Transactor{ BlockchainInfo: tip, Emitter: emitter, MempoolAccounts: mempoolAccounts, checkTxAsync: checkTxAsync, + nodeID: id, txEncoder: txEncoder, logger: logger.With(structure.ComponentKey, "Transactor"), } @@ -104,7 +98,7 @@ func (trans *Transactor) BroadcastTxSync(ctx context.Context, txEnv *txs.Envelop case msg := <-out: txe := msg.(*exec.TxExecution) callError := txe.CallError() - if callError != nil && callError.ErrorCode() != errors.ErrorCodeExecutionReverted { + if callError != nil && callError.ErrorCode() != errors.Codes.ExecutionReverted { return nil, errors.Wrap(callError, "exception during transaction execution") } return txe, nil @@ -233,14 +227,14 @@ func (trans *Transactor) CheckTxSyncRaw(ctx context.Context, txBytes []byte) (*t } return receipt, nil default: - return nil, errors.ErrorCodef(errors.Code(checkTxResponse.Code), - "error returned by Tendermint in BroadcastTxSync ABCI log: %v", checkTxResponse.Log) + return nil, fmt.Errorf("error %d returned by Tendermint in BroadcastTxSync ABCI log: %v", + checkTxResponse.Code, checkTxResponse.Log) } } } func (trans *Transactor) CheckTxAsyncRaw(txBytes []byte, callback func(res *abciTypes.Response)) error { - return trans.checkTxAsync(txBytes, callback) + return trans.checkTxAsync(txBytes, callback, mempool.TxInfo{SenderP2PID: trans.nodeID}) } func (trans *Transactor) CheckTxAsync(txEnv *txs.Envelope, callback func(res *abciTypes.Response)) error { diff --git a/execution/transactor_test.go b/execution/transactor_test.go index f796ba203..9f1832cf0 100644 --- a/execution/transactor_test.go +++ b/execution/transactor_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package execution @@ -25,13 +14,14 @@ import ( "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/event" "github.com/hyperledger/burrow/execution/exec" - "github.com/hyperledger/burrow/keys/mock" + "github.com/hyperledger/burrow/keys" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/txs" "github.com/hyperledger/burrow/txs/payload" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" abciTypes "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/mempool" tmTypes "github.com/tendermint/tendermint/types" ) @@ -52,8 +42,9 @@ func TestTransactor_BroadcastTxSync(t *testing.T) { err := txEnv.Sign(privAccount) require.NoError(t, err) height := uint64(35) - trans := NewTransactor(bc, evc, NewAccounts(acmstate.NewMemoryState(), mock.NewKeyClient(privAccount), 100), - func(tx tmTypes.Tx, cb func(*abciTypes.Response)) error { + trans := NewTransactor(bc, evc, NewAccounts(acmstate.NewMemoryState(), + keys.NewLocalKeyClient(keys.NewMemoryKeyStore(privAccount), logger), 100), + func(tx tmTypes.Tx, cb func(*abciTypes.Response), txInfo mempool.TxInfo) error { txe := exec.NewTxExecution(txEnv) txe.Height = height err := evc.Publish(context.Background(), txe, txe) @@ -69,7 +60,7 @@ func TestTransactor_BroadcastTxSync(t *testing.T) { Data: bs, })) return nil - }, txCodec, logger) + }, "", txCodec, logger) txe, err := trans.BroadcastTxSync(context.Background(), txEnv) require.NoError(t, err) assert.Equal(t, height, txe.Height) diff --git a/execution/vms/vms.go b/execution/vms/vms.go new file mode 100644 index 000000000..ad1e3a12f --- /dev/null +++ b/execution/vms/vms.go @@ -0,0 +1,25 @@ +package vms + +import ( + "github.com/hyperledger/burrow/execution/defaults" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/evm" + "github.com/hyperledger/burrow/execution/wasm" +) + +type VirtualMachines struct { + *evm.EVM + *wasm.WVM +} + +func NewConnectedVirtualMachines(options engine.Options) *VirtualMachines { + options = defaults.CompleteOptions(options) + evm := evm.New(options) + wvm := wasm.New(options) + // Allow the virtual machines to call each other + engine.Connect(evm, wvm) + return &VirtualMachines{ + EVM: evm, + WVM: wvm, + } +} diff --git a/execution/wasm/child.sol b/execution/wasm/child.sol new file mode 100644 index 000000000..5dc47879a --- /dev/null +++ b/execution/wasm/child.sol @@ -0,0 +1,10 @@ +pragma solidity >0.6.3; + +contract Child { + + address public owner; // public, so you can see it when you find the child + + constructor() public { + owner = msg.sender; + } +} diff --git a/execution/wasm/contract.go b/execution/wasm/contract.go new file mode 100644 index 000000000..9ca73a8f0 --- /dev/null +++ b/execution/wasm/contract.go @@ -0,0 +1,691 @@ +package wasm + +import ( + "bytes" + "encoding/binary" + "fmt" + "math/big" + + "github.com/go-interpreter/wagon/wasm/leb128" + lifeExec "github.com/perlin-network/life/exec" + hex "github.com/tmthrgd/go-hex" + + bin "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/engine" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/evm" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/permission" + "github.com/hyperledger/burrow/txs" +) + +type Contract struct { + vm *WVM + code []byte +} + +const Success = 0 +const Error = 1 +const Revert = 2 + +const ValueByteSize = 16 + +func (c *Contract) Call(state engine.State, params engine.CallParams) (output []byte, err error) { + return engine.Call(state, params, c.execute) +} + +func (c *Contract) execute(state engine.State, params engine.CallParams) ([]byte, error) { + const errHeader = "ewasm" + + // Since Life runs the execution for us we push the arguments into the import resolver state + ctx := &context{ + Contract: c, + state: state, + params: params, + code: c.code, + } + + // panics in ResolveFunc() will be recovered for us, no need for our own + vm, err := lifeExec.NewVirtualMachine(c.code[0:int(wasmSize(c.code))], c.vm.vmConfig, ctx, nil) + if err != nil { + return nil, errors.Errorf(errors.Codes.InvalidContract, "%s: motherfucker %v", errHeader, err) + } + + entryID, ok := vm.GetFunctionExport("main") + if !ok { + return nil, errors.Codes.UnresolvedSymbols + } + + _, err = vm.Run(entryID) + if err != nil && errors.GetCode(err) == errors.Codes.ExecutionReverted { + return nil, err + } + + if err != nil && errors.GetCode(err) != errors.Codes.None { + return nil, errors.Errorf(errors.Codes.ExecutionAborted, "%s: %v", errHeader, err) + } + + return ctx.output, nil +} + +type context struct { + *Contract + state engine.State + params engine.CallParams + code []byte + output []byte + returnData []byte + sequence uint64 +} + +var _ lifeExec.ImportResolver = (*context)(nil) + +func (ctx *context) ResolveGlobal(module, field string) int64 { + panic(fmt.Sprintf("global %s module %s not found", field, module)) +} + +func (ctx *context) ResolveFunc(module, field string) lifeExec.FunctionImport { + if module == "debug" { + // See https://github.com/ewasm/hera#interfaces + switch field { + case "print32": + return func(vm *lifeExec.VirtualMachine) int64 { + n := int32(vm.GetCurrentFrame().Locals[0]) + + s := fmt.Sprintf("%d", n) + + err := ctx.state.EventSink.Print(&exec.PrintEvent{ + Address: ctx.params.Callee, + Data: []byte(s), + }) + + if err != nil { + panic(fmt.Sprintf(" => print32 failed: %v", err)) + } + + return Success + } + + case "print64": + return func(vm *lifeExec.VirtualMachine) int64 { + n := int64(vm.GetCurrentFrame().Locals[0]) + + s := fmt.Sprintf("%d", n) + + err := ctx.state.EventSink.Print(&exec.PrintEvent{ + Address: ctx.params.Callee, + Data: []byte(s), + }) + + if err != nil { + panic(fmt.Sprintf(" => print32 failed: %v", err)) + } + + return Success + } + + case "printMem": + return func(vm *lifeExec.VirtualMachine) int64 { + dataPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataLen := int(uint32(vm.GetCurrentFrame().Locals[1])) + + s := vm.Memory[dataPtr : dataPtr+dataLen] + + err := ctx.state.EventSink.Print(&exec.PrintEvent{ + Address: ctx.params.Callee, + Data: s, + }) + + if err != nil { + panic(fmt.Sprintf(" => printMem failed: %v", err)) + } + + return Success + } + + case "printMemHex": + return func(vm *lifeExec.VirtualMachine) int64 { + dataPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataLen := int(uint32(vm.GetCurrentFrame().Locals[1])) + + s := hex.EncodeToString(vm.Memory[dataPtr : dataPtr+dataLen]) + + err := ctx.state.EventSink.Print(&exec.PrintEvent{ + Address: ctx.params.Callee, + Data: []byte(s), + }) + + if err != nil { + panic(fmt.Sprintf(" => printMemHex failed: %v", err)) + } + + return Success + } + + case "printStorage": + return func(vm *lifeExec.VirtualMachine) int64 { + keyPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + + key := bin.Word256{} + + copy(key[:], vm.Memory[keyPtr:keyPtr+32]) + + val, err := ctx.state.GetStorage(ctx.params.Callee, key) + if err != nil { + panic(err) + } + + err = ctx.state.EventSink.Print(&exec.PrintEvent{ + Address: ctx.params.Callee, + Data: val, + }) + + if err != nil { + panic(fmt.Sprintf(" => printStorage failed: %v", err)) + } + + return Success + } + + case "printStorageHex": + return func(vm *lifeExec.VirtualMachine) int64 { + keyPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + + key := bin.Word256{} + + copy(key[:], vm.Memory[keyPtr:keyPtr+32]) + + val, err := ctx.state.GetStorage(ctx.params.Callee, key) + if err != nil { + panic(err) + } + + s := hex.EncodeToString(val) + + err = ctx.state.EventSink.Print(&exec.PrintEvent{ + Address: ctx.params.Callee, + Data: []byte(s), + }) + + if err != nil { + panic(fmt.Sprintf(" => printStorage failed: %v", err)) + } + + return Success + } + + default: + panic(fmt.Sprintf("function %s unknown for debug module", field)) + } + } + + if module != "ethereum" { + panic(fmt.Sprintf("unknown module %s", module)) + } + + switch field { + case "create": + return func(vm *lifeExec.VirtualMachine) int64 { + valuePtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataPtr := uint32(vm.GetCurrentFrame().Locals[1]) + dataLen := uint32(vm.GetCurrentFrame().Locals[2]) + resultPtr := uint32(vm.GetCurrentFrame().Locals[3]) + + // TODO: is this guaranteed to be okay? Should be avoid panic here if out of bounds? + value := bin.BigIntFromLittleEndianBytes(vm.Memory[valuePtr : valuePtr+ValueByteSize]) + + var data []byte + copy(data, vm.Memory[dataPtr:dataPtr+dataLen]) + + ctx.sequence++ + nonce := make([]byte, txs.HashLength+8) + copy(nonce, ctx.vm.options.Nonce) + binary.BigEndian.PutUint64(nonce[txs.HashLength:], ctx.sequence) + newAccountAddress := crypto.NewContractAddress(ctx.params.Callee, nonce) + + err := engine.EnsurePermission(ctx.state.CallFrame, ctx.params.Callee, permission.CreateContract) + if err != nil { + return Error + } + + err = ctx.state.CallFrame.CreateAccount(ctx.params.Caller, newAccountAddress) + if err != nil { + return Error + } + + res, err := ctx.vm.Contract(vm.Memory[dataPtr:dataPtr+dataLen]).Call(ctx.state, engine.CallParams{ + Caller: ctx.params.Caller, + Callee: newAccountAddress, + Input: nil, + Value: *value, + Gas: ctx.params.Gas, + }) + + if err != nil { + if errors.GetCode(err) == errors.Codes.ExecutionReverted { + return Revert + } + panic(err) + } + err = engine.InitWASMCode(ctx.state, newAccountAddress, res) + if err != nil { + if errors.GetCode(err) == errors.Codes.ExecutionReverted { + return Revert + } + panic(err) + } + + copy(vm.Memory[resultPtr:], newAccountAddress.Bytes()) + + return Success + } + + case "getBlockDifficulty": + return func(vm *lifeExec.VirtualMachine) int64 { + resultPtr := int(vm.GetCurrentFrame().Locals[0]) + + // set it to 1 + copy(vm.Memory[resultPtr:resultPtr+32], bin.RightPadBytes([]byte{1}, 32)) + return Success + } + + case "getTxGasPrice": + return func(vm *lifeExec.VirtualMachine) int64 { + resultPtr := int(vm.GetCurrentFrame().Locals[0]) + + // set it to 1 + copy(vm.Memory[resultPtr:resultPtr+16], bin.RightPadBytes([]byte{1}, 16)) + return Success + } + + case "selfDestruct": + return func(vm *lifeExec.VirtualMachine) int64 { + receiverPtr := int(vm.GetCurrentFrame().Locals[0]) + + var receiver crypto.Address + copy(receiver[:], vm.Memory[receiverPtr:receiverPtr+crypto.AddressLength]) + + receiverAcc, err := ctx.state.GetAccount(receiver) + if err != nil { + panic(err) + } + if receiverAcc == nil { + err := ctx.state.CallFrame.CreateAccount(ctx.params.Callee, receiver) + if err != nil { + panic(err) + } + } + acc, err := ctx.state.GetAccount(ctx.params.Callee) + if err != nil { + panic(err) + } + balance := acc.Balance + err = acc.AddToBalance(balance) + if err != nil { + panic(err) + } + + err = ctx.state.CallFrame.UpdateAccount(acc) + if err != nil { + panic(err) + } + err = ctx.state.CallFrame.RemoveAccount(ctx.params.Callee) + if err != nil { + panic(err) + } + panic(errors.Codes.None) + } + + case "call", "callCode", "callDelegate", "callStatic": + return func(vm *lifeExec.VirtualMachine) int64 { + gasLimit := big.NewInt(vm.GetCurrentFrame().Locals[0]) + addressPtr := uint32(vm.GetCurrentFrame().Locals[1]) + i := 2 + var valuePtr int + if field == "call" || field == "callCode" { + valuePtr = int(uint32(vm.GetCurrentFrame().Locals[i])) + i++ + } + dataPtr := uint32(vm.GetCurrentFrame().Locals[i]) + dataLen := uint32(vm.GetCurrentFrame().Locals[i+1]) + + // TODO: avoid panic? Or at least panic with coded out-of-bounds + target := crypto.MustAddressFromBytes(vm.Memory[addressPtr : addressPtr+crypto.AddressLength]) + + // TODO: is this guaranteed to be okay? Should be avoid panic here if out of bounds? + value := bin.BigIntFromLittleEndianBytes(vm.Memory[valuePtr : valuePtr+ValueByteSize]) + + var callType exec.CallType + + switch field { + case "call": + callType = exec.CallTypeCall + case "callCode": + callType = exec.CallTypeCode + case "callStatic": + callType = exec.CallTypeStatic + case "callDeletegate": + callType = exec.CallTypeDelegate + default: + panic("should not happen") + } + + var err error + ctx.returnData, err = engine.CallFromSite(ctx.state, ctx.vm.externalDispatcher, ctx.params, + engine.CallParams{ + CallType: callType, + Callee: target, + Input: vm.Memory[dataPtr : dataPtr+dataLen], + Value: *value, + Gas: gasLimit, + }) + + // Refund any remaining gas to be used on subsequent calls + ctx.params.Gas.Add(ctx.params.Gas, gasLimit) + + // TODO[Silas]: we may need to consider trapping and non-trapping errors here in a bit more of a principled way + // (e.g. we may be currently handling things that should abort execution, it might be better to clasify + // all of our coded errors as trapping (fatal abort WASM) or non-trapping (return error to WASM caller) + // I'm not sure this is consistent in EVM either. + if err != nil { + if errors.GetCode(err) == errors.Codes.ExecutionReverted { + return Revert + } + // Spec says return 1 for error, but not sure when to do that (as opposed to abort): + // https://github.com/ewasm/design/blob/master/eth_interface.md#call + panic(err) + } + return Success + } + + case "getCallDataSize": + return func(vm *lifeExec.VirtualMachine) int64 { + return int64(len(ctx.params.Input)) + } + + case "callDataCopy": + return func(vm *lifeExec.VirtualMachine) int64 { + destPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataOffset := int(uint32(vm.GetCurrentFrame().Locals[1])) + dataLen := int(uint32(vm.GetCurrentFrame().Locals[2])) + + if dataLen > 0 { + copy(vm.Memory[destPtr:], ctx.params.Input[dataOffset:dataOffset+dataLen]) + } + + return Success + } + + case "getReturnDataSize": + return func(vm *lifeExec.VirtualMachine) int64 { + return int64(len(ctx.returnData)) + } + + case "returnDataCopy": + return func(vm *lifeExec.VirtualMachine) int64 { + destPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataOffset := int(uint32(vm.GetCurrentFrame().Locals[1])) + dataLen := int(uint32(vm.GetCurrentFrame().Locals[2])) + + if dataLen > 0 { + copy(vm.Memory[destPtr:], ctx.returnData[dataOffset:dataOffset+dataLen]) + } + + return Success + } + + case "getCodeSize": + return func(vm *lifeExec.VirtualMachine) int64 { + return int64(len(ctx.code)) + } + + case "codeCopy": + return func(vm *lifeExec.VirtualMachine) int64 { + destPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataOffset := int(uint32(vm.GetCurrentFrame().Locals[1])) + dataLen := int(uint32(vm.GetCurrentFrame().Locals[2])) + + if dataLen > 0 { + copy(vm.Memory[destPtr:], ctx.code[dataOffset:dataOffset+dataLen]) + } + + return Success + } + + case "storageStore": + return func(vm *lifeExec.VirtualMachine) int64 { + keyPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataPtr := int(uint32(vm.GetCurrentFrame().Locals[1])) + + key := bin.Word256{} + value := make([]byte, 32) + + copy(key[:], vm.Memory[keyPtr:keyPtr+32]) + copy(value, vm.Memory[dataPtr:dataPtr+32]) + + err := ctx.state.SetStorage(ctx.params.Callee, key, value) + if err != nil { + panic(err) + } + return Success + } + + case "storageLoad": + return func(vm *lifeExec.VirtualMachine) int64 { + + keyPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataPtr := int(uint32(vm.GetCurrentFrame().Locals[1])) + + key := bin.Word256{} + + copy(key[:], vm.Memory[keyPtr:keyPtr+32]) + + val, err := ctx.state.GetStorage(ctx.params.Callee, key) + if err != nil { + panic(err) + } + copy(vm.Memory[dataPtr:], val) + + return Success + } + + case "finish": + return func(vm *lifeExec.VirtualMachine) int64 { + dataPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataLen := int(uint32(vm.GetCurrentFrame().Locals[1])) + + ctx.output = vm.Memory[dataPtr : dataPtr+dataLen] + + panic(errors.Codes.None) + } + + case "revert": + return func(vm *lifeExec.VirtualMachine) int64 { + + dataPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataLen := int(uint32(vm.GetCurrentFrame().Locals[1])) + + ctx.output = vm.Memory[dataPtr : dataPtr+dataLen] + + panic(errors.Codes.ExecutionReverted) + } + + case "getAddress": + return func(vm *lifeExec.VirtualMachine) int64 { + addressPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + + copy(vm.Memory[addressPtr:], ctx.params.Callee.Bytes()) + + return Success + } + + case "getCallValue": + return func(vm *lifeExec.VirtualMachine) int64 { + valuePtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + + // ewasm value is little endian 128 bit value + copy(vm.Memory[valuePtr:], bin.BigIntToLittleEndianBytes(&ctx.params.Value)) + + return Success + } + + case "getExternalBalance": + return func(vm *lifeExec.VirtualMachine) int64 { + addressPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + balancePtr := int(uint32(vm.GetCurrentFrame().Locals[1])) + + address := crypto.Address{} + + copy(address[:], vm.Memory[addressPtr:addressPtr+crypto.AddressLength]) + acc, err := ctx.state.GetAccount(address) + if err != nil { + panic(errors.Codes.InvalidAddress) + } + + // ewasm value is little endian 128 bit value + bs := make([]byte, 16) + binary.LittleEndian.PutUint64(bs, acc.Balance) + + copy(vm.Memory[balancePtr:], bs) + + return Success + } + + case "getBlockTimestamp": + return func(vm *lifeExec.VirtualMachine) int64 { + return int64(ctx.state.Blockchain.LastBlockTime().Unix()) + } + + case "getBlockNumber": + return func(vm *lifeExec.VirtualMachine) int64 { + return int64(ctx.state.Blockchain.LastBlockHeight()) + } + + case "getTxOrigin": + return func(vm *lifeExec.VirtualMachine) int64 { + addressPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + + copy(vm.Memory[addressPtr:addressPtr+crypto.AddressLength], ctx.params.Origin.Bytes()) + + return Success + } + + case "getCaller": + return func(vm *lifeExec.VirtualMachine) int64 { + addressPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + + copy(vm.Memory[addressPtr:addressPtr+crypto.AddressLength], ctx.params.Caller.Bytes()) + + return Success + } + + case "getBlockGasLimit": + return func(vm *lifeExec.VirtualMachine) int64 { + return ctx.params.Gas.Int64() + } + + case "getGasLeft": + return func(vm *lifeExec.VirtualMachine) int64 { + // do the same as EVM + return ctx.params.Gas.Int64() + } + + case "getBlockCoinbase": + return func(vm *lifeExec.VirtualMachine) int64 { + // do the same as EVM + addressPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + + copy(vm.Memory[addressPtr:addressPtr+crypto.AddressLength], crypto.ZeroAddress.Bytes()) + + return Success + } + + case "getBlockHash": + return func(vm *lifeExec.VirtualMachine) int64 { + blockNumber := uint64(vm.GetCurrentFrame().Locals[0]) + hashPtr := int(vm.GetCurrentFrame().Locals[1]) + + lastBlockHeight := ctx.state.Blockchain.LastBlockHeight() + if blockNumber >= lastBlockHeight { + panic(fmt.Sprintf(" => attempted to get block hash of a non-existent block: %v", blockNumber)) + } else if lastBlockHeight-blockNumber > evm.MaximumAllowedBlockLookBack { + panic(fmt.Sprintf(" => attempted to get block hash of a block %d outside of the allowed range "+ + "(must be within %d blocks)", blockNumber, evm.MaximumAllowedBlockLookBack)) + } else { + hash, err := ctx.state.Blockchain.BlockHash(blockNumber) + if err != nil { + panic(fmt.Sprintf(" => blockhash failed: %v", err)) + } + + copy(vm.Memory[hashPtr:hashPtr+len(hash)], hash) + } + + return Success + } + + case "log": + return func(vm *lifeExec.VirtualMachine) int64 { + dataPtr := int(uint32(vm.GetCurrentFrame().Locals[0])) + dataLen := int(uint32(vm.GetCurrentFrame().Locals[1])) + + data := vm.Memory[dataPtr : dataPtr+dataLen] + + topicCount := uint32(vm.GetCurrentFrame().Locals[2]) + topics := make([]bin.Word256, topicCount) + + if topicCount > 4 { + panic(fmt.Sprintf("%d topics not permitted", topicCount)) + } + + for i := uint32(0); i < topicCount; i++ { + topicPtr := int(uint32(vm.GetCurrentFrame().Locals[3+i])) + topicData := vm.Memory[topicPtr : topicPtr+bin.Word256Bytes] + topics[i] = bin.RightPadWord256(topicData) + } + + err := ctx.state.EventSink.Log(&exec.LogEvent{ + Address: ctx.params.Callee, + Topics: topics, + Data: data, + }) + + if err != nil { + panic(fmt.Sprintf(" => log failed: %v", err)) + } + + return Success + } + + default: + panic(fmt.Sprintf("unknown function %s", field)) + } +} + +// When deploying wasm code, the abi encoded arguments to the constructor are added to the code. Wagon +// does not like seeing this data, so strip this off. We have to walk the wasm format to the last section + +// There might be a better solution to this. +func wasmSize(code []byte) int64 { + reader := bytes.NewReader(code) + top := int64(8) + for { + reader.Seek(top, 0) + id, err := reader.ReadByte() + if err != nil || id == 0 || id > 11 { + // invalid section id + break + } + size, err := leb128.ReadVarUint32(reader) + if err != nil { + break + } + pos, _ := reader.Seek(0, 1) + if pos+int64(size) > int64(len(code)) { + break + } + top = pos + int64(size) + } + + return top +} diff --git a/execution/wasm/parent.sol b/execution/wasm/parent.sol new file mode 100644 index 000000000..a20d470ed --- /dev/null +++ b/execution/wasm/parent.sol @@ -0,0 +1,37 @@ +pragma solidity >0.6.3; + +import "./child.sol"; + +contract Parent { + + + address payable owner; + address[] public children; // public, list, get a child address at row # + + + constructor () public payable{ + owner = msg.sender; + } + + + function createChild() public { + Child child = new Child(); + children.push(address(child)); // you can use the getter to fetch child addresses + } + + function getChild(uint256 index) public returns (address) { + return children[index]; + } + + function close() public { + selfdestruct(owner); + } + + function txPrice() public returns (uint) { + return tx.gasprice; + } + + function blockDifficulty() public returns (uint256) { + return block.difficulty; + } +} diff --git a/execution/wasm/storage_test.solang.go b/execution/wasm/storage_test.solang.go index f3635e11b..663699ab6 100644 --- a/execution/wasm/storage_test.solang.go +++ b/execution/wasm/storage_test.solang.go @@ -2,5 +2,8 @@ package wasm import hex "github.com/tmthrgd/go-hex" -var Bytecode_storage_test = hex.MustDecodeString("0061736D0100000001220760037F7F7F0060027F7F0060000060017F0060017F017F60027F7F017F6000017E02380303656E760D7365745F73746F726167653332000003656E760D6765745F73746F726167653332000003656E76066D656D6F727902010202030F0E00010102030405000002060203040608017F01418080040B07BB010E095F5F6D656D637079380002085F5F627A65726F380003075F5F627365743800040B5F5F696E69745F686561700005065F5F667265650006085F5F6D616C6C6F630007095F5F7265616C6C6F6300080B5F5F62653332746F6C654E00090B5F5F6C654E746F62653332000A12736F6C3A3A5F5F636F6E7374727563746F72000B10736F6C3A3A676574466F6F506C757332000C0B736F6C3A3A696E63466F6F000D0B636F6E7374727563746F72000E0866756E6374696F6E000F0AF8080E2600034020002001290300370300200041086A2100200141086A21012002417F6A22020D000B0B1C00034020004200370300200041086A21002001417F6A22010D000B0B1C0003402000427F370300200041086A21002001417F6A22010D000B0B2B00410041003602808004410041003602848004410041003A008C800441003F0041F0FF7B6A36028880040BB90101037F02402000450D00410021012000417C6A41003A0000024002400240200041706A22022802002203450D0020032D000C450D01200321010B200041746A2802002203450D020C010B20022003280200220136020002402001450D00200120023602040B200041786A2202200328020820022802006A41106A360200200041746A2802002203450D010B20032D000C0D0020012003360204200320013602002003200041786A28020020032802086A41106A3602080F0B0BA90101047F41808004210102400340024020012D000C0D002001280208220220004F0D020B200128020022010D000B41002101410028020821020B02402002200041076A41787122036B22024118490D00200120036A41106A22002001280200220436020002402004450D00200420003602040B2000200241706A360208200041003A000C2000200136020420012000360200200141086A20033602000B200141013A000C200141106A0BF50101057F024002400240200041706A22022802002203450D0020032D000C0D00200041786A220428020020032802086A41106A220520014F0D010B41002103410020014103766B21022001100721010340200120036A200020036A290300370300200341086A2103200241016A22020D000B20001006200121000C010B20042005360200200328020022032002360204200220033602002005200141076A41787122066B22054118490D00200020066A2201200336020002402003450D00200341046A20013602000B2001200541706A360208200141003A000C20012002360204200220013602002004200636020020000F0B20000B2D002000411F6A21000340200120002D00003A0000200141016A21012000417F6A21002002417F6A22020D000B0B2D002001411F6A21010340200120002D00003A00002001417F6A2101200041016A21002002417F6A22020D000B0B2701017F230041106B22002400200042E6003703084100200041086A41081000200041106A24000B2D02017F017E230041106B220024004100200041086A4108100120002903082101200041106A2400200142027C0B3701017F230041106B220024004100200041086A410810012000200029030842017C3703084100200041086A41081000200041106A24000B12001005024020002802000D00100B0F0B000B8E0103037F017E017F23002201210202402000280200220341034D0D002003417C6A21030240200041046A28020041DE9AB88F79470D0020030D01100D41041007220041003602002002240020000F0B20030D00100C21044124100722004120360200200041046A220541041003200141706A2203240020032004370300200320054108100A2002240020000F0B000B") -var Abi_storage_test = []byte(`[{"name":"","type":"constructor","inputs":[],"outputs":[],"constant":false,"payable":false,"stateMutability":"nonpayable"},{"name":"getFooPlus2","type":"function","inputs":[],"outputs":[{"name":"","type":"uint64"}],"constant":true,"payable":false,"stateMutability":"view"},{"name":"incFoo","type":"function","inputs":[],"outputs":[],"constant":false,"payable":false,"stateMutability":"nonpayable"}]`) +var Bytecode_storage_test = hex.MustDecodeString("0061736D01000000011C0660027F7F0060017F006000017F60037F7F7F0060017F017F6000000280010608657468657265756D0C73746F7261676553746F7265000008657468657265756D0C67657443616C6C56616C7565000108657468657265756D0B676574436F646553697A65000208657468657265756D08636F6465436F7079000308657468657265756D0666696E697368000008657468657265756D06726576657274000003060500040502050405017001010105030100020608017F01418080040B071102066D656D6F72790200046D61696E000A0AAB0305240002402001450D00034020004200370300200041086A21002001417F6A22010D000B0B0BA60101047F418080042101024003400240200128020C0D002001280208220220004F0D020B200128020022010D000B41002101410028020821020B02402002200041076A41787122036B22024118490D00200120036A41106A22002001280200220436020002402004450D00200420003602040B2000200241706A3602082000410036020C2000200136020420012000360200200120033602080B2001410136020C200141106A0B2E004100410036028080044100410036028480044100410036028C800441003F0041107441F0FF7B6A36028880040B4E01017F230041C0006B22002400200041386A4200370300200042003703302000420037032820004200370320200041041006200042E600370300200041206A20001000200041C0006A240041000B5E01027F230041106B220024002000100102402000290300200041086A290300844200520D0010084100100241C0736A22003602B00741002000100722013602B407200141C00C2000100310091A410041AE071004000B410041001005000B0BB507010041000BAE070061736D01000000011C0660017F006000017F60037F7F7F0060027F7F0060017F017F600000029F010708657468657265756D0C67657443616C6C56616C7565000008657468657265756D0F67657443616C6C4461746153697A65000108657468657265756D0C63616C6C44617461436F7079000208657468657265756D0B73746F726167654C6F6164000308657468657265756D06726576657274000308657468657265756D0C73746F7261676553746F7265000308657468657265756D0666696E697368000303060503020405050405017001010105030100020608017F01418080040B071102066D656D6F72790200046D61696E000B0AB20505240002402001450D00034020004200370300200041086A21002001417F6A22010D000B0B0B2D002001411F6A21010340200120002D00003A00002001417F6A2101200041016A21002002417F6A22020D000B0BA60101047F418080042101024003400240200128020C0D002001280208220220004F0D020B200128020022010D000B41002101410028020821020B02402002200041076A41787122036B22024118490D00200120036A41106A22002001280200220436020002402004450D00200420003602040B2000200241706A3602082000410036020C2000200136020420012000360200200120033602080B2001410136020C200141106A0B2E004100410036028080044100410036028480044100410036028C800441003F0041107441F0FF7B6A36028880040B850302037F017E230041A0016B22002400200041086A100002400240024002402000290308200041106A290300844200520D00100A41001001220136020441002001100922023602082002410020011002200141034D0D014100200228020022013602000240200141DE9AB88F79460D00200141A298B6BE01470D0220004198016A420037030020004200370390012000420037038801200042003703800120004180016A200041E0006A10032000200029036042027C3703184100450D03410041001004000B20004180016A41186A420037030020004200370390012000420037038801200042003703800120004180016A200041E0006A1003200041C0006A41186A420037030020004200370350200042003703482000420037034020002903602103200041206A410410072000200342017C370320200041C0006A200041206A10054100450D03410041001004000B410041001004000B410041001004000B41201009220141041007200041186A200141081008200141201006000B410041001006000B") +var Abi_storage_test = []byte(`[{"type":"constructor","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"getFooPlus2","type":"function","inputs":[],"outputs":[{"name":"","type":"uint64","internalType":"uint64"}],"stateMutability":"view"},{"name":"incFoo","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"}]`) + +var CREATETest = hex.MustDecodeString("0061736d01000000011c0660017f0060027f7f006000017f60037f7f7f0060017f017f600000026b0508657468657265756d0967657443616c6c6572000008657468657265756d0c73746f7261676553746f7265000108657468657265756d0b676574436f646553697a65000208657468657265756d08636f6465436f7079000308657468657265756d0666696e697368000103060501040502050405017001010105030100020608017f01418080040b071102066d656d6f72790200046d61696e00090abd0305240002402001450d00034020004200370300200041086a21002001417f6a22010d000b0b0ba60101047f418080042101024003400240200128020c0d002001280208220220004f0d020b200128020022010d000b41002101410028020821020b02402002200041076a41787122036b22024118490d00200120036a41106a22002001280200220436020002402004450d00200420003602040b2000200241706a3602082000410036020c2000200136020420012000360200200120033602080b2001410136020c200141106a0b2e004100410036028080044100410036028480044100410036028c800441003f0041107441f0ff7b6a36028880040b890102017f037e230041e0006b22002400200041c8006a1000200041c0006a4200370300200042003703382000420037033020004200370328200041d8006a3502002101200041d0006a290300210220002903482103200041086a410410052000200237031020002003370308200020013e0218200041286a200041086a1001200041e0006a240041000b3401027f10074100100241b35e6a22003602c01c41002000100622013602c41c200141cd212000100310081a410041bf1c1004000b0bc61c010041000bbf1c0061736d01000000012d0860047f7f7f7f017f60027f7f0060017f006000017f60037f7f7f0060017f017f60000060057e7e7e7e7f017f0280020b08657468657265756d06637265617465000008657468657265756d0b73746f726167654c6f6164000108657468657265756d0c73746f7261676553746f7265000108657468657265756d06726576657274000108657468657265756d0c67657443616c6c56616c7565000208657468657265756d0f67657443616c6c4461746153697a65000308657468657265756d0c63616c6c44617461436f7079000408657468657265756d12676574426c6f636b446966666963756c7479000208657468657265756d0d67657454784761735072696365000208657468657265756d0c73656c664465737472756374000208657468657265756d0666696e6973680001030b0a040104040405060307060405017001010105030100020608017f01418080040b071102066d656d6f72790200046d61696e00140ae70f0a2e0002402002450d000340200020012d00003a0000200041016a2100200141016a21012002417f6a22020d000b0b0b240002402001450d00034020004200370300200041086a21002001417f6a22010d000b0b0b2d002000411f6a21000340200120002d00003a0000200141016a21012000417f6a21002002417f6a22020d000b0b29002000417f6a210003402001200020026a2d00003a0000200141016a21012002417f6a22020d000b0b2d002001411f6a21010340200120002d00003a00002001417f6a2101200041016a21002002417f6a22020d000b0ba60101047f418080042101024003400240200128020c0d002001280208220220004f0d020b200128020022010d000b41002101410028020821020b02402002200041076a41787122036b22024118490d00200120036a41106a22002001280200220436020002402004450d00200420003602040b2000200241706a3602082000410036020c2000200136020420012000360200200120033602080b2001410136020c200141106a0b2e004100410036028080044100410036028480044100410036028c800441003f0041107441f0ff7b6a36028880040bcf0405037f037e017f067e017f230041c0006b2200240041db0910102201410041db09100b200141db096a419b01100c20002202420037032020024200370318200241186a200141db092002100021012002200241286a4114100e024020010d00200241286a41106a3502002103200241286a41086a290300210420022903282105200041606a220022012400200041186a4200370300200042003703102000420037030820004201370300200141606a22012206240020002001100120012903002107200141086a2903002108200141186a2903002109200141106a290300210a200641606a22012200240020012008200742c88eb0f4dffad89c6a7c220b2007542206ad7c42d4acba91b798dfbfd8007c220c3703082001200b3703002001200a428f89e3afcef7859c277c220b2006200c200854200c2008511bad7c220c370310200141186a2009200b200a54ad7c200c200b54ad7c42baebad86e1d48ecba57f7c370300200041606a2200220624002000200437030820002005370300200020033e0210200641606a2206220d240020064104100c2006200029030837030820062000290300370300200620003502103e0210200120061002200d41606a220022012400200041186a4200370300200042003703102000420037030820004201370300200141606a22012400200141186a2009200a200742017c220c200754220620082006ad7c220b200854200c20075a1bad7c2207200a54ad7c370300200120073703102001200b3703082001200c370300200020011002200241c0006a240041000f0b410041001003000bd60203027f027e027f230041c0006b220524002005220641206a41186a4200370300200642003703302006420037032820064201370320200641206a20061001024020002006290300542001200641086a29030022075420012007511b2002200641106a2903002208542003200641186a29030022075420032007511b2002200885200320078584501b0d00410041001003000b200541606a2205220924002005200042c88eb0f4dffad89c6a7c2207370300200520012007200054220aad7c42d4acba91b798dfbfd8007c220037030820052002428f89e3afcef7859c277c2207200a200020015420002001511bad7c2201370310200541186a20032007200254ad7c2001200754ad7c42baebad86e1d48ecba57f7c370300200941606a220924002005200910012004200941086a290300370308200420092903003703002004200941106a3502003e0210200641c0006a240041000b8a0502047f027e230041e0016b220024002000100402400240024002400240024002402000290300200041086a290300844200520d0010114100100522013602e00941002001101022023602e4092002410020011006200141034d0d064100200228020022033602dc09024002400240200341c993a89704460d000240200341a2c9ea8d034a0d00200341c3ae9bb17d460d03200341d688adbb01460d020c0a0b0240200341a3c9ea8d03460d00200341d8dfd3d007470d0a200041c0016a1007200041106a41186a200041c0016a41186a2903003703002000200041d0016a2903003703202000200041c8016a290300370318200020002903c0013703104100450d05410041001003000b1012450d05410041001003000b2001417c6a4120490d05200241046a200041306a4120100d2000290330200041386a290300200041c0006a290300200041c8006a290300200041d0006a1013450d06410041001003000b200041c0016a100820004180016a200041c8016a2903002204423f87220537030020002004370370200020002903c001370368200020053703784100450d06410041001003000b200041d8016a4200370300200042003703d001200042003703c801200042003703c001200041c0016a200041a0016a10012000200041a8016a29030037039001200020002903a001370388012000200041b0016a3502003e02980120004188016a1009000b410041001003000b4120101022014104100c200041106a20014120100f20014120100a000b41004100100a000b200041e0016a240041020f0b4120101022014104100c200041d0006a20014114100f20014120100a000b4120101022014104100c200041e8006a20014120100f20014120100a000b410041001003000b0be209010041000bdb090061736d01000000011c0660017f0060027f7f006000017f60037f7f7f0060017f017f6000000295010708657468657265756d0967657443616c6c6572000008657468657265756d0c73746f7261676553746f7265000108657468657265756d0c67657443616c6c56616c7565000008657468657265756d0b676574436f646553697a65000208657468657265756d08636f6465436f7079000308657468657265756d0666696e697368000108657468657265756d06726576657274000103060501040502050405017001010105030100020608017f01418080040b071102066d656d6f72790200046d61696e000b0ae70305240002402001450d00034020004200370300200041086a21002001417f6a22010d000b0b0ba60101047f418080042101024003400240200128020c0d002001280208220220004f0d020b200128020022010d000b41002101410028020821020b02402002200041076a41787122036b22024118490d00200120036a41106a22002001280200220436020002402004450d00200420003602040b2000200241706a3602082000410036020c2000200136020420012000360200200120033602080b2001410136020c200141106a0b2e004100410036028080044100410036028480044100410036028c800441003f0041107441f0ff7b6a36028880040b890102017f037e230041e0006b22002400200041c8006a1000200041c0006a4200370300200042003703382000420037033020004200370328200041d8006a3502002101200041d0006a290300210220002903482103200041086a410410072000200237031020002003370308200020013e0218200041286a200041086a1001200041e0006a240041000b5e01027f230041106b220024002000100202402000290300200041086a290300844200520d0010094100100341a5766a22003602f80341002000100822013602fc03200141db0920001004100a1a410041f8031005000b410041001006000b0bff03010041000bf8030061736d01000000011c0660017f006000017f60037f7f7f0060027f7f0060017f017f600000025e0408657468657265756d0c67657443616c6c56616c7565000008657468657265756d0f67657443616c6c4461746153697a65000108657468657265756d0c63616c6c44617461436f7079000208657468657265756d0672657665727400030304030405050405017001010105030100020608017f01418080040b071102066d656d6f72790200046d61696e00060ac00203a60101047f418080042101024003400240200128020c0d002001280208220220004f0d020b200128020022010d000b41002101410028020821020b02402002200041076a41787122036b22024118490d00200120036a41106a22002001280200220436020002402004450d00200420003602040b2000200241706a3602082000410036020c2000200136020420012000360200200120033602080b2001410136020c200141106a0b2e004100410036028080044100410036028480044100410036028c800441003f0041107441f0ff7b6a36028880040b6701027f230041106b220024002000100002402000290300200041086a290300844200520d001005410010012200360204410020001004220136020820014100200010020240200041034d0d00410020012802003602000b410041001003000b410041001003000b") +var Abi_CREATETest = []byte(`[{"type":"constructor","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"createChild","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"getChild","type":"function","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"name":"close","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"txPrice","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"name":"blockDifficulty","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"}]`) diff --git a/execution/wasm/wasm.go b/execution/wasm/wasm.go index 1e3f24218..81da984b0 100644 --- a/execution/wasm/wasm.go +++ b/execution/wasm/wasm.go @@ -1,150 +1,81 @@ package wasm import ( - "encoding/binary" - "fmt" - - burrow_binary "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/execution/defaults" + "github.com/hyperledger/burrow/execution/engine" "github.com/hyperledger/burrow/execution/errors" - "github.com/hyperledger/burrow/execution/evm" - "github.com/perlin-network/life/exec" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/execution/native" + lifeExec "github.com/perlin-network/life/exec" ) -type execContext struct { - address crypto.Address - state evm.Interface +// Implements ewasm, see https://github.com/ewasm/design +// WASM +var DefaultVMConfig = lifeExec.VMConfig{ + DisableFloatingPoint: true, + MaxMemoryPages: 16, + DefaultMemoryPages: 16, } -// In EVM, the code for an account is created by the EVM code itself; the code in the EVM deploy transaction is run, -// and the EVM code returns (via the RETURN) opcode) the code for the contract. In addition, when a new contract is -// created using the "new C()" construct is soldity, the EVM itself passes the code for the new contract. - -// The compiler must embed any contract code for smart contracts it wants to create. -// - This does not allow for circular references: contract A creates contract B, contract B creates contract A. -// - This makes it very hard to support other languages; e.g. go or rust have no such bizarre concepts, and would -// require tricking into supporting this -// - This makes it possible for tricksy contracts that create different contracts at different times. Very hard to -// support static analysis on these contracts -// - This makes it hard to know ahead-of-time what the code for a contract will be - -// Our WASM implementation does not allow for this. The code passed to the deploy transaction, is the contract. Any child contracts must be passed -// during the initial deployment (not implemented yet) - -// ABIs -// Our WASM ABI is entirely compatible with Solidity. This means that solidity EVM can call WASM contracts and vice -// versa. However, in the EVM ABI model the difference between constructor calls and function calls are implicit: the -// constructor code path is different from the function call code path, and there is nothing visible in the binary ABI -// encoded arguments telling you that it is a function call or a constructor. Note function calls do have a 4 byte -// prefix but this is not required; without it the fallback function should be called. - -// So in our WASM model the smart contract has two entry points: constructor and function. - -// ABIs memory space -// In the EVM model, ABIs are passed via the calldata opcodes. This means that the ABI encoded data is not directly -// accessible and has to be copied to smart contract memory. Solidity exposes this via the calldata and memory -// modifiers on variables. - -// In our WASM model, the function and constructor WASM fuctions have one argument and return value. The argument is -// where in WASM memory the ABI encoded arguments are and the return value is the offset where the return data can be -// found. At this offset we first find a 32 bit little endian encoded length (since WASM is little endian and we are -// using 32 bit memory model) followed by the bytes themselves. +type WVM struct { + engine.Externals + options engine.Options + vmConfig lifeExec.VMConfig + externalDispatcher engine.Dispatcher +} -// Contract Storage -// In the EVM model, contract storage is addressed via 256 bit key and the contents is a 256 bit value. For WASM, -// we've changed the contents to a arbitary byte string. This makes it much easier to store/retrieve smaller values -// (e.g. int64) and dynamic length fields (e.g. strings/arrays). +func New(options engine.Options) *WVM { + vm := &WVM{ + options: defaults.CompleteOptions(options), + vmConfig: DefaultVMConfig, + } + vm.externalDispatcher = engine.Dispatchers{&vm.Externals, options.Natives, vm} + return vm +} -// Access to contract storage is via WASM externals. -// - set_storage32(uint32 key, uint8* data, uint32 len) // set contract storage -// - get_storage32(uint32 key, uint8* data, uint32 len) // get contract storage (right pad with zeros) +func Default() *WVM { + return New(engine.Options{}) +} // RunWASM creates a WASM VM, and executes the given WASM contract code -func RunWASM(state evm.Interface, address crypto.Address, createContract bool, wasm, input []byte) (output []byte, cerr errors.CodedError) { +func (vm *WVM) Execute(st acmstate.ReaderWriter, blockchain engine.Blockchain, eventSink exec.EventSink, + params engine.CallParams, code []byte) (output []byte, cerr error) { defer func() { if r := recover(); r != nil { - cerr = errors.ErrorCodeExecutionAborted + cerr = errors.Codes.ExecutionAborted } }() - // WASM - config := exec.VMConfig{ - DisableFloatingPoint: true, - MaxMemoryPages: 2, - DefaultMemoryPages: 2, - } - - execContext := execContext{address, state} - vm, err := exec.NewVirtualMachine(wasm, config, &execContext, nil) + st = native.NewState(vm.options.Natives, st) - if err != nil { - return []byte{}, errors.ErrorCodeInvalidContract + state := engine.State{ + CallFrame: engine.NewCallFrame(st).WithMaxCallStackDepth(vm.options.CallStackMaxDepth), + Blockchain: blockchain, + EventSink: eventSink, } - // FIXME: Check length - if len(input) > 0 { - binary.LittleEndian.PutUint32(vm.Memory[:], uint32(len(input))) - copy(vm.Memory[4:], input) - } - - wasmFunc := "function" - if createContract { - wasmFunc = "constructor" - } - entryID, ok := vm.GetFunctionExport(wasmFunc) - if !ok { - return []byte{}, errors.ErrorCodeUnresolvedSymbols - } + output, err := vm.Contract(code).Call(state, params) - // The 0 argument is the offset where our calldata is stored (if any) - offset, err := vm.Run(entryID, 0) - if err != nil { - return []byte{}, errors.ErrorCodeExecutionAborted + if err == nil { + // Only sync back when there was no exception + err = state.CallFrame.Sync() } - - if offset > 0 { - // FIXME: Check length - length := binary.LittleEndian.Uint32(vm.Memory[offset : offset+4]) - output = vm.Memory[offset+4 : offset+4+int64(length)] - } - - return + // Always return output - we may have a reverted exception for which the return is meaningful + return output, err } -func (e *execContext) ResolveFunc(module, field string) exec.FunctionImport { - if module != "env" { - panic(fmt.Sprintf("unknown module %s", module)) - } - - switch field { - case "set_storage32": - return func(vm *exec.VirtualMachine) int64 { - key := int(uint32(vm.GetCurrentFrame().Locals[0])) - ptr := int(uint32(vm.GetCurrentFrame().Locals[1])) - len := int(uint32(vm.GetCurrentFrame().Locals[2])) - // FIXME: Check length - e.state.SetStorage(e.address, burrow_binary.Int64ToWord256(int64(key)), vm.Memory[ptr:ptr+len]) - return 0 - } - - case "get_storage32": - return func(vm *exec.VirtualMachine) int64 { - key := int(uint32(vm.GetCurrentFrame().Locals[0])) - ptr := int(uint32(vm.GetCurrentFrame().Locals[1])) - length := int(uint32(vm.GetCurrentFrame().Locals[2])) - val := e.state.GetStorage(e.address, burrow_binary.Int64ToWord256(int64(key))) - if len(val) < length { - val = append(val, make([]byte, length-len(val))...) - } - // FIXME: Check length - copy(vm.Memory[ptr:ptr+length], val) - return 0 - } - default: - panic(fmt.Sprintf("unknown function %s", field)) +func (vm *WVM) Dispatch(acc *acm.Account) engine.Callable { + if len(acc.WASMCode) == 0 { + return nil } + return vm.Contract(acc.WASMCode) } -func (e *execContext) ResolveGlobal(module, field string) int64 { - panic(fmt.Sprintf("global %s module %s not found", field, module)) +func (vm *WVM) Contract(code []byte) *Contract { + return &Contract{ + vm: vm, + code: code, + } } diff --git a/execution/wasm/wasm_test.go b/execution/wasm/wasm_test.go index 2bfce5330..70396edab 100644 --- a/execution/wasm/wasm_test.go +++ b/execution/wasm/wasm_test.go @@ -1,13 +1,18 @@ package wasm import ( + "encoding/hex" "fmt" + "math/big" "testing" - "github.com/hyperledger/burrow/binary" - "github.com/hyperledger/burrow/execution/evm" + "github.com/hyperledger/burrow/execution/native" + + "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/execution/engine" "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/crypto" @@ -15,11 +20,23 @@ import ( ) func TestStaticCallWithValue(t *testing.T) { - cache := evm.NewState(acmstate.NewMemoryState(), blockHashGetter) + cache := acmstate.NewMemoryState() + + params := engine.CallParams{ + Origin: crypto.ZeroAddress, + Caller: crypto.ZeroAddress, + Callee: crypto.ZeroAddress, + Input: []byte{}, + Value: *big.NewInt(0), + Gas: big.NewInt(1000), + } + + vm := Default() + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() - cache.CreateAccount(crypto.ZeroAddress) // run constructor - _, cerr := RunWASM(cache, crypto.ZeroAddress, true, Bytecode_storage_test, []byte{}) + runtime, cerr := vm.Execute(cache, blockchain, eventSink, params, Bytecode_storage_test) require.NoError(t, cerr) // run getFooPlus2 @@ -27,7 +44,9 @@ func TestStaticCallWithValue(t *testing.T) { require.NoError(t, err) calldata, _, err := spec.Pack("getFooPlus2") - returndata, cerr := RunWASM(cache, crypto.ZeroAddress, false, Bytecode_storage_test, calldata) + params.Input = calldata + + returndata, cerr := vm.Execute(cache, blockchain, eventSink, params, runtime) require.NoError(t, cerr) data := abi.GetPackingTypes(spec.Functions["getFooPlus2"].Outputs) @@ -42,7 +61,9 @@ func TestStaticCallWithValue(t *testing.T) { // call incFoo calldata, _, err = spec.Pack("incFoo") - returndata, cerr = RunWASM(cache, crypto.ZeroAddress, false, Bytecode_storage_test, calldata) + params.Input = calldata + + returndata, cerr = vm.Execute(cache, blockchain, eventSink, params, runtime) require.NoError(t, cerr) require.Equal(t, returndata, []byte{}) @@ -51,7 +72,9 @@ func TestStaticCallWithValue(t *testing.T) { calldata, _, err = spec.Pack("getFooPlus2") require.NoError(t, err) - returndata, cerr = RunWASM(cache, crypto.ZeroAddress, false, Bytecode_storage_test, calldata) + params.Input = calldata + + returndata, cerr = vm.Execute(cache, blockchain, eventSink, params, runtime) require.NoError(t, cerr) spec.Unpack(returndata, "getFooPlus2", data...) @@ -61,6 +84,135 @@ func TestStaticCallWithValue(t *testing.T) { require.Equal(t, expected, returnValue) } +func TestCREATE(t *testing.T) { + cache := acmstate.NewMemoryState() + + params := engine.CallParams{ + Origin: crypto.ZeroAddress, + Caller: crypto.ZeroAddress, + Callee: crypto.ZeroAddress, + Input: []byte{}, + Value: *big.NewInt(0), + Gas: big.NewInt(1000), + } + + vm := New(engine.Options{Natives: native.MustDefaultNatives()}) + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + // run constructor + runtime, cerr := vm.Execute(cache, blockchain, eventSink, params, CREATETest) + require.NoError(t, cerr) + + // run createChild + spec, err := abi.ReadSpec(Abi_CREATETest) + require.NoError(t, err) + calldata, _, err := spec.Pack("createChild") + + params.Input = calldata + + _, rerr := vm.Execute(cache, blockchain, eventSink, params, runtime) + vm.options.Nonce = []byte{0xff} + _, rerr = vm.Execute(cache, blockchain, eventSink, params, runtime) + require.NoError(t, rerr) + + // get created child + calldata, _, err = spec.Pack("getChild", "0") + require.NoError(t, err) + + params.Input = calldata + + res, rerr := vm.Execute(cache, blockchain, eventSink, params, runtime) + require.NoError(t, rerr) + require.Equal(t, "000000000000000000000000ef2fb521372225b89169ba60500142f68ebd82d3", hex.EncodeToString(res)) + + calldata, _, err = spec.Pack("getChild", "1") + require.NoError(t, err) + + params.Input = calldata + + res, rerr = vm.Execute(cache, blockchain, eventSink, params, runtime) + require.NoError(t, rerr) + require.Equal(t, "00000000000000000000000089686394a7cf94be0aa48ae593fe3cad5cbdbace", hex.EncodeToString(res)) +} + +func TestSelfDestruct(t *testing.T) { + cache := acmstate.NewMemoryState() + + params := engine.CallParams{ + Origin: crypto.ZeroAddress, + Caller: crypto.ZeroAddress, + Callee: crypto.ZeroAddress, + Input: []byte{}, + Value: *big.NewInt(0), + Gas: big.NewInt(1000), + } + + vm := New(engine.Options{Natives: native.MustDefaultNatives()}) + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + // run constructor + runtime, cerr := vm.Execute(cache, blockchain, eventSink, params, CREATETest) + require.NoError(t, cerr) + require.Equal(t, 1, len(cache.Accounts)) + + // run selfdestruct + spec, err := abi.ReadSpec(Abi_CREATETest) + require.NoError(t, err) + calldata, _, err := spec.Pack("close") + + params.Input = calldata + + _, rerr := vm.Execute(cache, blockchain, eventSink, params, runtime) + require.NoError(t, rerr) + + require.Equal(t, 0, len(cache.Accounts)) +} + +func TestMisc(t *testing.T) { + cache := acmstate.NewMemoryState() + + params := engine.CallParams{ + Origin: crypto.ZeroAddress, + Caller: crypto.ZeroAddress, + Callee: crypto.ZeroAddress, + Input: []byte{}, + Value: *big.NewInt(0), + Gas: big.NewInt(1000), + } + + vm := New(engine.Options{Natives: native.MustDefaultNatives()}) + blockchain := new(engine.TestBlockchain) + eventSink := exec.NewNoopEventSink() + + // run constructor + runtime, cerr := vm.Execute(cache, blockchain, eventSink, params, CREATETest) + require.NoError(t, cerr) + + // run txGasPrice + spec, err := abi.ReadSpec(Abi_CREATETest) + require.NoError(t, err) + calldata, _, err := spec.Pack("txPrice") + + params.Input = calldata + + res, rerr := vm.Execute(cache, blockchain, eventSink, params, runtime) + require.NoError(t, rerr) + require.Equal(t, "0000000000000000000000000000000000000000000000000000000000000001", hex.EncodeToString(res)) + + // run blockDifficulty + spec, err = abi.ReadSpec(Abi_CREATETest) + require.NoError(t, err) + calldata, _, err = spec.Pack("blockDifficulty") + + params.Input = calldata + + res, rerr = vm.Execute(cache, blockchain, eventSink, params, runtime) + require.NoError(t, rerr) + require.Equal(t, "0000000000000000000000000000000000000000000000000000000000000001", hex.EncodeToString(res)) +} + func blockHashGetter(height uint64) []byte { return binary.LeftPadWord256([]byte(fmt.Sprintf("block_hash_%d", height))).Bytes() } diff --git a/forensics/replay.go b/forensics/replay.go index 9bb4cb3d2..4fb5809ca 100644 --- a/forensics/replay.go +++ b/forensics/replay.go @@ -14,6 +14,7 @@ import ( "github.com/fatih/color" "github.com/hyperledger/burrow/bcm" "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/consensus/tendermint" "github.com/hyperledger/burrow/core" "github.com/hyperledger/burrow/event" "github.com/hyperledger/burrow/execution" @@ -23,14 +24,15 @@ import ( "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/txs" "github.com/pkg/errors" + sm "github.com/tendermint/tendermint/state" "github.com/tendermint/tendermint/store" "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" "github.com/xlab/treeprint" ) -// Replay is a kernel for state replaying -type Replay struct { +// Source is a kernel for tracking state +type Source struct { Explorer *bcm.BlockStore State *state.State db dbm.DB @@ -41,10 +43,10 @@ type Replay struct { logger *logging.Logger } -func NewReplay(burrowDB, tmDB dbm.DB, genesisDoc *genesis.GenesisDoc) *Replay { +func NewSource(burrowDB, tmDB dbm.DB, genesisDoc *genesis.GenesisDoc) *Source { // Avoid writing through to underlying DB cacheDB := storage.NewCacheDB(burrowDB) - return &Replay{ + return &Source{ Explorer: bcm.NewBlockStore(store.NewBlockStore(tmDB)), db: burrowDB, cacheDB: cacheDB, @@ -54,58 +56,118 @@ func NewReplay(burrowDB, tmDB dbm.DB, genesisDoc *genesis.GenesisDoc) *Replay { } } -func NewReplayFromDir(genesisDoc *genesis.GenesisDoc, dbDir string) *Replay { - burrowDB := dbm.NewDB(core.BurrowDBName, dbm.GoLevelDBBackend, dbDir) - tmDB := dbm.NewDB("blockstore", dbm.GoLevelDBBackend, path.Join(dbDir, "data")) - return NewReplay(burrowDB, tmDB, genesisDoc) +func NewSourceFromDir(genesisDoc *genesis.GenesisDoc, dbDir string) *Source { + burrowDB, err := dbm.NewDB(core.BurrowDBName, dbm.GoLevelDBBackend, dbDir) + if err != nil { + panic(fmt.Errorf("could not create core DB for replay source: %w", err)) + } + tmDB, err := dbm.NewDB("blockstore", dbm.GoLevelDBBackend, path.Join(dbDir, "data")) + if err != nil { + panic(fmt.Errorf("could not create blockstore DB for replay source: %w", err)) + } + return NewSource(burrowDB, tmDB, genesisDoc) +} + +func NewSourceFromGenesis(genesisDoc *genesis.GenesisDoc) *Source { + tmDB := dbm.NewMemDB() + gd := tendermint.DeriveGenesisDoc(genesisDoc, nil) + st, err := sm.MakeGenesisState(&types.GenesisDoc{ + ChainID: gd.ChainID, + Validators: gd.Validators, + AppHash: gd.AppHash, + }) + if err != nil { + panic(err) + } + stateStore := sm.NewStore(tmDB) + err = stateStore.Save(st) + if err != nil { + panic(err) + } + burrowDB, burrowState, burrowChain, err := initBurrow(genesisDoc) + if err != nil { + panic(err) + } + src := NewSource(burrowDB, tmDB, genesisDoc) + src.State = burrowState + src.committer, err = execution.NewBatchCommitter(burrowState, execution.ParamsFromGenesis(genesisDoc), + burrowChain, event.NewEmitter(), logging.NewNoopLogger()) + if err != nil { + panic(err) + } + return src +} + +func initBurrow(gd *genesis.GenesisDoc) (dbm.DB, *state.State, *bcm.Blockchain, error) { + db := dbm.NewMemDB() + st, err := state.MakeGenesisState(db, gd) + if err != nil { + return nil, nil, nil, err + } + err = st.InitialCommit() + if err != nil { + return nil, nil, nil, err + } + chain := bcm.NewBlockchain(db, gd) + return db, st, chain, nil } // LoadAt height -func (re *Replay) LoadAt(height uint64) (err error) { +func (src *Source) LoadAt(height uint64) (err error) { if height >= 1 { // Load and commit previous block - block, err := re.Explorer.Block(int64(height)) + block, err := src.Explorer.Block(int64(height)) if err != nil { return err } - err = re.blockchain.CommitBlockAtHeight(block.Time, block.Hash(), block.Header.AppHash, uint64(block.Height)) + err = src.blockchain.CommitBlockAtHeight(block.Time, block.Hash(), block.Header.AppHash, uint64(block.Height)) if err != nil { return err } } - re.State, err = state.LoadState(re.cacheDB, execution.VersionAtHeight(height)) + src.State, err = state.LoadState(src.cacheDB, execution.VersionAtHeight(height)) if err != nil { return err } // Get our commit machinery - re.committer = execution.NewBatchCommitter(re.State, execution.ParamsFromGenesis(re.genesisDoc), re.blockchain, - event.NewEmitter(), re.logger) - return nil + src.committer, err = execution.NewBatchCommitter(src.State, execution.ParamsFromGenesis(src.genesisDoc), src.blockchain, + event.NewEmitter(), src.logger) + return err } -func (re *Replay) LatestHeight() (uint64, error) { - blockchain, _, err := bcm.LoadOrNewBlockchain(re.db, re.genesisDoc, re.logger) +func (src *Source) LatestHeight() (uint64, error) { + blockchain, _, err := bcm.LoadOrNewBlockchain(src.db, src.genesisDoc, src.logger) if err != nil { return 0, err } return blockchain.LastBlockHeight(), nil } -func (re *Replay) LatestBlockchain() (*bcm.Blockchain, error) { - blockchain, _, err := bcm.LoadOrNewBlockchain(re.db, re.genesisDoc, re.logger) +func (src *Source) LatestBlockchain() (*bcm.Blockchain, error) { + blockchain, _, err := bcm.LoadOrNewBlockchain(src.db, src.genesisDoc, src.logger) if err != nil { return nil, err } - re.blockchain = blockchain + src.blockchain = blockchain return blockchain, nil } +// Replay is a kernel for state replaying +type Replay struct { + Src *Source + Dst *Source +} + +func NewReplay(src, dst *Source) *Replay { + return &Replay{src, dst} +} + // Block loads and commits a block func (re *Replay) Block(height uint64) (*ReplayCapture, error) { // block.AppHash is hash after txs from previous block have been applied - it's the state we want to load on top // of which we will reapply this block txs - if err := re.LoadAt(height - 1); err != nil { + if err := re.Src.LoadAt(height - 1); err != nil { return nil, err } return re.Commit(height) @@ -113,7 +175,7 @@ func (re *Replay) Block(height uint64) (*ReplayCapture, error) { // Blocks iterates through the given range func (re *Replay) Blocks(startHeight, endHeight uint64) ([]*ReplayCapture, error) { - if err := re.LoadAt(startHeight - 1); err != nil { + if err := re.Dst.LoadAt(startHeight - 1); err != nil { return nil, errors.Wrap(err, "State()") } @@ -134,7 +196,7 @@ func (re *Replay) Commit(height uint64) (*ReplayCapture, error) { Height: height, } - block, err := re.Explorer.Block(int64(height)) + block, err := re.Src.Explorer.Block(int64(height)) if err != nil { return nil, errors.Wrap(err, "explorer.Block()") } @@ -142,14 +204,14 @@ func (re *Replay) Commit(height uint64) (*ReplayCapture, error) { return nil, errors.Errorf("Tendermint block height %d != requested block height %d", block.Height, height) } - if height > 1 && !bytes.Equal(re.State.Hash(), block.AppHash) { + if height > 1 && !bytes.Equal(re.Dst.State.Hash(), block.AppHash) { return nil, errors.Errorf("state hash %X does not match AppHash %X at height %d", - re.State.Hash(), block.AppHash[:], height) + re.Dst.State.Hash(), block.AppHash[:], height) } recap.AppHashBefore = binary.HexBytes(block.AppHash) err = block.Transactions(func(txEnv *txs.Envelope) error { - txe, err := re.committer.Execute(txEnv) + txe, err := re.Dst.committer.Execute(txEnv) if err != nil { return errors.Wrap(err, "committer.Execute()") } @@ -161,7 +223,7 @@ func (re *Replay) Commit(height uint64) (*ReplayCapture, error) { } abciHeader := types.TM2PB.Header(&block.Header) - recap.AppHashAfter, err = re.committer.Commit(&abciHeader) + recap.AppHashAfter, err = re.Dst.committer.Commit(&abciHeader) if err != nil { return nil, errors.Wrap(err, "committer.Commit()") } @@ -184,8 +246,10 @@ func iterComp(exp, act *state.ReadState, tree treeprint.Tree, prefix []byte) (ui branch := tree.AddBranch(prefix) return diffs, reader1.Iterate(nil, nil, true, func(key, value []byte) error { - actual := reader2.Get(key) - if !bytes.Equal(actual, value) { + actual, err := reader2.Get(key) + if err != nil { + return err + } else if !bytes.Equal(actual, value) { diffs++ branch.AddNode(color.GreenString("%q -> %q", hex.EncodeToString(key), hex.EncodeToString(value))) branch.AddNode(color.RedString("%q -> %q", hex.EncodeToString(key), hex.EncodeToString(actual))) diff --git a/forensics/replay_test.go b/forensics/replay_test.go index ffc312462..a3e9a9238 100644 --- a/forensics/replay_test.go +++ b/forensics/replay_test.go @@ -58,22 +58,15 @@ func TestReplay(t *testing.T) { var height uint64 = 10 genesisDoc, tmDB, burrowDB := makeChain(t, height) - re := NewReplay(burrowDB, tmDB, genesisDoc) + src := NewSource(burrowDB, tmDB, genesisDoc) + dst := NewSourceFromGenesis(genesisDoc) + re := NewReplay(src, dst) + rc, err := re.Blocks(1, height) require.NoError(t, err) require.Len(t, rc, int(height-1)) } -func initBurrow(t *testing.T, gd *genesis.GenesisDoc) (dbm.DB, *state.State, *bcm.Blockchain) { - db := dbm.NewMemDB() - st, err := state.MakeGenesisState(db, gd) - require.NoError(t, err) - err = st.InitialCommit() - require.NoError(t, err) - chain := bcm.NewBlockchain(db, gd) - return db, st, chain -} - func makeChain(t *testing.T, max uint64) (*genesis.GenesisDoc, dbm.DB, dbm.DB) { genesisDoc, _, validators := genesis.NewDeterministicGenesis(0).GenesisDoc(0, 1) @@ -87,10 +80,12 @@ func makeChain(t *testing.T, max uint64) (*genesis.GenesisDoc, dbm.DB, dbm.DB) { }) require.NoError(t, err) - burrowDB, burrowState, burrowChain := initBurrow(t, genesisDoc) + burrowDB, burrowState, burrowChain, err := initBurrow(genesisDoc) + require.NoError(t, err) - committer := execution.NewBatchCommitter(burrowState, execution.ParamsFromGenesis(genesisDoc), + committer, err := execution.NewBatchCommitter(burrowState, execution.ParamsFromGenesis(genesisDoc), burrowChain, event.NewEmitter(), logging.NewNoopLogger()) + require.NoError(t, err) var stateHash []byte for i := uint64(1); i < max; i++ { @@ -123,10 +118,10 @@ func makeBlock(t *testing.T, st sm.State, bs *store.BlockStore, commit func(*typ commit(block) partSet := block.MakePartSet(2) - commitSigs := []*types.CommitSig{{Height: height, Timestamp: time.Time{}}} - seenCommit := types.NewCommit(types.BlockID{ - Hash: block.Hash(), - PartsHeader: partSet.Header(), + commitSigs := []types.CommitSig{{Timestamp: time.Time{}}} + seenCommit := types.NewCommit(height, 0, types.BlockID{ + Hash: block.Hash(), + PartSetHeader: partSet.Header(), }, commitSigs) bs.SaveBlock(block, partSet, seenCommit) } diff --git a/forensics/revert_test.go b/forensics/revert_test.go index 478be23b9..42fc92913 100644 --- a/forensics/revert_test.go +++ b/forensics/revert_test.go @@ -27,7 +27,7 @@ func testLoadStudio(t *testing.T, i int) { fmt.Printf("Validator %d hash: %X\n", i, st.Hash()) //txHash := hex.MustDecodeString("DEF358F2CD8746CC2CEADE6EDF6518699FA91C512C45A3894FBB0E746E57B749") - accum := new(exec.BlockAccumulator) + accum := exec.NewBlockAccumulator() buf := new(bytes.Buffer) err = st.IterateStreamEvents(nil, nil, func(ev *exec.StreamEvent) error { be, err := accum.Consume(ev) diff --git a/forensics/spin_test.go b/forensics/spin_test.go index a77d9ab74..1eea2c818 100644 --- a/forensics/spin_test.go +++ b/forensics/spin_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/require" + "github.com/hyperledger/burrow/encoding" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/rpc/rpcevents" - "google.golang.org/grpc" ) func TestSpin(t *testing.T) { @@ -38,7 +38,7 @@ func TestSpinAll(t *testing.T) { func consume(name, listenAddress string, wg *sync.WaitGroup) error { defer wg.Done() - conn, err := grpc.Dial(listenAddress, grpc.WithInsecure()) + conn, err := encoding.GRPCDial(listenAddress) if err != nil { return err } diff --git a/forensics/storage/cache_db.go b/forensics/storage/cache_db.go index b8c56ba1f..a731fe32a 100644 --- a/forensics/storage/cache_db.go +++ b/forensics/storage/cache_db.go @@ -18,49 +18,67 @@ func NewCacheDB(backend storage.KVIterableReader) *CacheDB { } // DB implementation -func (cdb *CacheDB) Get(key []byte) []byte { +func (cdb *CacheDB) Get(key []byte) ([]byte, error) { value, deleted := cdb.cache.Info(key) if deleted { - return nil + return nil, nil } if value != nil { - return value + return value, nil } return cdb.backend.Get(key) } -func (cdb *CacheDB) Has(key []byte) bool { +func (cdb *CacheDB) Has(key []byte) (bool, error) { value, deleted := cdb.cache.Info(key) - return !deleted && (value != nil || cdb.backend.Has(key)) + has, err := cdb.backend.Has(key) + if err != nil { + return false, err + } + return !deleted && (value != nil || has), nil } -func (cdb *CacheDB) Iterator(low, high []byte) storage.KVIterator { +func (cdb *CacheDB) Iterator(low, high []byte) (storage.KVIterator, error) { // Keys from cache will sort first because of order in MultiIterator and Uniq will take the first KVs so KVs // appearing in cache will override values from backend. - return Uniq(NewMultiIterator(false, cdb.cache.Iterator(low, high), cdb.backend.Iterator(low, high))) + iterator, err := cdb.backend.Iterator(low, high) + if err != nil { + return nil, err + } + + return Uniq(NewMultiIterator(false, cdb.cache.Iterator(low, high), iterator)), nil } -func (cdb *CacheDB) ReverseIterator(low, high []byte) storage.KVIterator { - return Uniq(NewMultiIterator(true, cdb.cache.ReverseIterator(low, high), cdb.backend.ReverseIterator(low, high))) +func (cdb *CacheDB) ReverseIterator(low, high []byte) (storage.KVIterator, error) { + iterator, err := cdb.backend.ReverseIterator(low, high) + if err != nil { + return nil, err + } + + return Uniq(NewMultiIterator(true, cdb.cache.ReverseIterator(low, high), iterator)), nil } -func (cdb *CacheDB) Set(key, value []byte) { +func (cdb *CacheDB) Set(key, value []byte) error { cdb.cache.Set(key, value) + return nil } -func (cdb *CacheDB) SetSync(key, value []byte) { +func (cdb *CacheDB) SetSync(key, value []byte) error { cdb.cache.Set(key, value) + return nil } -func (cdb *CacheDB) Delete(key []byte) { +func (cdb *CacheDB) Delete(key []byte) error { cdb.cache.Delete(key) + return nil } -func (cdb *CacheDB) DeleteSync(key []byte) { - cdb.Delete(key) +func (cdb *CacheDB) DeleteSync(key []byte) error { + return cdb.Delete(key) } -func (cdb *CacheDB) Close() { +func (cdb *CacheDB) Close() error { + return nil } func (cdb *CacheDB) NewBatch() dbm.Batch { @@ -80,26 +98,31 @@ type cacheBatch struct { backend *CacheDB } -func (cb *cacheBatch) Set(key, value []byte) { +func (cb *cacheBatch) Set(key, value []byte) error { cb.cache.Set(key, value) + return nil } -func (cb *cacheBatch) Delete(key []byte) { +func (cb *cacheBatch) Delete(key []byte) error { cb.cache.Delete(key) + return nil } -func (cb *cacheBatch) Write() { +func (cb *cacheBatch) Write() error { cb.cache.WriteTo(cb.backend) + return nil } -func (cb *cacheBatch) Close() { +func (cb *cacheBatch) Close() error { + return nil } -func (cb *cacheBatch) WriteSync() { - cb.Write() +func (cb *cacheBatch) WriteSync() error { + return cb.Write() } -func (cdb *CacheDB) Print() { +func (cdb *CacheDB) Print() error { + return nil } func (cdb *CacheDB) Stats() map[string]string { diff --git a/forensics/storage/cache_db_test.go b/forensics/storage/cache_db_test.go index ee0309edc..5bfa947c3 100644 --- a/forensics/storage/cache_db_test.go +++ b/forensics/storage/cache_db_test.go @@ -15,25 +15,46 @@ func TestBatchCommit(t *testing.T) { bam := []byte("bam") bosh := []byte("bosh") boom := []byte("boom") + db.Set(foo, bam) - assert.Equal(t, bam, cdb.Get(foo), "underlying writes should be seen") + result, err := cdb.Get(foo) + assert.NoError(t, err) + assert.Equal(t, bam, result, "underlying writes should be seen") cdb.Set(foo, bosh) - assert.Equal(t, bosh, cdb.Get(foo), "writes to CacheDB should be available") + result, err = cdb.Get(foo) + assert.NoError(t, err) + assert.Equal(t, bosh, result, "writes to CacheDB should be available") batch := cdb.NewBatch() batch.Set(foo, bam) - assert.Equal(t, bosh, cdb.Get(foo), "write to batch should not be seen") + result, err = cdb.Get(foo) + assert.NoError(t, err) + assert.Equal(t, bosh, result, "write to batch should not be seen") batch.WriteSync() cdb.Commit(db) - assert.Equal(t, bam, db.Get(foo), "changes should commit") + result, err = db.Get(foo) + assert.NoError(t, err) + assert.Equal(t, bam, result, "changes should commit") cdb.Set(foo, bosh) - assert.Equal(t, bam, db.Get(foo), "uncommitted changes should not be seen in db") + result, err = db.Get(foo) + assert.NoError(t, err) + assert.Equal(t, bam, result, "uncommitted changes should not be seen in db") cdb.Delete(foo) - assert.Nil(t, cdb.Get(foo)) - assert.Equal(t, bam, db.Get(foo)) + result, err = cdb.Get(foo) + assert.NoError(t, err) + assert.Nil(t, result) + result, err = db.Get(foo) + assert.NoError(t, err) + assert.Equal(t, bam, result) cdb.Commit(db) - assert.Nil(t, db.Get(foo)) + result, err = db.Get(foo) + assert.NoError(t, err) + + assert.Nil(t, result) cdb.Set(foo, boom) - assert.Nil(t, db.Get(foo)) + result, err = db.Get(foo) + assert.NoError(t, err) + + assert.Nil(t, result) } func TestCacheDB_Iterator(t *testing.T) { @@ -49,11 +70,13 @@ func TestCacheDB_Iterator(t *testing.T) { cdb.Set(append(foo, bosh...), bosh) cdb.Set(boom, boom) - it := cdb.Iterator(nil, nil) + it, err := cdb.Iterator(nil, nil) + assert.NoError(t, err) kvp := collectIterator(it) fmt.Println(kvp) cdb.Commit(db) - it = db.Iterator(nil, nil) + it, err = db.Iterator(nil, nil) + assert.NoError(t, err) assert.Equal(t, kvp, collectIterator(it)) } diff --git a/forensics/storage/channel_iterator.go b/forensics/storage/channel_iterator.go index a59eb737e..47ff04235 100644 --- a/forensics/storage/channel_iterator.go +++ b/forensics/storage/channel_iterator.go @@ -89,8 +89,18 @@ func (it *ChannelIterator) Value() []byte { return it.kv.Value } -func (it *ChannelIterator) Close() { +func (it *ChannelIterator) Close() error { for range it.ch { // drain channel if necessary } + return nil +} + +func (it *ChannelIterator) Error() error { + for range it.ch { + if err := it.Error(); err != nil { + return nil + } + } + return nil } diff --git a/forensics/storage/kvcache.go b/forensics/storage/kvcache.go index d549038a2..a68ca5ebc 100644 --- a/forensics/storage/kvcache.go +++ b/forensics/storage/kvcache.go @@ -202,7 +202,11 @@ func (kvi *KVCacheIterator) Valid() bool { return kvi.keyIndex < len(kvi.keys) } -func (kvi *KVCacheIterator) Close() {} +func (kvi *KVCacheIterator) Close() error { + return nil +} + +func (kvi *KVCacheIterator) Error() error { return nil } func (kvi *KVCacheIterator) sliceIndex() int { if kvi.reverse { diff --git a/forensics/storage/kvcache_test.go b/forensics/storage/kvcache_test.go index b5aabcefc..29ed90d11 100644 --- a/forensics/storage/kvcache_test.go +++ b/forensics/storage/kvcache_test.go @@ -48,11 +48,11 @@ func TestKVCache_Iterator2(t *testing.T) { } func BenchmarkKVCache_Iterator_1E6_Inserts(b *testing.B) { - benchmarkKVCache_Iterator(b, 1E6) + benchmarkKVCache_Iterator(b, 1e6) } func BenchmarkKVCache_Iterator_1E7_Inserts(b *testing.B) { - benchmarkKVCache_Iterator(b, 1E7) + benchmarkKVCache_Iterator(b, 1e7) } func benchmarkKVCache_Iterator(b *testing.B, inserts int) { diff --git a/forensics/storage/multi_iterator.go b/forensics/storage/multi_iterator.go index 9a1c8ba7a..7a846c9d9 100644 --- a/forensics/storage/multi_iterator.go +++ b/forensics/storage/multi_iterator.go @@ -109,9 +109,22 @@ func (mi *MultiIterator) Peek() storage.KVIterator { return mi.iterators[0] } -func (mi *MultiIterator) Close() { +func (mi *MultiIterator) Close() error { // Close any remaining valid iterators for _, it := range mi.iterators { - it.Close() + err := it.Close() + if err != nil { + return err + } + } + return nil +} + +func (mi *MultiIterator) Error() error { + for _, it := range mi.iterators { + if err := it.Error(); err != nil { + return err + } } + return nil } diff --git a/forensics/storage/unique_iterator.go b/forensics/storage/unique_iterator.go index d5904315e..29f8b9ce2 100644 --- a/forensics/storage/unique_iterator.go +++ b/forensics/storage/unique_iterator.go @@ -42,6 +42,10 @@ func (ui *uniqueIterator) Value() []byte { return ui.source.Value() } -func (ui *uniqueIterator) Close() { - ui.source.Close() +func (ui *uniqueIterator) Close() error { + return ui.source.Close() +} + +func (ui *uniqueIterator) Error() error { + return ui.source.Error() } diff --git a/genesis/deterministic_genesis.go b/genesis/deterministic_genesis.go index 2e0e666ce..6689894a4 100644 --- a/genesis/deterministic_genesis.go +++ b/genesis/deterministic_genesis.go @@ -79,14 +79,14 @@ func (dg *deterministicGenesis) Account(minBalance uint64) (*acm.Account, *acm.P panic(fmt.Errorf("could not generate private key deterministically")) } privAccount := &acm.ConcretePrivateAccount{ - PublicKey: privateKey.GetPublicKey(), + PublicKey: *privateKey.GetPublicKey(), PrivateKey: privateKey, Address: privateKey.GetPublicKey().GetAddress(), } perms := permission.DefaultAccountPermissions acc := &acm.Account{ Address: privAccount.Address, - PublicKey: privAccount.PublicKey, + PublicKey: &privAccount.PublicKey, Sequence: uint64(dg.random.Int()), Balance: minBalance, Permissions: perms, diff --git a/genesis/genesis.go b/genesis/genesis.go index b31b7a8cf..70e0fb2ba 100644 --- a/genesis/genesis.go +++ b/genesis/genesis.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package genesis @@ -40,7 +29,7 @@ const ShortHashSuffixBytes = 3 type BasicAccount struct { // Address is convenient to have in file for reference, but otherwise ignored since derived from PublicKey Address crypto.Address - PublicKey crypto.PublicKey + PublicKey *crypto.PublicKey Amount uint64 } @@ -65,8 +54,10 @@ type params struct { } type GenesisDoc struct { - GenesisTime time.Time - ChainName string + GenesisTime time.Time + ChainName string + // Ordinarily we derive this from the genesis hash but to support explicit Ethereum ChainID it may be set + ChainID string `json:",omitempty" toml:",omitempty"` AppHash binary.HexBytes `json:",omitempty" toml:",omitempty"` Params params `json:",omitempty" toml:",omitempty"` Salt []byte `json:",omitempty" toml:",omitempty"` @@ -74,8 +65,8 @@ type GenesisDoc struct { Accounts []Account Validators []Validator // memo - hash []byte chainID string + hash []byte } func (genesisDoc *GenesisDoc) GlobalPermissionsAccount() *acm.Account { @@ -108,7 +99,7 @@ func (genesisDoc *GenesisDoc) JSONBytes() ([]byte, error) { return json.MarshalIndent(genesisDoc, "", "\t") } -func (genesisDoc *GenesisDoc) Hash() []byte { +func (genesisDoc *GenesisDoc) Hash() binary.HexBytes { if genesisDoc.hash != nil { return genesisDoc.hash } @@ -126,9 +117,14 @@ func (genesisDoc *GenesisDoc) ShortHash() []byte { return genesisDoc.Hash()[:ShortHashSuffixBytes] } -func (genesisDoc *GenesisDoc) ChainID() string { +func (genesisDoc *GenesisDoc) GetChainID() string { if genesisDoc.chainID == "" { - genesisDoc.chainID = fmt.Sprintf("%s-%X", genesisDoc.ChainName, genesisDoc.ShortHash()) + // Prefer explicit override ChainID + if genesisDoc.ChainID != "" { + genesisDoc.chainID = genesisDoc.ChainID + } else { + genesisDoc.chainID = fmt.Sprintf("%s-%X", genesisDoc.ChainName, genesisDoc.ShortHash()) + } } return genesisDoc.chainID } diff --git a/genesis/genesis_test.go b/genesis/genesis_test.go index 1229a00e2..095febbc6 100644 --- a/genesis/genesis_test.go +++ b/genesis/genesis_test.go @@ -5,6 +5,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/acm/validator" "github.com/hyperledger/burrow/permission" @@ -33,6 +35,16 @@ func TestMakeGenesisDocFromAccounts(t *testing.T) { assert.Equal(t, genDoc.Hash(), genDocOut.Hash()) fmt.Println(string(bs)) } +func TestGenesisStability(t *testing.T) { + genDoc := MakeGenesisDocFromAccounts("test-chain", nil, genesisTime, + accountMap("Tinkie-winkie", "Lala", "Po", "Dipsy"), + validatorMap("Foo", "Bar", "Baz"), + ) + + require.Equal(t, expectedGenesisJSON, genDoc.JSONString()) + + require.Equal(t, "C5B64E6AD231221C328271ADCE401AA11F9DF12830F7DA2FC3B2C923E929C532", genDoc.Hash().String()) +} func accountMap(names ...string) map[string]*acm.Account { accounts := make(map[string]*acm.Account, len(names)) @@ -59,3 +71,118 @@ func accountFromName(name string) *acm.Account { ca.Permissions = permission.AllAccountPermissions.Clone() return ca } + +// For genesis stability test +const expectedGenesisJSON = `{ + "GenesisTime": "2017-10-27T00:00:00Z", + "ChainName": "test-chain", + "Params": { + "ProposalThreshold": 0 + }, + "GlobalPermissions": { + "Base": { + "Perms": "send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | hasRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + }, + "Accounts": [ + { + "Address": "410427F4A361B958C97B47D81DAFDCF0A2B6503D", + "PublicKey": null, + "Amount": 521, + "Name": "Dipsy", + "Permissions": { + "Base": { + "Perms": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + } + }, + { + "Address": "1815E3667F406CA3872234D2573014CDE6CD2ABC", + "PublicKey": null, + "Amount": 378, + "Name": "Lala", + "Permissions": { + "Base": { + "Perms": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + } + }, + { + "Address": "A8174022832E4BA1BB52B380128514F72FB2FEBD", + "PublicKey": null, + "Amount": 191, + "Name": "Po", + "Permissions": { + "Base": { + "Perms": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + } + }, + { + "Address": "8979C634DFD2F6D20975EBE02C34B5E9C280AB18", + "PublicKey": null, + "Amount": 1304, + "Name": "Tinkie-winkie", + "Permissions": { + "Base": { + "Perms": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + } + } + ], + "Validators": [ + { + "Address": "29BB63AD75E2DA3368FC823DC68C01CF1FA87190", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "A18679ADC4391630178AC0DB35A115BEAEDA38B3DEABF92AC5FDE31A748DC259" + }, + "Amount": 277, + "Name": "Bar", + "UnbondTo": [ + { + "Address": "29BB63AD75E2DA3368FC823DC68C01CF1FA87190", + "PublicKey": null, + "Amount": 277 + } + ] + }, + { + "Address": "C92303227C9F0EC569B27B02DB328CFA0A7DF7E0", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "E3C56A2C047C9C82036778620E6F9089E5FB38A5D36CE47D9545CBA930C79522" + }, + "Amount": 285, + "Name": "Baz", + "UnbondTo": [ + { + "Address": "C92303227C9F0EC569B27B02DB328CFA0A7DF7E0", + "PublicKey": null, + "Amount": 285 + } + ] + }, + { + "Address": "900EBED8C6B27F7B606B6CAD34DB03C2C5C0E541", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "78133DE07C66C616263FD2D6A54BD3FC0D8CBF3A87BB2E0C410A0C8DEB6189CE" + }, + "Amount": 292, + "Name": "Foo", + "UnbondTo": [ + { + "Address": "900EBED8C6B27F7B606B6CAD34DB03C2C5C0E541", + "PublicKey": null, + "Amount": 292 + } + ] + } + ] +}` diff --git a/genesis/spec/genesis_spec.go b/genesis/spec/genesis_spec.go index 7ea37e6f5..ae0650f0e 100644 --- a/genesis/spec/genesis_spec.go +++ b/genesis/spec/genesis_spec.go @@ -8,6 +8,7 @@ import ( "time" "github.com/hyperledger/burrow/acm/balance" + crypto "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/keys" "github.com/hyperledger/burrow/permission" @@ -35,18 +36,8 @@ type params struct { ProposalThreshold uint64 `json:",omitempty" toml:",omitempty"` } -func (gs *GenesisSpec) RealiseKeys(keyClient keys.KeyClient) error { - for _, templateAccount := range gs.Accounts { - _, _, err := templateAccount.RealisePublicKeyAndAddress(keyClient) - if err != nil { - return err - } - } - return nil -} - // Produce a fully realised GenesisDoc from a template GenesisDoc that may omit values -func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient) (*genesis.GenesisDoc, error) { +func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient, curve crypto.CurveType) (*genesis.GenesisDoc, error) { genesisDoc := new(genesis.GenesisDoc) if gs.GenesisTime == nil { genesisDoc.GenesisTime = time.Now() @@ -84,7 +75,13 @@ func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient) (*genesis.GenesisDoc } for i, templateAccount := range templateAccounts { - account, err := templateAccount.GenesisAccount(keyClient, i) + ct := curve + if templateAccount.Balances().HasPower() { + // currently only ed25519 is supported for validator keys + ct = crypto.CurveTypeEd25519 + } + + account, err := templateAccount.GenesisAccount(keyClient, i, ct) if err != nil { return nil, fmt.Errorf("could not create Account from template: %v", err) } @@ -93,7 +90,7 @@ func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient) (*genesis.GenesisDoc if templateAccount.Balances().HasPower() { // Note this does not modify the input template templateAccount.Address = &account.Address - validator, err := templateAccount.Validator(keyClient, i) + validator, err := templateAccount.Validator(keyClient, i, ct) if err != nil { return nil, fmt.Errorf("could not create Validator from template: %v", err) } diff --git a/genesis/spec/genesis_spec_test.go b/genesis/spec/genesis_spec_test.go index f40d93b53..4d6fe8d3c 100644 --- a/genesis/spec/genesis_spec_test.go +++ b/genesis/spec/genesis_spec_test.go @@ -5,14 +5,15 @@ import ( "github.com/hyperledger/burrow/acm/balance" "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/keys/mock" + "github.com/hyperledger/burrow/keys" + "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/permission" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestGenesisSpec_GenesisDoc(t *testing.T) { - keyClient := mock.NewKeyClient() + keyClient := keys.NewLocalKeyClient(keys.NewMemoryKeyStore(), logging.NewNoopLogger()) // Try a spec with a single account/validator amtBonded := uint64(100) @@ -22,7 +23,7 @@ func TestGenesisSpec_GenesisDoc(t *testing.T) { }}, } - genesisDoc, err := genesisSpec.GenesisDoc(keyClient) + genesisDoc, err := genesisSpec.GenesisDoc(keyClient, crypto.CurveTypeEd25519) require.NoError(t, err) require.Len(t, genesisDoc.Accounts, 1) // Should create validator @@ -52,7 +53,7 @@ func TestGenesisSpec_GenesisDoc(t *testing.T) { }}, } - genesisDoc, err = genesisSpec.GenesisDoc(keyClient) + genesisDoc, err = genesisSpec.GenesisDoc(keyClient, crypto.CurveTypeEd25519) require.NoError(t, err) require.Len(t, genesisDoc.Accounts, 2) @@ -67,7 +68,7 @@ func TestGenesisSpec_GenesisDoc(t *testing.T) { // Try an empty spec genesisSpec = GenesisSpec{} - genesisDoc, err = genesisSpec.GenesisDoc(keyClient) + genesisDoc, err = genesisSpec.GenesisDoc(keyClient, crypto.CurveTypeEd25519) require.NoError(t, err) // Similar assersions to first case - should generate our default single identity chain diff --git a/genesis/spec/presets_test.go b/genesis/spec/presets_test.go index 155fb706b..5fbb72698 100644 --- a/genesis/spec/presets_test.go +++ b/genesis/spec/presets_test.go @@ -4,16 +4,18 @@ import ( "testing" "github.com/hyperledger/burrow/acm/balance" - "github.com/hyperledger/burrow/keys/mock" + crypto "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/keys" + "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/permission" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestMergeGenesisSpecAccounts(t *testing.T) { - keyClient := mock.NewKeyClient() + keyClient := keys.NewLocalKeyClient(keys.NewMemoryKeyStore(), logging.NewNoopLogger()) gs := MergeGenesisSpecs(FullAccount("0"), ParticipantAccount("1"), ParticipantAccount("2")) - gd, err := gs.GenesisDoc(keyClient) + gd, err := gs.GenesisDoc(keyClient, crypto.CurveTypeEd25519) require.NoError(t, err) assert.Len(t, gd.Validators, 1) assert.Len(t, gd.Accounts, 3) diff --git a/genesis/spec/spec.pb.go b/genesis/spec/spec.pb.go index 6afe7cc50..6e13643a1 100644 --- a/genesis/spec/spec.pb.go +++ b/genesis/spec/spec.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -27,7 +28,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 type TemplateAccount struct { Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` @@ -51,7 +52,7 @@ func (m *TemplateAccount) XXX_Unmarshal(b []byte) error { } func (m *TemplateAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -116,39 +117,38 @@ func init() { proto.RegisterFile("spec.proto", fileDescriptor_423806180556987f) func init() { golang_proto.RegisterFile("spec.proto", fileDescriptor_423806180556987f) } var fileDescriptor_423806180556987f = []byte{ - // 401 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbf, 0x6f, 0xd4, 0x30, - 0x14, 0xc7, 0xcf, 0x5c, 0xda, 0xe3, 0x7c, 0x45, 0x50, 0x4f, 0x51, 0x87, 0x38, 0x3a, 0x06, 0x22, - 0x54, 0x12, 0xe9, 0x98, 0xe8, 0x76, 0xe1, 0xc7, 0x82, 0x84, 0xaa, 0xb4, 0x13, 0x5b, 0xe2, 0x3c, - 0xd2, 0x48, 0x71, 0x1c, 0xd9, 0x8e, 0x50, 0xfe, 0x0b, 0x24, 0x16, 0xe6, 0xfe, 0x25, 0x8c, 0x19, - 0x19, 0x51, 0x87, 0x08, 0xa5, 0x1b, 0x23, 0x7f, 0x01, 0x3a, 0xe7, 0x8e, 0xde, 0x44, 0x33, 0xf9, - 0x7d, 0xfd, 0xf4, 0xfd, 0xbc, 0x67, 0xbf, 0x87, 0xb1, 0xaa, 0x80, 0xf9, 0x95, 0x14, 0x5a, 0x10, - 0x6b, 0x13, 0x9f, 0xbc, 0xc8, 0x72, 0x7d, 0x55, 0x27, 0x3e, 0x13, 0x3c, 0xc8, 0x44, 0x26, 0x02, - 0x93, 0x4c, 0xea, 0x4f, 0x46, 0x19, 0x61, 0xa2, 0xc1, 0x74, 0x72, 0xc4, 0x64, 0x53, 0xe9, 0x9d, - 0x7a, 0x94, 0xc4, 0x45, 0x5c, 0x32, 0x18, 0xe4, 0xf2, 0xab, 0x85, 0x1f, 0x5f, 0x02, 0xaf, 0x8a, - 0x58, 0xc3, 0x9a, 0x31, 0x51, 0x97, 0x9a, 0x10, 0x6c, 0x7d, 0x88, 0x39, 0xd8, 0xc8, 0x45, 0xde, - 0x3c, 0x32, 0x31, 0xe1, 0x78, 0xb6, 0x4e, 0x53, 0x09, 0x4a, 0xd9, 0x0f, 0x5c, 0xe4, 0x1d, 0x85, - 0x17, 0x37, 0x1d, 0x3d, 0xdd, 0x6b, 0xe4, 0xaa, 0xa9, 0x40, 0x16, 0x90, 0x66, 0x20, 0x83, 0xa4, - 0x96, 0x52, 0x7c, 0x0e, 0xb6, 0x75, 0xb7, 0xbe, 0xdf, 0x1d, 0xc5, 0xa7, 0x82, 0xe7, 0x1a, 0x78, - 0xa5, 0x9b, 0x3f, 0x1d, 0x3d, 0xd6, 0x82, 0x17, 0x67, 0xcb, 0xbb, 0xbb, 0x65, 0xb4, 0xab, 0x41, - 0x2e, 0xf1, 0xfc, 0xbc, 0x4e, 0x8a, 0x9c, 0xbd, 0x87, 0xc6, 0x9e, 0xba, 0xc8, 0x5b, 0xac, 0x8e, - 0xfd, 0x2d, 0xef, 0x5f, 0x22, 0x7c, 0x3a, 0x86, 0x79, 0x07, 0x22, 0x17, 0x78, 0xb6, 0xe6, 0x9b, - 0x27, 0x2a, 0xdb, 0x72, 0xa7, 0xde, 0x62, 0xf5, 0xc4, 0xdf, 0xfd, 0x46, 0x38, 0x9c, 0xe1, 0xb3, - 0xb6, 0xa3, 0x93, 0x71, 0xad, 0x0e, 0x24, 0xf2, 0x16, 0x2f, 0xce, 0x41, 0xf2, 0x5c, 0xa9, 0x5c, - 0x94, 0xca, 0x3e, 0x70, 0xa7, 0xde, 0x7c, 0x5c, 0x67, 0xfb, 0x3e, 0xf2, 0x0a, 0x1f, 0x44, 0xa2, - 0x00, 0x65, 0x1f, 0x8e, 0x07, 0x0c, 0x0e, 0xf2, 0x0e, 0x5b, 0xaf, 0x45, 0x0a, 0xf6, 0xcc, 0x0c, - 0x66, 0xd5, 0x76, 0x14, 0xdd, 0x74, 0xf4, 0xf9, 0xff, 0x87, 0x13, 0x33, 0xee, 0x87, 0x8d, 0x06, - 0x26, 0x52, 0x88, 0x8c, 0xff, 0xec, 0xe1, 0x97, 0x6b, 0x3a, 0xf9, 0x76, 0x4d, 0x27, 0xe1, 0x9b, - 0xb6, 0x77, 0xd0, 0x8f, 0xde, 0x41, 0x3f, 0x7b, 0x07, 0xfd, 0xea, 0x1d, 0xf4, 0xfd, 0xd6, 0x41, - 0xed, 0xad, 0x83, 0x3e, 0xde, 0x43, 0xcd, 0xa0, 0x04, 0x95, 0xab, 0x60, 0xb3, 0xa7, 0xc9, 0xa1, - 0x59, 0xb1, 0x97, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xcf, 0x89, 0xb2, 0xc2, 0x02, 0x00, - 0x00, + // 394 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbf, 0x8e, 0xd3, 0x40, + 0x10, 0xc6, 0xb3, 0xc4, 0x77, 0x21, 0x9b, 0x43, 0x70, 0x2b, 0x0a, 0xeb, 0x0a, 0xaf, 0x15, 0x0a, + 0x2c, 0x74, 0xb2, 0xa5, 0x50, 0x71, 0x5d, 0xcc, 0x9f, 0x06, 0x09, 0x9d, 0x7c, 0x57, 0xd1, 0xd9, + 0xeb, 0x91, 0xcf, 0x92, 0xd7, 0x6b, 0xed, 0xae, 0x85, 0xfc, 0x16, 0x48, 0x34, 0xd4, 0x79, 0x12, + 0x4a, 0x97, 0x94, 0x28, 0x85, 0x85, 0x9c, 0x8e, 0x92, 0x27, 0x40, 0xb6, 0x13, 0x42, 0xc5, 0xb9, + 0xf2, 0x37, 0x33, 0xfa, 0x7e, 0x33, 0xde, 0x19, 0x8c, 0x55, 0x01, 0xcc, 0x2d, 0xa4, 0xd0, 0x82, + 0x18, 0x9d, 0xbe, 0x78, 0x9a, 0x88, 0x44, 0xf4, 0x09, 0xaf, 0x53, 0x43, 0xed, 0xe2, 0x8c, 0xc9, + 0xaa, 0xd0, 0x87, 0xe8, 0x51, 0x14, 0x66, 0x61, 0xce, 0x60, 0x08, 0x97, 0x5f, 0x0c, 0xfc, 0xf8, + 0x16, 0x78, 0x91, 0x85, 0x1a, 0xd6, 0x8c, 0x89, 0x32, 0xd7, 0x84, 0x60, 0xe3, 0x43, 0xc8, 0xc1, + 0x44, 0x36, 0x72, 0xe6, 0x41, 0xaf, 0x09, 0xc7, 0xb3, 0x75, 0x1c, 0x4b, 0x50, 0xca, 0x7c, 0x60, + 0x23, 0xe7, 0xcc, 0xbf, 0xd9, 0x36, 0xf4, 0x32, 0x49, 0xf5, 0x5d, 0x19, 0xb9, 0x4c, 0x70, 0xef, + 0xae, 0x2a, 0x40, 0x66, 0x10, 0x27, 0x20, 0xbd, 0xa8, 0x94, 0x52, 0x7c, 0xf2, 0xf6, 0x7d, 0xf7, + 0xbe, 0x5f, 0x0d, 0xc5, 0x97, 0x82, 0xa7, 0x1a, 0x78, 0xa1, 0xab, 0xdf, 0x0d, 0x3d, 0xd7, 0x82, + 0x67, 0x57, 0xcb, 0x63, 0x6e, 0x19, 0x1c, 0x7a, 0x90, 0x5b, 0x3c, 0xbf, 0x2e, 0xa3, 0x2c, 0x65, + 0xef, 0xa1, 0x32, 0xa7, 0x36, 0x72, 0x16, 0xab, 0x73, 0x77, 0xcf, 0xfb, 0x5b, 0xf0, 0x9f, 0x8d, + 0x61, 0x1e, 0x41, 0xe4, 0x06, 0xcf, 0xd6, 0xbc, 0xfb, 0x45, 0x65, 0x1a, 0xf6, 0xd4, 0x59, 0xac, + 0x9e, 0xb8, 0x87, 0xd7, 0xf0, 0x87, 0xaf, 0xff, 0xbc, 0x6e, 0xe8, 0x64, 0xdc, 0xa8, 0x03, 0x89, + 0xbc, 0xc5, 0x8b, 0x6b, 0x90, 0x3c, 0x55, 0x2a, 0x15, 0xb9, 0x32, 0x4f, 0xec, 0xa9, 0x33, 0x1f, + 0x37, 0xd9, 0xbf, 0x3e, 0xf2, 0x0a, 0x9f, 0x04, 0x22, 0x03, 0x65, 0x9e, 0x8e, 0x07, 0x0c, 0x0e, + 0xf2, 0x0e, 0x1b, 0xaf, 0x45, 0x0c, 0xe6, 0xac, 0x5f, 0xcc, 0xaa, 0x6e, 0x28, 0xda, 0x36, 0xf4, + 0xc5, 0xff, 0x97, 0x13, 0x32, 0xee, 0xfa, 0x95, 0x06, 0x26, 0x62, 0x08, 0x7a, 0xff, 0xd5, 0xc3, + 0xcf, 0x1b, 0x3a, 0xf9, 0xba, 0xa1, 0x13, 0xff, 0x4d, 0xdd, 0x5a, 0xe8, 0x7b, 0x6b, 0xa1, 0x1f, + 0xad, 0x85, 0x7e, 0xb6, 0x16, 0xfa, 0xb6, 0xb3, 0x50, 0xbd, 0xb3, 0xd0, 0xc7, 0x7b, 0xa8, 0x09, + 0xe4, 0xa0, 0x52, 0xe5, 0x75, 0xe7, 0x18, 0x9d, 0xf6, 0x27, 0xf6, 0xf2, 0x4f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xf3, 0x21, 0x48, 0x2d, 0xa9, 0x02, 0x00, 0x00, } func (m *TemplateAccount) 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 } @@ -156,102 +156,107 @@ func (m *TemplateAccount) Marshal() (dAtA []byte, err error) { } func (m *TemplateAccount) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TemplateAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintSpec(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.Address != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintSpec(dAtA, i, uint64(m.Address.Size())) - n1, err := m.Address.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Code != nil { + { + size := m.Code.Size() + i -= size + if _, err := m.Code.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintSpec(dAtA, i, uint64(size)) } - i += n1 + i-- + dAtA[i] = 0x3a } - if m.PublicKey != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintSpec(dAtA, i, uint64(m.PublicKey.Size())) - n2, err := m.PublicKey.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Roles) > 0 { + for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Roles[iNdEx]) + copy(dAtA[i:], m.Roles[iNdEx]) + i = encodeVarintSpec(dAtA, i, uint64(len(m.Roles[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if len(m.Permissions) > 0 { + for iNdEx := len(m.Permissions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Permissions[iNdEx]) + copy(dAtA[i:], m.Permissions[iNdEx]) + i = encodeVarintSpec(dAtA, i, uint64(len(m.Permissions[iNdEx]))) + i-- + dAtA[i] = 0x2a } - i += n2 } if len(m.Amounts) > 0 { - for _, msg := range m.Amounts { + for iNdEx := len(m.Amounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSpec(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x22 - i++ - i = encodeVarintSpec(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.PublicKey != nil { + { + size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n - } - } - if len(m.Permissions) > 0 { - for _, s := range m.Permissions { - dAtA[i] = 0x2a - 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 len(m.Roles) > 0 { - for _, s := range m.Roles { - dAtA[i] = 0x32 - 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) + i -= size + i = encodeVarintSpec(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a } - if m.Code != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintSpec(dAtA, i, uint64(m.Code.Size())) - n3, err := m.Code.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Address != nil { + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintSpec(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintSpec(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintSpec(dAtA []byte, offset int, v uint64) int { + offset -= sovSpec(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 (m *TemplateAccount) Size() (n int) { if m == nil { @@ -300,14 +305,7 @@ func (m *TemplateAccount) Size() (n int) { } func sovSpec(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozSpec(x uint64) (n int) { return sovSpec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -583,10 +581,7 @@ func (m *TemplateAccount) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthSpec - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthSpec } if (iNdEx + skippy) > l { @@ -605,6 +600,7 @@ func (m *TemplateAccount) Unmarshal(dAtA []byte) error { func skipSpec(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -636,10 +632,8 @@ func skipSpec(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -660,55 +654,30 @@ func skipSpec(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthSpec } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthSpec - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSpec - } - 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 := skipSpec(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthSpec - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSpec + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthSpec + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthSpec = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSpec = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthSpec = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSpec = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSpec = fmt.Errorf("proto: unexpected end of group") ) diff --git a/genesis/spec/template_account.go b/genesis/spec/template_account.go index 7ac6804cf..e1f318048 100644 --- a/genesis/spec/template_account.go +++ b/genesis/spec/template_account.go @@ -10,10 +10,10 @@ import ( "github.com/hyperledger/burrow/permission" ) -func (ta TemplateAccount) Validator(keyClient keys.KeyClient, index int) (*genesis.Validator, error) { +func (ta TemplateAccount) Validator(keyClient keys.KeyClient, index int, curve crypto.CurveType) (*genesis.Validator, error) { var err error gv := new(genesis.Validator) - gv.PublicKey, gv.Address, err = ta.RealisePublicKeyAndAddress(keyClient) + gv.PublicKey, gv.Address, err = ta.RealisePublicKeyAndAddress(keyClient, crypto.CurveTypeEd25519) if err != nil { return nil, err } @@ -43,10 +43,10 @@ func (ta TemplateAccount) AccountPermissions() (permission.AccountPermissions, e }, nil } -func (ta TemplateAccount) GenesisAccount(keyClient keys.KeyClient, index int) (*genesis.Account, error) { +func (ta TemplateAccount) GenesisAccount(keyClient keys.KeyClient, index int, curve crypto.CurveType) (*genesis.Account, error) { var err error ga := new(genesis.Account) - ga.PublicKey, ga.Address, err = ta.RealisePublicKeyAndAddress(keyClient) + ga.PublicKey, ga.Address, err = ta.RealisePublicKeyAndAddress(keyClient, curve) if err != nil { return nil, err } @@ -69,11 +69,11 @@ func (ta TemplateAccount) GenesisAccount(keyClient keys.KeyClient, index int) (* // Adds a public key and address to the template. If PublicKey will try to fetch it by Address. // If both PublicKey and Address are not set will use the keyClient to generate a new keypair -func (ta TemplateAccount) RealisePublicKeyAndAddress(keyClient keys.KeyClient) (pubKey crypto.PublicKey, address crypto.Address, err error) { +func (ta TemplateAccount) RealisePublicKeyAndAddress(keyClient keys.KeyClient, curve crypto.CurveType) (pubKey *crypto.PublicKey, address crypto.Address, err error) { if ta.PublicKey == nil { if ta.Address == nil { // If neither PublicKey or Address set then generate a new one - address, err = keyClient.Generate(ta.Name, crypto.CurveTypeEd25519) + address, err = keyClient.Generate(ta.Name, curve) if err != nil { return } @@ -91,7 +91,7 @@ func (ta TemplateAccount) RealisePublicKeyAndAddress(keyClient keys.KeyClient) ( err = fmt.Errorf("template address %s does not match public key derived address %s", ta.Address, ta.PublicKey) } - pubKey = *ta.PublicKey + pubKey = ta.PublicKey } return } diff --git a/go.mod b/go.mod index 945a5b440..f4fec39d1 100644 --- a/go.mod +++ b/go.mod @@ -1,69 +1,62 @@ module github.com/hyperledger/burrow -go 1.12 - -replace github.com/go-interpreter/wagon v0.0.0 => github.com/perlin-network/wagon v0.3.1-0.20180825141017-f8cb99b55a39 +go 1.15 require ( github.com/BurntSushi/toml v0.3.1 - github.com/OneOfOne/xxhash v1.2.5 - github.com/alecthomas/jsonschema v0.0.0-20190122210438-a6952de1bbe6 - github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect - github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect - github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf // indirect - github.com/btcsuite/btcd v0.0.0-20190418232430-6867ff32788a + github.com/OneOfOne/xxhash v1.2.8 + github.com/alecthomas/jsonschema v0.0.0-20201129101101-7b852d451add + github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect + github.com/btcsuite/btcd v0.21.0-beta github.com/cep21/xdgbasedir v0.0.0-20170329171747-21470bfc93b9 + github.com/cosmos/iavl v0.15.3 github.com/eapache/channels v1.1.0 - github.com/eapache/queue v1.1.0 // indirect - github.com/elgs/gojq v0.0.0-20160421194050-81fa9a608a13 + github.com/elgs/gojq v0.0.0-20201120033525-b5293fef2759 github.com/elgs/gosplitargs v0.0.0-20161028071935-a491c5eeb3c8 // indirect - github.com/fatih/color v1.7.0 - github.com/fortytw2/leaktest v1.3.0 // indirect - github.com/go-kit/kit v0.8.0 - github.com/go-logfmt/logfmt v0.4.0 // indirect - github.com/go-ozzo/ozzo-validation v3.5.0+incompatible - github.com/gogo/protobuf v1.2.1 - github.com/golang/protobuf v1.3.2 - github.com/gorilla/websocket v1.4.0 - github.com/hashicorp/golang-lru v0.5.1 - github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c - github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365 - github.com/imdario/mergo v0.3.7 - github.com/jawher/mow.cli v1.1.0 - github.com/jmoiron/sqlx v1.2.0 - github.com/kisielk/errcheck v1.2.0 // indirect - github.com/kr/pretty v0.1.0 // indirect - github.com/lib/pq v1.1.1 - github.com/mattn/go-colorable v0.1.2 // indirect - github.com/mattn/go-sqlite3 v1.10.0 + github.com/fatih/color v1.10.0 + github.com/go-interpreter/wagon v0.6.0 + github.com/go-kit/kit v0.10.0 + github.com/go-ozzo/ozzo-validation v3.6.0+incompatible + github.com/gogo/protobuf v1.3.2 + github.com/golang/protobuf v1.4.3 + github.com/gorilla/websocket v1.4.2 + github.com/hashicorp/golang-lru v0.5.4 + github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c + github.com/iancoleman/strcase v0.1.3 + github.com/imdario/mergo v0.3.11 + github.com/jawher/mow.cli v1.2.0 + github.com/jmoiron/sqlx v1.3.1 + github.com/lib/pq v1.9.0 + github.com/mattn/go-sqlite3 v1.14.6 github.com/monax/relic v2.0.0+incompatible - github.com/perlin-network/life v0.0.0-20190521143330-57f3819c2df0 - github.com/pkg/errors v0.8.1 - github.com/prometheus/client_golang v0.9.2 - github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 - github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 - github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a - github.com/sirupsen/logrus v1.4.2 // indirect - github.com/spf13/viper v1.3.2 + github.com/perlin-network/life v0.0.0-20191203030451-05c0e0f7eaea + github.com/pkg/errors v0.9.1 + github.com/pointlander/compress v1.1.0 // indirect + github.com/pointlander/jetset v1.0.0 // indirect + github.com/pointlander/peg v1.0.0 // indirect + github.com/prometheus/client_golang v1.9.0 + github.com/prometheus/client_model v0.2.0 + github.com/prometheus/common v0.15.0 + github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 + github.com/spf13/viper v1.7.1 github.com/streadway/simpleuuid v0.0.0-20130420165545-6617b501e485 - github.com/stretchr/testify v1.3.0 - github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 - github.com/tendermint/go-amino v0.14.1 - github.com/tendermint/iavl v0.12.4 - github.com/tendermint/tendermint v0.32.3 - github.com/tendermint/tm-db v0.1.1 - github.com/tmthrgd/go-hex v0.0.0-20190303111820-0bdcb15db631 - github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect - github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - github.com/xeipuuv/gojsonschema v1.1.0 - github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca - golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 - golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 - golang.org/x/sys v0.0.0-20190825160603-fb81701db80f // indirect - golang.org/x/text v0.3.2 // indirect - golang.org/x/tools v0.0.0-20190826060629-95c3470cfb70 // indirect - google.golang.org/grpc v1.22.0 - gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect - gopkg.in/yaml.v2 v2.2.2 + github.com/stretchr/testify v1.7.0 + github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca + github.com/tendermint/tendermint v0.34.3 + github.com/tendermint/tm-db v0.6.3 + github.com/test-go/testify v1.1.4 + github.com/tmthrgd/atomics v0.0.0-20190904060638-dc7a5fcc7e0d // indirect + github.com/tmthrgd/go-bitset v0.0.0-20190904054048-394d9a556c05 + github.com/tmthrgd/go-bitwise v0.0.0-20190904053232-1430ee983fca // indirect + github.com/tmthrgd/go-byte-test v0.0.0-20190904060354-2794345b9929 // indirect + github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc + github.com/tmthrgd/go-memset v0.0.0-20190904060434-6fb7a21f88f1 // indirect + github.com/tmthrgd/go-popcount v0.0.0-20190904054823-afb1ace8b04f // indirect + github.com/xeipuuv/gojsonschema v1.2.0 + github.com/xlab/treeprint v1.0.0 + golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad + golang.org/x/net v0.0.0-20210119194325-5f4716e94777 + google.golang.org/grpc v1.35.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 // indirect + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 1ca5f671f..4b825ac58 100644 --- a/go.sum +++ b/go.sum @@ -1,307 +1,894 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +filippo.io/edwards25519 v1.0.0-alpha.2 h1:EWbZLqGEPSIj2W69gx04KtNVkyPIfe3uj0DhDQJonbQ= +filippo.io/edwards25519 v1.0.0-alpha.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.5 h1:zl/OfRA6nftbBK9qTohYBJ5xvw6C/oNKizR7cZGl3cI= -github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= +github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/alecthomas/jsonschema v0.0.0-20190122210438-a6952de1bbe6 h1:xadBCbc8D9mmkaNfCsEBHbIoCjbayJXJNsY1JjPjNio= -github.com/alecthomas/jsonschema v0.0.0-20190122210438-a6952de1bbe6/go.mod h1:qpebaTNSsyUn5rPSJMsfqEtDw71TTggXM6stUDI16HA= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= +github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/alecthomas/jsonschema v0.0.0-20201129101101-7b852d451add h1:UWj2AVW7oygpatGgJRy6rvNBcl+J7u8vl6qTV+XNWzA= +github.com/alecthomas/jsonschema v0.0.0-20201129101101-7b852d451add/go.mod h1:/n6+1/DWPltRLWL/VKyUxg6tzsl5kHUCcraimt4vr60= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco= -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= -github.com/btcsuite/btcd v0.0.0-20190418232430-6867ff32788a h1:m/oCT7NlD/JpB64AxWzoS9GuZOCPKkTpt/bdIfeYPwA= -github.com/btcsuite/btcd v0.0.0-20190418232430-6867ff32788a/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803 h1:j3AgPKKZtZStM2nyhrDSLSYgT7YHrZKdSkq1OYeLjvM= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts= +github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cep21/xdgbasedir v0.0.0-20170329171747-21470bfc93b9 h1:Iy/9yf1PnKnwH8V0phEnqKE6aSIaqIZ+yn4PQgHF84E= github.com/cep21/xdgbasedir v0.0.0-20170329171747-21470bfc93b9/go.mod h1:6R3C29d3JonDKVjnlzFv5BGL/bfZP+0I7rKHKwiqKP8= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3 h1:PuGK2V1NJWZ8sSkNDq91jgT/cahFEW9RGp4Y5jxulf0= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3 h1:xE9r6HW8GeKeoYJN4zefpljZ1oukVScP/7M8oj6SUts= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/channels v1.1.0 h1:F1taHcn7/F0i8DYqKXJnyhJcVpp2kgFcNePxXtnyu4k= github.com/eapache/channels v1.1.0/go.mod h1:jMm2qB5Ubtg9zLd+inMZd2/NUvXgzmWXsDaLyQIGfH0= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/elgs/gojq v0.0.0-20160421194050-81fa9a608a13 h1:/voSflvo4UvPT0XZy+YQMuUk04topJ2swxyOOyXefMM= -github.com/elgs/gojq v0.0.0-20160421194050-81fa9a608a13/go.mod h1:rQELVIqRXpraeUryHOBadz99ePvEVQmTVpGr8M9QQ4Q= +github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elgs/gojq v0.0.0-20201120033525-b5293fef2759 h1:WtAKk9RULee8RXnR3to5hg7TrsPVCdxYVrOZRjR54LU= +github.com/elgs/gojq v0.0.0-20201120033525-b5293fef2759/go.mod h1:rQELVIqRXpraeUryHOBadz99ePvEVQmTVpGr8M9QQ4Q= github.com/elgs/gosplitargs v0.0.0-20161028071935-a491c5eeb3c8 h1:bD2/rCXwgXJm2vgoSSSCM9IPjVFfEoQFFblzg7HHABI= github.com/elgs/gosplitargs v0.0.0-20161028071935-a491c5eeb3c8/go.mod h1:o4DgpccPNAQAlPSxo7I4L/LWNh2oyr/BBGSynrLTmZM= -github.com/etcd-io/bbolt v1.3.2/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/go-kit/kit v0.6.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-interpreter/wagon v0.6.0 h1:BBxDxjiJiHgw9EdkYXAWs8NHhwnazZ5P2EWBW5hFNWw= +github.com/go-interpreter/wagon v0.6.0/go.mod h1:5+b/MBYkclRZngKF5s6qrgWxSLgE9F5dFdO1hAueZLc= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ozzo/ozzo-validation v3.5.0+incompatible h1:sUy/in/P6askYr16XJgTKq/0SZhiWsdg4WZGaLsGQkM= -github.com/go-ozzo/ozzo-validation v3.5.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/GeYW1cILu7Nuuj1N3BBkE= +github.com/go-ozzo/ozzo-validation v3.6.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 h1:FlFbCRLd5Jr4iYXZufAvgWN6Ao0JrI5chLINnUXDDr0= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0= -github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hdevalence/ed25519consensus v0.0.0-20201207055737-7fde80a9d5ff h1:LeVKjw8pcDQj7WVVnbFvbD7ovcv+r/l15ka1NH6Lswc= +github.com/hdevalence/ed25519consensus v0.0.0-20201207055737-7fde80a9d5ff/go.mod h1:Feit0l8NcNO4g69XNjwvsR0LGcwMMfzI1TF253rOIlQ= +github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c h1:aY2hhxLhjEAbfXOx2nRJxCXezC6CO2V/yN+OCr1srtk= +github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365 h1:ECW73yc9MY7935nNYXUkK7Dz17YuSUI9yqRqYS8aBww= -github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= -github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI= -github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 h1:i462o439ZjprVSFSZLZxcsoAe592sZB1rci2Z8j4wdk= +github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= +github.com/iancoleman/strcase v0.1.3 h1:dJBk1m2/qjL1twPLf68JND55vvivMupZ4wIzE8CTdBw= +github.com/iancoleman/strcase v0.1.3/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= +github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jawher/mow.cli v1.1.0 h1:NdtHXRc0CwZQ507wMvQ/IS+Q3W3x2fycn973/b8Zuk8= -github.com/jawher/mow.cli v1.1.0/go.mod h1:aNaQlc7ozF3vw6IJ2dHjp2ZFiA4ozMIYY6PyuRJwlUg= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/jawher/mow.cli v1.2.0 h1:e6ViPPy+82A/NFF/cfbq3Lr6q4JHKT9tyHwTCcUQgQw= +github.com/jawher/mow.cli v1.2.0/go.mod h1:y+pcA3jBAdo/GIZx/0rFjw/K2bVEODP9rfZOfaiq8Ko= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= -github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= +github.com/jmoiron/sqlx v1.3.1 h1:aLN7YINNZ7cYOPK3QC83dbM6KT0NMqVMw961TqrejlE= +github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= +github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= -github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.9.0 h1:L8nSXQQzAYByakOFMTwpjRoHsMJklur4Gi59b6VivR8= +github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o= -github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/monax/relic v2.0.0+incompatible h1:5q+fw8Y7UJJuOBzGV5bZNlBk9k9ii6fzmdpwXsZKMdg= github.com/monax/relic v2.0.0+incompatible/go.mod h1:ZJcXg8m9tYkd2h6VeEZruhRUQPklFKbzFaTxyXrXxVk= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/perlin-network/life v0.0.0-20190521143330-57f3819c2df0 h1:fP9xTEHvfuArvWXQhRDYHSBNX/3ZaAfFKlxzpZtUsqs= -github.com/perlin-network/life v0.0.0-20190521143330-57f3819c2df0/go.mod h1:z/EH0mO9zbeuTT5NX4u2VqVSG8y2vDQXz6iDKxikW2I= -github.com/perlin-network/wagon v0.3.1-0.20180825141017-f8cb99b55a39 h1:CYHXy6CWxxL7ugjvCbTELOm2j5iRLEWGPl3AQYvretw= -github.com/perlin-network/wagon v0.3.1-0.20180825141017-f8cb99b55a39/go.mod h1:zHOMvbitcZek8oshsMO5VpyBjWjV9X8cn8WTZwdebpM= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/perlin-network/life v0.0.0-20191203030451-05c0e0f7eaea h1:okKoivlkNRRLqXraEtatHfEhW+D71QTwkaj+4n4M2Xc= +github.com/perlin-network/life v0.0.0-20191203030451-05c0e0f7eaea/go.mod h1:3KEU5Dm8MAYWZqity880wOFJ9PhQjyKVZGwAEfc5Q4E= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pointlander/compress v1.1.0 h1:5fUcQV2qEHvk0OpILH6eltwluN5VnwiYrkc1wjGUHnU= +github.com/pointlander/compress v1.1.0/go.mod h1:q5NXNGzqj5uPnVuhGkZfmgHqNUhf15VLi6L9kW0VEc0= +github.com/pointlander/jetset v1.0.0 h1:bNlaNAX7cDPID9SlcogmXlDWq0KcRJSpKwHXaAM3bGQ= +github.com/pointlander/jetset v1.0.0/go.mod h1:zY6+WHRPB10uzTajloHtybSicLW1bf6Rz0eSaU9Deng= +github.com/pointlander/peg v1.0.0 h1:rtCtA6Fu6xJpILX8WJfU+cvrcKmXgTfG/v+bkLP8NYY= +github.com/pointlander/peg v1.0.0/go.mod h1:WJTMcgeWYr6fZz4CwHnY1oWZCXew8GWCF93FaAxPrh4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_golang v1.9.0 h1:Rrch9mh17XcxvEu9D9DEpb4isxjGBtcevQjKvxPRQIU= +github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= +github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= -github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0 h1:lMqc+fUb7RrFS3gQLtoQsJ7/6TV/pAIFvBsqX73DK8Y= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.1/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= -github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/streadway/simpleuuid v0.0.0-20130420165545-6617b501e485 h1:tvEO2/Btzw9L4N2VlAHD7AXjk1g1yFTwbGEm8dz7QWY= github.com/streadway/simpleuuid v0.0.0-20130420165545-6617b501e485/go.mod h1:fMlyZAyOBbIsA9SgKX9V3X8DvF+5ImkZ+Z1HZcmo8Ec= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= -github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= -github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6offJMk= -github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= -github.com/tendermint/iavl v0.12.2 h1:Ls5p5VINCM1HRT9g5Vvs2zmDOCU/CCIvIHzd/pZ8P0E= -github.com/tendermint/iavl v0.12.2/go.mod h1:EoKMMv++tDOL5qKKVnoIqtVPshRrEPeJ0WsgDOLAauM= -github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= -github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= -github.com/tendermint/tendermint v0.31.5 h1:vTet8tCq3B9/J9Yo11dNZ8pOB7NtSy++bVSfkP4KzR4= -github.com/tendermint/tendermint v0.31.5/go.mod h1:ymcPyWblXCplCPQjbOYbrF1fWnpslATMVqiGgWbZrlc= -github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= -github.com/tendermint/tendermint v0.32.3 h1:GEnWpGQ795h5oTFNbfBLsY0LW/CW2j6p6HtiYNfxsgg= -github.com/tendermint/tendermint v0.32.3/go.mod h1:ZK2c29jl1QRYznIRyRWRDsmm1yvtPzBRT00x4t1JToY= -github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0= -github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= -github.com/tmthrgd/go-hex v0.0.0-20190303111820-0bdcb15db631 h1:IlK6taZBmMKDcGfMqIlD4la5BlekNrrLsdtCMSn6aJI= -github.com/tmthrgd/go-hex v0.0.0-20190303111820-0bdcb15db631/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= +github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0 h1:eXCfMgoqVSzrjzOj6clI9GAejcHH0LvOlRjpCmMJksU= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.3 h1:9yEsf3WO5VAwPVwrmM+RffDMiijmNfWaBwNttHm0q5w= +github.com/tendermint/tendermint v0.34.3/go.mod h1:h57vnXeOlrdvvNFCqPBSaOrpOivl+2swWEtlUAqStYE= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3 h1:ZkhQcKnB8/2jr5EaZwGndN4owkPsGezW2fSisS9zGbg= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmthrgd/atomics v0.0.0-20190904060638-dc7a5fcc7e0d h1:2QXSQjy/gDm0QeP9G9NaO9Hm2Cl1LAle4ZV0JeYK7XY= +github.com/tmthrgd/atomics v0.0.0-20190904060638-dc7a5fcc7e0d/go.mod h1:J2+dTgaX/1g3PkyL6sLBglBWfaLmAp5bQbRhSfKw9XI= +github.com/tmthrgd/go-bitset v0.0.0-20190904054048-394d9a556c05 h1:5jOF3BEex8XyBKMbaDUN1SiPQJRAKVuP24/sbwC2aWA= +github.com/tmthrgd/go-bitset v0.0.0-20190904054048-394d9a556c05/go.mod h1:SooM96OIpihI7iMZhVGbpiiO9Qevqv8vXxHlwNtefd4= +github.com/tmthrgd/go-bitwise v0.0.0-20190904053232-1430ee983fca h1:Ns4/7EvYZ7FxKiKnEMkMMAPtoR/ifUgRsvk7lzlOtPY= +github.com/tmthrgd/go-bitwise v0.0.0-20190904053232-1430ee983fca/go.mod h1:Ba4ek/h+sJUzTQ03ZGD1r0lazhxd7CBoEQzFk/icxxU= +github.com/tmthrgd/go-byte-test v0.0.0-20190904060354-2794345b9929 h1:EV5x10oS2/QrR1RwniFQW1i22d/iyX/emvvMjHT32CA= +github.com/tmthrgd/go-byte-test v0.0.0-20190904060354-2794345b9929/go.mod h1:MEz1Lt0fxSL/ZgE7VN3yUJV0sP5I5aYecYLd9y/viEs= +github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= +github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= +github.com/tmthrgd/go-memset v0.0.0-20190904060434-6fb7a21f88f1 h1:KfSLDmc6rrLHr//urKbNApu51nt2AzdrwBCxqq0gRlk= +github.com/tmthrgd/go-memset v0.0.0-20190904060434-6fb7a21f88f1/go.mod h1:xUkvcKF3VBDKFmmqCtW333lognWBHzSScj4fgjVB0Ek= +github.com/tmthrgd/go-popcount v0.0.0-20190904054823-afb1ace8b04f h1:Phf2p9+twoHct5ZjSTrI8K7iWeSxO4x1p5pShTl0J00= +github.com/tmthrgd/go-popcount v0.0.0-20190904054823-afb1ace8b04f/go.mod h1:FcUQfrsAsSSqM3n9xf4EtPzB8tWzt58/y0AV+wNNM8Q= +github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc h1:RTUQlKzoZZVG3umWNzOYeFecQLIh+dbxXvJp1zPQJTI= +github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc/go.mod h1:NoCfSFWosfqMqmmD7hApkirIK9ozpHjxRnRxs1l413A= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.1.0 h1:ngVtJC9TY/lg0AA/1k48FYhBrhRoFlEmWzsehpNAaZg= -github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= -github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca h1:1CFlNzQhALwjS9mBAUkycX616GzgsuYUOCHA5+HSlXI= -github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xlab/treeprint v1.0.0 h1:J0TkWtiuYgtdlrkkrDLISYBQ92M+X5m4LrIIMKrbDTs= +github.com/xlab/treeprint v1.0.0/go.mod h1:IoImgRak9i3zJyuxOKUP1v4UZd1tMoKkq/Cimt1uhCg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= +golang.org/x/sys v0.0.0-20190306220234-b354f8bf4d9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190529164535-6a60838ec259 h1:so6Hr/LodwSZ5UQDu/7PmQiDeS112WwtLvU3lpSPZTU= -golang.org/x/sys v0.0.0-20190529164535-6a60838ec259/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190825160603-fb81701db80f h1:LCxigP8q3fPRGNVYndYsyHnF0zRrvcoVwZMfb8iQZe4= -golang.org/x/sys v0.0.0-20190825160603-fb81701db80f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e h1:AyodaIpKjppX+cBfTASF2E1US3H2JFBj920Ot3rtDjs= +golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190826060629-95c3470cfb70/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw= -google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0 h1:TwIQcH3es+MojMVojxxfQ3l3OF2KzlRxML2xZq0kRo8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/governance/governance.go b/governance/governance.go deleted file mode 100644 index 976e6734e..000000000 --- a/governance/governance.go +++ /dev/null @@ -1,55 +0,0 @@ -// The governance package contains functionality for altering permissions, token distribution, consensus parameters, -// validators, and network forks. -package governance - -import ( - "github.com/hyperledger/burrow/acm/balance" - "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/genesis/spec" - "github.com/hyperledger/burrow/permission" - "github.com/hyperledger/burrow/txs/payload" -) - -// TODO: -// - Set validator power -// - Set account amount(s) -// - Set account permissions -// - Set global permissions -// - Set ConsensusParams -// Future considerations: -// - Handle network forks/termination/merging/replacement ? -// - Provide transaction in stasis/sudo (voting?) -// - Handle bonding by other means (e.g. pre-shared key permitting n bondings) -// - Network administered proxies (i.e. instead of keys have password authentication for identities - allow calls to originate as if from address without key?) -// Subject to: -// - Less than 1/3 validator power change per block - -// Creates a GovTx that alters the validator power of id to the power passed -func AlterPowerTx(inputAddress crypto.Address, id crypto.Addressable, power uint64) *payload.GovTx { - return AlterBalanceTx(inputAddress, id, balance.New().Power(power)) -} - -func AlterBalanceTx(inputAddress crypto.Address, id crypto.Addressable, bal balance.Balances) *payload.GovTx { - publicKey := id.GetPublicKey() - return UpdateAccountTx(inputAddress, &spec.TemplateAccount{ - PublicKey: &publicKey, - Amounts: bal, - }) -} - -func AlterPermissionsTx(inputAddress crypto.Address, id crypto.Addressable, perms permission.PermFlag) *payload.GovTx { - address := id.GetAddress() - return UpdateAccountTx(inputAddress, &spec.TemplateAccount{ - Address: &address, - Permissions: permission.PermFlagToStringList(perms), - }) -} - -func UpdateAccountTx(inputAddress crypto.Address, updates ...*spec.TemplateAccount) *payload.GovTx { - return &payload.GovTx{ - Inputs: []*payload.TxInput{{ - Address: inputAddress, - }}, - AccountUpdates: updates, - } -} diff --git a/helm/burrow/.helmignore b/helm/burrow/.helmignore new file mode 100644 index 000000000..c13e3c8fb --- /dev/null +++ b/helm/burrow/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj \ No newline at end of file diff --git a/helm/burrow/Chart.yaml b/helm/burrow/Chart.yaml new file mode 100644 index 000000000..4b970d4a9 --- /dev/null +++ b/helm/burrow/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +appVersion: 0.30.2 +description: Burrow is a permissionable smart contract machine +home: https://github.com/hyperledger/burrow +icon: https://raw.githubusercontent.com/hyperledger/burrow/develop/docs/assets/images/burrow.png +keywords: +- blockchain +- smart contracts +- ethereum +- hyperledger +- evm +- web3 +maintainers: +- email: casey@monax.io + name: compleatang +- email: gregorydhill@outlook.com + name: gregdhill +name: burrow +sources: +- https://github.com/hyperledger/burrow +version: 0.30.2 diff --git a/helm/burrow/README.md b/helm/burrow/README.md new file mode 100644 index 000000000..ebec9989a --- /dev/null +++ b/helm/burrow/README.md @@ -0,0 +1,170 @@ +# Burrow + +[Burrow](https://github.com/hyperledger/burrow) is a permissioned Ethereum smart-contract blockchain node which provides transaction finality and high transaction throughput +on a proof-of-stake [Tendermint](https://tendermint.com) consensus engine. + +## Introduction + +This chart bootstraps a burrow network on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Installation + +### Prerequisites + +To deploy a new blockchain network, this chart requires that two objects be present in the same Kubernetes namespace: a configmap should house the genesis file and each node should +have a secret to hold any validator keys. The provided script, `addresses.sh` automatically provisions a number of files using the [burrow](https://github.com/hyperledger/burrow) toolkit, +so please first ensure that `burrow --version` matches the `image.tag` in the [configuration](#configuration). This sequence also requires that the [jq](https://stedolan.github.io/jq/) binary +is installed. Two files will be generated, the first of note is `setup.yaml` which contains the two necessary Kubernetes specifications to be added to the cluster: + +```bash +curl -LO https://raw.githubusercontent.com/helm/charts/master/stable/burrow/initialize.sh +CHAIN_NODES=4 CHAIN_NAME="my-release-burrow" ./initialize.sh +kubectl apply --filename setup.yaml +``` + +Please note that the variable `$CHAIN_NAME` should be the same as the helm release name specified below with the `-burrow` suffix. +Another file, `addresses.yaml` contains the the equivalent validator addresses to set in the charts. + +### Deployment + +To install the chart with the release name `my-release` with the set of custom validator addresses: + +```bash +helm install stable/burrow --name my-release --values addresses.yaml +``` + +The [configuration](#configuration) section below lists all possible parameters that can be configured during installation. Please also see the [runtime configuration](#runtime) +section for more information on how to setup your network properly. + +## Uninstall + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +This command removes all the Kubernetes components associated with the chart and deletes the release. To remove the configmap and secret created in the [prerequisites](#prerequisites), follow these steps: + +```bash +kubectl delete secret ${CHAIN_NAME}-keys +kubectl delete configmap ${CHAIN_NAME}-genesis +``` + +## Configuration + +The following table lists the configurable parameters of the Burrow chart and its default values. + +| Parameter | Description | Default | +| --------- | ----------- | ------- | +| `affinity` | node/pod affinities | `{}` | +| `chain.nodes` | number of nodes for the blockchain network | `1` | +| `chain.logLevel` | log level for the nodes (`debug`, `info`, `warn`) | `"info"` | +| `chain.extraSeeds` | network seeds to dial in addition to the cluster booted by the chart; each entry in the array should be in the form `ip:port` (note: because P2P connects over tcp, the port is absolutely required) | `[]` | +| `restore.enabled` | toggle chain restore mechanism | `false` | +| `chain.testing` | toggle pre-generated keys & genesis for ci testing | `false` | +| `config` | the [burrow configuration file](https://github.com/hyperledger/burrow/blob/develop/tests/chain/burrow.toml) | `{}` | +| `config.Tendermint.ListenPort` | peer port | `26656` | +| `contracts.enabled` | toggle post-install contract deployment | `false` | +| `contracts.image` | contract deployer image | `""` | +| `contracts.tag` | contract deployer tag | `""` | +| `contracts.deploy` | command to run in post-install hook | `""` | +| `env` | environment variables to configure burrow | `{}` | +| `extraArgs` | extra arguments to give to the build in `burrow start` command | `{}` | +| `image.repository` | image repository | `"hyperledger/burrow"` | +| `image.tag` | image tag | `"0.29.4"` | +| `image.pullPolicy` | image pull policy | `"IfNotPresent"` | +| `livenessProbe.enabled` | enable liveness checks | `true` | +| `livenessProbe.path` | http endpoint | `"/status?block_seen_time_within=3m"` | +| `livenessProbe.initialDelaySeconds` | start after | `240` | +| `livenessProbe.timeoutSeconds` | retry after | `1` | +| `livenessProbe.periodSeconds` | check every | `30` | +| `nodeSelector` | node labels for pod assignment | `{}` | +| `organization` | name of the organization running these nodes (used in the peer's moniker) | `""` | +| `persistence.enabled` | enable pvc for the chain data | `true` | +| `persistence.size` | size of the chain data pvc | `"80Gi"` | +| `persistence.storageClass` | storage class for the chain data pvc | `"standard"` | +| `persistence.accessMode` | access mode for the chain data pvc | `"ReadWriteOnce"` | +| `persistence.persistentVolumeReclaimPolicy` | does not delete on node restart | `"Retain"` | +| `podAnnotations` | annotations to add to each pod | `{}` | +| `podLabels` | labels to add to each pod | `{}` | +| `readinessProbe.enabled` | enable readiness checks | `true` | +| `readinessProbe.path` | http endpoint | `"/status"` | +| `readinessProbe.initialDelaySeconds` | start after | `5` | +| `resources.limits.cpu` | - | `"500m"` | +| `resources.limits.memory` | - | `"1Gi"` | +| `resources.requests.cpu` | - | `"100m"` | +| `resources.requests.memory` | - | `"256Mi"` | +| `grpc.service.type` | service type | `"ClusterIP"` | +| `grpc.service.loadBalance` | enable load balancing across nodes | `true` | +| `grpc.ingress.enabled` | expose port | `false` | +| `grpc.ingress.hosts` | - | `[]` | +| `grpc.ingress.annotations` | extra annotations | `` | +| `grpc.ingress.tls` | - | `` | +| `info.service.type` | service type | `"ClusterIP"` | +| `info.service.loadBalance` | enable load balancing across nodes | `true` | +| `info.ingress.enabled` | expose port | `false` | +| `info.ingress.partial` | exposes the `/accounts` and `/blocks` paths externally | `false` | +| `info.ingress.pathLeader` | - | `"/"` | +| `info.ingress.annotations` | extra annotations | `` | +| `info.ingress.hosts` | - | `[]` | +| `info.ingress.tls` | - | `` | +| `peer.service.type` | service type | `"ClusterIP"` | +| `peer.ingress.enabled` | expose port | `false` | +| `peer.ingress.hosts` | - | `[]` | +| `tolerations` | list of node taints to tolerate | `[]` | +| `validatorAddresses` | list of validators to deploy | `[]` | + + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +helm install stable/burrow --name my-release \ + --set=image.tag=0.23.2,resources.limits.cpu=200m -f addresses.yaml +``` + +Alternatively, append additional values to the YAML file generated in the [prerequisites](#prerequisites). For example, + +```bash +helm install stable/burrow --name my-release -f addresses.yaml +``` + +## Runtime + +It is unlikely that you will want to deploy this chart with the default runtime configuration. When booting permissioned blockchains in a cloud environment there are three predominant considerations in addition to the normal configuration of any cloud application. + +1. What access rights to place on the ports? +2. What is the set of initial accounts and validators for the chain? +3. What keys should the validating nodes have? + +Each of these considerations will be dealt with in more detail below. + +### Port Configuration + +Burrow utilizes three different ports by default: + +* `Peer`: Burrow's peer port is used for P2P communication within the blockchain network as part of the consensus engine ([Tendermint](https://github.com/tendermint/tendermint)) to perform bilateral gossiping communication. +* `Info`: Burrow's info port is used for conducting remote procedures. +* `GRPC`: Burrow's grpc port can be used by JavaScript libraries to interact with the chain over websockets. + +The default configuration for the chart sets up the port access rights in the following manner: + +* `Peer`: Peer ports are **only** opened within the cluster. By default, there is no P2P communication exposed to the general internet. Each node within the cluster has its own distinct peer service built by the chart which utilizes a `ClusterIP` service type. +* `Info`: The info port is **only** opened within the cluster. By default, there is no info communication exposed to the general internet. There is **one** info service built by the chart which utilizes a `ClusterIP` service type. The default info service used by the chart is strongly linked to node number `000` and is not load balanced across the nodes by default so as to reduce any challenges with tooling that conduct long-polling after sending transactions. The chart offers an ingress which is connected to the info service, but this is `disabled` by default. +* `GRPC`: The grpc port is **only** opened within the cluster. By default, there is no grpc communication exposed to the general internet. There is **one** grpc service built by the chart which utilizes a `ClusterIP` service type. The default grpc service used by the chart is load balanced across the nodes within the cluster by default because libraries which utilize this port typical do so on websockets and the service is able to utilize a sessionAffinity setting. + +In order to expose the peers to the general internet change the `peer.service.type` to `NodePort`. It is not advised to run P2P traffic through an ingress or other load balancing service as there is uncertainty with respect to the IP address which the blockchain node advertises and gossips. As such, the best way to expose P2P traffic to the internet is to utilize a `NodePort` service type. While such service types can be a challenge to work with in many instances, the P2P libraries that these blockchains utilize are very resilient to movement between machine nodes. The biggest gotcha with `NodePort` service types is to ensure that the machine nodes have proper egress within the cloud or data center provider. As long as the machine nodes do not have egress restrictions disabling the utilization of `NodePort` service types, the P2P traffic will be exposed fluidly. + +To expose the info service to the general internet change the default `rpcInfo.ingress.enabled` to `true` and add the appropriate fields to the ingress for your Kubernetes cluster. This will allow developers to connect to the info service from their local machines. + +To disable load balancing on the grpc service, change the `rpcGRPC.service.loadBalance` to `false`. + +### Genesis + +Burrow initializes any single blockchain via use of a `genesis.json` which defines what validators and accounts are given access to the permissioned blockchain when it is booted. The chart imports the `genesis.json` file as a Kubernetes configmap and then mounts it in each node deployment. + +### Validator Keys + +**NOTE: The chart has not been security audited and as such one should use the validator keys functionality of the chart at one's own risk.** + +Burrow blockchain nodes need to have a key available to them which has been properly registered within the `genesis.json` initial state. The registered key is what enables a blockchain node to participate in the P2P validation of the network. The chart imports the validator key files as Kubernetes secrets, so the security of the blockchain is only as strong as the cluster's integrity. diff --git a/helm/burrow/ci/test-values.yaml b/helm/burrow/ci/test-values.yaml new file mode 100644 index 000000000..95dcbc5db --- /dev/null +++ b/helm/burrow/ci/test-values.yaml @@ -0,0 +1,20 @@ +# CI Testing Values + +chain: + testing: true + +organization: "hyperledger" + +validators: + - name: Validator_0 + address: 744630EA9A7CBD310AE7B8EDAFCBF94E54D23F37 + nodeAddress: 9367CCE15205DC38DA61F5B348AF2AFEED2FE77A + - name: Validator_1 + address: 2C1B7046183387E63C17898235D3C0FDE4943BC7 + nodeAddress: 5B624373E8EE692ACDAF408F5B8E0831E78FEC50 + - name: Validator_2 + address: C5291CE95749A2DE1D992946B683280D75EDBE8C + nodeAddress: C13AEAC6523429A1ED244255D2BBAA7CB4AB7CB4 + - name: Validator_3 + address: A5BCAF761B774A61FADA691AB40C4E9A20D82B7B + nodeAddress: A85AE5C27FEDEFA57F425B7762A1BB5CCA095E64 diff --git a/helm/burrow/initialize.sh b/helm/burrow/initialize.sh new file mode 100644 index 000000000..92c2d93ee --- /dev/null +++ b/helm/burrow/initialize.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash + +# Preflight checks +if [[ "$(which mktemp)" == "" ]] +then + echo "Please install mktemp and then rerun me. Exiting." + exit 1 +fi +if [[ "$(which burrow)" == "" ]] +then + echo "Please install Hyperledger Burrow and then rerun me. Exiting." + exit 1 +fi + +export CHAIN_NODES=${CHAIN_NODES:-4} +export CHAIN_NAME=${CHAIN_NAME:-"my-release-burrow"} +if [ -z $CHAIN_OUTPUT_DIRECTORY ]; then + export CHAIN_OUTPUT_DIRECTORY=`pwd` +fi + +set -e + +title="Initializing $((CHAIN_NODES)) Validator Nodes" +echo -e "\n${title}\n${title//?/-}\n" + +echo "Writing kubernetes template files for validators secrets, and configmaps." +keysTemplate=$(mktemp) +valsTemplate=$(mktemp) +genSpec=$(mktemp) +genesis=$(mktemp) +keys=$(mktemp -d) + +function finish { + rm $keysTemplate + rm $valsTemplate + rm $genSpec + rm $genesis + rm -r $keys +} +trap finish EXIT + +setup="setup.yaml" +values="addresses.yaml" + +cat >$keysTemplate <$valsTemplate < $genSpec + +echo "Creating keys and necessary deploy files..." +burrow configure \ + --chain-name=$CHAIN_NAME \ + --keys-dir=$keys \ + --genesis-spec=$genSpec \ + --config-template-in=$keysTemplate \ + --config-out=$CHAIN_OUTPUT_DIRECTORY/$setup \ + --config-template-in=$valsTemplate \ + --config-out=$CHAIN_OUTPUT_DIRECTORY/$values \ + --separate-genesis-doc=$genesis >/dev/null + +echo "Saved keys and genesis as $CHAIN_OUTPUT_DIRECTORY/$setup" +echo "Saved example 'values.yaml' as $CHAIN_OUTPUT_DIRECTORY/$values" + +cat >>$CHAIN_OUTPUT_DIRECTORY/$setup < %v\n", k1Address, k2Address) err = k1.Node.Switch().DialPeerWithAddress(k2Address) if err != nil { switch e := err.(type) { case p2p.ErrRejected: - panic(fmt.Errorf("connection between test kernels was rejected: %v", e)) + return fmt.Errorf("connection between test kernels was rejected: %v", e) default: - panic(fmt.Errorf("could not connect test kernels: %v", err)) + return fmt.Errorf("could not connect test kernels: %v", err) } } + return nil } -func connectAllKernels(ks []*core.Kernel) { +func connectAllKernels(ks []*core.Kernel) error { source := ks[0] for _, dest := range ks[1:] { - connectKernels(source, dest) + err := connectKernels(source, dest) + if err != nil { + return err + } } + return nil } func getMaxFlow(t testing.TB, qcli rpcquery.QueryClient) uint64 { diff --git a/integration/governance/identify_test.go b/integration/governance/identify_test.go new file mode 100644 index 000000000..272b28e1b --- /dev/null +++ b/integration/governance/identify_test.go @@ -0,0 +1,120 @@ +// +build integration + +package governance + +import ( + "context" + "testing" + + "github.com/hyperledger/burrow/config" + "github.com/hyperledger/burrow/consensus/tendermint" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/rpc/rpcquery" + + "github.com/hyperledger/burrow/core" + "github.com/hyperledger/burrow/execution/registry" + "github.com/hyperledger/burrow/integration" + "github.com/hyperledger/burrow/integration/rpctest" + "github.com/hyperledger/burrow/txs/payload" + "github.com/stretchr/testify/require" +) + +func TestIdentify(t *testing.T) { + accounts := integration.MakePrivateAccounts("accounts", 2) + kernels := make([]*core.Kernel, len(accounts)) + configs := make([]*config.BurrowConfig, len(accounts)) + genesisDoc := integration.TestGenesisDoc(accounts, 0) + var err error + + for i, acc := range accounts { + configs[i], err = newConfig(genesisDoc, acc, accounts...) + require.NoError(t, err) + configs[i].Tendermint.IdentifyPeers = true + } + + // start first validator + kernels[0], err = newKernelAndBoot(configs[0], accounts[0], accounts...) + require.NoError(t, err) + defer integration.Shutdown(kernels[0]) + + // identify first validator (self) + node := nodeFromConf(t, + configs[0], + configs[0].Tendermint.ListenAddress(), + accounts[0].ConcretePrivateAccount().PrivateKey) + identifyTx := payload.NewIdentifyTx(accounts[0].GetAddress(), node) + tcli := rpctest.NewTransactClient(t, kernels[0].GRPCListenAddress().String()) + _, err = payloadSync(tcli, identifyTx) + require.NoError(t, err) + + // start second node + kernels[1], err = newKernelAndBoot(configs[1], accounts[1], accounts...) + require.NoError(t, err) + defer integration.Shutdown(kernels[1]) + + // should not connect before identified + err = connectKernels(kernels[1], kernels[0]) + require.Error(t, err) + + // identify second node (from first) + node = nodeFromConf(t, + configs[1], + configs[1].Tendermint.ListenHost, + accounts[1].ConcretePrivateAccount().PrivateKey) + identifyTx = payload.NewIdentifyTx(accounts[1].GetAddress(), node) + _, err = payloadSync(tcli, identifyTx) + require.NoError(t, err) + + // once identified, proceed + err = connectKernels(kernels[1], kernels[0]) + require.NoError(t, err) + + // query first validator for identities + qcli := rpctest.NewQueryClient(t, kernels[0].GRPCListenAddress().String()) + nr, err := qcli.GetNetworkRegistry(context.TODO(), &rpcquery.GetNetworkRegistryParam{}) + require.NoError(t, err) + netset := nr.GetSet() + require.Len(t, netset, 2) + addrs := make([]crypto.Address, len(netset)) + for _, node := range netset { + addrs = append(addrs, node.Address) + } + require.Contains(t, addrs, accounts[0].GetAddress()) + require.Contains(t, addrs, accounts[1].GetAddress()) + + // re-register node with different moniker + configs[1].Tendermint.Moniker = "foobar" + node = nodeFromConf(t, + configs[1], + configs[1].Tendermint.ListenHost, + accounts[1].ConcretePrivateAccount().PrivateKey) + identifyTx = payload.NewIdentifyTx(accounts[1].GetAddress(), node) + _, err = payloadSync(tcli, identifyTx) + require.NoError(t, err) + + // should update second node + nr, err = qcli.GetNetworkRegistry(context.TODO(), &rpcquery.GetNetworkRegistryParam{}) + require.NoError(t, err) + netset = nr.GetSet() + require.Len(t, netset, 2) + names := make([]string, len(netset)) + for _, node := range netset { + names = append(names, node.Node.Moniker) + } + require.Contains(t, names, configs[1].Tendermint.Moniker) +} + +func nodeFromConf(t *testing.T, conf *config.BurrowConfig, host string, val crypto.PrivateKey) *registry.NodeIdentity { + tmConf, err := conf.TendermintConfig() + require.NoError(t, err) + nodeKey, err := tendermint.EnsureNodeKey(tmConf.NodeKeyFile()) + require.NoError(t, err) + addr, err := crypto.AddressFromHexString(string(nodeKey.ID())) + require.NoError(t, err) + return ®istry.NodeIdentity{ + Moniker: conf.Tendermint.Moniker, + NetworkAddress: host, + TendermintNodeID: addr, + ValidatorPublicKey: val.GetPublicKey(), + } +} diff --git a/integration/integration.go b/integration/integration.go index d6d4aceab..1b502b7ee 100644 --- a/integration/integration.go +++ b/integration/integration.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package integration @@ -25,8 +14,6 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/acm/validator" "github.com/hyperledger/burrow/config" @@ -34,12 +21,12 @@ import ( "github.com/hyperledger/burrow/core" "github.com/hyperledger/burrow/execution" "github.com/hyperledger/burrow/genesis" - "github.com/hyperledger/burrow/keys/mock" + "github.com/hyperledger/burrow/keys" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/logconfig" - lConfig "github.com/hyperledger/burrow/logging/logconfig" "github.com/hyperledger/burrow/permission" "github.com/hyperledger/burrow/rpc" + "github.com/stretchr/testify/require" ) const ( @@ -63,14 +50,16 @@ func RunNode(t testing.TB, genesisDoc *genesis.GenesisDoc, privateAccounts []*ac options ...func(*config.BurrowConfig)) (kern *core.Kernel, shutdown func()) { var err error - var loggingConfig *logconfig.LoggingConfig - testConfig, cleanup := NewTestConfig(genesisDoc, options...) // Uncomment for log output from tests - //loggingConfig = logconfig.New().Root(func(sink *logconfig.SinkConfig) *logconfig.SinkConfig { - // return sink.SetOutput(logconfig.StderrOutput()) - //}) - kern, err = TestKernel(privateAccounts[0], privateAccounts, testConfig, loggingConfig) + // testConfig.Logging = logconfig.New().Root(func(sink *logconfig.SinkConfig) *logconfig.SinkConfig { + // return sink.SetOutput(logconfig.StderrOutput()) + // }) + testConfig.Logging = logconfig.New().Root(func(sink *logconfig.SinkConfig) *logconfig.SinkConfig { + return sink.SetTransform(logconfig.FilterTransform(logconfig.IncludeWhenAllMatch, + "total_validator")).SetOutput(logconfig.StdoutOutput()) + }) + kern, err = TestKernel(privateAccounts[0], privateAccounts, testConfig) require.NoError(t, err) err = kern.Boot() require.NoError(t, err) @@ -87,6 +76,7 @@ func NewTestConfig(genesisDoc *genesis.GenesisDoc, nodeNumber := atomic.AddUint64(&node, 1) name := fmt.Sprintf("node_%03d", nodeNumber) conf = config.DefaultBurrowConfig() + conf.Logging = nil testDir, cleanup := EnterTestDirectory() conf.BurrowDir = path.Join(testDir, fmt.Sprintf(".burrow_%s", name)) conf.GenesisDoc = genesisDoc @@ -104,6 +94,8 @@ func NewTestConfig(genesisDoc *genesis.GenesisDoc, conf.RPC.Metrics.ListenPort = freeport conf.RPC.Info.ListenHost = rpc.LocalHost conf.RPC.Info.ListenPort = freeport + conf.RPC.Web3.ListenHost = rpc.LocalHost + conf.RPC.Web3.ListenPort = freeport conf.Execution.TimeoutFactor = 0.5 conf.Execution.VMOptions = []execution.VMOption{} for _, opt := range options { @@ -116,7 +108,8 @@ func NewTestConfig(genesisDoc *genesis.GenesisDoc, // We use this to wrap tests func TestKernel(validatorAccount *acm.PrivateAccount, keysAccounts []*acm.PrivateAccount, - testConfig *config.BurrowConfig, loggingConfig *lConfig.LoggingConfig) (*core.Kernel, error) { + testConfig *config.BurrowConfig) (*core.Kernel, error) { + fmt.Println("Creating integration test Kernel...") kern, err := core.NewKernel(testConfig.BurrowDir) @@ -124,15 +117,16 @@ func TestKernel(validatorAccount *acm.PrivateAccount, keysAccounts []*acm.Privat return nil, err } - kern.SetLogger(logging.NewNoopLogger()) - if loggingConfig != nil { - err := kern.LoadLoggerFromConfig(loggingConfig) + logger := logging.NewNoopLogger() + kern.SetLogger(logger) + if testConfig.Logging != nil { + err := kern.LoadLoggerFromConfig(testConfig.Logging) if err != nil { return nil, err } } - kern.SetKeyClient(mock.NewKeyClient(keysAccounts...)) + kern.SetKeyClient(keys.NewLocalKeyClient(keys.NewMemoryKeyStore(keysAccounts...), logger)) err = kern.LoadExecutionOptionsFromConfig(testConfig.Execution) if err != nil { @@ -189,12 +183,14 @@ func TestGenesisDoc(addressables []*acm.PrivateAccount, vals ...int) *genesis.Ge for _, i := range vals { name := fmt.Sprintf("user_%d", i) validators[name] = validator.FromAccount(accounts[name], 1<<16) + // Tendermint validators use a different addressing scheme for secp256k1 + accounts[name].Address = validators[name].GetAddress() } return genesis.MakeGenesisDocFromAccounts(ChainName, nil, genesisTime, accounts, validators) } -// Deterministic account generation helper. Pass number of accounts to make +// Default deterministic account generation helper, pass number of accounts to make func MakePrivateAccounts(sec string, n int) []*acm.PrivateAccount { accounts := make([]*acm.PrivateAccount, n) for i := 0; i < n; i++ { @@ -203,6 +199,14 @@ func MakePrivateAccounts(sec string, n int) []*acm.PrivateAccount { return accounts } +func MakeEthereumAccounts(sec string, n int) []*acm.PrivateAccount { + accounts := make([]*acm.PrivateAccount, n) + for i := 0; i < n; i++ { + accounts[i] = acm.GenerateEthereumAccountFromSecret(sec + strconv.Itoa(i)) + } + return accounts +} + func Shutdown(kern *core.Kernel) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() diff --git a/integration/keys/keys_server_test.go b/integration/keys/keys_server_test.go index 9efa20872..5c23f4b4d 100644 --- a/integration/keys/keys_server_test.go +++ b/integration/keys/keys_server_test.go @@ -6,13 +6,14 @@ import ( "testing" "time" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" + "github.com/hyperledger/burrow/integration" "github.com/hyperledger/burrow/keys" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "google.golang.org/grpc" ) type hashInfo struct { @@ -35,7 +36,7 @@ func TestKeysServer(t *testing.T) { "sha256": {"hi", "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4"}, "ripemd160": {"hi", "242485AB6BFD3502BCB3442EA2E211687B8E4D89"}, } - conn, err := grpc.Dial(address, grpc.WithInsecure()) + conn, err := encoding.GRPCDial(address) require.NoError(t, err) cli := keys.NewKeysClient(conn) @@ -75,7 +76,8 @@ func TestKeysServer(t *testing.T) { resp, err := cli.PublicKey(ctx, &keys.PubRequest{Address: addr}) require.NoError(t, err) - hash := sha3.Sha3([]byte("the hash of something!")) + msg := []byte("the hash of something!") + hash := crypto.Keccak256(msg) sig, err := cli.Sign(ctx, &keys.SignRequest{Address: addr, Message: hash}) require.NoError(t, err) diff --git a/integration/rpcevents/execution_events_server_test.go b/integration/rpcevents/execution_events_server_test.go index cb6289011..470c9c0ae 100644 --- a/integration/rpcevents/execution_events_server_test.go +++ b/integration/rpcevents/execution_events_server_test.go @@ -1,19 +1,8 @@ // +build integration // Space above here matters -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpcevents @@ -130,7 +119,7 @@ func TestExecutionEventsTest(t *testing.T) { blocks = append(blocks, be) assert.Contains(t, strconv.FormatUint(be.Height, 10), "2") return nil - }) + }, exec.NonConsecutiveBlocks|exec.NonConsecutiveTxs) require.Equal(t, io.EOF, err) require.Len(t, blocks, 2, "should record blocks 2 and 12") assert.Equal(t, uint64(2), blocks[0].Height) @@ -176,7 +165,7 @@ func TestExecutionEventsTest(t *testing.T) { }) t.Run("Revert", func(t *testing.T) { - txe, err := rpctest.CreateContract(tcli, inputAddress0, solidity.Bytecode_Revert, nil) + txe, err := rpctest.CreateEVMContract(tcli, inputAddress0, solidity.Bytecode_Revert, nil) require.NoError(t, err) spec, err := abi.ReadSpec(solidity.Abi_Revert) require.NoError(t, err) @@ -185,7 +174,7 @@ func TestExecutionEventsTest(t *testing.T) { contractAddress := txe.Receipt.ContractAddress txe, err = rpctest.CallContract(tcli, inputAddress0, contractAddress, data) require.NoError(t, err) - assert.Equal(t, errors.ErrorCodeExecutionReverted, txe.Exception.Code) + assert.Equal(t, errors.Codes.ExecutionReverted, errors.GetCode(txe.Exception)) assert.Contains(t, txe.Exception.Error(), "I have reverted") request := &rpcevents.BlocksRequest{ diff --git a/integration/rpcinfo/info_server_test.go b/integration/rpcinfo/info_server_test.go index 06bc695b7..1c216fbd9 100644 --- a/integration/rpcinfo/info_server_test.go +++ b/integration/rpcinfo/info_server_test.go @@ -1,19 +1,8 @@ // +build integration // Space above here matters -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpcinfo @@ -24,18 +13,20 @@ import ( "testing" "time" + "github.com/hyperledger/burrow/rpc" + "github.com/hyperledger/burrow/rpc/lib/jsonrpc" + + tmjson "github.com/tendermint/tendermint/libs/json" + "github.com/hyperledger/burrow/integration" "github.com/hyperledger/burrow/txs/payload" "github.com/hyperledger/burrow/core" - "github.com/hyperledger/burrow/rpc/lib/client" - "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/event" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/integration/rpctest" - "github.com/hyperledger/burrow/rpc" "github.com/hyperledger/burrow/rpc/rpcinfo/infoclient" "github.com/hyperledger/burrow/rpc/rpctransact" "github.com/hyperledger/burrow/txs" @@ -50,10 +41,10 @@ func TestInfoServer(t *testing.T) { kern, shutdown := integration.RunNode(t, rpctest.GenesisDoc, rpctest.PrivateAccounts) defer shutdown() inputAddress := rpctest.PrivateAccounts[0].GetAddress() - infoAddress := kern.InfoListenAddress().String() - var clients = map[string]infoclient.RPCClient{ - "JSON RPC": client.NewJSONRPCClient(infoAddress), - "URI": client.NewURIClient(infoAddress), + infoAddress := "http://" + kern.InfoListenAddress().String() + var clients = map[string]rpc.Client{ + "JSON RPC": jsonrpc.NewClient(infoAddress), + "URI": jsonrpc.NewURIClient(infoAddress), } cli := rpctest.NewTransactClient(t, kern.GRPCListenAddress().String()) for clientName, rpcClient := range clients { @@ -63,7 +54,7 @@ func TestInfoServer(t *testing.T) { resp, err := infoclient.Status(rpcClient) require.NoError(t, err) assert.Contains(t, resp.GetNodeInfo().GetMoniker(), "node") - assert.Equal(t, rpctest.GenesisDoc.ChainID(), resp.NodeInfo.Network, + assert.Equal(t, rpctest.GenesisDoc.GetChainID(), resp.NodeInfo.Network, "ChainID should match NodeInfo.Network") }) @@ -223,9 +214,8 @@ func TestInfoServer(t *testing.T) { bs, err := json.Marshal(rawMap) require.NoError(t, err) - cdc := rpc.NewAminoCodec() rs := new(ctypes.RoundState) - err = cdc.UnmarshalJSON(bs, rs) + err = tmjson.Unmarshal(bs, rs) require.NoError(t, err) assert.Equal(t, rs.Validators.Validators[0].Address, rs.Validators.Proposer.Address) diff --git a/integration/rpcquery/query_server_test.go b/integration/rpcquery/query_server_test.go index 5bf6e1fee..4914c2ad1 100644 --- a/integration/rpcquery/query_server_test.go +++ b/integration/rpcquery/query_server_test.go @@ -31,7 +31,7 @@ func TestQueryServer(t *testing.T) { status, err := cli.Status(context.Background(), &rpcquery.StatusParam{}) require.NoError(t, err) assert.Equal(t, rpctest.PrivateAccounts[0].GetPublicKey(), status.ValidatorInfo.PublicKey) - assert.Equal(t, rpctest.GenesisDoc.ChainID(), status.ChainID) + assert.Equal(t, rpctest.GenesisDoc.GetChainID(), status.ChainID) for i := 0; i < 3; i++ { // Unless we get lucky this is an error _, err = cli.Status(context.Background(), &rpcquery.StatusParam{ diff --git a/integration/rpctest/helpers.go b/integration/rpctest/helpers.go index b68603a01..dc9064a58 100644 --- a/integration/rpctest/helpers.go +++ b/integration/rpctest/helpers.go @@ -4,9 +4,11 @@ import ( "context" "testing" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/acm" "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/crypto/sha3" + _ "github.com/hyperledger/burrow/encoding" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/execution/names" "github.com/hyperledger/burrow/integration" @@ -18,7 +20,7 @@ import ( "github.com/hyperledger/burrow/txs" "github.com/hyperledger/burrow/txs/payload" "github.com/stretchr/testify/require" - "google.golang.org/grpc" + "golang.org/x/crypto/sha3" ) // Recursive call count for UpsieDownsie() function call from strange_loop.sol @@ -31,19 +33,19 @@ var GenesisDoc = integration.TestGenesisDoc(PrivateAccounts, 0) // Helpers func NewTransactClient(t testing.TB, listenAddress string) rpctransact.TransactClient { - conn, err := grpc.Dial(listenAddress, grpc.WithInsecure()) + conn, err := encoding.GRPCDial(listenAddress) require.NoError(t, err) return rpctransact.NewTransactClient(conn) } func NewExecutionEventsClient(t testing.TB, listenAddress string) rpcevents.ExecutionEventsClient { - conn, err := grpc.Dial(listenAddress, grpc.WithInsecure()) + conn, err := encoding.GRPCDial(listenAddress) require.NoError(t, err) return rpcevents.NewExecutionEventsClient(conn) } func NewQueryClient(t testing.TB, listenAddress string) rpcquery.QueryClient { - conn, err := grpc.Dial(listenAddress, grpc.WithInsecure()) + conn, err := encoding.GRPCDial(listenAddress) require.NoError(t, err) return rpcquery.NewQueryClient(conn) } @@ -53,13 +55,13 @@ type MetadataMap struct { Abi []byte } -func CreateContract(cli rpctransact.TransactClient, inputAddress crypto.Address, bytecode []byte, metamap []MetadataMap) (*exec.TxExecution, error) { +func CreateEVMContract(cli rpctransact.TransactClient, inputAddress crypto.Address, bytecode []byte, metamap []MetadataMap) (*exec.TxExecution, error) { var meta []*payload.ContractMeta if metamap != nil { meta = make([]*payload.ContractMeta, len(metamap)) for i, m := range metamap { - hash := sha3.NewKeccak256() - hash.Write([]byte(m.DeployedCode)) + hash := sha3.NewLegacyKeccak256() + hash.Write(m.DeployedCode) meta[i] = &payload.ContractMeta{ CodeHash: hash.Sum(nil), Meta: string(m.Abi), @@ -84,6 +86,37 @@ func CreateContract(cli rpctransact.TransactClient, inputAddress crypto.Address, return txe, nil } +func CreateWASMContract(cli rpctransact.TransactClient, inputAddress crypto.Address, bytecode []byte, metamap []MetadataMap) (*exec.TxExecution, error) { + var meta []*payload.ContractMeta + if metamap != nil { + meta = make([]*payload.ContractMeta, len(metamap)) + for i, m := range metamap { + hash := sha3.NewLegacyKeccak256() + hash.Write(m.DeployedCode) + meta[i] = &payload.ContractMeta{ + CodeHash: hash.Sum(nil), + Meta: string(m.Abi), + } + } + } + + txe, err := cli.CallTxSync(context.Background(), &payload.CallTx{ + Input: &payload.TxInput{ + Address: inputAddress, + Amount: 2, + }, + Address: nil, + WASM: bytecode, + Fee: 2, + GasLimit: 10000, + ContractMeta: meta, + }) + if err != nil { + return nil, err + } + return txe, nil +} + func CallContract(cli rpctransact.TransactClient, inputAddress, contractAddress crypto.Address, data []byte) (*exec.TxExecution, error) { txe, err := cli.CallTxSync(context.Background(), &payload.CallTx{ Input: &payload.TxInput{ @@ -117,11 +150,11 @@ func UpdateName(cli rpctransact.TransactClient, inputAddress crypto.Address, nam //------------------------------------------------------------------------------- // some default transaction functions -func MakeDefaultCallTx(t *testing.T, client infoclient.RPCClient, addr *crypto.Address, code []byte, amt, gasLim, +func MakeDefaultCallTx(t *testing.T, client rpc.Client, addr *crypto.Address, code []byte, amt, gasLim, fee uint64) *txs.Envelope { sequence := GetSequence(t, client, PrivateAccounts[0].GetAddress()) tx := payload.NewCallTxWithSequence(PrivateAccounts[0].GetPublicKey(), addr, code, amt, gasLim, fee, sequence+1) - txEnv := txs.Enclose(GenesisDoc.ChainID(), tx) + txEnv := txs.Enclose(GenesisDoc.GetChainID(), tx) require.NoError(t, txEnv.Sign(PrivateAccounts[0])) return txEnv } @@ -130,7 +163,7 @@ func MakeDefaultCallTx(t *testing.T, client infoclient.RPCClient, addr *crypto.A // rpc call wrappers (fail on err) // get an account's sequence number -func GetSequence(t *testing.T, client infoclient.RPCClient, addr crypto.Address) uint64 { +func GetSequence(t *testing.T, client rpc.Client, addr crypto.Address) uint64 { acc, err := infoclient.Account(client, addr) if err != nil { t.Fatal(err) @@ -142,7 +175,7 @@ func GetSequence(t *testing.T, client infoclient.RPCClient, addr crypto.Address) } // get the account -func GetAccount(t *testing.T, client infoclient.RPCClient, addr crypto.Address) *acm.Account { +func GetAccount(t *testing.T, client rpc.Client, addr crypto.Address) *acm.Account { ac, err := infoclient.Account(client, addr) if err != nil { t.Fatal(err) @@ -151,7 +184,7 @@ func GetAccount(t *testing.T, client infoclient.RPCClient, addr crypto.Address) } // dump all storage for an account. currently unused -func DumpStorage(t *testing.T, client infoclient.RPCClient, addr crypto.Address) *rpc.ResultDumpStorage { +func DumpStorage(t *testing.T, client rpc.Client, addr crypto.Address) *rpc.ResultDumpStorage { resp, err := infoclient.DumpStorage(client, addr) if err != nil { t.Fatal(err) @@ -159,7 +192,7 @@ func DumpStorage(t *testing.T, client infoclient.RPCClient, addr crypto.Address) return resp } -func GetStorage(t *testing.T, client infoclient.RPCClient, addr crypto.Address, key []byte) []byte { +func GetStorage(t *testing.T, client rpc.Client, addr crypto.Address, key []byte) []byte { resp, err := infoclient.Storage(client, addr, key) if err != nil { t.Fatal(err) diff --git a/integration/rpctransact/call_test.go b/integration/rpctransact/call_test.go index a040f87d9..9323785e7 100644 --- a/integration/rpctransact/call_test.go +++ b/integration/rpctransact/call_test.go @@ -10,9 +10,9 @@ import ( "sync" "testing" - "github.com/hyperledger/burrow/crypto/sha3" "github.com/hyperledger/burrow/execution/errors" "github.com/hyperledger/burrow/execution/evm/abi" + "golang.org/x/crypto/sha3" "github.com/hyperledger/burrow/integration" @@ -140,7 +140,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) go func() { defer wg.Done() for j := 0; j < numRuns; j++ { - createTxe, err := rpctest.CreateContract(cli, inputAddress, solidity.Bytecode_StrangeLoop, nil) + createTxe, err := rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_StrangeLoop, nil) if err != nil { errCh <- err return @@ -280,7 +280,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) t.Run("CallEvents", func(t *testing.T) { t.Parallel() - createTxe, err := rpctest.CreateContract(cli, inputAddress, solidity.Bytecode_StrangeLoop, nil) + createTxe, err := rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_StrangeLoop, nil) require.NoError(t, err) address := lastCall(createTxe.Events).CallData.Callee spec, err := abi.ReadSpec(solidity.Abi_StrangeLoop) @@ -299,7 +299,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) t.Run("DeployAbis", func(t *testing.T) { t.Parallel() - createTxe, err := rpctest.CreateContract(cli, inputAddress, solidity.Bytecode_A, []rpctest.MetadataMap{ + createTxe, err := rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_A, []rpctest.MetadataMap{ {DeployedCode: solidity.DeployedBytecode_A, Abi: solidity.Abi_A}, {DeployedCode: solidity.DeployedBytecode_B, Abi: solidity.Abi_B}, {DeployedCode: solidity.DeployedBytecode_C, Abi: solidity.Abi_C}, @@ -310,7 +310,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) qcli := rpctest.NewQueryClient(t, kern.GRPCListenAddress().String()) res, err := qcli.GetMetadata(context.Background(), &rpcquery.GetMetadataParam{Address: &addressA}) require.NoError(t, err) - assert.Equal(t, res.Metadata, string(solidity.Abi_A)) + assert.Equal(t, string(solidity.Abi_A), res.Metadata) // CreateB spec, err := abi.ReadSpec(solidity.Abi_A) require.NoError(t, err) @@ -323,7 +323,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) // check ABI for contract B res, err = qcli.GetMetadata(context.Background(), &rpcquery.GetMetadataParam{Address: &addressB}) require.NoError(t, err) - assert.Equal(t, res.Metadata, string(solidity.Abi_B)) + assert.Equal(t, string(solidity.Abi_B), res.Metadata) // CreateC spec, err = abi.ReadSpec(solidity.Abi_B) require.NoError(t, err) @@ -336,13 +336,13 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) // check abi for contract C res, err = qcli.GetMetadata(context.Background(), &rpcquery.GetMetadataParam{Address: &addressC}) require.NoError(t, err) - assert.Equal(t, res.Metadata, string(solidity.Abi_C)) + assert.Equal(t, string(solidity.Abi_C), res.Metadata) return }) t.Run("LogEvents", func(t *testing.T) { t.Parallel() - createTxe, err := rpctest.CreateContract(cli, inputAddress, solidity.Bytecode_StrangeLoop, nil) + createTxe, err := rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_StrangeLoop, nil) require.NoError(t, err) address := lastCall(createTxe.Events).CallData.Callee spec, err := abi.ReadSpec(solidity.Abi_StrangeLoop) @@ -357,7 +357,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) var direction string var depth int64 evAbi := spec.EventsByName["ChangeLevel"] - err = abi.UnpackEvent(&evAbi, log.Topics, log.Data, &direction, &depth) + err = abi.UnpackEvent(evAbi, log.Topics, log.Data, &direction, &depth) require.NoError(t, err) assert.Equal(t, evAbi.ID.Bytes(), log.Topics[0].Bytes()) assert.Equal(t, int64(18), depth) @@ -367,7 +367,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) t.Run("EventEmitter", func(t *testing.T) { t.Parallel() - createTxe, err := rpctest.CreateContract(cli, inputAddress, solidity.Bytecode_EventEmitter, nil) + createTxe, err := rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_EventEmitter, nil) require.NoError(t, err) address := lastCall(createTxe.Events).CallData.Callee spec, err := abi.ReadSpec(solidity.Abi_EventEmitter) @@ -382,10 +382,10 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) data := abi.GetPackingTypes(evAbi.Inputs) // Check signature assert.Equal(t, evAbi.ID.Bytes(), log.Topics[0].Bytes()) - err = abi.UnpackEvent(&evAbi, log.Topics, log.Data.Bytes(), data...) + err = abi.UnpackEvent(evAbi, log.Topics, log.Data.Bytes(), data...) require.NoError(t, err) - h := sha3.NewKeccak256() + h := sha3.NewLegacyKeccak256() h.Write([]byte("hash")) expectedHash := h.Sum(nil) // "Downsie!", true, "Donaudampfschifffahrtselektrizitätenhauptbetriebswerkbauunterbeamtengesellschaft", 102, 42, 'hash') @@ -406,7 +406,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) * Any indexed string (or dynamic array) will be hashed, so we might want to store strings * in bytes32. This shows how we would automatically map this to string */ - createTxe, err := rpctest.CreateContract(cli, inputAddress, solidity.Bytecode_EventEmitter, nil) + createTxe, err := rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_EventEmitter, nil) require.NoError(t, err) address := lastCall(createTxe.Events).CallData.Callee spec, err := abi.ReadSpec(solidity.Abi_EventEmitter) @@ -424,10 +424,10 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) data[i] = new(string) } } - err = abi.UnpackEvent(&evAbi, log.Topics, log.Data.Bytes(), data...) + err = abi.UnpackEvent(evAbi, log.Topics, log.Data.Bytes(), data...) require.NoError(t, err) - h := sha3.NewKeccak256() + h := sha3.NewLegacyKeccak256() h.Write([]byte("hash")) expectedHash := h.Sum(nil) // "Downsie!", true, "Donaudampfschifffahrtselektrizitätenhauptbetriebswerkbauunterbeamtengesellschaft", 102, 42, 'hash') @@ -442,7 +442,7 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) t.Run("Revert", func(t *testing.T) { t.Parallel() - txe, err := rpctest.CreateContract(cli, inputAddress, solidity.Bytecode_Revert, nil) + txe, err := rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_Revert, nil) require.NoError(t, err) spec, err := abi.ReadSpec(solidity.Abi_Revert) require.NoError(t, err) @@ -450,16 +450,17 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) require.NoError(t, err) txe, err = rpctest.CallContract(cli, inputAddress, txe.Receipt.ContractAddress, data) require.NoError(t, err) - assert.Equal(t, errors.ErrorCodeExecutionReverted, txe.Exception.Code) + assert.Equal(t, errors.Codes.ExecutionReverted, errors.GetCode(txe.Exception)) revertReason, err := abi.UnpackRevert(txe.Result.Return) require.NoError(t, err) + require.NotNil(t, revertReason) assert.Equal(t, *revertReason, "I have reverted") return }) t.Run("RevertWithoutReason", func(t *testing.T) { t.Parallel() - txe, err := rpctest.CreateContract(cli, inputAddress, solidity.Bytecode_Revert, nil) + txe, err := rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_Revert, nil) require.NoError(t, err) spec, err := abi.ReadSpec(solidity.Abi_Revert) require.NoError(t, err) @@ -467,12 +468,146 @@ func testCallTx(t *testing.T, kern *core.Kernel, cli rpctransact.TransactClient) require.NoError(t, err) txe, err = rpctest.CallContract(cli, inputAddress, txe.Receipt.ContractAddress, data) require.NoError(t, err) - assert.Equal(t, errors.ErrorCodeExecutionReverted, txe.Exception.Code) + assert.Equal(t, errors.Codes.ExecutionReverted, errors.GetCode(txe.Exception)) revertReason, err := abi.UnpackRevert(txe.Result.Return) require.NoError(t, err) assert.Nil(t, revertReason) return }) + + t.Run("SimpleWasm", func(t *testing.T) { + t.Parallel() + txe, err := rpctest.CreateWASMContract(cli, inputAddress, solidity.Bytecode_ewasm, nil) + require.NoError(t, err) + spec, err := abi.ReadSpec(solidity.Abi_ewasm) + require.NoError(t, err) + data, _, err := spec.Pack("get_number") + require.NoError(t, err) + txe, err = rpctest.CallContract(cli, inputAddress, txe.Receipt.ContractAddress, data) + require.NoError(t, err) + var number int64 + err = spec.Unpack(txe.Result.Return, "get_number", &number) + require.NoError(t, err) + assert.Equal(t, number, int64(54321)) + return + }) + + t.Run("WasmRevertWithoutReason", func(t *testing.T) { + t.Parallel() + txe, err := rpctest.CreateWASMContract(cli, inputAddress, solidity.Bytecode_ewasm, nil) + require.NoError(t, err) + spec, err := abi.ReadSpec(solidity.Abi_ewasm) + require.NoError(t, err) + data, _, err := spec.Pack("try_revert") + require.NoError(t, err) + txe, err = rpctest.CallContract(cli, inputAddress, txe.Receipt.ContractAddress, data) + require.NoError(t, err) + assert.Equal(t, errors.Codes.ExecutionReverted, errors.GetCode(txe.Exception)) + revertReason, err := abi.UnpackRevert(txe.Result.Return) + require.NoError(t, err) + assert.Nil(t, revertReason) + return + }) + + t.Run("WasmCallEvm", func(t *testing.T) { + t.Parallel() + txe, err := rpctest.CreateWASMContract(cli, inputAddress, solidity.Bytecode_ewasm, nil) + require.NoError(t, err) + wasmContract := txe.Receipt.ContractAddress + txe, err = rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_evm, nil) + require.NoError(t, err) + evmContract := txe.Receipt.ContractAddress + spec, err := abi.ReadSpec(solidity.Abi_ewasm) + require.NoError(t, err) + data, _, err := spec.Pack("call_get_vm", evmContract) + require.NoError(t, err) + txe, err = rpctest.CallContract(cli, inputAddress, wasmContract, data) + require.NoError(t, err) + var res string + err = spec.Unpack(txe.Result.Return, "call_get_vm", &res) + require.NoError(t, err) + assert.Equal(t, res, "ewasm called evm") + return + }) + + t.Run("EvmCallWasm", func(t *testing.T) { + t.Parallel() + txe, err := rpctest.CreateWASMContract(cli, inputAddress, solidity.Bytecode_ewasm, nil) + require.NoError(t, err) + wasmContract := txe.Receipt.ContractAddress + txe, err = rpctest.CreateEVMContract(cli, inputAddress, solidity.Bytecode_evm, nil) + require.NoError(t, err) + evmContract := txe.Receipt.ContractAddress + spec, err := abi.ReadSpec(solidity.Abi_evm) + require.NoError(t, err) + data, _, err := spec.Pack("call_get_vm", wasmContract) + require.NoError(t, err) + txe, err = rpctest.CallContract(cli, inputAddress, evmContract, data) + require.NoError(t, err) + var res string + err = spec.Unpack(txe.Result.Return, "call_get_vm", &res) + require.NoError(t, err) + assert.Equal(t, res, "evm called ewasm") + return + }) + + t.Run("WasmHashPrecompiles", func(t *testing.T) { + t.Parallel() + txe, err := rpctest.CreateWASMContract(cli, inputAddress, solidity.Bytecode_ewasm, nil) + require.NoError(t, err) + wasmContract := txe.Receipt.ContractAddress + spec, err := abi.ReadSpec(solidity.Abi_ewasm) + require.NoError(t, err) + data, _, err := spec.Pack("hash_tests", wasmContract) + require.NoError(t, err) + txe, err = rpctest.CallContract(cli, inputAddress, wasmContract, data) + require.NoError(t, err) + return + }) + + t.Run("WasmLogEvents", func(t *testing.T) { + t.Parallel() + createTxe, err := rpctest.CreateWASMContract(cli, inputAddress, solidity.Bytecode_ewasm, nil) + require.NoError(t, err) + address := lastCall(createTxe.Events).CallData.Callee + spec, err := abi.ReadSpec(solidity.Abi_ewasm) + require.NoError(t, err) + data, _, err := spec.Pack("test_events") + require.NoError(t, err) + callTxe, err := rpctest.CallContract(cli, inputAddress, address, data) + require.NoError(t, err) + evs := filterLogs(callTxe.Events) + require.Len(t, evs, 1) + log := evs[0] + var f1 int64 + var f2 string + var f3 bool + evAbi := spec.EventsByName["L"] + err = abi.UnpackEvent(evAbi, log.Topics, log.Data, &f1, &f2, &f3) + require.NoError(t, err) + assert.Equal(t, evAbi.ID.Bytes(), log.Topics[0].Bytes()) + assert.Equal(t, int64(102), f1) + assert.Equal(t, "Hello from wasm", f2) + assert.Equal(t, true, f3) + return + }) + + t.Run("WasmPrint", func(t *testing.T) { + t.Parallel() + createTxe, err := rpctest.CreateWASMContract(cli, inputAddress, solidity.Bytecode_ewasm, nil) + require.NoError(t, err) + address := lastCall(createTxe.Events).CallData.Callee + spec, err := abi.ReadSpec(solidity.Abi_ewasm) + require.NoError(t, err) + data, _, err := spec.Pack("test_print", 102, "Fishy") + require.NoError(t, err) + callTxe, err := rpctest.CallContract(cli, inputAddress, address, data) + require.NoError(t, err) + evs := filterPrint(callTxe.Events) + require.Len(t, evs, 1) + assert.Equal(t, string(evs[0].Data), "arg1:102 arg2:Fishy") + return + }) }) } @@ -516,6 +651,16 @@ func filterLogs(evs []*exec.Event) []*exec.LogEvent { return logEvs } +func filterPrint(evs []*exec.Event) []*exec.PrintEvent { + var printEvs []*exec.PrintEvent + for _, ev := range evs { + if ev.Print != nil { + printEvs = append(printEvs, ev.Print) + } + } + return printEvs +} + func lastCall(evs []*exec.Event) *exec.CallEvent { callEvs := filterCalls(evs) return callEvs[len(callEvs)-1] diff --git a/integration/rpctransact/transact_server_test.go b/integration/rpctransact/transact_server_test.go index 7c41e409e..826a4cdef 100644 --- a/integration/rpctransact/transact_server_test.go +++ b/integration/rpctransact/transact_server_test.go @@ -1,19 +1,8 @@ // +build integration // Space above here matters -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpctransact @@ -53,10 +42,10 @@ func TestTransactServer(t *testing.T) { require.NoError(t, err) // Account PublicKey should be initially unset - assert.False(t, acc.PublicKey.IsSet()) + assert.False(t, acc.GetPublicKey().IsSet()) // Sign with this account - should set public key - _, err = rpctest.CreateContract(tcli, input.GetAddress(), solidity.Bytecode_StrangeLoop, nil) + _, err = rpctest.CreateEVMContract(tcli, input.GetAddress(), solidity.Bytecode_StrangeLoop, nil) require.NoError(t, err) acc, err = qcli.GetAccount(context.Background(), &rpcquery.GetAccountParam{Address: input.GetAddress()}) @@ -73,7 +62,7 @@ func TestTransactServer(t *testing.T) { }) require.NoError(t, err) amount := uint64(2123) - txEnv := txs.Enclose(rpctest.GenesisDoc.ChainID(), &payload.SendTx{ + txEnv := txs.Enclose(rpctest.GenesisDoc.GetChainID(), &payload.SendTx{ Inputs: []*payload.TxInput{{ Address: inputAddress, Sequence: acc.Sequence + 1, @@ -131,7 +120,7 @@ func TestTransactServer(t *testing.T) { // We should see the sign bytes embedded if !assert.Contains(t, string(bs), fmt.Sprintf("{\"ChainID\":\"%s\",\"Type\":\"CallTx\","+ "\"Payload\":{\"Input\":{\"Address\":\"E80BB91C2F0F4C3C39FC53E89BF8416B219BE6E4\",\"Amount\":230},"+ - "\"Data\":\"0203060403\"}}", rpctest.GenesisDoc.ChainID())) { + "\"Data\":\"0203060403\"}}", rpctest.GenesisDoc.GetChainID())) { fmt.Println(string(bs)) } }) diff --git a/js/README.md b/js/README.md index ca5e17f47..0a21a44b4 100644 --- a/js/README.md +++ b/js/README.md @@ -1,13 +1,7 @@ -# @monax/burrow (Alpha) +# @hyperledger/burrow -This is a JavaScript API for communicating with a [Hyperledger Burrow](https://github.com/hyperledger/burrow) server, which implements the GRPC spec. - -[![npm version][npm-image]][npm-url] - -## New Library - -Previously our client libs were broken into two components `@monax/legacy-db.js` and `@monax/legacy-contract.js`. These have both been replaced by this library `@monax/burrow`. This upgrade was part of a major re-write on the back-end and as such ONLY `@monax/burrow` SHOULD BE USED WITH BURROW VERSIONS GREATER THAN 0.20.0. There is NO BACKWARDS COMPATIBILITY of this lib with versions of burrow less than 0.20.0. There will be a short guide below for upgrading existing applications to new burrow versions. +This is a TypeScript API for communicating with a [Hyperledger Burrow](https://github.com/hyperledger/burrow) server, which implements the GRPC spec. ## Version compatibility -This lib's version is pegged to burrow's version on the minor. So @monax/burrow at version X.Y.^ will work with burrow version X.Y.^ where ^ means latest patch version. The patch version numbering will not always correspond. If you are having difficulties getting this lib to work with a burrow release please first make sure you have the latest patch version of each. \ No newline at end of file +This lib's version is pegged to burrow's version on the minor. So @hyperledger/burrow at version X.Y.^ will work with burrow version X.Y.^ where ^ means latest patch version. The patch version numbering will not always correspond. If you are having difficulties getting this lib to work with a burrow release please first make sure you have the latest patch version of each. diff --git a/js/index.js b/js/index.js deleted file mode 100644 index c47f3410e..000000000 --- a/js/index.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @file index.js - * @fileOverview Index file for the Burrow javascript API. This file contains a factory method - * for creating a new Burrow instance. - * @author Andreas Olofsson - * @module index - */ -'use strict' - -var Burrow = require('./lib/Burrow') -var utils = require('./lib/utils/utils') - -module.exports = { - createInstance: Burrow.createInstance, - Burrow: Burrow, - utils: utils -} diff --git a/js/lib/Burrow.js b/js/lib/Burrow.js deleted file mode 100644 index 7b1606c38..000000000 --- a/js/lib/Burrow.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file Burrow.js - * @fileOverview Factory module for the Burrow class. - * @author Dennis Mckinnon - * @module Burrow - */ - -'use strict' - -var Service = require('./service') -var events = require('./events.js') - -var Pipe = require('./pipe') -var ContractManager = require('./contractManager') -var Namereg = require('./namereg') - -/** - * Create a new instance of the Burrow class. - * - * @param {string} URL - URL of Burrow instance. - * @returns {Burrow} - A new instance of the Burrow class. - */ -exports.createInstance = function (URL, account, options) { - URL = (typeof URL === 'string' ? URL : URL.host + ':' + URL.port) - return new Burrow(URL, account, options) -} - -/** - * The main class. - * - * @param {string} URL - URL of Burrow instance. - * @constructor - */ -function Burrow (URL, account, options) { - this.URL = URL - this.tag = options.tag - - if (!account) { - this.readonly = true - this.account = null - } else { - this.readonly = false - this.account = account - } - - this.executionEvents = Service('rpcevents.proto', 'rpcevents', 'ExecutionEvents', URL) - - this.transact = Service('rpctransact.proto', 'rpctransact', 'Transact', URL) - this.query = Service('rpcquery.proto', 'rpcquery', 'Query', URL) - - // This is the execution events streaming service running on top of the raw streaming function. - this.events = events(this) - - // Contracts stuff running on top of grpc - this.pipe = new Pipe(this) - this.contracts = new ContractManager(this, options) - - this.namereg = new Namereg(this) -} diff --git a/js/lib/contractManager.js b/js/lib/contractManager.js deleted file mode 100644 index 3c6b60f59..000000000 --- a/js/lib/contractManager.js +++ /dev/null @@ -1,112 +0,0 @@ -/** - * @file contractManager.js - * @author Dennis Mckinnon - * @date 2018 - * @module contracts - */ - -var Contract = require('./contracts/contract') - -var defaultHandlers = { - call: function (result) { - // console.log(result) - return result.raw - }, - con: function (result) { - // console.log(result) - return result.contractAddress - } -} - -var nullHandler = function (result) { return result } - -function ContractManager (burrow, options) { - options = Object.assign({ objectReturn: false }, options) - var handlers = Object.assign({}, defaultHandlers, options.handlers) - this.burrow = burrow - this.handlers = handlers - - // In the future change the default handler to use nullhandler by default - if (options.objectReturn) { - this.handlers.call = nullHandler - } else { - console.log('DEPRECATION WARNING. In the future the default behaviour of contract calls will be to return the full result object (instead of an array of arguments)') - console.log('If you wish to keep existing behaviour you can recreate it by using a handler function for calls.') - console.log('This can be done by passing {handlers: {call: function(result){return result.raw}} as an option to burrow object creation (new burrow(URL, account, options))') - } -} - -/** - * Should be called to create new contract on a blockchain - * - * @method new - * @param {Object} abi object (required) - * @param {string} byteCode - Hex encoded bytecode of contact - * @param {*} [contract] constructor param1 (optional) - * @param {*} [contract] constructor param2 (optional) - * @param {Function} callback (optional) - * @param {Object} Handlers (optional) - * @returns {Contract} returns a promise if no callback provided - */ -ContractManager.prototype.deploy = function () { - // parse arguments - var callback = null - var handlers = Object.assign({}, this.handlers) - - var args = Array.prototype.slice.call(arguments) - if (args[args.length - 1] instanceof Object) { - handlers = Object.assign(handlers, args.pop()) - } - - if (args[args.length - 1] instanceof Function) { - callback = args.pop() - } - - // TODO just pass in the bytecode and set it don't do this merging - var abi = args.shift() - var byteCode = args.shift() - - var contract = new Contract(abi, null, byteCode, this.burrow, handlers) - var P = contract._constructor.apply(contract, args).then((address) => { contract.address = address; return contract }) - - if (callback) { - P.then((contract) => { return callback(null, contract) }) - .catch((err) => { return callback(err) }) - } else { - return P.then(() => { return contract }) - } -} - -/** - * Creates a contract object interface from an abi - * - * @method new - * @param {Object} abi - abi object for contract - * @param {string} byteCode - Hex encoded bytecode of contact [can be null] - * @param {string} address - default contract address [can be null] - * @returns {Contract} returns contract interface object - */ -ContractManager.prototype.new = function (abi, byteCode, address, handlers) { - handlers = Object.assign({}, this.handlers, handlers) - return new Contract(abi, address, byteCode, this.burrow, handlers) -} - -/** - * Creates a contract object interface from an address without ABI. - * The contract must be deployed using a recent burrow deploy which registers - * metadata. - * - * @method address - * @param {string} address - default contract address [can be null] - * @returns {Contract} returns contract interface object - */ -ContractManager.prototype.address = function (address, handlers) { - handlers = Object.assign({}, this.handlers, handlers) - return this.burrow.query.GetMetadata({ Address: Buffer.from(address, 'hex') }) - .then((data) => { - const abi = JSON.parse(data.Metadata).Abi - return this.burrow.contracts.new(abi, null, address, handlers) - }) -} - -module.exports = ContractManager diff --git a/js/lib/contracts/contract.js b/js/lib/contracts/contract.js deleted file mode 100644 index 8e844003e..000000000 --- a/js/lib/contracts/contract.js +++ /dev/null @@ -1,95 +0,0 @@ -'use strict' - -var SolidityEvent = require('./event') -var SolidityFunction = require('./function') - -/** - * The contract type. This class is instantiated internally through the factory. - * - * @method Contract - * @param {Array} abi - * @param {string} address - * @param {pipe} pipe; - * @param {Function} outputFormatter - the output formatter. - */ -var Contract = function (abi, address, code, burrow, handlers) { - this.address = address - this.abi = abi - this.code = code - this.burrow = burrow - this.handlers = handlers - - addFunctionsToContract(this) - addEventsToContract(this) -} - -/** - * Should be called to add functions to contract object - * - * @method addFunctionsToContract - * @param {Contract} contract - * @param {Array} abi - * TODO - * @param {function} pipe - The pipe (added internally). - * @param {function} outputFormatter - the output formatter (added internally). - */ - -var addFunctionsToContract = function (contract) { - contract.abi.filter(function (json) { - return (json.type === 'function' || json.type === 'constructor') - }).forEach(function (json) { - let {displayName, typeName, call, encode, decode} = SolidityFunction(json) - - if (json.type === 'constructor') { - contract._constructor = call.bind(contract, false, contract.handlers.con, '') - } else { - // bind the function call to the contract, specify if call or transact is desired - var execute = call.bind(contract, json.constant, contract.handlers.call, null) - execute.sim = call.bind(contract, true, contract.handlers.call, null) - // These allow the interface to be used for a generic contract of this type - execute.at = call.bind(contract, json.constant, contract.handlers.call) - execute.atSim = call.bind(contract, true, contract.handlers.call) - - execute.encode = encode.bind(contract) - execute.decode = decode.bind(contract) - - // Attach to the contract object - if (!contract[displayName]) { - contract[displayName] = execute - } - contract[displayName][typeName] = execute - } - }) - - // Not every abi has a constructor specification. - // If it doesn't we force a _constructor with null abi - if (!contract._constructor) { - let {call} = SolidityFunction(null) - contract._constructor = call.bind(contract, false, contract.handlers.con, '') - } -} - -/** - * Should be called to add events to contract object - * - * @method addEventsToContract - * @param {Contract} contract - * @param {Array} abi - */ -var addEventsToContract = function (contract) { - contract.abi.filter(function (json) { - return json.type === 'event' - }).forEach(function (json) { - let {displayName, typeName, call} = SolidityEvent(json) - - var execute = call.bind(contract, null) - execute.once = call.bind(contract, null) - execute.at = call.bind(contract) - if (!contract[displayName]) { - contract[displayName] = execute - } - contract[displayName][typeName] = call.bind(contract) - }) -} - -module.exports = Contract diff --git a/js/lib/contracts/event.js b/js/lib/contracts/event.js deleted file mode 100644 index 04a43493e..000000000 --- a/js/lib/contracts/event.js +++ /dev/null @@ -1,79 +0,0 @@ -var utils = require('../utils/utils') -var coder = require('ethereumjs-abi') -var convert = require('../utils/convert') -var sha3 = require('../utils/sha3') - -/** - * This prototype should be used to create event filters - */ - -var types = function (abi, indexed) { - return abi.inputs.filter(function (i) { - return i.indexed === indexed - }).map(function (i) { - return i.type - }) -} -/** - * Should be used to decode indexed params and options - * - * @method decode - * @param {Object} data - * @return {Object} result object with decoded indexed && not indexed params - */ -var decode = function (abi, data) { - var argTopics = abi.anonymous ? data.Topics : data.Topics.slice(1) - var indexedParamsABI = types(abi, true) - var nonIndexedParamsABI = types(abi, false) - var indexedData = Buffer.concat(argTopics) - var indexedParams = convert.abiToBurrow(indexedParamsABI, coder.rawDecode(indexedParamsABI, indexedData)) - - // var notIndexedData = data.Data.slice(2) - var nonIndexedParams = convert.abiToBurrow(nonIndexedParamsABI, coder.rawDecode(nonIndexedParamsABI, data.Data)) - - // var result = formatters.outputLogFormatter(data); - var result = {} - result.event = utils.transformToFullName(abi) - result.address = data.Address - - result.args = abi.inputs.reduce(function (acc, current) { - acc[current.name] = current.indexed ? indexedParams.shift() : nonIndexedParams.shift() - return acc - }, {}) - - return result -} - -var SolidityEvent = function (abi) { - var name = utils.transformToFullName(abi) - var displayName = utils.extractDisplayName(name) - var typeName = utils.extractTypeName(name) - var signature = sha3(name) - - var call = function (address, callback) { - address = address || this.address - if (!callback) { throw new Error('Can not subscribe to an event without a callback') }; - - return this.burrow.pipe.eventSub(address, signature, (error, event) => { - if (error) return callback(error) - - try { - var decoded = decode(abi, event.Log) - } catch (error) { - return callback(error) - } - - const converted = Object.assign( - {}, - decoded, - {args: decoded.args} - ) - - return callback(null, converted) - }) - } - - return {displayName, typeName, call} -} - -module.exports = SolidityEvent diff --git a/js/lib/contracts/function.js b/js/lib/contracts/function.js deleted file mode 100644 index c44eae642..000000000 --- a/js/lib/contracts/function.js +++ /dev/null @@ -1,192 +0,0 @@ -var utils = require('../utils/utils') -var convert = require('../utils/convert') -// var formatters = require('./formatters'); -var sha3 = require('../utils/sha3') -var coder = require('ethereumjs-abi') - -var config = require('../utils/config') -var ZERO_ADDRESS = Buffer.from('0000000000000000000000000000000000000000', 'hex') - -var functionSig = function (abi) { - var name = utils.transformToFullName(abi) - return sha3(name).slice(0, 8) -} - -var types = function (args) { - return args.map(function (arg) { - return arg.type - }) -} - -var txPayload = function (data, account, address) { - var payload = {} - - payload.Input = {Address: Buffer.from(account || ZERO_ADDRESS, 'hex'), Amount: 0} - payload.Address = address ? Buffer.from(address, 'hex') : null - payload.GasLimit = config.DEFAULT_GAS - payload.Fee = 0 - payload.Data = Buffer.from(data, 'hex') - - return payload -} - -var encodeF = function (abi, args, bytecode) { - if (abi) { - var abiInputs = types(abi.inputs) - args = convert.burrowToAbi(abiInputs, args) // If abi is passed, convert values accordingly - } - - // If bytecode provided then this is a creation call, bytecode goes first - if (bytecode) { - var data = bytecode - if (abi) data += convert.bytesTB(coder.rawEncode(abiInputs, args)) - return data - } else { - return functionSig(abi) + convert.bytesTB(coder.rawEncode(abiInputs, args)) - } -} - -var decodeF = function (abi, output) { - if (!output) { - return - } - - var outputs = abi.outputs - var outputTypes = types(outputs) - - // Decode raw bytes to arguments - var raw = convert.abiToBurrow(outputTypes, coder.rawDecode(outputTypes, Buffer.from(output, 'hex'))) - - // If an object is wanted, - var result = {raw: raw.slice()} - - var args = outputs.reduce(function (acc, current) { - var value = raw.shift() - if (current.name) { - acc[current.name] = value - } - return acc - }, {}) - - result.values = args - - return result -} - -/** - * Calls a contract function. - * - * @method call - * @param {...Object} Contract function arguments - * @param {function} - * @return {String} output bytes - */ -var SolidityFunction = function (abi) { - var isCon = (abi == null || abi.type === 'constructor') - var name - var displayName - var typeName - - if (!isCon) { - name = utils.transformToFullName(abi) - displayName = utils.extractDisplayName(name) - typeName = utils.extractTypeName(name) - } - - // It might seem weird to include copies of the functions in here and above - // My reason is the code above can be used "functionally" whereas this version - // Uses implicit attributes of this object. - // I want to keep them separate in the case that we want to move all the functional - // components together and maybe even... write tests for them (gasp!) - var encode = function () { - var args = Array.prototype.slice.call(arguments) - return encodeF(abi, args, isCon ? this.code : null) - } - - var decode = function (data) { - return decodeF(abi, data, this.objectReturn) - } - - var call = function () { - var args = Array.prototype.slice.call(arguments) - var isSim = args.shift() - var handler = args.shift() || function (result) { return result } - var address = args.shift() || this.address - - if (isCon) { address = null } - - var callback - if (utils.isFunction(args[args.length - 1])) { callback = args.pop() }; - - var self = this - - var P = new Promise(function (resolve, reject) { - if (address == null && !isCon) reject(new Error('Address not provided to call')) - if (abi != null && abi.inputs.length !== args.length) reject(new Error('Insufficient arguments passed to function: ' + (isCon ? 'constructor' : name))) - // Post process the return - var post = function (error, result) { - if (error) return reject(error) - - // Handle execution reversions - if (result.Exception && result.Exception.Code === 16) { - // Decode error message if there is one otherwise default - if (result.Result.Return.length === 0) { - error = new Error('Execution Reverted') - } else { - // Strip first 4 bytes(function signature) the decode as a string - error = new Error(coder.rawDecode(['string'], result.Result.Return.slice(4))[0]) - } - error.code = 'ERR_EXECUTION_REVERT' - return reject(error) - } - - // Unpack return arguments - var returnObj = {} - if (!isCon) { - try { - returnObj = decodeF(abi, result.Result.Return, self.objectReturn) - } catch (e) { - return reject(e) - } - } - - // Meta Data (address, caller, height, etc) - returnObj.contractAddress = result.Receipt.ContractAddress.toString('hex').toUpperCase() - returnObj.height = result.Header.Height - returnObj.index = result.Header.Index - returnObj.hash = result.Header.TxHash.toString('hex').toUpperCase() - returnObj.type = result.Header.TxType - returnObj.result = result.Result - returnObj.tx = result.Envelope - returnObj.caller = convert.recApply(result.Envelope.Signatories, convert.bytesTB) - - return resolve(returnObj) - } - - // Decide if to make a "call" or a "transaction" - // For the moment we need to use the burrowtoweb3 function to prefix bytes with 0x - // otherwise the coder will give an error with bugnumber not a number - // TODO investigate if other libs or an updated lib will fix this - // var data = encodeF(abi, utils.burrowToWeb3(args), isCon ? self.code : null) - var data = encodeF(abi, args, isCon ? self.code : null) - var payload = txPayload(data, self.burrow.account || ZERO_ADDRESS, address) - - if (isSim) { - self.burrow.pipe.call(payload, post) - } else { - self.burrow.pipe.transact(payload, post) - } - }) - - if (callback) { - P.then(handler).then((result) => { return callback(null, result) }) - .catch((err) => { return callback(err) }) - } else { - return P.then(handler) - } - } - - return {displayName, typeName, call, encode, decode} -} - -module.exports = SolidityFunction diff --git a/js/lib/events.js b/js/lib/events.js deleted file mode 100644 index c100cb282..000000000 --- a/js/lib/events.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -function Events (burrow) { - this.burrow = burrow -} - -module.exports = function (burrow) { - return new Events(burrow) -} - -Events.prototype.listen = function (Query, options, callback) { - // TODO Construct blockrange from options - var BlockRange = { - Start: { - Type: 3, - Index: 0 - }, - End: { - Type: 4, - Index: 0 - } - } - - return this.burrow.executionEvents.Events({ BlockRange, Query }, function (err, data) { - if (err) { - return callback(err) - } - for (var i = 0; i < data.Events.length; i++) { - callback(null, data.Events[i]) - }; - }) -} - -Events.prototype.subContractEvents = function (address, signature, options, callback) { - var filter = "EventType = 'LogEvent' AND Address = '" + address.toUpperCase() + "'" + " AND Log0 = '" + signature.toUpperCase() + "'" - return this.listen(filter, {}, callback) -} diff --git a/js/lib/namereg.js b/js/lib/namereg.js deleted file mode 100644 index bacbf6f6b..000000000 --- a/js/lib/namereg.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict' - -function Namereg (burrow) { - this.burrow = burrow -} - -Namereg.prototype.set = function (name, data, lease, callback) { - var payload = {} - payload.Input = { Address: Buffer.from(this.burrow.account, 'hex'), Amount: 50000 } - payload.Name = name - payload.Data = data - payload.Fee = 5000// 1 * lease * (data.length + 32); - return this.burrow.transact.NameTxSync(payload, callback) -} - -Namereg.prototype.get = function (name, callback) { - var payload = { Name: name } - return this.burrow.query.GetName(payload, callback) -} - -module.exports = Namereg diff --git a/js/lib/pipe.js b/js/lib/pipe.js deleted file mode 100644 index bbc272ed8..000000000 --- a/js/lib/pipe.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file dev_pipe.js - * @fileOverview Base class for the dev-pipe. - * @author Andreas Olofsson - * @module pipe/dev_pipe - */ -'use strict' - -/** - * Constructor for the Pipe class. - * - * @type {Pipe} - */ -module.exports = Pipe - -/** - * DevPipe transacts using the unsafe private-key transactions. - * - * @param {*} burrow - the burrow object. - * @param {string} accounts - the private key to use when sending transactions. NOTE: This means a private key - * will be passed over the net, so it should only be used when developing, or if it's 100% certain that the - * Burrow server and this script runs on the same machine, or communication is secure. The recommended way - * will be to call a signing function on the client side, like in a browser plugin. - * - * @constructor - */ -function Pipe (burrow) { - this.burrow = burrow -} - -/** - * Used to send a transaction. - * @param {module:solidity/function~TxPayload} txPayload - The payload object. - * @param callback - The error-first callback. The 'data' param is a contract address in the case of a - * create transactions, otherwise it's the return value. - */ -Pipe.prototype.transact = function (txPayload, callback) { - this.burrow.transact.CallTxSync(txPayload, callback) -} - -/** - * Used to do a call. - * @param {module:solidity/function~TxPayload} txPayload - The payload object. - * @param callback - The error-first callback. - */ -Pipe.prototype.call = function (txPayload, callback) { - this.burrow.transact.CallTxSim(txPayload, callback) -} - -/** - * Used to subscribe to Solidity events from a given account. - * - * @param {string} accountAddress - the address of the account. - * @param {function} createCallback - error-first callback. The data object is the EventSub object. - * @param {function} eventCallback - error-first callback. The data object is a solidity event object. - */ -Pipe.prototype.eventSub = function (accountAddress, signature, callback) { - return this.burrow.events.subContractEvents(accountAddress, signature, {}, callback) -} - -Pipe.prototype.burrow = function () { - return this.burrow -} diff --git a/js/lib/service.js b/js/lib/service.js deleted file mode 100644 index c831cde74..000000000 --- a/js/lib/service.js +++ /dev/null @@ -1,103 +0,0 @@ -'use strict' - -var protoLoader = require('@grpc/proto-loader') -var grpc = require('grpc') -var protobuf = require('protobufjs') -var path = require('path') - -const PROTO_PATH = path.join(__dirname, '../../protobuf/') -const GITHUB_PATH = path.join(PROTO_PATH, 'github.com/') - -const options = { - keepCase: true, - longs: String, - enums: String, - defaults: true, - oneofs: true, - includeDirs: [PROTO_PATH, GITHUB_PATH] -} - -function removeNested (object) { - if (!object) return - - var newObject = {} - - for (var key in object) { - if (key === 'nested') { - return removeNested(object.nested) - } - - if (typeof object[key] === 'object' && object[key].constructor === Object) { - newObject[key] = removeNested(object[key]) - } else { - newObject[key] = object[key] - } - } - return newObject -} - -function wrapGRPC (name) { - return function (params, callback) { - // Fetch requestType and ResponseType - var pName = this.packageName - var sName = this.serviceName - - var reqStream = this.pbJSON[pName][sName].methods[name].requestStream - var resStream = this.pbJSON[pName][sName].methods[name].responseStream - - if (reqStream) { - throw new Error("Can't call a requestStream method") - } - - if (resStream) { - if (!callback) throw new Error('Callback not provided') - - var call = this.client[name](params) - call.on('data', (data) => { - callback(null, data) - }) - call.on('error', (error) => { - callback(error) - }) - // Return a function that will close the stream when called - return () => { - console.log('WARNING: stream closing is not implemented') - } - } else { - // Make call through client - var P = new Promise((resolve, reject) => { - this.client[name](params, function (err, result) { - if (err) return reject(err) - resolve(result) - }) - }) - if (callback) { - return P.then((result) => { callback(null, result) }).catch((err) => { callback(err) }) - } else { - return P - } - } - } -} - -function Service (filePath, packageName, serviceName, URL) { - this.URL = URL - this.packageName = packageName - this.serviceName = serviceName - - filePath = PROTO_PATH + filePath - var protoPackage = protoLoader.loadSync(filePath, options) - - this.service = grpc.loadPackageDefinition(protoPackage) - this.pbJSON = removeNested(protobuf.loadSync(filePath).toJSON()) - - this.client = new this.service[packageName][serviceName](URL, grpc.credentials.createInsecure()) - - for (var method in this.pbJSON[packageName][serviceName].methods) { - this[method] = wrapGRPC(method).bind(this) - } -} - -module.exports = function (file, packageName, serviceName, URL) { - return new Service(file, packageName, serviceName, URL) -} diff --git a/js/lib/test.js b/js/lib/test.js deleted file mode 100644 index d2c8de56e..000000000 --- a/js/lib/test.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict' - -const Burrow = require('..') -const url = require('url') -const Solidity = require('solc') - -const blockchainUrl = (urlObj) => { - var envUrl = {} - if (process.env.BURROW_GRPC_PORT) envUrl.port = process.env.BURROW_GRPC_PORT - if (process.env.BURROW_HOST) envUrl.hostname = process.env.BURROW_HOST - - urlObj = Object.assign({ port: '20997', hostname: '127.0.0.1' }, envUrl, urlObj) - return url.format(urlObj) -} - -// Convenience function to compile Solidity code in tests. -const compile = (source, name) => { - const compiled = Solidity.compile(source, 1) - if (compiled.errors) { - throw new Error(compiled.errors) - } - const contract = compiled.contracts[name] - const abi = JSON.parse(contract.interface) - const bytecode = contract.bytecode - - return { abi, bytecode } -} - -// Return a contract manager in the test harness. -const Test = (options) => { - options = options || {} - const urlString = (typeof options.url === 'string' ? options.url : blockchainUrl(options.url)) - delete options.url - let account - let burrow - - return { - before: (burrowOptions, callback) => - function () { - if (typeof burrowOptions === 'function') { - callback = burrowOptions - burrowOptions = {} - } - if (!burrowOptions) burrowOptions = {} - - try { - account = JSON.parse(process.env.account) - } catch (err) { - return Promise.reject(new Error('Could not parse required account JSON: ' + process.env.account + ' Make sure you are passing a valid account json string as an env var account=\'{accountdata}\'')) - } - - // Options overrules defaults - // burrowOptions = Object.assign(burrowOptions, options) - - burrow = Burrow.createInstance(urlString, account.address, burrowOptions) - - if (callback) { - return callback(burrow) // eslint-disable-line - } - }, - - it: (callback) => - function () { - return callback(burrow) // eslint-disable-line - }, - - after: () => - function () { - } - } -} - -module.exports = { - compile, - Test -} diff --git a/js/lib/utils/config.js b/js/lib/utils/config.js deleted file mode 100644 index 146854965..000000000 --- a/js/lib/utils/config.js +++ /dev/null @@ -1,10 +0,0 @@ - -/** @file config.js - * @author Dennis Mckinnon - * @date 2019 - * @module utils/config - */ - -module.exports = { - DEFAULT_GAS: 1111111111 -} diff --git a/js/lib/utils/convert.js b/js/lib/utils/convert.js deleted file mode 100644 index dfe04cf0b..000000000 --- a/js/lib/utils/convert.js +++ /dev/null @@ -1,84 +0,0 @@ - -var recApply = function (arg, func) { - let newArg - if (Array.isArray(arg)) { - newArg = [] - for (var i = 0; i < arg.length; i++) { - newArg.push(recApply(arg[i], func)) - }; - } else { - newArg = func(arg) - } - return newArg -} - -var addressTB = function (arg) { - return arg.toUpperCase() -} - -var addressTA = function (arg) { - if (!/^0x/i.test(arg)) { - return '0x' + arg - } - return arg -} - -var bytesTB = function (arg) { - return arg.toString('hex').toUpperCase() -} - -var bytesTA = function (arg) { - if (typeof (arg) === 'string' && /^0x/i.test(arg)) { - arg = arg.slice(2) - } - return Buffer.from(arg, 'hex') - // if (!/^0x/i.test(arg)) { - // return '0x' + arg - // } - // return arg -} - -var numberTB = function (arg) { - return arg.toNumber() -} - -var abiToBurrow = function (puts, args) { - var out = [] - for (var i = 0; i < puts.length; i++) { - if (/address/i.test(puts[i])) { - out.push(recApply(args[i], addressTB)) - } else if (/bytes/i.test(puts[i])) { - out.push(recApply(args[i], bytesTB)) - } else if (/int/i.test(puts[i])) { - out.push(recApply(args[i], numberTB)) - } else { - out.push(args[i]) - } - }; - return out -} - -var burrowToAbi = function (puts, args) { - var out = [] - for (var i = 0; i < puts.length; i++) { - if (/address/i.test(puts[i])) { - out.push(recApply(args[i], addressTA)) - } else if (/bytes/i.test(puts[i])) { - out.push(recApply(args[i], bytesTA)) - } else { - out.push(args[i]) - } - }; - return out -} - -module.exports = { - abiToBurrow: abiToBurrow, - burrowToAbi: burrowToAbi, - addressTA: addressTA, - addressTB: addressTB, - bytesTA: bytesTA, - bytesTB: bytesTB, - numberTB: numberTB, - recApply: recApply -} diff --git a/js/lib/utils/sha3.js b/js/lib/utils/sha3.js deleted file mode 100644 index c74ac50b4..000000000 --- a/js/lib/utils/sha3.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @file sha3.js - * @author Marek Kotewicz - * @author Andreas Olofsson - * @date 2015 - * @module utils/sha3 - */ -var utils = require('./utils') -var sha3 = require('crypto-js/sha3') - -module.exports = function (str, isNew) { - if (str.substr(0, 2) === '0x' && !isNew) { - console.warn('requirement of using web3.fromAscii before sha3 is deprecated') - console.warn('new usage: \'web3.sha3("hello")\'') - console.warn('see https://github.com/ethereum/web3.js/pull/205') - console.warn('if you need to hash hex value, you can do \'sha3("0xfff", true)\'') - str = utils.toAscii(str) - } - - return sha3(str, { - outputLength: 256 - }).toString().toUpperCase() -} diff --git a/js/lib/utils/utils.js b/js/lib/utils/utils.js deleted file mode 100644 index 6d79aab36..000000000 --- a/js/lib/utils/utils.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file utils.js - * @author Marek Kotewicz - * @author Andreas Olofsson - * @date 2015 - * @module utils/utils - */ - -/** - * Should be used to create full function/event name from json abi - * - * @method transformToFullName - * @param {Object} json - json-abi - * @return {String} full fnction/event name - */ -var transformToFullName = function (json) { - if (json.name.indexOf('(') !== -1) { - return json.name - } - - var typeName = json.inputs.map(function (i) { - return i.type - }).join() - return json.name + '(' + typeName + ')' -} - -/** - * Should be called to get display name of contract function - * - * @method extractDisplayName - * @param {String} name of function/event - * @returns {String} display name for function/event eg. multiply(uint256) -> multiply - */ -var extractDisplayName = function (name) { - var length = name.indexOf('(') - return length !== -1 ? name.substr(0, length) : name -} - -/** - * - * @param {String} name - the name. - * @returns {String} overloaded part of function/event name - */ -var extractTypeName = function (name) { - /// TODO: make it invulnerable - var length = name.indexOf('(') - return length !== -1 ? name.substr(length + 1, name.length - 1 - (length + 1)).replace(' ', '') : '' -} - -/** - * Returns true if object is function, otherwise false - * - * @method isFunction - * @param {Object} object - object to test - * @return {Boolean} - */ -var isFunction = function (object) { - return typeof object === 'function' -} - -module.exports = { - transformToFullName: transformToFullName, - extractDisplayName: extractDisplayName, - extractTypeName: extractTypeName, - isFunction: isFunction -} diff --git a/js/package.json b/js/package.json new file mode 100644 index 000000000..a8f736e6a --- /dev/null +++ b/js/package.json @@ -0,0 +1,68 @@ +{ + "version": "0.0.0", + "name": "@hyperledger/burrow", + "description": "TypeScript library that calls a Hyperledger Burrow server over GRPC.", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "author": { + "name": "Dennis Mckinnon" + }, + "files": [ + "dist", + "proto" + ], + "bugs": { + "url": "https://github.com/hyperledger/burrow/issues" + }, + "scripts": { + "build": "tsc --build", + "test": "./test.sh 'src/test/**/*.test.ts'" + }, + "dependencies": { + "@grpc/grpc-js": "^1.2.10", + "@types/ethereumjs-abi": "^0.6.3", + "bn.js": "^5.1.3", + "ethereumjs-abi": "^0.6.8", + "google-protobuf": "^3.14.0", + "sha3": "^2.1.3", + "solc": "^0.6.1", + "ts-node": "^9.1.1", + "typescript": "^4.1.3" + }, + "devDependencies": { + "@types/mocha": "^8.2.0", + "grpc-tools": "^1.10.0", + "grpc_tools_node_protoc_ts": "^5.1.3", + "mocha": "^8.2.1" + }, + "mocha": { + "bail": true, + "exit": true, + "timeout": 60000 + }, + "homepage": "https://github.com/hyperledger/burrow/", + "keywords": [ + "Burrow", + "Hyperledger", + "Monax" + ], + "license": "Apache-2.0", + "maintainers": [ + { + "name": "Silas Davis", + "email": "silas@monax.io" + }, + { + "name": "Sean Young", + "email": "sean@mess.org" + }, + { + "name": "Greg Hill", + "email": "gregorydhill@outlook.com" + } + ], + "repository": { + "type": "git", + "url": "git+https://github.com/hyperledger/burrow.git" + } +} diff --git a/js/proto/acm_grpc_pb.js b/js/proto/acm_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/acm_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/acm_pb.d.ts b/js/proto/acm_pb.d.ts new file mode 100644 index 000000000..24bdea2d5 --- /dev/null +++ b/js/proto/acm_pb.d.ts @@ -0,0 +1,122 @@ +// package: acm +// file: acm.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as permission_pb from "./permission_pb"; +import * as crypto_pb from "./crypto_pb"; + +export class Account extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): Account; + + + hasPublickey(): boolean; + clearPublickey(): void; + getPublickey(): crypto_pb.PublicKey | undefined; + setPublickey(value?: crypto_pb.PublicKey): Account; + + getSequence(): number; + setSequence(value: number): Account; + + getBalance(): number; + setBalance(value: number): Account; + + getEvmcode(): Uint8Array | string; + getEvmcode_asU8(): Uint8Array; + getEvmcode_asB64(): string; + setEvmcode(value: Uint8Array | string): Account; + + + hasPermissions(): boolean; + clearPermissions(): void; + getPermissions(): permission_pb.AccountPermissions | undefined; + setPermissions(value?: permission_pb.AccountPermissions): Account; + + getWasmcode(): Uint8Array | string; + getWasmcode_asU8(): Uint8Array; + getWasmcode_asB64(): string; + setWasmcode(value: Uint8Array | string): Account; + + getNativename(): string; + setNativename(value: string): Account; + + getCodehash(): Uint8Array | string; + getCodehash_asU8(): Uint8Array; + getCodehash_asB64(): string; + setCodehash(value: Uint8Array | string): Account; + + clearContractmetaList(): void; + getContractmetaList(): Array; + setContractmetaList(value: Array): Account; + addContractmeta(value?: ContractMeta, index?: number): ContractMeta; + + getForebear(): Uint8Array | string; + getForebear_asU8(): Uint8Array; + getForebear_asB64(): string; + setForebear(value: Uint8Array | string): Account; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Account.AsObject; + static toObject(includeInstance: boolean, msg: Account): Account.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Account, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Account; + static deserializeBinaryFromReader(message: Account, reader: jspb.BinaryReader): Account; +} + +export namespace Account { + export type AsObject = { + address: Uint8Array | string, + publickey?: crypto_pb.PublicKey.AsObject, + sequence: number, + balance: number, + evmcode: Uint8Array | string, + permissions?: permission_pb.AccountPermissions.AsObject, + wasmcode: Uint8Array | string, + nativename: string, + codehash: Uint8Array | string, + contractmetaList: Array, + forebear: Uint8Array | string, + } +} + +export class ContractMeta extends jspb.Message { + getCodehash(): Uint8Array | string; + getCodehash_asU8(): Uint8Array; + getCodehash_asB64(): string; + setCodehash(value: Uint8Array | string): ContractMeta; + + getMetadatahash(): Uint8Array | string; + getMetadatahash_asU8(): Uint8Array; + getMetadatahash_asB64(): string; + setMetadatahash(value: Uint8Array | string): ContractMeta; + + getMetadata(): string; + setMetadata(value: string): ContractMeta; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ContractMeta.AsObject; + static toObject(includeInstance: boolean, msg: ContractMeta): ContractMeta.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ContractMeta, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ContractMeta; + static deserializeBinaryFromReader(message: ContractMeta, reader: jspb.BinaryReader): ContractMeta; +} + +export namespace ContractMeta { + export type AsObject = { + codehash: Uint8Array | string, + metadatahash: Uint8Array | string, + metadata: string, + } +} diff --git a/js/proto/acm_pb.js b/js/proto/acm_pb.js new file mode 100644 index 000000000..f8f8cb28b --- /dev/null +++ b/js/proto/acm_pb.js @@ -0,0 +1,927 @@ +// source: acm.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var permission_pb = require('./permission_pb.js'); +goog.object.extend(proto, permission_pb); +var crypto_pb = require('./crypto_pb.js'); +goog.object.extend(proto, crypto_pb); +goog.exportSymbol('proto.acm.Account', null, global); +goog.exportSymbol('proto.acm.ContractMeta', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.acm.Account = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.acm.Account.repeatedFields_, null); +}; +goog.inherits(proto.acm.Account, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.acm.Account.displayName = 'proto.acm.Account'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.acm.ContractMeta = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.acm.ContractMeta, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.acm.ContractMeta.displayName = 'proto.acm.ContractMeta'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.acm.Account.repeatedFields_ = [9]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.acm.Account.prototype.toObject = function(opt_includeInstance) { + return proto.acm.Account.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.acm.Account} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.acm.Account.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + publickey: (f = msg.getPublickey()) && crypto_pb.PublicKey.toObject(includeInstance, f), + sequence: jspb.Message.getFieldWithDefault(msg, 3, 0), + balance: jspb.Message.getFieldWithDefault(msg, 4, 0), + evmcode: msg.getEvmcode_asB64(), + permissions: (f = msg.getPermissions()) && permission_pb.AccountPermissions.toObject(includeInstance, f), + wasmcode: msg.getWasmcode_asB64(), + nativename: jspb.Message.getFieldWithDefault(msg, 11, ""), + codehash: msg.getCodehash_asB64(), + contractmetaList: jspb.Message.toObjectList(msg.getContractmetaList(), + proto.acm.ContractMeta.toObject, includeInstance), + forebear: msg.getForebear_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.acm.Account} + */ +proto.acm.Account.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.acm.Account; + return proto.acm.Account.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.acm.Account} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.acm.Account} + */ +proto.acm.Account.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = new crypto_pb.PublicKey; + reader.readMessage(value,crypto_pb.PublicKey.deserializeBinaryFromReader); + msg.setPublickey(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setSequence(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setBalance(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setEvmcode(value); + break; + case 6: + var value = new permission_pb.AccountPermissions; + reader.readMessage(value,permission_pb.AccountPermissions.deserializeBinaryFromReader); + msg.setPermissions(value); + break; + case 7: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setWasmcode(value); + break; + case 11: + var value = /** @type {string} */ (reader.readString()); + msg.setNativename(value); + break; + case 8: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCodehash(value); + break; + case 9: + var value = new proto.acm.ContractMeta; + reader.readMessage(value,proto.acm.ContractMeta.deserializeBinaryFromReader); + msg.addContractmeta(value); + break; + case 10: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setForebear(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.acm.Account.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.acm.Account.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.acm.Account} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.acm.Account.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPublickey(); + if (f != null) { + writer.writeMessage( + 2, + f, + crypto_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getSequence(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getBalance(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getEvmcode_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getPermissions(); + if (f != null) { + writer.writeMessage( + 6, + f, + permission_pb.AccountPermissions.serializeBinaryToWriter + ); + } + f = message.getWasmcode_asU8(); + if (f.length > 0) { + writer.writeBytes( + 7, + f + ); + } + f = message.getNativename(); + if (f.length > 0) { + writer.writeString( + 11, + f + ); + } + f = message.getCodehash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 8, + f + ); + } + f = message.getContractmetaList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 9, + f, + proto.acm.ContractMeta.serializeBinaryToWriter + ); + } + f = message.getForebear_asU8(); + if (f.length > 0) { + writer.writeBytes( + 10, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.acm.Account.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.acm.Account.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.acm.Account.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional crypto.PublicKey PublicKey = 2; + * @return {?proto.crypto.PublicKey} + */ +proto.acm.Account.prototype.getPublickey = function() { + return /** @type{?proto.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, crypto_pb.PublicKey, 2)); +}; + + +/** + * @param {?proto.crypto.PublicKey|undefined} value + * @return {!proto.acm.Account} returns this +*/ +proto.acm.Account.prototype.setPublickey = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.clearPublickey = function() { + return this.setPublickey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.acm.Account.prototype.hasPublickey = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint64 Sequence = 3; + * @return {number} + */ +proto.acm.Account.prototype.getSequence = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.setSequence = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint64 Balance = 4; + * @return {number} + */ +proto.acm.Account.prototype.getBalance = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.setBalance = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional bytes EVMCode = 5; + * @return {!(string|Uint8Array)} + */ +proto.acm.Account.prototype.getEvmcode = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes EVMCode = 5; + * This is a type-conversion wrapper around `getEvmcode()` + * @return {string} + */ +proto.acm.Account.prototype.getEvmcode_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getEvmcode())); +}; + + +/** + * optional bytes EVMCode = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getEvmcode()` + * @return {!Uint8Array} + */ +proto.acm.Account.prototype.getEvmcode_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getEvmcode())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.setEvmcode = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * optional permission.AccountPermissions Permissions = 6; + * @return {?proto.permission.AccountPermissions} + */ +proto.acm.Account.prototype.getPermissions = function() { + return /** @type{?proto.permission.AccountPermissions} */ ( + jspb.Message.getWrapperField(this, permission_pb.AccountPermissions, 6)); +}; + + +/** + * @param {?proto.permission.AccountPermissions|undefined} value + * @return {!proto.acm.Account} returns this +*/ +proto.acm.Account.prototype.setPermissions = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.clearPermissions = function() { + return this.setPermissions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.acm.Account.prototype.hasPermissions = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bytes WASMCode = 7; + * @return {!(string|Uint8Array)} + */ +proto.acm.Account.prototype.getWasmcode = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * optional bytes WASMCode = 7; + * This is a type-conversion wrapper around `getWasmcode()` + * @return {string} + */ +proto.acm.Account.prototype.getWasmcode_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getWasmcode())); +}; + + +/** + * optional bytes WASMCode = 7; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getWasmcode()` + * @return {!Uint8Array} + */ +proto.acm.Account.prototype.getWasmcode_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getWasmcode())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.setWasmcode = function(value) { + return jspb.Message.setProto3BytesField(this, 7, value); +}; + + +/** + * optional string NativeName = 11; + * @return {string} + */ +proto.acm.Account.prototype.getNativename = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 11, "")); +}; + + +/** + * @param {string} value + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.setNativename = function(value) { + return jspb.Message.setProto3StringField(this, 11, value); +}; + + +/** + * optional bytes CodeHash = 8; + * @return {!(string|Uint8Array)} + */ +proto.acm.Account.prototype.getCodehash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * optional bytes CodeHash = 8; + * This is a type-conversion wrapper around `getCodehash()` + * @return {string} + */ +proto.acm.Account.prototype.getCodehash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCodehash())); +}; + + +/** + * optional bytes CodeHash = 8; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCodehash()` + * @return {!Uint8Array} + */ +proto.acm.Account.prototype.getCodehash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCodehash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.setCodehash = function(value) { + return jspb.Message.setProto3BytesField(this, 8, value); +}; + + +/** + * repeated ContractMeta ContractMeta = 9; + * @return {!Array} + */ +proto.acm.Account.prototype.getContractmetaList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.acm.ContractMeta, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.acm.Account} returns this +*/ +proto.acm.Account.prototype.setContractmetaList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 9, value); +}; + + +/** + * @param {!proto.acm.ContractMeta=} opt_value + * @param {number=} opt_index + * @return {!proto.acm.ContractMeta} + */ +proto.acm.Account.prototype.addContractmeta = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 9, opt_value, proto.acm.ContractMeta, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.clearContractmetaList = function() { + return this.setContractmetaList([]); +}; + + +/** + * optional bytes Forebear = 10; + * @return {!(string|Uint8Array)} + */ +proto.acm.Account.prototype.getForebear = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 10, "")); +}; + + +/** + * optional bytes Forebear = 10; + * This is a type-conversion wrapper around `getForebear()` + * @return {string} + */ +proto.acm.Account.prototype.getForebear_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getForebear())); +}; + + +/** + * optional bytes Forebear = 10; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getForebear()` + * @return {!Uint8Array} + */ +proto.acm.Account.prototype.getForebear_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getForebear())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.acm.Account} returns this + */ +proto.acm.Account.prototype.setForebear = function(value) { + return jspb.Message.setProto3BytesField(this, 10, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.acm.ContractMeta.prototype.toObject = function(opt_includeInstance) { + return proto.acm.ContractMeta.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.acm.ContractMeta} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.acm.ContractMeta.toObject = function(includeInstance, msg) { + var f, obj = { + codehash: msg.getCodehash_asB64(), + metadatahash: msg.getMetadatahash_asB64(), + metadata: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.acm.ContractMeta} + */ +proto.acm.ContractMeta.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.acm.ContractMeta; + return proto.acm.ContractMeta.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.acm.ContractMeta} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.acm.ContractMeta} + */ +proto.acm.ContractMeta.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCodehash(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMetadatahash(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.acm.ContractMeta.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.acm.ContractMeta.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.acm.ContractMeta} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.acm.ContractMeta.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCodehash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getMetadatahash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getMetadata(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional bytes CodeHash = 1; + * @return {!(string|Uint8Array)} + */ +proto.acm.ContractMeta.prototype.getCodehash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes CodeHash = 1; + * This is a type-conversion wrapper around `getCodehash()` + * @return {string} + */ +proto.acm.ContractMeta.prototype.getCodehash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCodehash())); +}; + + +/** + * optional bytes CodeHash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCodehash()` + * @return {!Uint8Array} + */ +proto.acm.ContractMeta.prototype.getCodehash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCodehash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.acm.ContractMeta} returns this + */ +proto.acm.ContractMeta.prototype.setCodehash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes MetadataHash = 2; + * @return {!(string|Uint8Array)} + */ +proto.acm.ContractMeta.prototype.getMetadatahash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes MetadataHash = 2; + * This is a type-conversion wrapper around `getMetadatahash()` + * @return {string} + */ +proto.acm.ContractMeta.prototype.getMetadatahash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMetadatahash())); +}; + + +/** + * optional bytes MetadataHash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMetadatahash()` + * @return {!Uint8Array} + */ +proto.acm.ContractMeta.prototype.getMetadatahash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMetadatahash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.acm.ContractMeta} returns this + */ +proto.acm.ContractMeta.prototype.setMetadatahash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional string Metadata = 3; + * @return {string} + */ +proto.acm.ContractMeta.prototype.getMetadata = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.acm.ContractMeta} returns this + */ +proto.acm.ContractMeta.prototype.setMetadata = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +goog.object.extend(exports, proto.acm); diff --git a/js/proto/balance_grpc_pb.js b/js/proto/balance_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/balance_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/balance_pb.d.ts b/js/proto/balance_pb.d.ts new file mode 100644 index 000000000..58015a33a --- /dev/null +++ b/js/proto/balance_pb.d.ts @@ -0,0 +1,33 @@ +// package: balance +// file: balance.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class Balance extends jspb.Message { + getType(): number; + setType(value: number): Balance; + + getAmount(): number; + setAmount(value: number): Balance; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Balance.AsObject; + static toObject(includeInstance: boolean, msg: Balance): Balance.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Balance, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Balance; + static deserializeBinaryFromReader(message: Balance, reader: jspb.BinaryReader): Balance; +} + +export namespace Balance { + export type AsObject = { + type: number, + amount: number, + } +} diff --git a/js/proto/balance_pb.js b/js/proto/balance_pb.js new file mode 100644 index 000000000..c3234f566 --- /dev/null +++ b/js/proto/balance_pb.js @@ -0,0 +1,201 @@ +// source: balance.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.balance.Balance', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.balance.Balance = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.balance.Balance, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.balance.Balance.displayName = 'proto.balance.Balance'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.balance.Balance.prototype.toObject = function(opt_includeInstance) { + return proto.balance.Balance.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.balance.Balance} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.balance.Balance.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + amount: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.balance.Balance} + */ +proto.balance.Balance.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.balance.Balance; + return proto.balance.Balance.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.balance.Balance} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.balance.Balance} + */ +proto.balance.Balance.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAmount(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.balance.Balance.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.balance.Balance.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.balance.Balance} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.balance.Balance.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getAmount(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional uint32 Type = 1; + * @return {number} + */ +proto.balance.Balance.prototype.getType = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.balance.Balance} returns this + */ +proto.balance.Balance.prototype.setType = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 Amount = 2; + * @return {number} + */ +proto.balance.Balance.prototype.getAmount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.balance.Balance} returns this + */ +proto.balance.Balance.prototype.setAmount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +goog.object.extend(exports, proto.balance); diff --git a/js/proto/bcm_grpc_pb.js b/js/proto/bcm_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/bcm_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/bcm_pb.d.ts b/js/proto/bcm_pb.d.ts new file mode 100644 index 000000000..dff8860c2 --- /dev/null +++ b/js/proto/bcm_pb.d.ts @@ -0,0 +1,104 @@ +// package: bcm +// file: bcm.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb"; + +export class SyncInfo extends jspb.Message { + getLatestblockheight(): number; + setLatestblockheight(value: number): SyncInfo; + + getLatestblockhash(): Uint8Array | string; + getLatestblockhash_asU8(): Uint8Array; + getLatestblockhash_asB64(): string; + setLatestblockhash(value: Uint8Array | string): SyncInfo; + + getLatestapphash(): Uint8Array | string; + getLatestapphash_asU8(): Uint8Array; + getLatestapphash_asB64(): string; + setLatestapphash(value: Uint8Array | string): SyncInfo; + + + hasLatestblocktime(): boolean; + clearLatestblocktime(): void; + getLatestblocktime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setLatestblocktime(value?: google_protobuf_timestamp_pb.Timestamp): SyncInfo; + + + hasLatestblockseentime(): boolean; + clearLatestblockseentime(): void; + getLatestblockseentime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setLatestblockseentime(value?: google_protobuf_timestamp_pb.Timestamp): SyncInfo; + + + hasLatestblockduration(): boolean; + clearLatestblockduration(): void; + getLatestblockduration(): google_protobuf_duration_pb.Duration | undefined; + setLatestblockduration(value?: google_protobuf_duration_pb.Duration): SyncInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SyncInfo.AsObject; + static toObject(includeInstance: boolean, msg: SyncInfo): SyncInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SyncInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SyncInfo; + static deserializeBinaryFromReader(message: SyncInfo, reader: jspb.BinaryReader): SyncInfo; +} + +export namespace SyncInfo { + export type AsObject = { + latestblockheight: number, + latestblockhash: Uint8Array | string, + latestapphash: Uint8Array | string, + latestblocktime?: google_protobuf_timestamp_pb.Timestamp.AsObject, + latestblockseentime?: google_protobuf_timestamp_pb.Timestamp.AsObject, + latestblockduration?: google_protobuf_duration_pb.Duration.AsObject, + } +} + +export class PersistedState extends jspb.Message { + getApphashafterlastblock(): Uint8Array | string; + getApphashafterlastblock_asU8(): Uint8Array; + getApphashafterlastblock_asB64(): string; + setApphashafterlastblock(value: Uint8Array | string): PersistedState; + + + hasLastblocktime(): boolean; + clearLastblocktime(): void; + getLastblocktime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setLastblocktime(value?: google_protobuf_timestamp_pb.Timestamp): PersistedState; + + getLastblockheight(): number; + setLastblockheight(value: number): PersistedState; + + getGenesishash(): Uint8Array | string; + getGenesishash_asU8(): Uint8Array; + getGenesishash_asB64(): string; + setGenesishash(value: Uint8Array | string): PersistedState; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PersistedState.AsObject; + static toObject(includeInstance: boolean, msg: PersistedState): PersistedState.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PersistedState, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PersistedState; + static deserializeBinaryFromReader(message: PersistedState, reader: jspb.BinaryReader): PersistedState; +} + +export namespace PersistedState { + export type AsObject = { + apphashafterlastblock: Uint8Array | string, + lastblocktime?: google_protobuf_timestamp_pb.Timestamp.AsObject, + lastblockheight: number, + genesishash: Uint8Array | string, + } +} diff --git a/js/proto/bcm_pb.js b/js/proto/bcm_pb.js new file mode 100644 index 000000000..07e464ae2 --- /dev/null +++ b/js/proto/bcm_pb.js @@ -0,0 +1,747 @@ +// source: bcm.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js'); +goog.object.extend(proto, google_protobuf_duration_pb); +goog.exportSymbol('proto.bcm.PersistedState', null, global); +goog.exportSymbol('proto.bcm.SyncInfo', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.bcm.SyncInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.bcm.SyncInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.bcm.SyncInfo.displayName = 'proto.bcm.SyncInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.bcm.PersistedState = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.bcm.PersistedState, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.bcm.PersistedState.displayName = 'proto.bcm.PersistedState'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.bcm.SyncInfo.prototype.toObject = function(opt_includeInstance) { + return proto.bcm.SyncInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.bcm.SyncInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.bcm.SyncInfo.toObject = function(includeInstance, msg) { + var f, obj = { + latestblockheight: jspb.Message.getFieldWithDefault(msg, 1, 0), + latestblockhash: msg.getLatestblockhash_asB64(), + latestapphash: msg.getLatestapphash_asB64(), + latestblocktime: (f = msg.getLatestblocktime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + latestblockseentime: (f = msg.getLatestblockseentime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + latestblockduration: (f = msg.getLatestblockduration()) && google_protobuf_duration_pb.Duration.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.bcm.SyncInfo} + */ +proto.bcm.SyncInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.bcm.SyncInfo; + return proto.bcm.SyncInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.bcm.SyncInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.bcm.SyncInfo} + */ +proto.bcm.SyncInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setLatestblockheight(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLatestblockhash(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLatestapphash(value); + break; + case 4: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setLatestblocktime(value); + break; + case 5: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setLatestblockseentime(value); + break; + case 6: + var value = new google_protobuf_duration_pb.Duration; + reader.readMessage(value,google_protobuf_duration_pb.Duration.deserializeBinaryFromReader); + msg.setLatestblockduration(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.bcm.SyncInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.bcm.SyncInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.bcm.SyncInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.bcm.SyncInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getLatestblockheight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getLatestblockhash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getLatestapphash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getLatestblocktime(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getLatestblockseentime(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getLatestblockduration(); + if (f != null) { + writer.writeMessage( + 6, + f, + google_protobuf_duration_pb.Duration.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 LatestBlockHeight = 1; + * @return {number} + */ +proto.bcm.SyncInfo.prototype.getLatestblockheight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.bcm.SyncInfo} returns this + */ +proto.bcm.SyncInfo.prototype.setLatestblockheight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes LatestBlockHash = 2; + * @return {!(string|Uint8Array)} + */ +proto.bcm.SyncInfo.prototype.getLatestblockhash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes LatestBlockHash = 2; + * This is a type-conversion wrapper around `getLatestblockhash()` + * @return {string} + */ +proto.bcm.SyncInfo.prototype.getLatestblockhash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLatestblockhash())); +}; + + +/** + * optional bytes LatestBlockHash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLatestblockhash()` + * @return {!Uint8Array} + */ +proto.bcm.SyncInfo.prototype.getLatestblockhash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLatestblockhash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.bcm.SyncInfo} returns this + */ +proto.bcm.SyncInfo.prototype.setLatestblockhash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes LatestAppHash = 3; + * @return {!(string|Uint8Array)} + */ +proto.bcm.SyncInfo.prototype.getLatestapphash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes LatestAppHash = 3; + * This is a type-conversion wrapper around `getLatestapphash()` + * @return {string} + */ +proto.bcm.SyncInfo.prototype.getLatestapphash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLatestapphash())); +}; + + +/** + * optional bytes LatestAppHash = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLatestapphash()` + * @return {!Uint8Array} + */ +proto.bcm.SyncInfo.prototype.getLatestapphash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLatestapphash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.bcm.SyncInfo} returns this + */ +proto.bcm.SyncInfo.prototype.setLatestapphash = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional google.protobuf.Timestamp LatestBlockTime = 4; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.bcm.SyncInfo.prototype.getLatestblocktime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 4)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.bcm.SyncInfo} returns this +*/ +proto.bcm.SyncInfo.prototype.setLatestblocktime = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.bcm.SyncInfo} returns this + */ +proto.bcm.SyncInfo.prototype.clearLatestblocktime = function() { + return this.setLatestblocktime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.bcm.SyncInfo.prototype.hasLatestblocktime = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional google.protobuf.Timestamp LatestBlockSeenTime = 5; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.bcm.SyncInfo.prototype.getLatestblockseentime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.bcm.SyncInfo} returns this +*/ +proto.bcm.SyncInfo.prototype.setLatestblockseentime = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.bcm.SyncInfo} returns this + */ +proto.bcm.SyncInfo.prototype.clearLatestblockseentime = function() { + return this.setLatestblockseentime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.bcm.SyncInfo.prototype.hasLatestblockseentime = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional google.protobuf.Duration LatestBlockDuration = 6; + * @return {?proto.google.protobuf.Duration} + */ +proto.bcm.SyncInfo.prototype.getLatestblockduration = function() { + return /** @type{?proto.google.protobuf.Duration} */ ( + jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 6)); +}; + + +/** + * @param {?proto.google.protobuf.Duration|undefined} value + * @return {!proto.bcm.SyncInfo} returns this +*/ +proto.bcm.SyncInfo.prototype.setLatestblockduration = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.bcm.SyncInfo} returns this + */ +proto.bcm.SyncInfo.prototype.clearLatestblockduration = function() { + return this.setLatestblockduration(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.bcm.SyncInfo.prototype.hasLatestblockduration = function() { + return jspb.Message.getField(this, 6) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.bcm.PersistedState.prototype.toObject = function(opt_includeInstance) { + return proto.bcm.PersistedState.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.bcm.PersistedState} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.bcm.PersistedState.toObject = function(includeInstance, msg) { + var f, obj = { + apphashafterlastblock: msg.getApphashafterlastblock_asB64(), + lastblocktime: (f = msg.getLastblocktime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + lastblockheight: jspb.Message.getFieldWithDefault(msg, 3, 0), + genesishash: msg.getGenesishash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.bcm.PersistedState} + */ +proto.bcm.PersistedState.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.bcm.PersistedState; + return proto.bcm.PersistedState.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.bcm.PersistedState} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.bcm.PersistedState} + */ +proto.bcm.PersistedState.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setApphashafterlastblock(value); + break; + case 2: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setLastblocktime(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setLastblockheight(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setGenesishash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.bcm.PersistedState.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.bcm.PersistedState.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.bcm.PersistedState} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.bcm.PersistedState.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getApphashafterlastblock_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getLastblocktime(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getLastblockheight(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getGenesishash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional bytes AppHashAfterLastBlock = 1; + * @return {!(string|Uint8Array)} + */ +proto.bcm.PersistedState.prototype.getApphashafterlastblock = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes AppHashAfterLastBlock = 1; + * This is a type-conversion wrapper around `getApphashafterlastblock()` + * @return {string} + */ +proto.bcm.PersistedState.prototype.getApphashafterlastblock_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getApphashafterlastblock())); +}; + + +/** + * optional bytes AppHashAfterLastBlock = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getApphashafterlastblock()` + * @return {!Uint8Array} + */ +proto.bcm.PersistedState.prototype.getApphashafterlastblock_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getApphashafterlastblock())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.bcm.PersistedState} returns this + */ +proto.bcm.PersistedState.prototype.setApphashafterlastblock = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional google.protobuf.Timestamp LastBlockTime = 2; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.bcm.PersistedState.prototype.getLastblocktime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.bcm.PersistedState} returns this +*/ +proto.bcm.PersistedState.prototype.setLastblocktime = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.bcm.PersistedState} returns this + */ +proto.bcm.PersistedState.prototype.clearLastblocktime = function() { + return this.setLastblocktime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.bcm.PersistedState.prototype.hasLastblocktime = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint64 LastBlockHeight = 3; + * @return {number} + */ +proto.bcm.PersistedState.prototype.getLastblockheight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.bcm.PersistedState} returns this + */ +proto.bcm.PersistedState.prototype.setLastblockheight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional bytes GenesisHash = 4; + * @return {!(string|Uint8Array)} + */ +proto.bcm.PersistedState.prototype.getGenesishash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes GenesisHash = 4; + * This is a type-conversion wrapper around `getGenesishash()` + * @return {string} + */ +proto.bcm.PersistedState.prototype.getGenesishash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getGenesishash())); +}; + + +/** + * optional bytes GenesisHash = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getGenesishash()` + * @return {!Uint8Array} + */ +proto.bcm.PersistedState.prototype.getGenesishash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getGenesishash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.bcm.PersistedState} returns this + */ +proto.bcm.PersistedState.prototype.setGenesishash = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +goog.object.extend(exports, proto.bcm); diff --git a/js/proto/crypto_grpc_pb.js b/js/proto/crypto_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/crypto_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/crypto_pb.d.ts b/js/proto/crypto_pb.d.ts new file mode 100644 index 000000000..939d58cb8 --- /dev/null +++ b/js/proto/crypto_pb.d.ts @@ -0,0 +1,95 @@ +// package: crypto +// file: crypto.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class PublicKey extends jspb.Message { + getCurvetype(): number; + setCurvetype(value: number): PublicKey; + + getPublickey(): Uint8Array | string; + getPublickey_asU8(): Uint8Array; + getPublickey_asB64(): string; + setPublickey(value: Uint8Array | string): PublicKey; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PublicKey.AsObject; + static toObject(includeInstance: boolean, msg: PublicKey): PublicKey.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PublicKey, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PublicKey; + static deserializeBinaryFromReader(message: PublicKey, reader: jspb.BinaryReader): PublicKey; +} + +export namespace PublicKey { + export type AsObject = { + curvetype: number, + publickey: Uint8Array | string, + } +} + +export class PrivateKey extends jspb.Message { + getCurvetype(): number; + setCurvetype(value: number): PrivateKey; + + getPublickey(): Uint8Array | string; + getPublickey_asU8(): Uint8Array; + getPublickey_asB64(): string; + setPublickey(value: Uint8Array | string): PrivateKey; + + getPrivatekey(): Uint8Array | string; + getPrivatekey_asU8(): Uint8Array; + getPrivatekey_asB64(): string; + setPrivatekey(value: Uint8Array | string): PrivateKey; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PrivateKey.AsObject; + static toObject(includeInstance: boolean, msg: PrivateKey): PrivateKey.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PrivateKey, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PrivateKey; + static deserializeBinaryFromReader(message: PrivateKey, reader: jspb.BinaryReader): PrivateKey; +} + +export namespace PrivateKey { + export type AsObject = { + curvetype: number, + publickey: Uint8Array | string, + privatekey: Uint8Array | string, + } +} + +export class Signature extends jspb.Message { + getCurvetype(): number; + setCurvetype(value: number): Signature; + + getSignature(): Uint8Array | string; + getSignature_asU8(): Uint8Array; + getSignature_asB64(): string; + setSignature(value: Uint8Array | string): Signature; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Signature.AsObject; + static toObject(includeInstance: boolean, msg: Signature): Signature.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Signature, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Signature; + static deserializeBinaryFromReader(message: Signature, reader: jspb.BinaryReader): Signature; +} + +export namespace Signature { + export type AsObject = { + curvetype: number, + signature: Uint8Array | string, + } +} diff --git a/js/proto/crypto_pb.js b/js/proto/crypto_pb.js new file mode 100644 index 000000000..9f904f9da --- /dev/null +++ b/js/proto/crypto_pb.js @@ -0,0 +1,691 @@ +// source: crypto.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.crypto.PrivateKey', null, global); +goog.exportSymbol('proto.crypto.PublicKey', null, global); +goog.exportSymbol('proto.crypto.Signature', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.crypto.PublicKey = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.crypto.PublicKey, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.crypto.PublicKey.displayName = 'proto.crypto.PublicKey'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.crypto.PrivateKey = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.crypto.PrivateKey, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.crypto.PrivateKey.displayName = 'proto.crypto.PrivateKey'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.crypto.Signature = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.crypto.Signature, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.crypto.Signature.displayName = 'proto.crypto.Signature'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.crypto.PublicKey.prototype.toObject = function(opt_includeInstance) { + return proto.crypto.PublicKey.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.crypto.PublicKey} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.crypto.PublicKey.toObject = function(includeInstance, msg) { + var f, obj = { + curvetype: jspb.Message.getFieldWithDefault(msg, 1, 0), + publickey: msg.getPublickey_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.crypto.PublicKey} + */ +proto.crypto.PublicKey.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.crypto.PublicKey; + return proto.crypto.PublicKey.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.crypto.PublicKey} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.crypto.PublicKey} + */ +proto.crypto.PublicKey.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCurvetype(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPublickey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.crypto.PublicKey.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.crypto.PublicKey.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.crypto.PublicKey} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.crypto.PublicKey.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCurvetype(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getPublickey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional uint32 CurveType = 1; + * @return {number} + */ +proto.crypto.PublicKey.prototype.getCurvetype = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.crypto.PublicKey} returns this + */ +proto.crypto.PublicKey.prototype.setCurvetype = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes PublicKey = 2; + * @return {!(string|Uint8Array)} + */ +proto.crypto.PublicKey.prototype.getPublickey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes PublicKey = 2; + * This is a type-conversion wrapper around `getPublickey()` + * @return {string} + */ +proto.crypto.PublicKey.prototype.getPublickey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublickey())); +}; + + +/** + * optional bytes PublicKey = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPublickey()` + * @return {!Uint8Array} + */ +proto.crypto.PublicKey.prototype.getPublickey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublickey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.crypto.PublicKey} returns this + */ +proto.crypto.PublicKey.prototype.setPublickey = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.crypto.PrivateKey.prototype.toObject = function(opt_includeInstance) { + return proto.crypto.PrivateKey.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.crypto.PrivateKey} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.crypto.PrivateKey.toObject = function(includeInstance, msg) { + var f, obj = { + curvetype: jspb.Message.getFieldWithDefault(msg, 1, 0), + publickey: msg.getPublickey_asB64(), + privatekey: msg.getPrivatekey_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.crypto.PrivateKey} + */ +proto.crypto.PrivateKey.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.crypto.PrivateKey; + return proto.crypto.PrivateKey.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.crypto.PrivateKey} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.crypto.PrivateKey} + */ +proto.crypto.PrivateKey.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCurvetype(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPublickey(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPrivatekey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.crypto.PrivateKey.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.crypto.PrivateKey.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.crypto.PrivateKey} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.crypto.PrivateKey.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCurvetype(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getPublickey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getPrivatekey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional uint32 CurveType = 1; + * @return {number} + */ +proto.crypto.PrivateKey.prototype.getCurvetype = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.crypto.PrivateKey} returns this + */ +proto.crypto.PrivateKey.prototype.setCurvetype = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes PublicKey = 2; + * @return {!(string|Uint8Array)} + */ +proto.crypto.PrivateKey.prototype.getPublickey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes PublicKey = 2; + * This is a type-conversion wrapper around `getPublickey()` + * @return {string} + */ +proto.crypto.PrivateKey.prototype.getPublickey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublickey())); +}; + + +/** + * optional bytes PublicKey = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPublickey()` + * @return {!Uint8Array} + */ +proto.crypto.PrivateKey.prototype.getPublickey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublickey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.crypto.PrivateKey} returns this + */ +proto.crypto.PrivateKey.prototype.setPublickey = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes PrivateKey = 3; + * @return {!(string|Uint8Array)} + */ +proto.crypto.PrivateKey.prototype.getPrivatekey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes PrivateKey = 3; + * This is a type-conversion wrapper around `getPrivatekey()` + * @return {string} + */ +proto.crypto.PrivateKey.prototype.getPrivatekey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPrivatekey())); +}; + + +/** + * optional bytes PrivateKey = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPrivatekey()` + * @return {!Uint8Array} + */ +proto.crypto.PrivateKey.prototype.getPrivatekey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPrivatekey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.crypto.PrivateKey} returns this + */ +proto.crypto.PrivateKey.prototype.setPrivatekey = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.crypto.Signature.prototype.toObject = function(opt_includeInstance) { + return proto.crypto.Signature.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.crypto.Signature} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.crypto.Signature.toObject = function(includeInstance, msg) { + var f, obj = { + curvetype: jspb.Message.getFieldWithDefault(msg, 1, 0), + signature: msg.getSignature_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.crypto.Signature} + */ +proto.crypto.Signature.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.crypto.Signature; + return proto.crypto.Signature.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.crypto.Signature} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.crypto.Signature} + */ +proto.crypto.Signature.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCurvetype(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.crypto.Signature.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.crypto.Signature.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.crypto.Signature} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.crypto.Signature.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCurvetype(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getSignature_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional uint32 CurveType = 1; + * @return {number} + */ +proto.crypto.Signature.prototype.getCurvetype = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.crypto.Signature} returns this + */ +proto.crypto.Signature.prototype.setCurvetype = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes Signature = 2; + * @return {!(string|Uint8Array)} + */ +proto.crypto.Signature.prototype.getSignature = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Signature = 2; + * This is a type-conversion wrapper around `getSignature()` + * @return {string} + */ +proto.crypto.Signature.prototype.getSignature_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSignature())); +}; + + +/** + * optional bytes Signature = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSignature()` + * @return {!Uint8Array} + */ +proto.crypto.Signature.prototype.getSignature_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSignature())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.crypto.Signature} returns this + */ +proto.crypto.Signature.prototype.setSignature = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +goog.object.extend(exports, proto.crypto); diff --git a/js/proto/dump_grpc_pb.js b/js/proto/dump_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/dump_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/dump_pb.d.ts b/js/proto/dump_pb.d.ts new file mode 100644 index 000000000..769b75fe3 --- /dev/null +++ b/js/proto/dump_pb.d.ts @@ -0,0 +1,158 @@ +// package: dump +// file: dump.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as acm_pb from "./acm_pb"; +import * as exec_pb from "./exec_pb"; +import * as names_pb from "./names_pb"; + +export class Storage extends jspb.Message { + getKey(): Uint8Array | string; + getKey_asU8(): Uint8Array; + getKey_asB64(): string; + setKey(value: Uint8Array | string): Storage; + + getValue(): Uint8Array | string; + getValue_asU8(): Uint8Array; + getValue_asB64(): string; + setValue(value: Uint8Array | string): Storage; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Storage.AsObject; + static toObject(includeInstance: boolean, msg: Storage): Storage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Storage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Storage; + static deserializeBinaryFromReader(message: Storage, reader: jspb.BinaryReader): Storage; +} + +export namespace Storage { + export type AsObject = { + key: Uint8Array | string, + value: Uint8Array | string, + } +} + +export class AccountStorage extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): AccountStorage; + + clearStorageList(): void; + getStorageList(): Array; + setStorageList(value: Array): AccountStorage; + addStorage(value?: Storage, index?: number): Storage; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): AccountStorage.AsObject; + static toObject(includeInstance: boolean, msg: AccountStorage): AccountStorage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: AccountStorage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AccountStorage; + static deserializeBinaryFromReader(message: AccountStorage, reader: jspb.BinaryReader): AccountStorage; +} + +export namespace AccountStorage { + export type AsObject = { + address: Uint8Array | string, + storageList: Array, + } +} + +export class EVMEvent extends jspb.Message { + getChainid(): string; + setChainid(value: string): EVMEvent; + + getIndex(): number; + setIndex(value: number): EVMEvent; + + + hasTime(): boolean; + clearTime(): void; + getTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTime(value?: google_protobuf_timestamp_pb.Timestamp): EVMEvent; + + + hasEvent(): boolean; + clearEvent(): void; + getEvent(): exec_pb.LogEvent | undefined; + setEvent(value?: exec_pb.LogEvent): EVMEvent; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EVMEvent.AsObject; + static toObject(includeInstance: boolean, msg: EVMEvent): EVMEvent.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EVMEvent, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EVMEvent; + static deserializeBinaryFromReader(message: EVMEvent, reader: jspb.BinaryReader): EVMEvent; +} + +export namespace EVMEvent { + export type AsObject = { + chainid: string, + index: number, + time?: google_protobuf_timestamp_pb.Timestamp.AsObject, + event?: exec_pb.LogEvent.AsObject, + } +} + +export class Dump extends jspb.Message { + getHeight(): number; + setHeight(value: number): Dump; + + + hasAccount(): boolean; + clearAccount(): void; + getAccount(): acm_pb.Account | undefined; + setAccount(value?: acm_pb.Account): Dump; + + + hasAccountstorage(): boolean; + clearAccountstorage(): void; + getAccountstorage(): AccountStorage | undefined; + setAccountstorage(value?: AccountStorage): Dump; + + + hasEvmevent(): boolean; + clearEvmevent(): void; + getEvmevent(): EVMEvent | undefined; + setEvmevent(value?: EVMEvent): Dump; + + + hasName(): boolean; + clearName(): void; + getName(): names_pb.Entry | undefined; + setName(value?: names_pb.Entry): Dump; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Dump.AsObject; + static toObject(includeInstance: boolean, msg: Dump): Dump.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Dump, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Dump; + static deserializeBinaryFromReader(message: Dump, reader: jspb.BinaryReader): Dump; +} + +export namespace Dump { + export type AsObject = { + height: number, + account?: acm_pb.Account.AsObject, + accountstorage?: AccountStorage.AsObject, + evmevent?: EVMEvent.AsObject, + name?: names_pb.Entry.AsObject, + } +} diff --git a/js/proto/dump_pb.js b/js/proto/dump_pb.js new file mode 100644 index 000000000..0b0f5c4b5 --- /dev/null +++ b/js/proto/dump_pb.js @@ -0,0 +1,1133 @@ +// source: dump.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +var acm_pb = require('./acm_pb.js'); +goog.object.extend(proto, acm_pb); +var exec_pb = require('./exec_pb.js'); +goog.object.extend(proto, exec_pb); +var names_pb = require('./names_pb.js'); +goog.object.extend(proto, names_pb); +goog.exportSymbol('proto.dump.AccountStorage', null, global); +goog.exportSymbol('proto.dump.Dump', null, global); +goog.exportSymbol('proto.dump.EVMEvent', null, global); +goog.exportSymbol('proto.dump.Storage', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.dump.Storage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.dump.Storage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.dump.Storage.displayName = 'proto.dump.Storage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.dump.AccountStorage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.dump.AccountStorage.repeatedFields_, null); +}; +goog.inherits(proto.dump.AccountStorage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.dump.AccountStorage.displayName = 'proto.dump.AccountStorage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.dump.EVMEvent = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.dump.EVMEvent, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.dump.EVMEvent.displayName = 'proto.dump.EVMEvent'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.dump.Dump = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.dump.Dump, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.dump.Dump.displayName = 'proto.dump.Dump'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.dump.Storage.prototype.toObject = function(opt_includeInstance) { + return proto.dump.Storage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.dump.Storage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.dump.Storage.toObject = function(includeInstance, msg) { + var f, obj = { + key: msg.getKey_asB64(), + value: msg.getValue_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.dump.Storage} + */ +proto.dump.Storage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.dump.Storage; + return proto.dump.Storage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.dump.Storage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.dump.Storage} + */ +proto.dump.Storage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setKey(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.dump.Storage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.dump.Storage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.dump.Storage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.dump.Storage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getValue_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional bytes Key = 1; + * @return {!(string|Uint8Array)} + */ +proto.dump.Storage.prototype.getKey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Key = 1; + * This is a type-conversion wrapper around `getKey()` + * @return {string} + */ +proto.dump.Storage.prototype.getKey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getKey())); +}; + + +/** + * optional bytes Key = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKey()` + * @return {!Uint8Array} + */ +proto.dump.Storage.prototype.getKey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getKey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.dump.Storage} returns this + */ +proto.dump.Storage.prototype.setKey = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes Value = 2; + * @return {!(string|Uint8Array)} + */ +proto.dump.Storage.prototype.getValue = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Value = 2; + * This is a type-conversion wrapper around `getValue()` + * @return {string} + */ +proto.dump.Storage.prototype.getValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValue())); +}; + + +/** + * optional bytes Value = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValue()` + * @return {!Uint8Array} + */ +proto.dump.Storage.prototype.getValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.dump.Storage} returns this + */ +proto.dump.Storage.prototype.setValue = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.dump.AccountStorage.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.dump.AccountStorage.prototype.toObject = function(opt_includeInstance) { + return proto.dump.AccountStorage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.dump.AccountStorage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.dump.AccountStorage.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + storageList: jspb.Message.toObjectList(msg.getStorageList(), + proto.dump.Storage.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.dump.AccountStorage} + */ +proto.dump.AccountStorage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.dump.AccountStorage; + return proto.dump.AccountStorage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.dump.AccountStorage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.dump.AccountStorage} + */ +proto.dump.AccountStorage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = new proto.dump.Storage; + reader.readMessage(value,proto.dump.Storage.deserializeBinaryFromReader); + msg.addStorage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.dump.AccountStorage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.dump.AccountStorage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.dump.AccountStorage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.dump.AccountStorage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getStorageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.dump.Storage.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.dump.AccountStorage.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.dump.AccountStorage.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.dump.AccountStorage.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.dump.AccountStorage} returns this + */ +proto.dump.AccountStorage.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * repeated Storage Storage = 2; + * @return {!Array} + */ +proto.dump.AccountStorage.prototype.getStorageList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.dump.Storage, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.dump.AccountStorage} returns this +*/ +proto.dump.AccountStorage.prototype.setStorageList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.dump.Storage=} opt_value + * @param {number=} opt_index + * @return {!proto.dump.Storage} + */ +proto.dump.AccountStorage.prototype.addStorage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.dump.Storage, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.dump.AccountStorage} returns this + */ +proto.dump.AccountStorage.prototype.clearStorageList = function() { + return this.setStorageList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.dump.EVMEvent.prototype.toObject = function(opt_includeInstance) { + return proto.dump.EVMEvent.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.dump.EVMEvent} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.dump.EVMEvent.toObject = function(includeInstance, msg) { + var f, obj = { + chainid: jspb.Message.getFieldWithDefault(msg, 1, ""), + index: jspb.Message.getFieldWithDefault(msg, 4, 0), + time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + event: (f = msg.getEvent()) && exec_pb.LogEvent.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.dump.EVMEvent} + */ +proto.dump.EVMEvent.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.dump.EVMEvent; + return proto.dump.EVMEvent.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.dump.EVMEvent} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.dump.EVMEvent} + */ +proto.dump.EVMEvent.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setChainid(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIndex(value); + break; + case 2: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTime(value); + break; + case 3: + var value = new exec_pb.LogEvent; + reader.readMessage(value,exec_pb.LogEvent.deserializeBinaryFromReader); + msg.setEvent(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.dump.EVMEvent.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.dump.EVMEvent.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.dump.EVMEvent} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.dump.EVMEvent.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getChainid(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getTime(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getEvent(); + if (f != null) { + writer.writeMessage( + 3, + f, + exec_pb.LogEvent.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string ChainID = 1; + * @return {string} + */ +proto.dump.EVMEvent.prototype.getChainid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.dump.EVMEvent} returns this + */ +proto.dump.EVMEvent.prototype.setChainid = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional uint64 Index = 4; + * @return {number} + */ +proto.dump.EVMEvent.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.dump.EVMEvent} returns this + */ +proto.dump.EVMEvent.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional google.protobuf.Timestamp Time = 2; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.dump.EVMEvent.prototype.getTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.dump.EVMEvent} returns this +*/ +proto.dump.EVMEvent.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.dump.EVMEvent} returns this + */ +proto.dump.EVMEvent.prototype.clearTime = function() { + return this.setTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.dump.EVMEvent.prototype.hasTime = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional exec.LogEvent Event = 3; + * @return {?proto.exec.LogEvent} + */ +proto.dump.EVMEvent.prototype.getEvent = function() { + return /** @type{?proto.exec.LogEvent} */ ( + jspb.Message.getWrapperField(this, exec_pb.LogEvent, 3)); +}; + + +/** + * @param {?proto.exec.LogEvent|undefined} value + * @return {!proto.dump.EVMEvent} returns this +*/ +proto.dump.EVMEvent.prototype.setEvent = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.dump.EVMEvent} returns this + */ +proto.dump.EVMEvent.prototype.clearEvent = function() { + return this.setEvent(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.dump.EVMEvent.prototype.hasEvent = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.dump.Dump.prototype.toObject = function(opt_includeInstance) { + return proto.dump.Dump.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.dump.Dump} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.dump.Dump.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + account: (f = msg.getAccount()) && acm_pb.Account.toObject(includeInstance, f), + accountstorage: (f = msg.getAccountstorage()) && proto.dump.AccountStorage.toObject(includeInstance, f), + evmevent: (f = msg.getEvmevent()) && proto.dump.EVMEvent.toObject(includeInstance, f), + name: (f = msg.getName()) && names_pb.Entry.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.dump.Dump} + */ +proto.dump.Dump.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.dump.Dump; + return proto.dump.Dump.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.dump.Dump} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.dump.Dump} + */ +proto.dump.Dump.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = new acm_pb.Account; + reader.readMessage(value,acm_pb.Account.deserializeBinaryFromReader); + msg.setAccount(value); + break; + case 3: + var value = new proto.dump.AccountStorage; + reader.readMessage(value,proto.dump.AccountStorage.deserializeBinaryFromReader); + msg.setAccountstorage(value); + break; + case 4: + var value = new proto.dump.EVMEvent; + reader.readMessage(value,proto.dump.EVMEvent.deserializeBinaryFromReader); + msg.setEvmevent(value); + break; + case 5: + var value = new names_pb.Entry; + reader.readMessage(value,names_pb.Entry.deserializeBinaryFromReader); + msg.setName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.dump.Dump.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.dump.Dump.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.dump.Dump} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.dump.Dump.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getAccount(); + if (f != null) { + writer.writeMessage( + 2, + f, + acm_pb.Account.serializeBinaryToWriter + ); + } + f = message.getAccountstorage(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.dump.AccountStorage.serializeBinaryToWriter + ); + } + f = message.getEvmevent(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.dump.EVMEvent.serializeBinaryToWriter + ); + } + f = message.getName(); + if (f != null) { + writer.writeMessage( + 5, + f, + names_pb.Entry.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.dump.Dump.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.dump.Dump} returns this + */ +proto.dump.Dump.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional acm.Account Account = 2; + * @return {?proto.acm.Account} + */ +proto.dump.Dump.prototype.getAccount = function() { + return /** @type{?proto.acm.Account} */ ( + jspb.Message.getWrapperField(this, acm_pb.Account, 2)); +}; + + +/** + * @param {?proto.acm.Account|undefined} value + * @return {!proto.dump.Dump} returns this +*/ +proto.dump.Dump.prototype.setAccount = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.dump.Dump} returns this + */ +proto.dump.Dump.prototype.clearAccount = function() { + return this.setAccount(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.dump.Dump.prototype.hasAccount = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional AccountStorage AccountStorage = 3; + * @return {?proto.dump.AccountStorage} + */ +proto.dump.Dump.prototype.getAccountstorage = function() { + return /** @type{?proto.dump.AccountStorage} */ ( + jspb.Message.getWrapperField(this, proto.dump.AccountStorage, 3)); +}; + + +/** + * @param {?proto.dump.AccountStorage|undefined} value + * @return {!proto.dump.Dump} returns this +*/ +proto.dump.Dump.prototype.setAccountstorage = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.dump.Dump} returns this + */ +proto.dump.Dump.prototype.clearAccountstorage = function() { + return this.setAccountstorage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.dump.Dump.prototype.hasAccountstorage = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional EVMEvent EVMEvent = 4; + * @return {?proto.dump.EVMEvent} + */ +proto.dump.Dump.prototype.getEvmevent = function() { + return /** @type{?proto.dump.EVMEvent} */ ( + jspb.Message.getWrapperField(this, proto.dump.EVMEvent, 4)); +}; + + +/** + * @param {?proto.dump.EVMEvent|undefined} value + * @return {!proto.dump.Dump} returns this +*/ +proto.dump.Dump.prototype.setEvmevent = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.dump.Dump} returns this + */ +proto.dump.Dump.prototype.clearEvmevent = function() { + return this.setEvmevent(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.dump.Dump.prototype.hasEvmevent = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional names.Entry Name = 5; + * @return {?proto.names.Entry} + */ +proto.dump.Dump.prototype.getName = function() { + return /** @type{?proto.names.Entry} */ ( + jspb.Message.getWrapperField(this, names_pb.Entry, 5)); +}; + + +/** + * @param {?proto.names.Entry|undefined} value + * @return {!proto.dump.Dump} returns this +*/ +proto.dump.Dump.prototype.setName = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.dump.Dump} returns this + */ +proto.dump.Dump.prototype.clearName = function() { + return this.setName(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.dump.Dump.prototype.hasName = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +goog.object.extend(exports, proto.dump); diff --git a/js/proto/encoding_grpc_pb.js b/js/proto/encoding_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/encoding_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/encoding_pb.d.ts b/js/proto/encoding_pb.d.ts new file mode 100644 index 000000000..ed0c75546 --- /dev/null +++ b/js/proto/encoding_pb.d.ts @@ -0,0 +1,33 @@ +// package: encoding +// file: encoding.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class TestMessage extends jspb.Message { + getType(): number; + setType(value: number): TestMessage; + + getAmount(): number; + setAmount(value: number): TestMessage; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TestMessage.AsObject; + static toObject(includeInstance: boolean, msg: TestMessage): TestMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TestMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TestMessage; + static deserializeBinaryFromReader(message: TestMessage, reader: jspb.BinaryReader): TestMessage; +} + +export namespace TestMessage { + export type AsObject = { + type: number, + amount: number, + } +} diff --git a/js/proto/encoding_pb.js b/js/proto/encoding_pb.js new file mode 100644 index 000000000..96507c900 --- /dev/null +++ b/js/proto/encoding_pb.js @@ -0,0 +1,201 @@ +// source: encoding.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.encoding.TestMessage', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.encoding.TestMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.encoding.TestMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.encoding.TestMessage.displayName = 'proto.encoding.TestMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.encoding.TestMessage.prototype.toObject = function(opt_includeInstance) { + return proto.encoding.TestMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.encoding.TestMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.encoding.TestMessage.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + amount: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.encoding.TestMessage} + */ +proto.encoding.TestMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.encoding.TestMessage; + return proto.encoding.TestMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.encoding.TestMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.encoding.TestMessage} + */ +proto.encoding.TestMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAmount(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.encoding.TestMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.encoding.TestMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.encoding.TestMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.encoding.TestMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getAmount(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional uint32 Type = 1; + * @return {number} + */ +proto.encoding.TestMessage.prototype.getType = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.encoding.TestMessage} returns this + */ +proto.encoding.TestMessage.prototype.setType = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 Amount = 2; + * @return {number} + */ +proto.encoding.TestMessage.prototype.getAmount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.encoding.TestMessage} returns this + */ +proto.encoding.TestMessage.prototype.setAmount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +goog.object.extend(exports, proto.encoding); diff --git a/js/proto/errors_grpc_pb.js b/js/proto/errors_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/errors_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/errors_pb.d.ts b/js/proto/errors_pb.d.ts new file mode 100644 index 000000000..f235786bb --- /dev/null +++ b/js/proto/errors_pb.d.ts @@ -0,0 +1,33 @@ +// package: errors +// file: errors.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class Exception extends jspb.Message { + getCode(): number; + setCode(value: number): Exception; + + getException(): string; + setException(value: string): Exception; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Exception.AsObject; + static toObject(includeInstance: boolean, msg: Exception): Exception.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Exception, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Exception; + static deserializeBinaryFromReader(message: Exception, reader: jspb.BinaryReader): Exception; +} + +export namespace Exception { + export type AsObject = { + code: number, + exception: string, + } +} diff --git a/js/proto/errors_pb.js b/js/proto/errors_pb.js new file mode 100644 index 000000000..3f90948ed --- /dev/null +++ b/js/proto/errors_pb.js @@ -0,0 +1,201 @@ +// source: errors.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.errors.Exception', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.errors.Exception = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.errors.Exception, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.errors.Exception.displayName = 'proto.errors.Exception'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.errors.Exception.prototype.toObject = function(opt_includeInstance) { + return proto.errors.Exception.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.errors.Exception} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.errors.Exception.toObject = function(includeInstance, msg) { + var f, obj = { + code: jspb.Message.getFieldWithDefault(msg, 1, 0), + exception: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.errors.Exception} + */ +proto.errors.Exception.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.errors.Exception; + return proto.errors.Exception.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.errors.Exception} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.errors.Exception} + */ +proto.errors.Exception.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCode(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setException(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.errors.Exception.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.errors.Exception.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.errors.Exception} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.errors.Exception.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCode(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getException(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional uint32 Code = 1; + * @return {number} + */ +proto.errors.Exception.prototype.getCode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.errors.Exception} returns this + */ +proto.errors.Exception.prototype.setCode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string Exception = 2; + * @return {string} + */ +proto.errors.Exception.prototype.getException = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.errors.Exception} returns this + */ +proto.errors.Exception.prototype.setException = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +goog.object.extend(exports, proto.errors); diff --git a/js/proto/exec_grpc_pb.js b/js/proto/exec_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/exec_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/exec_pb.d.ts b/js/proto/exec_pb.d.ts new file mode 100644 index 000000000..bc1f87597 --- /dev/null +++ b/js/proto/exec_pb.d.ts @@ -0,0 +1,808 @@ +// package: exec +// file: exec.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as tendermint_types_types_pb from "./tendermint/types/types_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as errors_pb from "./errors_pb"; +import * as names_pb from "./names_pb"; +import * as txs_pb from "./txs_pb"; +import * as permission_pb from "./permission_pb"; +import * as spec_pb from "./spec_pb"; + +export class StreamEvents extends jspb.Message { + clearStreameventsList(): void; + getStreameventsList(): Array; + setStreameventsList(value: Array): StreamEvents; + addStreamevents(value?: StreamEvent, index?: number): StreamEvent; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StreamEvents.AsObject; + static toObject(includeInstance: boolean, msg: StreamEvents): StreamEvents.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StreamEvents, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StreamEvents; + static deserializeBinaryFromReader(message: StreamEvents, reader: jspb.BinaryReader): StreamEvents; +} + +export namespace StreamEvents { + export type AsObject = { + streameventsList: Array, + } +} + +export class StreamEvent extends jspb.Message { + + hasBeginblock(): boolean; + clearBeginblock(): void; + getBeginblock(): BeginBlock | undefined; + setBeginblock(value?: BeginBlock): StreamEvent; + + + hasBegintx(): boolean; + clearBegintx(): void; + getBegintx(): BeginTx | undefined; + setBegintx(value?: BeginTx): StreamEvent; + + + hasEnvelope(): boolean; + clearEnvelope(): void; + getEnvelope(): txs_pb.Envelope | undefined; + setEnvelope(value?: txs_pb.Envelope): StreamEvent; + + + hasEvent(): boolean; + clearEvent(): void; + getEvent(): Event | undefined; + setEvent(value?: Event): StreamEvent; + + + hasEndtx(): boolean; + clearEndtx(): void; + getEndtx(): EndTx | undefined; + setEndtx(value?: EndTx): StreamEvent; + + + hasEndblock(): boolean; + clearEndblock(): void; + getEndblock(): EndBlock | undefined; + setEndblock(value?: EndBlock): StreamEvent; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StreamEvent.AsObject; + static toObject(includeInstance: boolean, msg: StreamEvent): StreamEvent.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StreamEvent, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StreamEvent; + static deserializeBinaryFromReader(message: StreamEvent, reader: jspb.BinaryReader): StreamEvent; +} + +export namespace StreamEvent { + export type AsObject = { + beginblock?: BeginBlock.AsObject, + begintx?: BeginTx.AsObject, + envelope?: txs_pb.Envelope.AsObject, + event?: Event.AsObject, + endtx?: EndTx.AsObject, + endblock?: EndBlock.AsObject, + } +} + +export class BeginBlock extends jspb.Message { + getHeight(): number; + setHeight(value: number): BeginBlock; + + getNumtxs(): number; + setNumtxs(value: number): BeginBlock; + + getPredecessorheight(): number; + setPredecessorheight(value: number): BeginBlock; + + + hasHeader(): boolean; + clearHeader(): void; + getHeader(): tendermint_types_types_pb.Header | undefined; + setHeader(value?: tendermint_types_types_pb.Header): BeginBlock; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BeginBlock.AsObject; + static toObject(includeInstance: boolean, msg: BeginBlock): BeginBlock.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BeginBlock, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BeginBlock; + static deserializeBinaryFromReader(message: BeginBlock, reader: jspb.BinaryReader): BeginBlock; +} + +export namespace BeginBlock { + export type AsObject = { + height: number, + numtxs: number, + predecessorheight: number, + header?: tendermint_types_types_pb.Header.AsObject, + } +} + +export class EndBlock extends jspb.Message { + getHeight(): number; + setHeight(value: number): EndBlock; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EndBlock.AsObject; + static toObject(includeInstance: boolean, msg: EndBlock): EndBlock.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EndBlock, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EndBlock; + static deserializeBinaryFromReader(message: EndBlock, reader: jspb.BinaryReader): EndBlock; +} + +export namespace EndBlock { + export type AsObject = { + height: number, + } +} + +export class BeginTx extends jspb.Message { + + hasTxheader(): boolean; + clearTxheader(): void; + getTxheader(): TxHeader | undefined; + setTxheader(value?: TxHeader): BeginTx; + + getNumevents(): number; + setNumevents(value: number): BeginTx; + + + hasResult(): boolean; + clearResult(): void; + getResult(): Result | undefined; + setResult(value?: Result): BeginTx; + + + hasException(): boolean; + clearException(): void; + getException(): errors_pb.Exception | undefined; + setException(value?: errors_pb.Exception): BeginTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BeginTx.AsObject; + static toObject(includeInstance: boolean, msg: BeginTx): BeginTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BeginTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BeginTx; + static deserializeBinaryFromReader(message: BeginTx, reader: jspb.BinaryReader): BeginTx; +} + +export namespace BeginTx { + export type AsObject = { + txheader?: TxHeader.AsObject, + numevents: number, + result?: Result.AsObject, + exception?: errors_pb.Exception.AsObject, + } +} + +export class EndTx extends jspb.Message { + getTxhash(): Uint8Array | string; + getTxhash_asU8(): Uint8Array; + getTxhash_asB64(): string; + setTxhash(value: Uint8Array | string): EndTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EndTx.AsObject; + static toObject(includeInstance: boolean, msg: EndTx): EndTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EndTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EndTx; + static deserializeBinaryFromReader(message: EndTx, reader: jspb.BinaryReader): EndTx; +} + +export namespace EndTx { + export type AsObject = { + txhash: Uint8Array | string, + } +} + +export class TxHeader extends jspb.Message { + getTxtype(): number; + setTxtype(value: number): TxHeader; + + getTxhash(): Uint8Array | string; + getTxhash_asU8(): Uint8Array; + getTxhash_asB64(): string; + setTxhash(value: Uint8Array | string): TxHeader; + + getHeight(): number; + setHeight(value: number): TxHeader; + + getIndex(): number; + setIndex(value: number): TxHeader; + + + hasOrigin(): boolean; + clearOrigin(): void; + getOrigin(): Origin | undefined; + setOrigin(value?: Origin): TxHeader; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxHeader.AsObject; + static toObject(includeInstance: boolean, msg: TxHeader): TxHeader.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxHeader, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxHeader; + static deserializeBinaryFromReader(message: TxHeader, reader: jspb.BinaryReader): TxHeader; +} + +export namespace TxHeader { + export type AsObject = { + txtype: number, + txhash: Uint8Array | string, + height: number, + index: number, + origin?: Origin.AsObject, + } +} + +export class BlockExecution extends jspb.Message { + getHeight(): number; + setHeight(value: number): BlockExecution; + + getPredecessorheight(): number; + setPredecessorheight(value: number): BlockExecution; + + + hasHeader(): boolean; + clearHeader(): void; + getHeader(): tendermint_types_types_pb.Header | undefined; + setHeader(value?: tendermint_types_types_pb.Header): BlockExecution; + + clearTxexecutionsList(): void; + getTxexecutionsList(): Array; + setTxexecutionsList(value: Array): BlockExecution; + addTxexecutions(value?: TxExecution, index?: number): TxExecution; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockExecution.AsObject; + static toObject(includeInstance: boolean, msg: BlockExecution): BlockExecution.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockExecution, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockExecution; + static deserializeBinaryFromReader(message: BlockExecution, reader: jspb.BinaryReader): BlockExecution; +} + +export namespace BlockExecution { + export type AsObject = { + height: number, + predecessorheight: number, + header?: tendermint_types_types_pb.Header.AsObject, + txexecutionsList: Array, + } +} + +export class TxExecutionKey extends jspb.Message { + getHeight(): number; + setHeight(value: number): TxExecutionKey; + + getOffset(): number; + setOffset(value: number): TxExecutionKey; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxExecutionKey.AsObject; + static toObject(includeInstance: boolean, msg: TxExecutionKey): TxExecutionKey.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxExecutionKey, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxExecutionKey; + static deserializeBinaryFromReader(message: TxExecutionKey, reader: jspb.BinaryReader): TxExecutionKey; +} + +export namespace TxExecutionKey { + export type AsObject = { + height: number, + offset: number, + } +} + +export class TxExecution extends jspb.Message { + + hasHeader(): boolean; + clearHeader(): void; + getHeader(): TxHeader | undefined; + setHeader(value?: TxHeader): TxExecution; + + + hasEnvelope(): boolean; + clearEnvelope(): void; + getEnvelope(): txs_pb.Envelope | undefined; + setEnvelope(value?: txs_pb.Envelope): TxExecution; + + clearEventsList(): void; + getEventsList(): Array; + setEventsList(value: Array): TxExecution; + addEvents(value?: Event, index?: number): Event; + + + hasResult(): boolean; + clearResult(): void; + getResult(): Result | undefined; + setResult(value?: Result): TxExecution; + + + hasReceipt(): boolean; + clearReceipt(): void; + getReceipt(): txs_pb.Receipt | undefined; + setReceipt(value?: txs_pb.Receipt): TxExecution; + + + hasException(): boolean; + clearException(): void; + getException(): errors_pb.Exception | undefined; + setException(value?: errors_pb.Exception): TxExecution; + + clearTxexecutionsList(): void; + getTxexecutionsList(): Array; + setTxexecutionsList(value: Array): TxExecution; + addTxexecutions(value?: TxExecution, index?: number): TxExecution; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxExecution.AsObject; + static toObject(includeInstance: boolean, msg: TxExecution): TxExecution.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxExecution, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxExecution; + static deserializeBinaryFromReader(message: TxExecution, reader: jspb.BinaryReader): TxExecution; +} + +export namespace TxExecution { + export type AsObject = { + header?: TxHeader.AsObject, + envelope?: txs_pb.Envelope.AsObject, + eventsList: Array, + result?: Result.AsObject, + receipt?: txs_pb.Receipt.AsObject, + exception?: errors_pb.Exception.AsObject, + txexecutionsList: Array, + } +} + +export class Origin extends jspb.Message { + getChainid(): string; + setChainid(value: string): Origin; + + getHeight(): number; + setHeight(value: number): Origin; + + getIndex(): number; + setIndex(value: number): Origin; + + + hasTime(): boolean; + clearTime(): void; + getTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTime(value?: google_protobuf_timestamp_pb.Timestamp): Origin; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Origin.AsObject; + static toObject(includeInstance: boolean, msg: Origin): Origin.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Origin, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Origin; + static deserializeBinaryFromReader(message: Origin, reader: jspb.BinaryReader): Origin; +} + +export namespace Origin { + export type AsObject = { + chainid: string, + height: number, + index: number, + time?: google_protobuf_timestamp_pb.Timestamp.AsObject, + } +} + +export class Header extends jspb.Message { + getTxtype(): number; + setTxtype(value: number): Header; + + getTxhash(): Uint8Array | string; + getTxhash_asU8(): Uint8Array; + getTxhash_asB64(): string; + setTxhash(value: Uint8Array | string): Header; + + getEventtype(): number; + setEventtype(value: number): Header; + + getEventid(): string; + setEventid(value: string): Header; + + getHeight(): number; + setHeight(value: number): Header; + + getIndex(): number; + setIndex(value: number): Header; + + + hasException(): boolean; + clearException(): void; + getException(): errors_pb.Exception | undefined; + setException(value?: errors_pb.Exception): Header; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Header.AsObject; + static toObject(includeInstance: boolean, msg: Header): Header.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Header, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Header; + static deserializeBinaryFromReader(message: Header, reader: jspb.BinaryReader): Header; +} + +export namespace Header { + export type AsObject = { + txtype: number, + txhash: Uint8Array | string, + eventtype: number, + eventid: string, + height: number, + index: number, + exception?: errors_pb.Exception.AsObject, + } +} + +export class Event extends jspb.Message { + + hasHeader(): boolean; + clearHeader(): void; + getHeader(): Header | undefined; + setHeader(value?: Header): Event; + + + hasInput(): boolean; + clearInput(): void; + getInput(): InputEvent | undefined; + setInput(value?: InputEvent): Event; + + + hasOutput(): boolean; + clearOutput(): void; + getOutput(): OutputEvent | undefined; + setOutput(value?: OutputEvent): Event; + + + hasCall(): boolean; + clearCall(): void; + getCall(): CallEvent | undefined; + setCall(value?: CallEvent): Event; + + + hasLog(): boolean; + clearLog(): void; + getLog(): LogEvent | undefined; + setLog(value?: LogEvent): Event; + + + hasGovernaccount(): boolean; + clearGovernaccount(): void; + getGovernaccount(): GovernAccountEvent | undefined; + setGovernaccount(value?: GovernAccountEvent): Event; + + + hasPrint(): boolean; + clearPrint(): void; + getPrint(): PrintEvent | undefined; + setPrint(value?: PrintEvent): Event; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Event.AsObject; + static toObject(includeInstance: boolean, msg: Event): Event.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Event, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Event; + static deserializeBinaryFromReader(message: Event, reader: jspb.BinaryReader): Event; +} + +export namespace Event { + export type AsObject = { + header?: Header.AsObject, + input?: InputEvent.AsObject, + output?: OutputEvent.AsObject, + call?: CallEvent.AsObject, + log?: LogEvent.AsObject, + governaccount?: GovernAccountEvent.AsObject, + print?: PrintEvent.AsObject, + } +} + +export class Result extends jspb.Message { + getReturn(): Uint8Array | string; + getReturn_asU8(): Uint8Array; + getReturn_asB64(): string; + setReturn(value: Uint8Array | string): Result; + + getGasused(): number; + setGasused(value: number): Result; + + + hasNameentry(): boolean; + clearNameentry(): void; + getNameentry(): names_pb.Entry | undefined; + setNameentry(value?: names_pb.Entry): Result; + + + hasPermargs(): boolean; + clearPermargs(): void; + getPermargs(): permission_pb.PermArgs | undefined; + setPermargs(value?: permission_pb.PermArgs): Result; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Result.AsObject; + static toObject(includeInstance: boolean, msg: Result): Result.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Result, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Result; + static deserializeBinaryFromReader(message: Result, reader: jspb.BinaryReader): Result; +} + +export namespace Result { + export type AsObject = { + pb_return: Uint8Array | string, + gasused: number, + nameentry?: names_pb.Entry.AsObject, + permargs?: permission_pb.PermArgs.AsObject, + } +} + +export class LogEvent extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): LogEvent; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): LogEvent; + + clearTopicsList(): void; + getTopicsList(): Array; + getTopicsList_asU8(): Array; + getTopicsList_asB64(): Array; + setTopicsList(value: Array): LogEvent; + addTopics(value: Uint8Array | string, index?: number): Uint8Array | string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): LogEvent.AsObject; + static toObject(includeInstance: boolean, msg: LogEvent): LogEvent.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: LogEvent, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): LogEvent; + static deserializeBinaryFromReader(message: LogEvent, reader: jspb.BinaryReader): LogEvent; +} + +export namespace LogEvent { + export type AsObject = { + address: Uint8Array | string, + data: Uint8Array | string, + topicsList: Array, + } +} + +export class CallEvent extends jspb.Message { + getCalltype(): number; + setCalltype(value: number): CallEvent; + + + hasCalldata(): boolean; + clearCalldata(): void; + getCalldata(): CallData | undefined; + setCalldata(value?: CallData): CallEvent; + + getOrigin(): Uint8Array | string; + getOrigin_asU8(): Uint8Array; + getOrigin_asB64(): string; + setOrigin(value: Uint8Array | string): CallEvent; + + getStackdepth(): number; + setStackdepth(value: number): CallEvent; + + getReturn(): Uint8Array | string; + getReturn_asU8(): Uint8Array; + getReturn_asB64(): string; + setReturn(value: Uint8Array | string): CallEvent; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CallEvent.AsObject; + static toObject(includeInstance: boolean, msg: CallEvent): CallEvent.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CallEvent, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CallEvent; + static deserializeBinaryFromReader(message: CallEvent, reader: jspb.BinaryReader): CallEvent; +} + +export namespace CallEvent { + export type AsObject = { + calltype: number, + calldata?: CallData.AsObject, + origin: Uint8Array | string, + stackdepth: number, + pb_return: Uint8Array | string, + } +} + +export class PrintEvent extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): PrintEvent; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): PrintEvent; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PrintEvent.AsObject; + static toObject(includeInstance: boolean, msg: PrintEvent): PrintEvent.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PrintEvent, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PrintEvent; + static deserializeBinaryFromReader(message: PrintEvent, reader: jspb.BinaryReader): PrintEvent; +} + +export namespace PrintEvent { + export type AsObject = { + address: Uint8Array | string, + data: Uint8Array | string, + } +} + +export class GovernAccountEvent extends jspb.Message { + + hasAccountupdate(): boolean; + clearAccountupdate(): void; + getAccountupdate(): spec_pb.TemplateAccount | undefined; + setAccountupdate(value?: spec_pb.TemplateAccount): GovernAccountEvent; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GovernAccountEvent.AsObject; + static toObject(includeInstance: boolean, msg: GovernAccountEvent): GovernAccountEvent.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GovernAccountEvent, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GovernAccountEvent; + static deserializeBinaryFromReader(message: GovernAccountEvent, reader: jspb.BinaryReader): GovernAccountEvent; +} + +export namespace GovernAccountEvent { + export type AsObject = { + accountupdate?: spec_pb.TemplateAccount.AsObject, + } +} + +export class InputEvent extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): InputEvent; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): InputEvent.AsObject; + static toObject(includeInstance: boolean, msg: InputEvent): InputEvent.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: InputEvent, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): InputEvent; + static deserializeBinaryFromReader(message: InputEvent, reader: jspb.BinaryReader): InputEvent; +} + +export namespace InputEvent { + export type AsObject = { + address: Uint8Array | string, + } +} + +export class OutputEvent extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): OutputEvent; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OutputEvent.AsObject; + static toObject(includeInstance: boolean, msg: OutputEvent): OutputEvent.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OutputEvent, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OutputEvent; + static deserializeBinaryFromReader(message: OutputEvent, reader: jspb.BinaryReader): OutputEvent; +} + +export namespace OutputEvent { + export type AsObject = { + address: Uint8Array | string, + } +} + +export class CallData extends jspb.Message { + getCaller(): Uint8Array | string; + getCaller_asU8(): Uint8Array; + getCaller_asB64(): string; + setCaller(value: Uint8Array | string): CallData; + + getCallee(): Uint8Array | string; + getCallee_asU8(): Uint8Array; + getCallee_asB64(): string; + setCallee(value: Uint8Array | string): CallData; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): CallData; + + getValue(): Uint8Array | string; + getValue_asU8(): Uint8Array; + getValue_asB64(): string; + setValue(value: Uint8Array | string): CallData; + + getGas(): Uint8Array | string; + getGas_asU8(): Uint8Array; + getGas_asB64(): string; + setGas(value: Uint8Array | string): CallData; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CallData.AsObject; + static toObject(includeInstance: boolean, msg: CallData): CallData.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CallData, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CallData; + static deserializeBinaryFromReader(message: CallData, reader: jspb.BinaryReader): CallData; +} + +export namespace CallData { + export type AsObject = { + caller: Uint8Array | string, + callee: Uint8Array | string, + data: Uint8Array | string, + value: Uint8Array | string, + gas: Uint8Array | string, + } +} diff --git a/js/proto/exec_pb.js b/js/proto/exec_pb.js new file mode 100644 index 000000000..cf5598c15 --- /dev/null +++ b/js/proto/exec_pb.js @@ -0,0 +1,6046 @@ +// source: exec.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_types_types_pb = require('./tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +var errors_pb = require('./errors_pb.js'); +goog.object.extend(proto, errors_pb); +var names_pb = require('./names_pb.js'); +goog.object.extend(proto, names_pb); +var txs_pb = require('./txs_pb.js'); +goog.object.extend(proto, txs_pb); +var permission_pb = require('./permission_pb.js'); +goog.object.extend(proto, permission_pb); +var spec_pb = require('./spec_pb.js'); +goog.object.extend(proto, spec_pb); +goog.exportSymbol('proto.exec.BeginBlock', null, global); +goog.exportSymbol('proto.exec.BeginTx', null, global); +goog.exportSymbol('proto.exec.BlockExecution', null, global); +goog.exportSymbol('proto.exec.CallData', null, global); +goog.exportSymbol('proto.exec.CallEvent', null, global); +goog.exportSymbol('proto.exec.EndBlock', null, global); +goog.exportSymbol('proto.exec.EndTx', null, global); +goog.exportSymbol('proto.exec.Event', null, global); +goog.exportSymbol('proto.exec.GovernAccountEvent', null, global); +goog.exportSymbol('proto.exec.Header', null, global); +goog.exportSymbol('proto.exec.InputEvent', null, global); +goog.exportSymbol('proto.exec.LogEvent', null, global); +goog.exportSymbol('proto.exec.Origin', null, global); +goog.exportSymbol('proto.exec.OutputEvent', null, global); +goog.exportSymbol('proto.exec.PrintEvent', null, global); +goog.exportSymbol('proto.exec.Result', null, global); +goog.exportSymbol('proto.exec.StreamEvent', null, global); +goog.exportSymbol('proto.exec.StreamEvents', null, global); +goog.exportSymbol('proto.exec.TxExecution', null, global); +goog.exportSymbol('proto.exec.TxExecutionKey', null, global); +goog.exportSymbol('proto.exec.TxHeader', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.StreamEvents = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.exec.StreamEvents.repeatedFields_, null); +}; +goog.inherits(proto.exec.StreamEvents, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.StreamEvents.displayName = 'proto.exec.StreamEvents'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.StreamEvent = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.StreamEvent, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.StreamEvent.displayName = 'proto.exec.StreamEvent'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.BeginBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.BeginBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.BeginBlock.displayName = 'proto.exec.BeginBlock'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.EndBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.EndBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.EndBlock.displayName = 'proto.exec.EndBlock'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.BeginTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.BeginTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.BeginTx.displayName = 'proto.exec.BeginTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.EndTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.EndTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.EndTx.displayName = 'proto.exec.EndTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.TxHeader = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.TxHeader, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.TxHeader.displayName = 'proto.exec.TxHeader'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.BlockExecution = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.exec.BlockExecution.repeatedFields_, null); +}; +goog.inherits(proto.exec.BlockExecution, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.BlockExecution.displayName = 'proto.exec.BlockExecution'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.TxExecutionKey = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.TxExecutionKey, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.TxExecutionKey.displayName = 'proto.exec.TxExecutionKey'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.TxExecution = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.exec.TxExecution.repeatedFields_, null); +}; +goog.inherits(proto.exec.TxExecution, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.TxExecution.displayName = 'proto.exec.TxExecution'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.Origin = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.Origin, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.Origin.displayName = 'proto.exec.Origin'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.Header = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.Header, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.Header.displayName = 'proto.exec.Header'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.Event = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.Event, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.Event.displayName = 'proto.exec.Event'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.Result = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.Result, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.Result.displayName = 'proto.exec.Result'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.LogEvent = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.exec.LogEvent.repeatedFields_, null); +}; +goog.inherits(proto.exec.LogEvent, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.LogEvent.displayName = 'proto.exec.LogEvent'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.CallEvent = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.CallEvent, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.CallEvent.displayName = 'proto.exec.CallEvent'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.PrintEvent = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.PrintEvent, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.PrintEvent.displayName = 'proto.exec.PrintEvent'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.GovernAccountEvent = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.GovernAccountEvent, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.GovernAccountEvent.displayName = 'proto.exec.GovernAccountEvent'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.InputEvent = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.InputEvent, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.InputEvent.displayName = 'proto.exec.InputEvent'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.OutputEvent = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.OutputEvent, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.OutputEvent.displayName = 'proto.exec.OutputEvent'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.exec.CallData = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.exec.CallData, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.exec.CallData.displayName = 'proto.exec.CallData'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.exec.StreamEvents.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.StreamEvents.prototype.toObject = function(opt_includeInstance) { + return proto.exec.StreamEvents.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.StreamEvents} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.StreamEvents.toObject = function(includeInstance, msg) { + var f, obj = { + streameventsList: jspb.Message.toObjectList(msg.getStreameventsList(), + proto.exec.StreamEvent.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.StreamEvents} + */ +proto.exec.StreamEvents.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.StreamEvents; + return proto.exec.StreamEvents.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.StreamEvents} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.StreamEvents} + */ +proto.exec.StreamEvents.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.exec.StreamEvent; + reader.readMessage(value,proto.exec.StreamEvent.deserializeBinaryFromReader); + msg.addStreamevents(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.StreamEvents.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.StreamEvents.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.StreamEvents} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.StreamEvents.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStreameventsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.exec.StreamEvent.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated StreamEvent StreamEvents = 1; + * @return {!Array} + */ +proto.exec.StreamEvents.prototype.getStreameventsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.exec.StreamEvent, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.exec.StreamEvents} returns this +*/ +proto.exec.StreamEvents.prototype.setStreameventsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.exec.StreamEvent=} opt_value + * @param {number=} opt_index + * @return {!proto.exec.StreamEvent} + */ +proto.exec.StreamEvents.prototype.addStreamevents = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.exec.StreamEvent, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.exec.StreamEvents} returns this + */ +proto.exec.StreamEvents.prototype.clearStreameventsList = function() { + return this.setStreameventsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.StreamEvent.prototype.toObject = function(opt_includeInstance) { + return proto.exec.StreamEvent.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.StreamEvent} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.StreamEvent.toObject = function(includeInstance, msg) { + var f, obj = { + beginblock: (f = msg.getBeginblock()) && proto.exec.BeginBlock.toObject(includeInstance, f), + begintx: (f = msg.getBegintx()) && proto.exec.BeginTx.toObject(includeInstance, f), + envelope: (f = msg.getEnvelope()) && txs_pb.Envelope.toObject(includeInstance, f), + event: (f = msg.getEvent()) && proto.exec.Event.toObject(includeInstance, f), + endtx: (f = msg.getEndtx()) && proto.exec.EndTx.toObject(includeInstance, f), + endblock: (f = msg.getEndblock()) && proto.exec.EndBlock.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.StreamEvent} + */ +proto.exec.StreamEvent.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.StreamEvent; + return proto.exec.StreamEvent.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.StreamEvent} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.StreamEvent} + */ +proto.exec.StreamEvent.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.exec.BeginBlock; + reader.readMessage(value,proto.exec.BeginBlock.deserializeBinaryFromReader); + msg.setBeginblock(value); + break; + case 2: + var value = new proto.exec.BeginTx; + reader.readMessage(value,proto.exec.BeginTx.deserializeBinaryFromReader); + msg.setBegintx(value); + break; + case 3: + var value = new txs_pb.Envelope; + reader.readMessage(value,txs_pb.Envelope.deserializeBinaryFromReader); + msg.setEnvelope(value); + break; + case 4: + var value = new proto.exec.Event; + reader.readMessage(value,proto.exec.Event.deserializeBinaryFromReader); + msg.setEvent(value); + break; + case 5: + var value = new proto.exec.EndTx; + reader.readMessage(value,proto.exec.EndTx.deserializeBinaryFromReader); + msg.setEndtx(value); + break; + case 6: + var value = new proto.exec.EndBlock; + reader.readMessage(value,proto.exec.EndBlock.deserializeBinaryFromReader); + msg.setEndblock(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.StreamEvent.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.StreamEvent.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.StreamEvent} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.StreamEvent.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBeginblock(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.exec.BeginBlock.serializeBinaryToWriter + ); + } + f = message.getBegintx(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.exec.BeginTx.serializeBinaryToWriter + ); + } + f = message.getEnvelope(); + if (f != null) { + writer.writeMessage( + 3, + f, + txs_pb.Envelope.serializeBinaryToWriter + ); + } + f = message.getEvent(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.exec.Event.serializeBinaryToWriter + ); + } + f = message.getEndtx(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.exec.EndTx.serializeBinaryToWriter + ); + } + f = message.getEndblock(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.exec.EndBlock.serializeBinaryToWriter + ); + } +}; + + +/** + * optional BeginBlock BeginBlock = 1; + * @return {?proto.exec.BeginBlock} + */ +proto.exec.StreamEvent.prototype.getBeginblock = function() { + return /** @type{?proto.exec.BeginBlock} */ ( + jspb.Message.getWrapperField(this, proto.exec.BeginBlock, 1)); +}; + + +/** + * @param {?proto.exec.BeginBlock|undefined} value + * @return {!proto.exec.StreamEvent} returns this +*/ +proto.exec.StreamEvent.prototype.setBeginblock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.StreamEvent} returns this + */ +proto.exec.StreamEvent.prototype.clearBeginblock = function() { + return this.setBeginblock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.StreamEvent.prototype.hasBeginblock = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional BeginTx BeginTx = 2; + * @return {?proto.exec.BeginTx} + */ +proto.exec.StreamEvent.prototype.getBegintx = function() { + return /** @type{?proto.exec.BeginTx} */ ( + jspb.Message.getWrapperField(this, proto.exec.BeginTx, 2)); +}; + + +/** + * @param {?proto.exec.BeginTx|undefined} value + * @return {!proto.exec.StreamEvent} returns this +*/ +proto.exec.StreamEvent.prototype.setBegintx = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.StreamEvent} returns this + */ +proto.exec.StreamEvent.prototype.clearBegintx = function() { + return this.setBegintx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.StreamEvent.prototype.hasBegintx = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional txs.Envelope Envelope = 3; + * @return {?proto.txs.Envelope} + */ +proto.exec.StreamEvent.prototype.getEnvelope = function() { + return /** @type{?proto.txs.Envelope} */ ( + jspb.Message.getWrapperField(this, txs_pb.Envelope, 3)); +}; + + +/** + * @param {?proto.txs.Envelope|undefined} value + * @return {!proto.exec.StreamEvent} returns this +*/ +proto.exec.StreamEvent.prototype.setEnvelope = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.StreamEvent} returns this + */ +proto.exec.StreamEvent.prototype.clearEnvelope = function() { + return this.setEnvelope(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.StreamEvent.prototype.hasEnvelope = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional Event Event = 4; + * @return {?proto.exec.Event} + */ +proto.exec.StreamEvent.prototype.getEvent = function() { + return /** @type{?proto.exec.Event} */ ( + jspb.Message.getWrapperField(this, proto.exec.Event, 4)); +}; + + +/** + * @param {?proto.exec.Event|undefined} value + * @return {!proto.exec.StreamEvent} returns this +*/ +proto.exec.StreamEvent.prototype.setEvent = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.StreamEvent} returns this + */ +proto.exec.StreamEvent.prototype.clearEvent = function() { + return this.setEvent(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.StreamEvent.prototype.hasEvent = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional EndTx EndTx = 5; + * @return {?proto.exec.EndTx} + */ +proto.exec.StreamEvent.prototype.getEndtx = function() { + return /** @type{?proto.exec.EndTx} */ ( + jspb.Message.getWrapperField(this, proto.exec.EndTx, 5)); +}; + + +/** + * @param {?proto.exec.EndTx|undefined} value + * @return {!proto.exec.StreamEvent} returns this +*/ +proto.exec.StreamEvent.prototype.setEndtx = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.StreamEvent} returns this + */ +proto.exec.StreamEvent.prototype.clearEndtx = function() { + return this.setEndtx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.StreamEvent.prototype.hasEndtx = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional EndBlock EndBlock = 6; + * @return {?proto.exec.EndBlock} + */ +proto.exec.StreamEvent.prototype.getEndblock = function() { + return /** @type{?proto.exec.EndBlock} */ ( + jspb.Message.getWrapperField(this, proto.exec.EndBlock, 6)); +}; + + +/** + * @param {?proto.exec.EndBlock|undefined} value + * @return {!proto.exec.StreamEvent} returns this +*/ +proto.exec.StreamEvent.prototype.setEndblock = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.StreamEvent} returns this + */ +proto.exec.StreamEvent.prototype.clearEndblock = function() { + return this.setEndblock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.StreamEvent.prototype.hasEndblock = function() { + return jspb.Message.getField(this, 6) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.BeginBlock.prototype.toObject = function(opt_includeInstance) { + return proto.exec.BeginBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.BeginBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.BeginBlock.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + numtxs: jspb.Message.getFieldWithDefault(msg, 3, 0), + predecessorheight: jspb.Message.getFieldWithDefault(msg, 4, 0), + header: (f = msg.getHeader()) && tendermint_types_types_pb.Header.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.BeginBlock} + */ +proto.exec.BeginBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.BeginBlock; + return proto.exec.BeginBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.BeginBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.BeginBlock} + */ +proto.exec.BeginBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setNumtxs(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setPredecessorheight(value); + break; + case 2: + var value = new tendermint_types_types_pb.Header; + reader.readMessage(value,tendermint_types_types_pb.Header.deserializeBinaryFromReader); + msg.setHeader(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.BeginBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.BeginBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.BeginBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.BeginBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getNumtxs(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getPredecessorheight(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getHeader(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_types_types_pb.Header.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.exec.BeginBlock.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.BeginBlock} returns this + */ +proto.exec.BeginBlock.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 NumTxs = 3; + * @return {number} + */ +proto.exec.BeginBlock.prototype.getNumtxs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.BeginBlock} returns this + */ +proto.exec.BeginBlock.prototype.setNumtxs = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint64 PredecessorHeight = 4; + * @return {number} + */ +proto.exec.BeginBlock.prototype.getPredecessorheight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.BeginBlock} returns this + */ +proto.exec.BeginBlock.prototype.setPredecessorheight = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional tendermint.types.Header Header = 2; + * @return {?proto.tendermint.types.Header} + */ +proto.exec.BeginBlock.prototype.getHeader = function() { + return /** @type{?proto.tendermint.types.Header} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Header, 2)); +}; + + +/** + * @param {?proto.tendermint.types.Header|undefined} value + * @return {!proto.exec.BeginBlock} returns this +*/ +proto.exec.BeginBlock.prototype.setHeader = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.BeginBlock} returns this + */ +proto.exec.BeginBlock.prototype.clearHeader = function() { + return this.setHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.BeginBlock.prototype.hasHeader = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.EndBlock.prototype.toObject = function(opt_includeInstance) { + return proto.exec.EndBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.EndBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.EndBlock.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.EndBlock} + */ +proto.exec.EndBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.EndBlock; + return proto.exec.EndBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.EndBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.EndBlock} + */ +proto.exec.EndBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.EndBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.EndBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.EndBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.EndBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.exec.EndBlock.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.EndBlock} returns this + */ +proto.exec.EndBlock.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.BeginTx.prototype.toObject = function(opt_includeInstance) { + return proto.exec.BeginTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.BeginTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.BeginTx.toObject = function(includeInstance, msg) { + var f, obj = { + txheader: (f = msg.getTxheader()) && proto.exec.TxHeader.toObject(includeInstance, f), + numevents: jspb.Message.getFieldWithDefault(msg, 5, 0), + result: (f = msg.getResult()) && proto.exec.Result.toObject(includeInstance, f), + exception: (f = msg.getException()) && errors_pb.Exception.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.BeginTx} + */ +proto.exec.BeginTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.BeginTx; + return proto.exec.BeginTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.BeginTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.BeginTx} + */ +proto.exec.BeginTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.exec.TxHeader; + reader.readMessage(value,proto.exec.TxHeader.deserializeBinaryFromReader); + msg.setTxheader(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint64()); + msg.setNumevents(value); + break; + case 2: + var value = new proto.exec.Result; + reader.readMessage(value,proto.exec.Result.deserializeBinaryFromReader); + msg.setResult(value); + break; + case 4: + var value = new errors_pb.Exception; + reader.readMessage(value,errors_pb.Exception.deserializeBinaryFromReader); + msg.setException(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.BeginTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.BeginTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.BeginTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.BeginTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxheader(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.exec.TxHeader.serializeBinaryToWriter + ); + } + f = message.getNumevents(); + if (f !== 0) { + writer.writeUint64( + 5, + f + ); + } + f = message.getResult(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.exec.Result.serializeBinaryToWriter + ); + } + f = message.getException(); + if (f != null) { + writer.writeMessage( + 4, + f, + errors_pb.Exception.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TxHeader TxHeader = 1; + * @return {?proto.exec.TxHeader} + */ +proto.exec.BeginTx.prototype.getTxheader = function() { + return /** @type{?proto.exec.TxHeader} */ ( + jspb.Message.getWrapperField(this, proto.exec.TxHeader, 1)); +}; + + +/** + * @param {?proto.exec.TxHeader|undefined} value + * @return {!proto.exec.BeginTx} returns this +*/ +proto.exec.BeginTx.prototype.setTxheader = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.BeginTx} returns this + */ +proto.exec.BeginTx.prototype.clearTxheader = function() { + return this.setTxheader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.BeginTx.prototype.hasTxheader = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional uint64 NumEvents = 5; + * @return {number} + */ +proto.exec.BeginTx.prototype.getNumevents = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.BeginTx} returns this + */ +proto.exec.BeginTx.prototype.setNumevents = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional Result Result = 2; + * @return {?proto.exec.Result} + */ +proto.exec.BeginTx.prototype.getResult = function() { + return /** @type{?proto.exec.Result} */ ( + jspb.Message.getWrapperField(this, proto.exec.Result, 2)); +}; + + +/** + * @param {?proto.exec.Result|undefined} value + * @return {!proto.exec.BeginTx} returns this +*/ +proto.exec.BeginTx.prototype.setResult = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.BeginTx} returns this + */ +proto.exec.BeginTx.prototype.clearResult = function() { + return this.setResult(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.BeginTx.prototype.hasResult = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional errors.Exception Exception = 4; + * @return {?proto.errors.Exception} + */ +proto.exec.BeginTx.prototype.getException = function() { + return /** @type{?proto.errors.Exception} */ ( + jspb.Message.getWrapperField(this, errors_pb.Exception, 4)); +}; + + +/** + * @param {?proto.errors.Exception|undefined} value + * @return {!proto.exec.BeginTx} returns this +*/ +proto.exec.BeginTx.prototype.setException = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.BeginTx} returns this + */ +proto.exec.BeginTx.prototype.clearException = function() { + return this.setException(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.BeginTx.prototype.hasException = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.EndTx.prototype.toObject = function(opt_includeInstance) { + return proto.exec.EndTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.EndTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.EndTx.toObject = function(includeInstance, msg) { + var f, obj = { + txhash: msg.getTxhash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.EndTx} + */ +proto.exec.EndTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.EndTx; + return proto.exec.EndTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.EndTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.EndTx} + */ +proto.exec.EndTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTxhash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.EndTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.EndTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.EndTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.EndTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxhash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional bytes TxHash = 3; + * @return {!(string|Uint8Array)} + */ +proto.exec.EndTx.prototype.getTxhash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes TxHash = 3; + * This is a type-conversion wrapper around `getTxhash()` + * @return {string} + */ +proto.exec.EndTx.prototype.getTxhash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTxhash())); +}; + + +/** + * optional bytes TxHash = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTxhash()` + * @return {!Uint8Array} + */ +proto.exec.EndTx.prototype.getTxhash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTxhash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.EndTx} returns this + */ +proto.exec.EndTx.prototype.setTxhash = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.TxHeader.prototype.toObject = function(opt_includeInstance) { + return proto.exec.TxHeader.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.TxHeader} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.TxHeader.toObject = function(includeInstance, msg) { + var f, obj = { + txtype: jspb.Message.getFieldWithDefault(msg, 1, 0), + txhash: msg.getTxhash_asB64(), + height: jspb.Message.getFieldWithDefault(msg, 3, 0), + index: jspb.Message.getFieldWithDefault(msg, 4, 0), + origin: (f = msg.getOrigin()) && proto.exec.Origin.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.TxHeader} + */ +proto.exec.TxHeader.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.TxHeader; + return proto.exec.TxHeader.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.TxHeader} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.TxHeader} + */ +proto.exec.TxHeader.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setTxtype(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTxhash(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIndex(value); + break; + case 5: + var value = new proto.exec.Origin; + reader.readMessage(value,proto.exec.Origin.deserializeBinaryFromReader); + msg.setOrigin(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.TxHeader.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.TxHeader.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.TxHeader} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.TxHeader.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxtype(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getTxhash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getOrigin(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.exec.Origin.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint32 TxType = 1; + * @return {number} + */ +proto.exec.TxHeader.prototype.getTxtype = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.TxHeader} returns this + */ +proto.exec.TxHeader.prototype.setTxtype = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes TxHash = 2; + * @return {!(string|Uint8Array)} + */ +proto.exec.TxHeader.prototype.getTxhash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes TxHash = 2; + * This is a type-conversion wrapper around `getTxhash()` + * @return {string} + */ +proto.exec.TxHeader.prototype.getTxhash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTxhash())); +}; + + +/** + * optional bytes TxHash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTxhash()` + * @return {!Uint8Array} + */ +proto.exec.TxHeader.prototype.getTxhash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTxhash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.TxHeader} returns this + */ +proto.exec.TxHeader.prototype.setTxhash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional uint64 Height = 3; + * @return {number} + */ +proto.exec.TxHeader.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.TxHeader} returns this + */ +proto.exec.TxHeader.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint64 Index = 4; + * @return {number} + */ +proto.exec.TxHeader.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.TxHeader} returns this + */ +proto.exec.TxHeader.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional Origin Origin = 5; + * @return {?proto.exec.Origin} + */ +proto.exec.TxHeader.prototype.getOrigin = function() { + return /** @type{?proto.exec.Origin} */ ( + jspb.Message.getWrapperField(this, proto.exec.Origin, 5)); +}; + + +/** + * @param {?proto.exec.Origin|undefined} value + * @return {!proto.exec.TxHeader} returns this +*/ +proto.exec.TxHeader.prototype.setOrigin = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.TxHeader} returns this + */ +proto.exec.TxHeader.prototype.clearOrigin = function() { + return this.setOrigin(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.TxHeader.prototype.hasOrigin = function() { + return jspb.Message.getField(this, 5) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.exec.BlockExecution.repeatedFields_ = [3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.BlockExecution.prototype.toObject = function(opt_includeInstance) { + return proto.exec.BlockExecution.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.BlockExecution} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.BlockExecution.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + predecessorheight: jspb.Message.getFieldWithDefault(msg, 4, 0), + header: (f = msg.getHeader()) && tendermint_types_types_pb.Header.toObject(includeInstance, f), + txexecutionsList: jspb.Message.toObjectList(msg.getTxexecutionsList(), + proto.exec.TxExecution.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.BlockExecution} + */ +proto.exec.BlockExecution.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.BlockExecution; + return proto.exec.BlockExecution.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.BlockExecution} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.BlockExecution} + */ +proto.exec.BlockExecution.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setPredecessorheight(value); + break; + case 2: + var value = new tendermint_types_types_pb.Header; + reader.readMessage(value,tendermint_types_types_pb.Header.deserializeBinaryFromReader); + msg.setHeader(value); + break; + case 3: + var value = new proto.exec.TxExecution; + reader.readMessage(value,proto.exec.TxExecution.deserializeBinaryFromReader); + msg.addTxexecutions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.BlockExecution.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.BlockExecution.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.BlockExecution} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.BlockExecution.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getPredecessorheight(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getHeader(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_types_types_pb.Header.serializeBinaryToWriter + ); + } + f = message.getTxexecutionsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.exec.TxExecution.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.exec.BlockExecution.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.BlockExecution} returns this + */ +proto.exec.BlockExecution.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 PredecessorHeight = 4; + * @return {number} + */ +proto.exec.BlockExecution.prototype.getPredecessorheight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.BlockExecution} returns this + */ +proto.exec.BlockExecution.prototype.setPredecessorheight = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional tendermint.types.Header Header = 2; + * @return {?proto.tendermint.types.Header} + */ +proto.exec.BlockExecution.prototype.getHeader = function() { + return /** @type{?proto.tendermint.types.Header} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Header, 2)); +}; + + +/** + * @param {?proto.tendermint.types.Header|undefined} value + * @return {!proto.exec.BlockExecution} returns this +*/ +proto.exec.BlockExecution.prototype.setHeader = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.BlockExecution} returns this + */ +proto.exec.BlockExecution.prototype.clearHeader = function() { + return this.setHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.BlockExecution.prototype.hasHeader = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated TxExecution TxExecutions = 3; + * @return {!Array} + */ +proto.exec.BlockExecution.prototype.getTxexecutionsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.exec.TxExecution, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.exec.BlockExecution} returns this +*/ +proto.exec.BlockExecution.prototype.setTxexecutionsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.exec.TxExecution=} opt_value + * @param {number=} opt_index + * @return {!proto.exec.TxExecution} + */ +proto.exec.BlockExecution.prototype.addTxexecutions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.exec.TxExecution, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.exec.BlockExecution} returns this + */ +proto.exec.BlockExecution.prototype.clearTxexecutionsList = function() { + return this.setTxexecutionsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.TxExecutionKey.prototype.toObject = function(opt_includeInstance) { + return proto.exec.TxExecutionKey.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.TxExecutionKey} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.TxExecutionKey.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + offset: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.TxExecutionKey} + */ +proto.exec.TxExecutionKey.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.TxExecutionKey; + return proto.exec.TxExecutionKey.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.TxExecutionKey} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.TxExecutionKey} + */ +proto.exec.TxExecutionKey.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setOffset(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.TxExecutionKey.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.TxExecutionKey.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.TxExecutionKey} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.TxExecutionKey.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getOffset(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.exec.TxExecutionKey.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.TxExecutionKey} returns this + */ +proto.exec.TxExecutionKey.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 Offset = 2; + * @return {number} + */ +proto.exec.TxExecutionKey.prototype.getOffset = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.TxExecutionKey} returns this + */ +proto.exec.TxExecutionKey.prototype.setOffset = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.exec.TxExecution.repeatedFields_ = [7,11]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.TxExecution.prototype.toObject = function(opt_includeInstance) { + return proto.exec.TxExecution.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.TxExecution} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.TxExecution.toObject = function(includeInstance, msg) { + var f, obj = { + header: (f = msg.getHeader()) && proto.exec.TxHeader.toObject(includeInstance, f), + envelope: (f = msg.getEnvelope()) && txs_pb.Envelope.toObject(includeInstance, f), + eventsList: jspb.Message.toObjectList(msg.getEventsList(), + proto.exec.Event.toObject, includeInstance), + result: (f = msg.getResult()) && proto.exec.Result.toObject(includeInstance, f), + receipt: (f = msg.getReceipt()) && txs_pb.Receipt.toObject(includeInstance, f), + exception: (f = msg.getException()) && errors_pb.Exception.toObject(includeInstance, f), + txexecutionsList: jspb.Message.toObjectList(msg.getTxexecutionsList(), + proto.exec.TxExecution.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.TxExecution} + */ +proto.exec.TxExecution.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.TxExecution; + return proto.exec.TxExecution.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.TxExecution} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.TxExecution} + */ +proto.exec.TxExecution.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.exec.TxHeader; + reader.readMessage(value,proto.exec.TxHeader.deserializeBinaryFromReader); + msg.setHeader(value); + break; + case 6: + var value = new txs_pb.Envelope; + reader.readMessage(value,txs_pb.Envelope.deserializeBinaryFromReader); + msg.setEnvelope(value); + break; + case 7: + var value = new proto.exec.Event; + reader.readMessage(value,proto.exec.Event.deserializeBinaryFromReader); + msg.addEvents(value); + break; + case 8: + var value = new proto.exec.Result; + reader.readMessage(value,proto.exec.Result.deserializeBinaryFromReader); + msg.setResult(value); + break; + case 9: + var value = new txs_pb.Receipt; + reader.readMessage(value,txs_pb.Receipt.deserializeBinaryFromReader); + msg.setReceipt(value); + break; + case 10: + var value = new errors_pb.Exception; + reader.readMessage(value,errors_pb.Exception.deserializeBinaryFromReader); + msg.setException(value); + break; + case 11: + var value = new proto.exec.TxExecution; + reader.readMessage(value,proto.exec.TxExecution.deserializeBinaryFromReader); + msg.addTxexecutions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.TxExecution.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.TxExecution.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.TxExecution} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.TxExecution.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeader(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.exec.TxHeader.serializeBinaryToWriter + ); + } + f = message.getEnvelope(); + if (f != null) { + writer.writeMessage( + 6, + f, + txs_pb.Envelope.serializeBinaryToWriter + ); + } + f = message.getEventsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 7, + f, + proto.exec.Event.serializeBinaryToWriter + ); + } + f = message.getResult(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.exec.Result.serializeBinaryToWriter + ); + } + f = message.getReceipt(); + if (f != null) { + writer.writeMessage( + 9, + f, + txs_pb.Receipt.serializeBinaryToWriter + ); + } + f = message.getException(); + if (f != null) { + writer.writeMessage( + 10, + f, + errors_pb.Exception.serializeBinaryToWriter + ); + } + f = message.getTxexecutionsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 11, + f, + proto.exec.TxExecution.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TxHeader Header = 1; + * @return {?proto.exec.TxHeader} + */ +proto.exec.TxExecution.prototype.getHeader = function() { + return /** @type{?proto.exec.TxHeader} */ ( + jspb.Message.getWrapperField(this, proto.exec.TxHeader, 1)); +}; + + +/** + * @param {?proto.exec.TxHeader|undefined} value + * @return {!proto.exec.TxExecution} returns this +*/ +proto.exec.TxExecution.prototype.setHeader = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.TxExecution} returns this + */ +proto.exec.TxExecution.prototype.clearHeader = function() { + return this.setHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.TxExecution.prototype.hasHeader = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional txs.Envelope Envelope = 6; + * @return {?proto.txs.Envelope} + */ +proto.exec.TxExecution.prototype.getEnvelope = function() { + return /** @type{?proto.txs.Envelope} */ ( + jspb.Message.getWrapperField(this, txs_pb.Envelope, 6)); +}; + + +/** + * @param {?proto.txs.Envelope|undefined} value + * @return {!proto.exec.TxExecution} returns this +*/ +proto.exec.TxExecution.prototype.setEnvelope = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.TxExecution} returns this + */ +proto.exec.TxExecution.prototype.clearEnvelope = function() { + return this.setEnvelope(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.TxExecution.prototype.hasEnvelope = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * repeated Event Events = 7; + * @return {!Array} + */ +proto.exec.TxExecution.prototype.getEventsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.exec.Event, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.exec.TxExecution} returns this +*/ +proto.exec.TxExecution.prototype.setEventsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 7, value); +}; + + +/** + * @param {!proto.exec.Event=} opt_value + * @param {number=} opt_index + * @return {!proto.exec.Event} + */ +proto.exec.TxExecution.prototype.addEvents = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.exec.Event, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.exec.TxExecution} returns this + */ +proto.exec.TxExecution.prototype.clearEventsList = function() { + return this.setEventsList([]); +}; + + +/** + * optional Result Result = 8; + * @return {?proto.exec.Result} + */ +proto.exec.TxExecution.prototype.getResult = function() { + return /** @type{?proto.exec.Result} */ ( + jspb.Message.getWrapperField(this, proto.exec.Result, 8)); +}; + + +/** + * @param {?proto.exec.Result|undefined} value + * @return {!proto.exec.TxExecution} returns this +*/ +proto.exec.TxExecution.prototype.setResult = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.TxExecution} returns this + */ +proto.exec.TxExecution.prototype.clearResult = function() { + return this.setResult(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.TxExecution.prototype.hasResult = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional txs.Receipt Receipt = 9; + * @return {?proto.txs.Receipt} + */ +proto.exec.TxExecution.prototype.getReceipt = function() { + return /** @type{?proto.txs.Receipt} */ ( + jspb.Message.getWrapperField(this, txs_pb.Receipt, 9)); +}; + + +/** + * @param {?proto.txs.Receipt|undefined} value + * @return {!proto.exec.TxExecution} returns this +*/ +proto.exec.TxExecution.prototype.setReceipt = function(value) { + return jspb.Message.setWrapperField(this, 9, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.TxExecution} returns this + */ +proto.exec.TxExecution.prototype.clearReceipt = function() { + return this.setReceipt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.TxExecution.prototype.hasReceipt = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional errors.Exception Exception = 10; + * @return {?proto.errors.Exception} + */ +proto.exec.TxExecution.prototype.getException = function() { + return /** @type{?proto.errors.Exception} */ ( + jspb.Message.getWrapperField(this, errors_pb.Exception, 10)); +}; + + +/** + * @param {?proto.errors.Exception|undefined} value + * @return {!proto.exec.TxExecution} returns this +*/ +proto.exec.TxExecution.prototype.setException = function(value) { + return jspb.Message.setWrapperField(this, 10, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.TxExecution} returns this + */ +proto.exec.TxExecution.prototype.clearException = function() { + return this.setException(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.TxExecution.prototype.hasException = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * repeated TxExecution TxExecutions = 11; + * @return {!Array} + */ +proto.exec.TxExecution.prototype.getTxexecutionsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.exec.TxExecution, 11)); +}; + + +/** + * @param {!Array} value + * @return {!proto.exec.TxExecution} returns this +*/ +proto.exec.TxExecution.prototype.setTxexecutionsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 11, value); +}; + + +/** + * @param {!proto.exec.TxExecution=} opt_value + * @param {number=} opt_index + * @return {!proto.exec.TxExecution} + */ +proto.exec.TxExecution.prototype.addTxexecutions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 11, opt_value, proto.exec.TxExecution, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.exec.TxExecution} returns this + */ +proto.exec.TxExecution.prototype.clearTxexecutionsList = function() { + return this.setTxexecutionsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.Origin.prototype.toObject = function(opt_includeInstance) { + return proto.exec.Origin.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.Origin} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.Origin.toObject = function(includeInstance, msg) { + var f, obj = { + chainid: jspb.Message.getFieldWithDefault(msg, 1, ""), + height: jspb.Message.getFieldWithDefault(msg, 2, 0), + index: jspb.Message.getFieldWithDefault(msg, 3, 0), + time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.Origin} + */ +proto.exec.Origin.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.Origin; + return proto.exec.Origin.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.Origin} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.Origin} + */ +proto.exec.Origin.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setChainid(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIndex(value); + break; + case 4: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTime(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.Origin.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.Origin.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.Origin} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.Origin.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getChainid(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getTime(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string ChainID = 1; + * @return {string} + */ +proto.exec.Origin.prototype.getChainid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.exec.Origin} returns this + */ +proto.exec.Origin.prototype.setChainid = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional uint64 Height = 2; + * @return {number} + */ +proto.exec.Origin.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.Origin} returns this + */ +proto.exec.Origin.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint64 Index = 3; + * @return {number} + */ +proto.exec.Origin.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.Origin} returns this + */ +proto.exec.Origin.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional google.protobuf.Timestamp Time = 4; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.exec.Origin.prototype.getTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 4)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.exec.Origin} returns this +*/ +proto.exec.Origin.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Origin} returns this + */ +proto.exec.Origin.prototype.clearTime = function() { + return this.setTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Origin.prototype.hasTime = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.Header.prototype.toObject = function(opt_includeInstance) { + return proto.exec.Header.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.Header} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.Header.toObject = function(includeInstance, msg) { + var f, obj = { + txtype: jspb.Message.getFieldWithDefault(msg, 1, 0), + txhash: msg.getTxhash_asB64(), + eventtype: jspb.Message.getFieldWithDefault(msg, 3, 0), + eventid: jspb.Message.getFieldWithDefault(msg, 4, ""), + height: jspb.Message.getFieldWithDefault(msg, 5, 0), + index: jspb.Message.getFieldWithDefault(msg, 6, 0), + exception: (f = msg.getException()) && errors_pb.Exception.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.Header} + */ +proto.exec.Header.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.Header; + return proto.exec.Header.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.Header} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.Header} + */ +proto.exec.Header.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setTxtype(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTxhash(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setEventtype(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setEventid(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIndex(value); + break; + case 7: + var value = new errors_pb.Exception; + reader.readMessage(value,errors_pb.Exception.deserializeBinaryFromReader); + msg.setException(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.Header.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.Header.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.Header} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.Header.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxtype(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getTxhash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getEventtype(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getEventid(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 5, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint64( + 6, + f + ); + } + f = message.getException(); + if (f != null) { + writer.writeMessage( + 7, + f, + errors_pb.Exception.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint32 TxType = 1; + * @return {number} + */ +proto.exec.Header.prototype.getTxtype = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.Header} returns this + */ +proto.exec.Header.prototype.setTxtype = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes TxHash = 2; + * @return {!(string|Uint8Array)} + */ +proto.exec.Header.prototype.getTxhash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes TxHash = 2; + * This is a type-conversion wrapper around `getTxhash()` + * @return {string} + */ +proto.exec.Header.prototype.getTxhash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTxhash())); +}; + + +/** + * optional bytes TxHash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTxhash()` + * @return {!Uint8Array} + */ +proto.exec.Header.prototype.getTxhash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTxhash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.Header} returns this + */ +proto.exec.Header.prototype.setTxhash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional uint32 EventType = 3; + * @return {number} + */ +proto.exec.Header.prototype.getEventtype = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.Header} returns this + */ +proto.exec.Header.prototype.setEventtype = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional string EventID = 4; + * @return {string} + */ +proto.exec.Header.prototype.getEventid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.exec.Header} returns this + */ +proto.exec.Header.prototype.setEventid = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional uint64 Height = 5; + * @return {number} + */ +proto.exec.Header.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.Header} returns this + */ +proto.exec.Header.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional uint64 Index = 6; + * @return {number} + */ +proto.exec.Header.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.Header} returns this + */ +proto.exec.Header.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + +/** + * optional errors.Exception Exception = 7; + * @return {?proto.errors.Exception} + */ +proto.exec.Header.prototype.getException = function() { + return /** @type{?proto.errors.Exception} */ ( + jspb.Message.getWrapperField(this, errors_pb.Exception, 7)); +}; + + +/** + * @param {?proto.errors.Exception|undefined} value + * @return {!proto.exec.Header} returns this +*/ +proto.exec.Header.prototype.setException = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Header} returns this + */ +proto.exec.Header.prototype.clearException = function() { + return this.setException(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Header.prototype.hasException = function() { + return jspb.Message.getField(this, 7) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.Event.prototype.toObject = function(opt_includeInstance) { + return proto.exec.Event.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.Event} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.Event.toObject = function(includeInstance, msg) { + var f, obj = { + header: (f = msg.getHeader()) && proto.exec.Header.toObject(includeInstance, f), + input: (f = msg.getInput()) && proto.exec.InputEvent.toObject(includeInstance, f), + output: (f = msg.getOutput()) && proto.exec.OutputEvent.toObject(includeInstance, f), + call: (f = msg.getCall()) && proto.exec.CallEvent.toObject(includeInstance, f), + log: (f = msg.getLog()) && proto.exec.LogEvent.toObject(includeInstance, f), + governaccount: (f = msg.getGovernaccount()) && proto.exec.GovernAccountEvent.toObject(includeInstance, f), + print: (f = msg.getPrint()) && proto.exec.PrintEvent.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.Event} + */ +proto.exec.Event.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.Event; + return proto.exec.Event.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.Event} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.Event} + */ +proto.exec.Event.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.exec.Header; + reader.readMessage(value,proto.exec.Header.deserializeBinaryFromReader); + msg.setHeader(value); + break; + case 2: + var value = new proto.exec.InputEvent; + reader.readMessage(value,proto.exec.InputEvent.deserializeBinaryFromReader); + msg.setInput(value); + break; + case 3: + var value = new proto.exec.OutputEvent; + reader.readMessage(value,proto.exec.OutputEvent.deserializeBinaryFromReader); + msg.setOutput(value); + break; + case 4: + var value = new proto.exec.CallEvent; + reader.readMessage(value,proto.exec.CallEvent.deserializeBinaryFromReader); + msg.setCall(value); + break; + case 5: + var value = new proto.exec.LogEvent; + reader.readMessage(value,proto.exec.LogEvent.deserializeBinaryFromReader); + msg.setLog(value); + break; + case 6: + var value = new proto.exec.GovernAccountEvent; + reader.readMessage(value,proto.exec.GovernAccountEvent.deserializeBinaryFromReader); + msg.setGovernaccount(value); + break; + case 7: + var value = new proto.exec.PrintEvent; + reader.readMessage(value,proto.exec.PrintEvent.deserializeBinaryFromReader); + msg.setPrint(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.Event.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.Event.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.Event} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.Event.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeader(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.exec.Header.serializeBinaryToWriter + ); + } + f = message.getInput(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.exec.InputEvent.serializeBinaryToWriter + ); + } + f = message.getOutput(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.exec.OutputEvent.serializeBinaryToWriter + ); + } + f = message.getCall(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.exec.CallEvent.serializeBinaryToWriter + ); + } + f = message.getLog(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.exec.LogEvent.serializeBinaryToWriter + ); + } + f = message.getGovernaccount(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.exec.GovernAccountEvent.serializeBinaryToWriter + ); + } + f = message.getPrint(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.exec.PrintEvent.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Header Header = 1; + * @return {?proto.exec.Header} + */ +proto.exec.Event.prototype.getHeader = function() { + return /** @type{?proto.exec.Header} */ ( + jspb.Message.getWrapperField(this, proto.exec.Header, 1)); +}; + + +/** + * @param {?proto.exec.Header|undefined} value + * @return {!proto.exec.Event} returns this +*/ +proto.exec.Event.prototype.setHeader = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Event} returns this + */ +proto.exec.Event.prototype.clearHeader = function() { + return this.setHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Event.prototype.hasHeader = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional InputEvent Input = 2; + * @return {?proto.exec.InputEvent} + */ +proto.exec.Event.prototype.getInput = function() { + return /** @type{?proto.exec.InputEvent} */ ( + jspb.Message.getWrapperField(this, proto.exec.InputEvent, 2)); +}; + + +/** + * @param {?proto.exec.InputEvent|undefined} value + * @return {!proto.exec.Event} returns this +*/ +proto.exec.Event.prototype.setInput = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Event} returns this + */ +proto.exec.Event.prototype.clearInput = function() { + return this.setInput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Event.prototype.hasInput = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional OutputEvent Output = 3; + * @return {?proto.exec.OutputEvent} + */ +proto.exec.Event.prototype.getOutput = function() { + return /** @type{?proto.exec.OutputEvent} */ ( + jspb.Message.getWrapperField(this, proto.exec.OutputEvent, 3)); +}; + + +/** + * @param {?proto.exec.OutputEvent|undefined} value + * @return {!proto.exec.Event} returns this +*/ +proto.exec.Event.prototype.setOutput = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Event} returns this + */ +proto.exec.Event.prototype.clearOutput = function() { + return this.setOutput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Event.prototype.hasOutput = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional CallEvent Call = 4; + * @return {?proto.exec.CallEvent} + */ +proto.exec.Event.prototype.getCall = function() { + return /** @type{?proto.exec.CallEvent} */ ( + jspb.Message.getWrapperField(this, proto.exec.CallEvent, 4)); +}; + + +/** + * @param {?proto.exec.CallEvent|undefined} value + * @return {!proto.exec.Event} returns this +*/ +proto.exec.Event.prototype.setCall = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Event} returns this + */ +proto.exec.Event.prototype.clearCall = function() { + return this.setCall(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Event.prototype.hasCall = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional LogEvent Log = 5; + * @return {?proto.exec.LogEvent} + */ +proto.exec.Event.prototype.getLog = function() { + return /** @type{?proto.exec.LogEvent} */ ( + jspb.Message.getWrapperField(this, proto.exec.LogEvent, 5)); +}; + + +/** + * @param {?proto.exec.LogEvent|undefined} value + * @return {!proto.exec.Event} returns this +*/ +proto.exec.Event.prototype.setLog = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Event} returns this + */ +proto.exec.Event.prototype.clearLog = function() { + return this.setLog(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Event.prototype.hasLog = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional GovernAccountEvent GovernAccount = 6; + * @return {?proto.exec.GovernAccountEvent} + */ +proto.exec.Event.prototype.getGovernaccount = function() { + return /** @type{?proto.exec.GovernAccountEvent} */ ( + jspb.Message.getWrapperField(this, proto.exec.GovernAccountEvent, 6)); +}; + + +/** + * @param {?proto.exec.GovernAccountEvent|undefined} value + * @return {!proto.exec.Event} returns this +*/ +proto.exec.Event.prototype.setGovernaccount = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Event} returns this + */ +proto.exec.Event.prototype.clearGovernaccount = function() { + return this.setGovernaccount(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Event.prototype.hasGovernaccount = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional PrintEvent Print = 7; + * @return {?proto.exec.PrintEvent} + */ +proto.exec.Event.prototype.getPrint = function() { + return /** @type{?proto.exec.PrintEvent} */ ( + jspb.Message.getWrapperField(this, proto.exec.PrintEvent, 7)); +}; + + +/** + * @param {?proto.exec.PrintEvent|undefined} value + * @return {!proto.exec.Event} returns this +*/ +proto.exec.Event.prototype.setPrint = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Event} returns this + */ +proto.exec.Event.prototype.clearPrint = function() { + return this.setPrint(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Event.prototype.hasPrint = function() { + return jspb.Message.getField(this, 7) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.Result.prototype.toObject = function(opt_includeInstance) { + return proto.exec.Result.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.Result} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.Result.toObject = function(includeInstance, msg) { + var f, obj = { + pb_return: msg.getReturn_asB64(), + gasused: jspb.Message.getFieldWithDefault(msg, 2, 0), + nameentry: (f = msg.getNameentry()) && names_pb.Entry.toObject(includeInstance, f), + permargs: (f = msg.getPermargs()) && permission_pb.PermArgs.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.Result} + */ +proto.exec.Result.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.Result; + return proto.exec.Result.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.Result} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.Result} + */ +proto.exec.Result.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setReturn(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setGasused(value); + break; + case 3: + var value = new names_pb.Entry; + reader.readMessage(value,names_pb.Entry.deserializeBinaryFromReader); + msg.setNameentry(value); + break; + case 4: + var value = new permission_pb.PermArgs; + reader.readMessage(value,permission_pb.PermArgs.deserializeBinaryFromReader); + msg.setPermargs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.Result.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.Result.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.Result} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.Result.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getReturn_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getGasused(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getNameentry(); + if (f != null) { + writer.writeMessage( + 3, + f, + names_pb.Entry.serializeBinaryToWriter + ); + } + f = message.getPermargs(); + if (f != null) { + writer.writeMessage( + 4, + f, + permission_pb.PermArgs.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes Return = 1; + * @return {!(string|Uint8Array)} + */ +proto.exec.Result.prototype.getReturn = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Return = 1; + * This is a type-conversion wrapper around `getReturn()` + * @return {string} + */ +proto.exec.Result.prototype.getReturn_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getReturn())); +}; + + +/** + * optional bytes Return = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getReturn()` + * @return {!Uint8Array} + */ +proto.exec.Result.prototype.getReturn_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getReturn())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.Result} returns this + */ +proto.exec.Result.prototype.setReturn = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional uint64 GasUsed = 2; + * @return {number} + */ +proto.exec.Result.prototype.getGasused = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.Result} returns this + */ +proto.exec.Result.prototype.setGasused = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional names.Entry NameEntry = 3; + * @return {?proto.names.Entry} + */ +proto.exec.Result.prototype.getNameentry = function() { + return /** @type{?proto.names.Entry} */ ( + jspb.Message.getWrapperField(this, names_pb.Entry, 3)); +}; + + +/** + * @param {?proto.names.Entry|undefined} value + * @return {!proto.exec.Result} returns this +*/ +proto.exec.Result.prototype.setNameentry = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Result} returns this + */ +proto.exec.Result.prototype.clearNameentry = function() { + return this.setNameentry(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Result.prototype.hasNameentry = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional permission.PermArgs PermArgs = 4; + * @return {?proto.permission.PermArgs} + */ +proto.exec.Result.prototype.getPermargs = function() { + return /** @type{?proto.permission.PermArgs} */ ( + jspb.Message.getWrapperField(this, permission_pb.PermArgs, 4)); +}; + + +/** + * @param {?proto.permission.PermArgs|undefined} value + * @return {!proto.exec.Result} returns this +*/ +proto.exec.Result.prototype.setPermargs = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.Result} returns this + */ +proto.exec.Result.prototype.clearPermargs = function() { + return this.setPermargs(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.Result.prototype.hasPermargs = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.exec.LogEvent.repeatedFields_ = [3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.LogEvent.prototype.toObject = function(opt_includeInstance) { + return proto.exec.LogEvent.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.LogEvent} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.LogEvent.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + data: msg.getData_asB64(), + topicsList: msg.getTopicsList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.LogEvent} + */ +proto.exec.LogEvent.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.LogEvent; + return proto.exec.LogEvent.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.LogEvent} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.LogEvent} + */ +proto.exec.LogEvent.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addTopics(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.LogEvent.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.LogEvent.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.LogEvent} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.LogEvent.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getTopicsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 3, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.exec.LogEvent.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.exec.LogEvent.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.exec.LogEvent.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.LogEvent} returns this + */ +proto.exec.LogEvent.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes Data = 2; + * @return {!(string|Uint8Array)} + */ +proto.exec.LogEvent.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.exec.LogEvent.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes Data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.exec.LogEvent.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.LogEvent} returns this + */ +proto.exec.LogEvent.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * repeated bytes Topics = 3; + * @return {!(Array|Array)} + */ +proto.exec.LogEvent.prototype.getTopicsList = function() { + return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * repeated bytes Topics = 3; + * This is a type-conversion wrapper around `getTopicsList()` + * @return {!Array} + */ +proto.exec.LogEvent.prototype.getTopicsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getTopicsList())); +}; + + +/** + * repeated bytes Topics = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTopicsList()` + * @return {!Array} + */ +proto.exec.LogEvent.prototype.getTopicsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getTopicsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.exec.LogEvent} returns this + */ +proto.exec.LogEvent.prototype.setTopicsList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.exec.LogEvent} returns this + */ +proto.exec.LogEvent.prototype.addTopics = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.exec.LogEvent} returns this + */ +proto.exec.LogEvent.prototype.clearTopicsList = function() { + return this.setTopicsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.CallEvent.prototype.toObject = function(opt_includeInstance) { + return proto.exec.CallEvent.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.CallEvent} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.CallEvent.toObject = function(includeInstance, msg) { + var f, obj = { + calltype: jspb.Message.getFieldWithDefault(msg, 5, 0), + calldata: (f = msg.getCalldata()) && proto.exec.CallData.toObject(includeInstance, f), + origin: msg.getOrigin_asB64(), + stackdepth: jspb.Message.getFieldWithDefault(msg, 3, 0), + pb_return: msg.getReturn_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.CallEvent} + */ +proto.exec.CallEvent.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.CallEvent; + return proto.exec.CallEvent.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.CallEvent} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.CallEvent} + */ +proto.exec.CallEvent.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 5: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCalltype(value); + break; + case 1: + var value = new proto.exec.CallData; + reader.readMessage(value,proto.exec.CallData.deserializeBinaryFromReader); + msg.setCalldata(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOrigin(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setStackdepth(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setReturn(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.CallEvent.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.CallEvent.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.CallEvent} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.CallEvent.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCalltype(); + if (f !== 0) { + writer.writeUint32( + 5, + f + ); + } + f = message.getCalldata(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.exec.CallData.serializeBinaryToWriter + ); + } + f = message.getOrigin_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getStackdepth(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getReturn_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional uint32 CallType = 5; + * @return {number} + */ +proto.exec.CallEvent.prototype.getCalltype = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.CallEvent} returns this + */ +proto.exec.CallEvent.prototype.setCalltype = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional CallData CallData = 1; + * @return {?proto.exec.CallData} + */ +proto.exec.CallEvent.prototype.getCalldata = function() { + return /** @type{?proto.exec.CallData} */ ( + jspb.Message.getWrapperField(this, proto.exec.CallData, 1)); +}; + + +/** + * @param {?proto.exec.CallData|undefined} value + * @return {!proto.exec.CallEvent} returns this +*/ +proto.exec.CallEvent.prototype.setCalldata = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.CallEvent} returns this + */ +proto.exec.CallEvent.prototype.clearCalldata = function() { + return this.setCalldata(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.CallEvent.prototype.hasCalldata = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes Origin = 2; + * @return {!(string|Uint8Array)} + */ +proto.exec.CallEvent.prototype.getOrigin = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Origin = 2; + * This is a type-conversion wrapper around `getOrigin()` + * @return {string} + */ +proto.exec.CallEvent.prototype.getOrigin_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOrigin())); +}; + + +/** + * optional bytes Origin = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOrigin()` + * @return {!Uint8Array} + */ +proto.exec.CallEvent.prototype.getOrigin_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOrigin())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.CallEvent} returns this + */ +proto.exec.CallEvent.prototype.setOrigin = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional uint64 StackDepth = 3; + * @return {number} + */ +proto.exec.CallEvent.prototype.getStackdepth = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.exec.CallEvent} returns this + */ +proto.exec.CallEvent.prototype.setStackdepth = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional bytes Return = 4; + * @return {!(string|Uint8Array)} + */ +proto.exec.CallEvent.prototype.getReturn = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes Return = 4; + * This is a type-conversion wrapper around `getReturn()` + * @return {string} + */ +proto.exec.CallEvent.prototype.getReturn_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getReturn())); +}; + + +/** + * optional bytes Return = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getReturn()` + * @return {!Uint8Array} + */ +proto.exec.CallEvent.prototype.getReturn_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getReturn())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.CallEvent} returns this + */ +proto.exec.CallEvent.prototype.setReturn = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.PrintEvent.prototype.toObject = function(opt_includeInstance) { + return proto.exec.PrintEvent.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.PrintEvent} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.PrintEvent.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.PrintEvent} + */ +proto.exec.PrintEvent.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.PrintEvent; + return proto.exec.PrintEvent.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.PrintEvent} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.PrintEvent} + */ +proto.exec.PrintEvent.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.PrintEvent.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.PrintEvent.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.PrintEvent} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.PrintEvent.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.exec.PrintEvent.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.exec.PrintEvent.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.exec.PrintEvent.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.PrintEvent} returns this + */ +proto.exec.PrintEvent.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes Data = 2; + * @return {!(string|Uint8Array)} + */ +proto.exec.PrintEvent.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.exec.PrintEvent.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes Data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.exec.PrintEvent.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.PrintEvent} returns this + */ +proto.exec.PrintEvent.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.GovernAccountEvent.prototype.toObject = function(opt_includeInstance) { + return proto.exec.GovernAccountEvent.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.GovernAccountEvent} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.GovernAccountEvent.toObject = function(includeInstance, msg) { + var f, obj = { + accountupdate: (f = msg.getAccountupdate()) && spec_pb.TemplateAccount.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.GovernAccountEvent} + */ +proto.exec.GovernAccountEvent.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.GovernAccountEvent; + return proto.exec.GovernAccountEvent.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.GovernAccountEvent} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.GovernAccountEvent} + */ +proto.exec.GovernAccountEvent.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new spec_pb.TemplateAccount; + reader.readMessage(value,spec_pb.TemplateAccount.deserializeBinaryFromReader); + msg.setAccountupdate(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.GovernAccountEvent.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.GovernAccountEvent.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.GovernAccountEvent} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.GovernAccountEvent.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAccountupdate(); + if (f != null) { + writer.writeMessage( + 1, + f, + spec_pb.TemplateAccount.serializeBinaryToWriter + ); + } +}; + + +/** + * optional spec.TemplateAccount AccountUpdate = 1; + * @return {?proto.spec.TemplateAccount} + */ +proto.exec.GovernAccountEvent.prototype.getAccountupdate = function() { + return /** @type{?proto.spec.TemplateAccount} */ ( + jspb.Message.getWrapperField(this, spec_pb.TemplateAccount, 1)); +}; + + +/** + * @param {?proto.spec.TemplateAccount|undefined} value + * @return {!proto.exec.GovernAccountEvent} returns this +*/ +proto.exec.GovernAccountEvent.prototype.setAccountupdate = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.exec.GovernAccountEvent} returns this + */ +proto.exec.GovernAccountEvent.prototype.clearAccountupdate = function() { + return this.setAccountupdate(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.exec.GovernAccountEvent.prototype.hasAccountupdate = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.InputEvent.prototype.toObject = function(opt_includeInstance) { + return proto.exec.InputEvent.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.InputEvent} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.InputEvent.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.InputEvent} + */ +proto.exec.InputEvent.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.InputEvent; + return proto.exec.InputEvent.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.InputEvent} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.InputEvent} + */ +proto.exec.InputEvent.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.InputEvent.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.InputEvent.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.InputEvent} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.InputEvent.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.exec.InputEvent.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.exec.InputEvent.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.exec.InputEvent.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.InputEvent} returns this + */ +proto.exec.InputEvent.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.OutputEvent.prototype.toObject = function(opt_includeInstance) { + return proto.exec.OutputEvent.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.OutputEvent} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.OutputEvent.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.OutputEvent} + */ +proto.exec.OutputEvent.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.OutputEvent; + return proto.exec.OutputEvent.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.OutputEvent} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.OutputEvent} + */ +proto.exec.OutputEvent.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.OutputEvent.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.OutputEvent.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.OutputEvent} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.OutputEvent.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.exec.OutputEvent.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.exec.OutputEvent.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.exec.OutputEvent.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.OutputEvent} returns this + */ +proto.exec.OutputEvent.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.exec.CallData.prototype.toObject = function(opt_includeInstance) { + return proto.exec.CallData.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.exec.CallData} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.CallData.toObject = function(includeInstance, msg) { + var f, obj = { + caller: msg.getCaller_asB64(), + callee: msg.getCallee_asB64(), + data: msg.getData_asB64(), + value: msg.getValue_asB64(), + gas: msg.getGas_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.exec.CallData} + */ +proto.exec.CallData.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.exec.CallData; + return proto.exec.CallData.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.exec.CallData} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.exec.CallData} + */ +proto.exec.CallData.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCaller(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCallee(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValue(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setGas(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.exec.CallData.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.exec.CallData.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.exec.CallData} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.exec.CallData.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCaller_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getCallee_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getValue_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getGas_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } +}; + + +/** + * optional bytes Caller = 1; + * @return {!(string|Uint8Array)} + */ +proto.exec.CallData.prototype.getCaller = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Caller = 1; + * This is a type-conversion wrapper around `getCaller()` + * @return {string} + */ +proto.exec.CallData.prototype.getCaller_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCaller())); +}; + + +/** + * optional bytes Caller = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCaller()` + * @return {!Uint8Array} + */ +proto.exec.CallData.prototype.getCaller_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCaller())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.CallData} returns this + */ +proto.exec.CallData.prototype.setCaller = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes Callee = 2; + * @return {!(string|Uint8Array)} + */ +proto.exec.CallData.prototype.getCallee = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Callee = 2; + * This is a type-conversion wrapper around `getCallee()` + * @return {string} + */ +proto.exec.CallData.prototype.getCallee_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCallee())); +}; + + +/** + * optional bytes Callee = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCallee()` + * @return {!Uint8Array} + */ +proto.exec.CallData.prototype.getCallee_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCallee())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.CallData} returns this + */ +proto.exec.CallData.prototype.setCallee = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes Data = 3; + * @return {!(string|Uint8Array)} + */ +proto.exec.CallData.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes Data = 3; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.exec.CallData.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes Data = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.exec.CallData.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.CallData} returns this + */ +proto.exec.CallData.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional bytes Value = 4; + * @return {!(string|Uint8Array)} + */ +proto.exec.CallData.prototype.getValue = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes Value = 4; + * This is a type-conversion wrapper around `getValue()` + * @return {string} + */ +proto.exec.CallData.prototype.getValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValue())); +}; + + +/** + * optional bytes Value = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValue()` + * @return {!Uint8Array} + */ +proto.exec.CallData.prototype.getValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.CallData} returns this + */ +proto.exec.CallData.prototype.setValue = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional bytes Gas = 5; + * @return {!(string|Uint8Array)} + */ +proto.exec.CallData.prototype.getGas = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes Gas = 5; + * This is a type-conversion wrapper around `getGas()` + * @return {string} + */ +proto.exec.CallData.prototype.getGas_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getGas())); +}; + + +/** + * optional bytes Gas = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getGas()` + * @return {!Uint8Array} + */ +proto.exec.CallData.prototype.getGas_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getGas())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.exec.CallData} returns this + */ +proto.exec.CallData.prototype.setGas = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +goog.object.extend(exports, proto.exec); diff --git a/js/proto/gogoproto/gogo_grpc_pb.js b/js/proto/gogoproto/gogo_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/gogoproto/gogo_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/gogoproto/gogo_pb.d.ts b/js/proto/gogoproto/gogo_pb.d.ts new file mode 100644 index 000000000..22a2c0112 --- /dev/null +++ b/js/proto/gogoproto/gogo_pb.d.ts @@ -0,0 +1,160 @@ +// package: gogoproto +// file: gogoproto/gogo.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as google_protobuf_descriptor_pb from "google-protobuf/google/protobuf/descriptor_pb"; + +export const goprotoEnumPrefix: jspb.ExtensionFieldInfo; + +export const goprotoEnumStringer: jspb.ExtensionFieldInfo; + +export const enumStringer: jspb.ExtensionFieldInfo; + +export const enumCustomname: jspb.ExtensionFieldInfo; + +export const enumdecl: jspb.ExtensionFieldInfo; + +export const enumvalueCustomname: jspb.ExtensionFieldInfo; + +export const goprotoGettersAll: jspb.ExtensionFieldInfo; + +export const goprotoEnumPrefixAll: jspb.ExtensionFieldInfo; + +export const goprotoStringerAll: jspb.ExtensionFieldInfo; + +export const verboseEqualAll: jspb.ExtensionFieldInfo; + +export const faceAll: jspb.ExtensionFieldInfo; + +export const gostringAll: jspb.ExtensionFieldInfo; + +export const populateAll: jspb.ExtensionFieldInfo; + +export const stringerAll: jspb.ExtensionFieldInfo; + +export const onlyoneAll: jspb.ExtensionFieldInfo; + +export const equalAll: jspb.ExtensionFieldInfo; + +export const descriptionAll: jspb.ExtensionFieldInfo; + +export const testgenAll: jspb.ExtensionFieldInfo; + +export const benchgenAll: jspb.ExtensionFieldInfo; + +export const marshalerAll: jspb.ExtensionFieldInfo; + +export const unmarshalerAll: jspb.ExtensionFieldInfo; + +export const stableMarshalerAll: jspb.ExtensionFieldInfo; + +export const sizerAll: jspb.ExtensionFieldInfo; + +export const goprotoEnumStringerAll: jspb.ExtensionFieldInfo; + +export const enumStringerAll: jspb.ExtensionFieldInfo; + +export const unsafeMarshalerAll: jspb.ExtensionFieldInfo; + +export const unsafeUnmarshalerAll: jspb.ExtensionFieldInfo; + +export const goprotoExtensionsMapAll: jspb.ExtensionFieldInfo; + +export const goprotoUnrecognizedAll: jspb.ExtensionFieldInfo; + +export const gogoprotoImport: jspb.ExtensionFieldInfo; + +export const protosizerAll: jspb.ExtensionFieldInfo; + +export const compareAll: jspb.ExtensionFieldInfo; + +export const typedeclAll: jspb.ExtensionFieldInfo; + +export const enumdeclAll: jspb.ExtensionFieldInfo; + +export const goprotoRegistration: jspb.ExtensionFieldInfo; + +export const messagenameAll: jspb.ExtensionFieldInfo; + +export const goprotoSizecacheAll: jspb.ExtensionFieldInfo; + +export const goprotoUnkeyedAll: jspb.ExtensionFieldInfo; + +export const goprotoGetters: jspb.ExtensionFieldInfo; + +export const goprotoStringer: jspb.ExtensionFieldInfo; + +export const verboseEqual: jspb.ExtensionFieldInfo; + +export const face: jspb.ExtensionFieldInfo; + +export const gostring: jspb.ExtensionFieldInfo; + +export const populate: jspb.ExtensionFieldInfo; + +export const stringer: jspb.ExtensionFieldInfo; + +export const onlyone: jspb.ExtensionFieldInfo; + +export const equal: jspb.ExtensionFieldInfo; + +export const description: jspb.ExtensionFieldInfo; + +export const testgen: jspb.ExtensionFieldInfo; + +export const benchgen: jspb.ExtensionFieldInfo; + +export const marshaler: jspb.ExtensionFieldInfo; + +export const unmarshaler: jspb.ExtensionFieldInfo; + +export const stableMarshaler: jspb.ExtensionFieldInfo; + +export const sizer: jspb.ExtensionFieldInfo; + +export const unsafeMarshaler: jspb.ExtensionFieldInfo; + +export const unsafeUnmarshaler: jspb.ExtensionFieldInfo; + +export const goprotoExtensionsMap: jspb.ExtensionFieldInfo; + +export const goprotoUnrecognized: jspb.ExtensionFieldInfo; + +export const protosizer: jspb.ExtensionFieldInfo; + +export const compare: jspb.ExtensionFieldInfo; + +export const typedecl: jspb.ExtensionFieldInfo; + +export const messagename: jspb.ExtensionFieldInfo; + +export const goprotoSizecache: jspb.ExtensionFieldInfo; + +export const goprotoUnkeyed: jspb.ExtensionFieldInfo; + +export const nullable: jspb.ExtensionFieldInfo; + +export const embed: jspb.ExtensionFieldInfo; + +export const customtype: jspb.ExtensionFieldInfo; + +export const customname: jspb.ExtensionFieldInfo; + +export const jsontag: jspb.ExtensionFieldInfo; + +export const moretags: jspb.ExtensionFieldInfo; + +export const casttype: jspb.ExtensionFieldInfo; + +export const castkey: jspb.ExtensionFieldInfo; + +export const castvalue: jspb.ExtensionFieldInfo; + +export const stdtime: jspb.ExtensionFieldInfo; + +export const stdduration: jspb.ExtensionFieldInfo; + +export const wktpointer: jspb.ExtensionFieldInfo; diff --git a/js/proto/gogoproto/gogo_pb.js b/js/proto/gogoproto/gogo_pb.js new file mode 100644 index 000000000..235bd0e12 --- /dev/null +++ b/js/proto/gogoproto/gogo_pb.js @@ -0,0 +1,1995 @@ +// source: gogoproto/gogo.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var google_protobuf_descriptor_pb = require('google-protobuf/google/protobuf/descriptor_pb.js'); +goog.object.extend(proto, google_protobuf_descriptor_pb); +goog.exportSymbol('proto.gogoproto.benchgen', null, global); +goog.exportSymbol('proto.gogoproto.benchgenAll', null, global); +goog.exportSymbol('proto.gogoproto.castkey', null, global); +goog.exportSymbol('proto.gogoproto.casttype', null, global); +goog.exportSymbol('proto.gogoproto.castvalue', null, global); +goog.exportSymbol('proto.gogoproto.compare', null, global); +goog.exportSymbol('proto.gogoproto.compareAll', null, global); +goog.exportSymbol('proto.gogoproto.customname', null, global); +goog.exportSymbol('proto.gogoproto.customtype', null, global); +goog.exportSymbol('proto.gogoproto.description', null, global); +goog.exportSymbol('proto.gogoproto.descriptionAll', null, global); +goog.exportSymbol('proto.gogoproto.embed', null, global); +goog.exportSymbol('proto.gogoproto.enumCustomname', null, global); +goog.exportSymbol('proto.gogoproto.enumStringer', null, global); +goog.exportSymbol('proto.gogoproto.enumStringerAll', null, global); +goog.exportSymbol('proto.gogoproto.enumdecl', null, global); +goog.exportSymbol('proto.gogoproto.enumdeclAll', null, global); +goog.exportSymbol('proto.gogoproto.enumvalueCustomname', null, global); +goog.exportSymbol('proto.gogoproto.equal', null, global); +goog.exportSymbol('proto.gogoproto.equalAll', null, global); +goog.exportSymbol('proto.gogoproto.face', null, global); +goog.exportSymbol('proto.gogoproto.faceAll', null, global); +goog.exportSymbol('proto.gogoproto.gogoprotoImport', null, global); +goog.exportSymbol('proto.gogoproto.goprotoEnumPrefix', null, global); +goog.exportSymbol('proto.gogoproto.goprotoEnumPrefixAll', null, global); +goog.exportSymbol('proto.gogoproto.goprotoEnumStringer', null, global); +goog.exportSymbol('proto.gogoproto.goprotoEnumStringerAll', null, global); +goog.exportSymbol('proto.gogoproto.goprotoExtensionsMap', null, global); +goog.exportSymbol('proto.gogoproto.goprotoExtensionsMapAll', null, global); +goog.exportSymbol('proto.gogoproto.goprotoGetters', null, global); +goog.exportSymbol('proto.gogoproto.goprotoGettersAll', null, global); +goog.exportSymbol('proto.gogoproto.goprotoRegistration', null, global); +goog.exportSymbol('proto.gogoproto.goprotoSizecache', null, global); +goog.exportSymbol('proto.gogoproto.goprotoSizecacheAll', null, global); +goog.exportSymbol('proto.gogoproto.goprotoStringer', null, global); +goog.exportSymbol('proto.gogoproto.goprotoStringerAll', null, global); +goog.exportSymbol('proto.gogoproto.goprotoUnkeyed', null, global); +goog.exportSymbol('proto.gogoproto.goprotoUnkeyedAll', null, global); +goog.exportSymbol('proto.gogoproto.goprotoUnrecognized', null, global); +goog.exportSymbol('proto.gogoproto.goprotoUnrecognizedAll', null, global); +goog.exportSymbol('proto.gogoproto.gostring', null, global); +goog.exportSymbol('proto.gogoproto.gostringAll', null, global); +goog.exportSymbol('proto.gogoproto.jsontag', null, global); +goog.exportSymbol('proto.gogoproto.marshaler', null, global); +goog.exportSymbol('proto.gogoproto.marshalerAll', null, global); +goog.exportSymbol('proto.gogoproto.messagename', null, global); +goog.exportSymbol('proto.gogoproto.messagenameAll', null, global); +goog.exportSymbol('proto.gogoproto.moretags', null, global); +goog.exportSymbol('proto.gogoproto.nullable', null, global); +goog.exportSymbol('proto.gogoproto.onlyone', null, global); +goog.exportSymbol('proto.gogoproto.onlyoneAll', null, global); +goog.exportSymbol('proto.gogoproto.populate', null, global); +goog.exportSymbol('proto.gogoproto.populateAll', null, global); +goog.exportSymbol('proto.gogoproto.protosizer', null, global); +goog.exportSymbol('proto.gogoproto.protosizerAll', null, global); +goog.exportSymbol('proto.gogoproto.sizer', null, global); +goog.exportSymbol('proto.gogoproto.sizerAll', null, global); +goog.exportSymbol('proto.gogoproto.stableMarshaler', null, global); +goog.exportSymbol('proto.gogoproto.stableMarshalerAll', null, global); +goog.exportSymbol('proto.gogoproto.stdduration', null, global); +goog.exportSymbol('proto.gogoproto.stdtime', null, global); +goog.exportSymbol('proto.gogoproto.stringer', null, global); +goog.exportSymbol('proto.gogoproto.stringerAll', null, global); +goog.exportSymbol('proto.gogoproto.testgen', null, global); +goog.exportSymbol('proto.gogoproto.testgenAll', null, global); +goog.exportSymbol('proto.gogoproto.typedecl', null, global); +goog.exportSymbol('proto.gogoproto.typedeclAll', null, global); +goog.exportSymbol('proto.gogoproto.unmarshaler', null, global); +goog.exportSymbol('proto.gogoproto.unmarshalerAll', null, global); +goog.exportSymbol('proto.gogoproto.unsafeMarshaler', null, global); +goog.exportSymbol('proto.gogoproto.unsafeMarshalerAll', null, global); +goog.exportSymbol('proto.gogoproto.unsafeUnmarshaler', null, global); +goog.exportSymbol('proto.gogoproto.unsafeUnmarshalerAll', null, global); +goog.exportSymbol('proto.gogoproto.verboseEqual', null, global); +goog.exportSymbol('proto.gogoproto.verboseEqualAll', null, global); +goog.exportSymbol('proto.gogoproto.wktpointer', null, global); + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoEnumPrefix`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoEnumPrefix = new jspb.ExtensionFieldInfo( + 62001, + {goprotoEnumPrefix: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[62001] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoEnumPrefix, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.EnumOptions.extensions[62001] = proto.gogoproto.goprotoEnumPrefix; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoEnumStringer`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoEnumStringer = new jspb.ExtensionFieldInfo( + 62021, + {goprotoEnumStringer: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[62021] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoEnumStringer, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.EnumOptions.extensions[62021] = proto.gogoproto.goprotoEnumStringer; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `enumStringer`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.enumStringer = new jspb.ExtensionFieldInfo( + 62022, + {enumStringer: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[62022] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.enumStringer, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.EnumOptions.extensions[62022] = proto.gogoproto.enumStringer; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `enumCustomname`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.enumCustomname = new jspb.ExtensionFieldInfo( + 62023, + {enumCustomname: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[62023] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.enumCustomname, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.EnumOptions.extensions[62023] = proto.gogoproto.enumCustomname; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `enumdecl`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.enumdecl = new jspb.ExtensionFieldInfo( + 62024, + {enumdecl: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[62024] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.enumdecl, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.EnumOptions.extensions[62024] = proto.gogoproto.enumdecl; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `enumvalueCustomname`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.enumvalueCustomname = new jspb.ExtensionFieldInfo( + 66001, + {enumvalueCustomname: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.EnumValueOptions.extensionsBinary[66001] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.enumvalueCustomname, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.EnumValueOptions.extensions[66001] = proto.gogoproto.enumvalueCustomname; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoGettersAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoGettersAll = new jspb.ExtensionFieldInfo( + 63001, + {goprotoGettersAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63001] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoGettersAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63001] = proto.gogoproto.goprotoGettersAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoEnumPrefixAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoEnumPrefixAll = new jspb.ExtensionFieldInfo( + 63002, + {goprotoEnumPrefixAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63002] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoEnumPrefixAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63002] = proto.gogoproto.goprotoEnumPrefixAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoStringerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoStringerAll = new jspb.ExtensionFieldInfo( + 63003, + {goprotoStringerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63003] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoStringerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63003] = proto.gogoproto.goprotoStringerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `verboseEqualAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.verboseEqualAll = new jspb.ExtensionFieldInfo( + 63004, + {verboseEqualAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63004] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.verboseEqualAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63004] = proto.gogoproto.verboseEqualAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `faceAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.faceAll = new jspb.ExtensionFieldInfo( + 63005, + {faceAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63005] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.faceAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63005] = proto.gogoproto.faceAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `gostringAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.gostringAll = new jspb.ExtensionFieldInfo( + 63006, + {gostringAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63006] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.gostringAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63006] = proto.gogoproto.gostringAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `populateAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.populateAll = new jspb.ExtensionFieldInfo( + 63007, + {populateAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63007] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.populateAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63007] = proto.gogoproto.populateAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `stringerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.stringerAll = new jspb.ExtensionFieldInfo( + 63008, + {stringerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63008] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.stringerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63008] = proto.gogoproto.stringerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `onlyoneAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.onlyoneAll = new jspb.ExtensionFieldInfo( + 63009, + {onlyoneAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63009] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.onlyoneAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63009] = proto.gogoproto.onlyoneAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `equalAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.equalAll = new jspb.ExtensionFieldInfo( + 63013, + {equalAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63013] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.equalAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63013] = proto.gogoproto.equalAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `descriptionAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.descriptionAll = new jspb.ExtensionFieldInfo( + 63014, + {descriptionAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63014] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.descriptionAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63014] = proto.gogoproto.descriptionAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `testgenAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.testgenAll = new jspb.ExtensionFieldInfo( + 63015, + {testgenAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63015] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.testgenAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63015] = proto.gogoproto.testgenAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `benchgenAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.benchgenAll = new jspb.ExtensionFieldInfo( + 63016, + {benchgenAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63016] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.benchgenAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63016] = proto.gogoproto.benchgenAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `marshalerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.marshalerAll = new jspb.ExtensionFieldInfo( + 63017, + {marshalerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63017] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.marshalerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63017] = proto.gogoproto.marshalerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `unmarshalerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.unmarshalerAll = new jspb.ExtensionFieldInfo( + 63018, + {unmarshalerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63018] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.unmarshalerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63018] = proto.gogoproto.unmarshalerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `stableMarshalerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.stableMarshalerAll = new jspb.ExtensionFieldInfo( + 63019, + {stableMarshalerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63019] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.stableMarshalerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63019] = proto.gogoproto.stableMarshalerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `sizerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.sizerAll = new jspb.ExtensionFieldInfo( + 63020, + {sizerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63020] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.sizerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63020] = proto.gogoproto.sizerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoEnumStringerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoEnumStringerAll = new jspb.ExtensionFieldInfo( + 63021, + {goprotoEnumStringerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63021] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoEnumStringerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63021] = proto.gogoproto.goprotoEnumStringerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `enumStringerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.enumStringerAll = new jspb.ExtensionFieldInfo( + 63022, + {enumStringerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63022] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.enumStringerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63022] = proto.gogoproto.enumStringerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `unsafeMarshalerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.unsafeMarshalerAll = new jspb.ExtensionFieldInfo( + 63023, + {unsafeMarshalerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63023] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.unsafeMarshalerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63023] = proto.gogoproto.unsafeMarshalerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `unsafeUnmarshalerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.unsafeUnmarshalerAll = new jspb.ExtensionFieldInfo( + 63024, + {unsafeUnmarshalerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63024] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.unsafeUnmarshalerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63024] = proto.gogoproto.unsafeUnmarshalerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoExtensionsMapAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoExtensionsMapAll = new jspb.ExtensionFieldInfo( + 63025, + {goprotoExtensionsMapAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63025] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoExtensionsMapAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63025] = proto.gogoproto.goprotoExtensionsMapAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoUnrecognizedAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoUnrecognizedAll = new jspb.ExtensionFieldInfo( + 63026, + {goprotoUnrecognizedAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63026] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoUnrecognizedAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63026] = proto.gogoproto.goprotoUnrecognizedAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `gogoprotoImport`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.gogoprotoImport = new jspb.ExtensionFieldInfo( + 63027, + {gogoprotoImport: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63027] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.gogoprotoImport, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63027] = proto.gogoproto.gogoprotoImport; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `protosizerAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.protosizerAll = new jspb.ExtensionFieldInfo( + 63028, + {protosizerAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63028] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.protosizerAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63028] = proto.gogoproto.protosizerAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `compareAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.compareAll = new jspb.ExtensionFieldInfo( + 63029, + {compareAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63029] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.compareAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63029] = proto.gogoproto.compareAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `typedeclAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.typedeclAll = new jspb.ExtensionFieldInfo( + 63030, + {typedeclAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63030] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.typedeclAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63030] = proto.gogoproto.typedeclAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `enumdeclAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.enumdeclAll = new jspb.ExtensionFieldInfo( + 63031, + {enumdeclAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63031] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.enumdeclAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63031] = proto.gogoproto.enumdeclAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoRegistration`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoRegistration = new jspb.ExtensionFieldInfo( + 63032, + {goprotoRegistration: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63032] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoRegistration, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63032] = proto.gogoproto.goprotoRegistration; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `messagenameAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.messagenameAll = new jspb.ExtensionFieldInfo( + 63033, + {messagenameAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63033] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.messagenameAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63033] = proto.gogoproto.messagenameAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoSizecacheAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoSizecacheAll = new jspb.ExtensionFieldInfo( + 63034, + {goprotoSizecacheAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63034] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoSizecacheAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63034] = proto.gogoproto.goprotoSizecacheAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoUnkeyedAll`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoUnkeyedAll = new jspb.ExtensionFieldInfo( + 63035, + {goprotoUnkeyedAll: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FileOptions.extensionsBinary[63035] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoUnkeyedAll, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FileOptions.extensions[63035] = proto.gogoproto.goprotoUnkeyedAll; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoGetters`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoGetters = new jspb.ExtensionFieldInfo( + 64001, + {goprotoGetters: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64001] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoGetters, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64001] = proto.gogoproto.goprotoGetters; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoStringer`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoStringer = new jspb.ExtensionFieldInfo( + 64003, + {goprotoStringer: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64003] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoStringer, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64003] = proto.gogoproto.goprotoStringer; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `verboseEqual`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.verboseEqual = new jspb.ExtensionFieldInfo( + 64004, + {verboseEqual: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64004] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.verboseEqual, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64004] = proto.gogoproto.verboseEqual; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `face`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.face = new jspb.ExtensionFieldInfo( + 64005, + {face: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64005] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.face, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64005] = proto.gogoproto.face; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `gostring`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.gostring = new jspb.ExtensionFieldInfo( + 64006, + {gostring: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64006] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.gostring, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64006] = proto.gogoproto.gostring; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `populate`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.populate = new jspb.ExtensionFieldInfo( + 64007, + {populate: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64007] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.populate, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64007] = proto.gogoproto.populate; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `stringer`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.stringer = new jspb.ExtensionFieldInfo( + 67008, + {stringer: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[67008] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.stringer, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[67008] = proto.gogoproto.stringer; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `onlyone`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.onlyone = new jspb.ExtensionFieldInfo( + 64009, + {onlyone: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64009] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.onlyone, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64009] = proto.gogoproto.onlyone; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `equal`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.equal = new jspb.ExtensionFieldInfo( + 64013, + {equal: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64013] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.equal, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64013] = proto.gogoproto.equal; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `description`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.description = new jspb.ExtensionFieldInfo( + 64014, + {description: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64014] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.description, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64014] = proto.gogoproto.description; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `testgen`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.testgen = new jspb.ExtensionFieldInfo( + 64015, + {testgen: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64015] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.testgen, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64015] = proto.gogoproto.testgen; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `benchgen`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.benchgen = new jspb.ExtensionFieldInfo( + 64016, + {benchgen: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64016] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.benchgen, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64016] = proto.gogoproto.benchgen; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `marshaler`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.marshaler = new jspb.ExtensionFieldInfo( + 64017, + {marshaler: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64017] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.marshaler, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64017] = proto.gogoproto.marshaler; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `unmarshaler`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.unmarshaler = new jspb.ExtensionFieldInfo( + 64018, + {unmarshaler: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64018] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.unmarshaler, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64018] = proto.gogoproto.unmarshaler; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `stableMarshaler`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.stableMarshaler = new jspb.ExtensionFieldInfo( + 64019, + {stableMarshaler: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64019] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.stableMarshaler, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64019] = proto.gogoproto.stableMarshaler; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `sizer`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.sizer = new jspb.ExtensionFieldInfo( + 64020, + {sizer: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64020] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.sizer, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64020] = proto.gogoproto.sizer; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `unsafeMarshaler`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.unsafeMarshaler = new jspb.ExtensionFieldInfo( + 64023, + {unsafeMarshaler: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64023] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.unsafeMarshaler, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64023] = proto.gogoproto.unsafeMarshaler; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `unsafeUnmarshaler`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.unsafeUnmarshaler = new jspb.ExtensionFieldInfo( + 64024, + {unsafeUnmarshaler: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64024] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.unsafeUnmarshaler, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64024] = proto.gogoproto.unsafeUnmarshaler; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoExtensionsMap`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoExtensionsMap = new jspb.ExtensionFieldInfo( + 64025, + {goprotoExtensionsMap: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64025] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoExtensionsMap, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64025] = proto.gogoproto.goprotoExtensionsMap; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoUnrecognized`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoUnrecognized = new jspb.ExtensionFieldInfo( + 64026, + {goprotoUnrecognized: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64026] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoUnrecognized, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64026] = proto.gogoproto.goprotoUnrecognized; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `protosizer`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.protosizer = new jspb.ExtensionFieldInfo( + 64028, + {protosizer: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64028] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.protosizer, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64028] = proto.gogoproto.protosizer; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `compare`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.compare = new jspb.ExtensionFieldInfo( + 64029, + {compare: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64029] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.compare, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64029] = proto.gogoproto.compare; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `typedecl`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.typedecl = new jspb.ExtensionFieldInfo( + 64030, + {typedecl: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64030] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.typedecl, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64030] = proto.gogoproto.typedecl; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `messagename`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.messagename = new jspb.ExtensionFieldInfo( + 64033, + {messagename: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64033] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.messagename, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64033] = proto.gogoproto.messagename; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoSizecache`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoSizecache = new jspb.ExtensionFieldInfo( + 64034, + {goprotoSizecache: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64034] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoSizecache, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64034] = proto.gogoproto.goprotoSizecache; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `goprotoUnkeyed`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.goprotoUnkeyed = new jspb.ExtensionFieldInfo( + 64035, + {goprotoUnkeyed: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[64035] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.goprotoUnkeyed, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.MessageOptions.extensions[64035] = proto.gogoproto.goprotoUnkeyed; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `nullable`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.nullable = new jspb.ExtensionFieldInfo( + 65001, + {nullable: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65001] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.nullable, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65001] = proto.gogoproto.nullable; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `embed`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.embed = new jspb.ExtensionFieldInfo( + 65002, + {embed: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65002] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.embed, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65002] = proto.gogoproto.embed; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `customtype`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.customtype = new jspb.ExtensionFieldInfo( + 65003, + {customtype: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65003] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.customtype, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65003] = proto.gogoproto.customtype; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `customname`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.customname = new jspb.ExtensionFieldInfo( + 65004, + {customname: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65004] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.customname, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65004] = proto.gogoproto.customname; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `jsontag`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.jsontag = new jspb.ExtensionFieldInfo( + 65005, + {jsontag: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65005] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.jsontag, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65005] = proto.gogoproto.jsontag; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `moretags`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.moretags = new jspb.ExtensionFieldInfo( + 65006, + {moretags: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65006] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.moretags, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65006] = proto.gogoproto.moretags; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `casttype`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.casttype = new jspb.ExtensionFieldInfo( + 65007, + {casttype: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65007] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.casttype, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65007] = proto.gogoproto.casttype; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `castkey`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.castkey = new jspb.ExtensionFieldInfo( + 65008, + {castkey: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65008] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.castkey, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65008] = proto.gogoproto.castkey; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `castvalue`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.castvalue = new jspb.ExtensionFieldInfo( + 65009, + {castvalue: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65009] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.castvalue, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65009] = proto.gogoproto.castvalue; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `stdtime`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.stdtime = new jspb.ExtensionFieldInfo( + 65010, + {stdtime: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65010] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.stdtime, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65010] = proto.gogoproto.stdtime; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `stdduration`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.stdduration = new jspb.ExtensionFieldInfo( + 65011, + {stdduration: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65011] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.stdduration, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65011] = proto.gogoproto.stdduration; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `wktpointer`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.gogoproto.wktpointer = new jspb.ExtensionFieldInfo( + 65012, + {wktpointer: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[65012] = new jspb.ExtensionFieldBinaryInfo( + proto.gogoproto.wktpointer, + jspb.BinaryReader.prototype.readBool, + jspb.BinaryWriter.prototype.writeBool, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.FieldOptions.extensions[65012] = proto.gogoproto.wktpointer; + +goog.object.extend(exports, proto.gogoproto); diff --git a/js/proto/google/protobuf/descriptor_grpc_pb.js b/js/proto/google/protobuf/descriptor_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/google/protobuf/descriptor_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/google/protobuf/descriptor_pb.d.ts b/js/proto/google/protobuf/descriptor_pb.d.ts new file mode 100644 index 000000000..55bb93334 --- /dev/null +++ b/js/proto/google/protobuf/descriptor_pb.d.ts @@ -0,0 +1,1365 @@ +// package: google.protobuf +// file: google/protobuf/descriptor.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class FileDescriptorSet extends jspb.Message { + clearFileList(): void; + getFileList(): Array; + setFileList(value: Array): FileDescriptorSet; + addFile(value?: FileDescriptorProto, index?: number): FileDescriptorProto; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FileDescriptorSet.AsObject; + static toObject(includeInstance: boolean, msg: FileDescriptorSet): FileDescriptorSet.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FileDescriptorSet, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FileDescriptorSet; + static deserializeBinaryFromReader(message: FileDescriptorSet, reader: jspb.BinaryReader): FileDescriptorSet; +} + +export namespace FileDescriptorSet { + export type AsObject = { + fileList: Array, + } +} + +export class FileDescriptorProto extends jspb.Message { + + hasName(): boolean; + clearName(): void; + getName(): string | undefined; + setName(value: string): FileDescriptorProto; + + + hasPackage(): boolean; + clearPackage(): void; + getPackage(): string | undefined; + setPackage(value: string): FileDescriptorProto; + + clearDependencyList(): void; + getDependencyList(): Array; + setDependencyList(value: Array): FileDescriptorProto; + addDependency(value: string, index?: number): string; + + clearPublicDependencyList(): void; + getPublicDependencyList(): Array; + setPublicDependencyList(value: Array): FileDescriptorProto; + addPublicDependency(value: number, index?: number): number; + + clearWeakDependencyList(): void; + getWeakDependencyList(): Array; + setWeakDependencyList(value: Array): FileDescriptorProto; + addWeakDependency(value: number, index?: number): number; + + clearMessageTypeList(): void; + getMessageTypeList(): Array; + setMessageTypeList(value: Array): FileDescriptorProto; + addMessageType(value?: DescriptorProto, index?: number): DescriptorProto; + + clearEnumTypeList(): void; + getEnumTypeList(): Array; + setEnumTypeList(value: Array): FileDescriptorProto; + addEnumType(value?: EnumDescriptorProto, index?: number): EnumDescriptorProto; + + clearServiceList(): void; + getServiceList(): Array; + setServiceList(value: Array): FileDescriptorProto; + addService(value?: ServiceDescriptorProto, index?: number): ServiceDescriptorProto; + + clearExtensionList(): void; + getExtensionList(): Array; + setExtensionList(value: Array): FileDescriptorProto; + addExtension(value?: FieldDescriptorProto, index?: number): FieldDescriptorProto; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): FileOptions | undefined; + setOptions(value?: FileOptions): FileDescriptorProto; + + + hasSourceCodeInfo(): boolean; + clearSourceCodeInfo(): void; + getSourceCodeInfo(): SourceCodeInfo | undefined; + setSourceCodeInfo(value?: SourceCodeInfo): FileDescriptorProto; + + + hasSyntax(): boolean; + clearSyntax(): void; + getSyntax(): string | undefined; + setSyntax(value: string): FileDescriptorProto; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FileDescriptorProto.AsObject; + static toObject(includeInstance: boolean, msg: FileDescriptorProto): FileDescriptorProto.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FileDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FileDescriptorProto; + static deserializeBinaryFromReader(message: FileDescriptorProto, reader: jspb.BinaryReader): FileDescriptorProto; +} + +export namespace FileDescriptorProto { + export type AsObject = { + name?: string, + pb_package?: string, + dependencyList: Array, + publicDependencyList: Array, + weakDependencyList: Array, + messageTypeList: Array, + enumTypeList: Array, + serviceList: Array, + extensionList: Array, + options?: FileOptions.AsObject, + sourceCodeInfo?: SourceCodeInfo.AsObject, + syntax?: string, + } +} + +export class DescriptorProto extends jspb.Message { + + hasName(): boolean; + clearName(): void; + getName(): string | undefined; + setName(value: string): DescriptorProto; + + clearFieldList(): void; + getFieldList(): Array; + setFieldList(value: Array): DescriptorProto; + addField(value?: FieldDescriptorProto, index?: number): FieldDescriptorProto; + + clearExtensionList(): void; + getExtensionList(): Array; + setExtensionList(value: Array): DescriptorProto; + addExtension(value?: FieldDescriptorProto, index?: number): FieldDescriptorProto; + + clearNestedTypeList(): void; + getNestedTypeList(): Array; + setNestedTypeList(value: Array): DescriptorProto; + addNestedType(value?: DescriptorProto, index?: number): DescriptorProto; + + clearEnumTypeList(): void; + getEnumTypeList(): Array; + setEnumTypeList(value: Array): DescriptorProto; + addEnumType(value?: EnumDescriptorProto, index?: number): EnumDescriptorProto; + + clearExtensionRangeList(): void; + getExtensionRangeList(): Array; + setExtensionRangeList(value: Array): DescriptorProto; + addExtensionRange(value?: DescriptorProto.ExtensionRange, index?: number): DescriptorProto.ExtensionRange; + + clearOneofDeclList(): void; + getOneofDeclList(): Array; + setOneofDeclList(value: Array): DescriptorProto; + addOneofDecl(value?: OneofDescriptorProto, index?: number): OneofDescriptorProto; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): MessageOptions | undefined; + setOptions(value?: MessageOptions): DescriptorProto; + + clearReservedRangeList(): void; + getReservedRangeList(): Array; + setReservedRangeList(value: Array): DescriptorProto; + addReservedRange(value?: DescriptorProto.ReservedRange, index?: number): DescriptorProto.ReservedRange; + + clearReservedNameList(): void; + getReservedNameList(): Array; + setReservedNameList(value: Array): DescriptorProto; + addReservedName(value: string, index?: number): string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DescriptorProto.AsObject; + static toObject(includeInstance: boolean, msg: DescriptorProto): DescriptorProto.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DescriptorProto; + static deserializeBinaryFromReader(message: DescriptorProto, reader: jspb.BinaryReader): DescriptorProto; +} + +export namespace DescriptorProto { + export type AsObject = { + name?: string, + fieldList: Array, + extensionList: Array, + nestedTypeList: Array, + enumTypeList: Array, + extensionRangeList: Array, + oneofDeclList: Array, + options?: MessageOptions.AsObject, + reservedRangeList: Array, + reservedNameList: Array, + } + + + export class ExtensionRange extends jspb.Message { + + hasStart(): boolean; + clearStart(): void; + getStart(): number | undefined; + setStart(value: number): ExtensionRange; + + + hasEnd(): boolean; + clearEnd(): void; + getEnd(): number | undefined; + setEnd(value: number): ExtensionRange; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): ExtensionRangeOptions | undefined; + setOptions(value?: ExtensionRangeOptions): ExtensionRange; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ExtensionRange.AsObject; + static toObject(includeInstance: boolean, msg: ExtensionRange): ExtensionRange.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ExtensionRange, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ExtensionRange; + static deserializeBinaryFromReader(message: ExtensionRange, reader: jspb.BinaryReader): ExtensionRange; + } + + export namespace ExtensionRange { + export type AsObject = { + start?: number, + end?: number, + options?: ExtensionRangeOptions.AsObject, + } + } + + export class ReservedRange extends jspb.Message { + + hasStart(): boolean; + clearStart(): void; + getStart(): number | undefined; + setStart(value: number): ReservedRange; + + + hasEnd(): boolean; + clearEnd(): void; + getEnd(): number | undefined; + setEnd(value: number): ReservedRange; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ReservedRange.AsObject; + static toObject(includeInstance: boolean, msg: ReservedRange): ReservedRange.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ReservedRange, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ReservedRange; + static deserializeBinaryFromReader(message: ReservedRange, reader: jspb.BinaryReader): ReservedRange; + } + + export namespace ReservedRange { + export type AsObject = { + start?: number, + end?: number, + } + } + +} + +export class ExtensionRangeOptions extends jspb.Message { + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): ExtensionRangeOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ExtensionRangeOptions.AsObject; + static toObject(includeInstance: boolean, msg: ExtensionRangeOptions): ExtensionRangeOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ExtensionRangeOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ExtensionRangeOptions; + static deserializeBinaryFromReader(message: ExtensionRangeOptions, reader: jspb.BinaryReader): ExtensionRangeOptions; +} + +export namespace ExtensionRangeOptions { + export type AsObject = { + uninterpretedOptionList: Array, + } +} + +export class FieldDescriptorProto extends jspb.Message { + + hasName(): boolean; + clearName(): void; + getName(): string | undefined; + setName(value: string): FieldDescriptorProto; + + + hasNumber(): boolean; + clearNumber(): void; + getNumber(): number | undefined; + setNumber(value: number): FieldDescriptorProto; + + + hasLabel(): boolean; + clearLabel(): void; + getLabel(): FieldDescriptorProto.Label | undefined; + setLabel(value: FieldDescriptorProto.Label): FieldDescriptorProto; + + + hasType(): boolean; + clearType(): void; + getType(): FieldDescriptorProto.Type | undefined; + setType(value: FieldDescriptorProto.Type): FieldDescriptorProto; + + + hasTypeName(): boolean; + clearTypeName(): void; + getTypeName(): string | undefined; + setTypeName(value: string): FieldDescriptorProto; + + + hasExtendee(): boolean; + clearExtendee(): void; + getExtendee(): string | undefined; + setExtendee(value: string): FieldDescriptorProto; + + + hasDefaultValue(): boolean; + clearDefaultValue(): void; + getDefaultValue(): string | undefined; + setDefaultValue(value: string): FieldDescriptorProto; + + + hasOneofIndex(): boolean; + clearOneofIndex(): void; + getOneofIndex(): number | undefined; + setOneofIndex(value: number): FieldDescriptorProto; + + + hasJsonName(): boolean; + clearJsonName(): void; + getJsonName(): string | undefined; + setJsonName(value: string): FieldDescriptorProto; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): FieldOptions | undefined; + setOptions(value?: FieldOptions): FieldDescriptorProto; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FieldDescriptorProto.AsObject; + static toObject(includeInstance: boolean, msg: FieldDescriptorProto): FieldDescriptorProto.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FieldDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FieldDescriptorProto; + static deserializeBinaryFromReader(message: FieldDescriptorProto, reader: jspb.BinaryReader): FieldDescriptorProto; +} + +export namespace FieldDescriptorProto { + export type AsObject = { + name?: string, + number?: number, + label?: FieldDescriptorProto.Label, + type?: FieldDescriptorProto.Type, + typeName?: string, + extendee?: string, + defaultValue?: string, + oneofIndex?: number, + jsonName?: string, + options?: FieldOptions.AsObject, + } + + export enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18, + } + + export enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + } + +} + +export class OneofDescriptorProto extends jspb.Message { + + hasName(): boolean; + clearName(): void; + getName(): string | undefined; + setName(value: string): OneofDescriptorProto; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): OneofOptions | undefined; + setOptions(value?: OneofOptions): OneofDescriptorProto; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OneofDescriptorProto.AsObject; + static toObject(includeInstance: boolean, msg: OneofDescriptorProto): OneofDescriptorProto.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OneofDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OneofDescriptorProto; + static deserializeBinaryFromReader(message: OneofDescriptorProto, reader: jspb.BinaryReader): OneofDescriptorProto; +} + +export namespace OneofDescriptorProto { + export type AsObject = { + name?: string, + options?: OneofOptions.AsObject, + } +} + +export class EnumDescriptorProto extends jspb.Message { + + hasName(): boolean; + clearName(): void; + getName(): string | undefined; + setName(value: string): EnumDescriptorProto; + + clearValueList(): void; + getValueList(): Array; + setValueList(value: Array): EnumDescriptorProto; + addValue(value?: EnumValueDescriptorProto, index?: number): EnumValueDescriptorProto; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): EnumOptions | undefined; + setOptions(value?: EnumOptions): EnumDescriptorProto; + + clearReservedRangeList(): void; + getReservedRangeList(): Array; + setReservedRangeList(value: Array): EnumDescriptorProto; + addReservedRange(value?: EnumDescriptorProto.EnumReservedRange, index?: number): EnumDescriptorProto.EnumReservedRange; + + clearReservedNameList(): void; + getReservedNameList(): Array; + setReservedNameList(value: Array): EnumDescriptorProto; + addReservedName(value: string, index?: number): string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EnumDescriptorProto.AsObject; + static toObject(includeInstance: boolean, msg: EnumDescriptorProto): EnumDescriptorProto.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumDescriptorProto; + static deserializeBinaryFromReader(message: EnumDescriptorProto, reader: jspb.BinaryReader): EnumDescriptorProto; +} + +export namespace EnumDescriptorProto { + export type AsObject = { + name?: string, + valueList: Array, + options?: EnumOptions.AsObject, + reservedRangeList: Array, + reservedNameList: Array, + } + + + export class EnumReservedRange extends jspb.Message { + + hasStart(): boolean; + clearStart(): void; + getStart(): number | undefined; + setStart(value: number): EnumReservedRange; + + + hasEnd(): boolean; + clearEnd(): void; + getEnd(): number | undefined; + setEnd(value: number): EnumReservedRange; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EnumReservedRange.AsObject; + static toObject(includeInstance: boolean, msg: EnumReservedRange): EnumReservedRange.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumReservedRange, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumReservedRange; + static deserializeBinaryFromReader(message: EnumReservedRange, reader: jspb.BinaryReader): EnumReservedRange; + } + + export namespace EnumReservedRange { + export type AsObject = { + start?: number, + end?: number, + } + } + +} + +export class EnumValueDescriptorProto extends jspb.Message { + + hasName(): boolean; + clearName(): void; + getName(): string | undefined; + setName(value: string): EnumValueDescriptorProto; + + + hasNumber(): boolean; + clearNumber(): void; + getNumber(): number | undefined; + setNumber(value: number): EnumValueDescriptorProto; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): EnumValueOptions | undefined; + setOptions(value?: EnumValueOptions): EnumValueDescriptorProto; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EnumValueDescriptorProto.AsObject; + static toObject(includeInstance: boolean, msg: EnumValueDescriptorProto): EnumValueDescriptorProto.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumValueDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumValueDescriptorProto; + static deserializeBinaryFromReader(message: EnumValueDescriptorProto, reader: jspb.BinaryReader): EnumValueDescriptorProto; +} + +export namespace EnumValueDescriptorProto { + export type AsObject = { + name?: string, + number?: number, + options?: EnumValueOptions.AsObject, + } +} + +export class ServiceDescriptorProto extends jspb.Message { + + hasName(): boolean; + clearName(): void; + getName(): string | undefined; + setName(value: string): ServiceDescriptorProto; + + clearMethodList(): void; + getMethodList(): Array; + setMethodList(value: Array): ServiceDescriptorProto; + addMethod(value?: MethodDescriptorProto, index?: number): MethodDescriptorProto; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): ServiceOptions | undefined; + setOptions(value?: ServiceOptions): ServiceDescriptorProto; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ServiceDescriptorProto.AsObject; + static toObject(includeInstance: boolean, msg: ServiceDescriptorProto): ServiceDescriptorProto.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ServiceDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ServiceDescriptorProto; + static deserializeBinaryFromReader(message: ServiceDescriptorProto, reader: jspb.BinaryReader): ServiceDescriptorProto; +} + +export namespace ServiceDescriptorProto { + export type AsObject = { + name?: string, + methodList: Array, + options?: ServiceOptions.AsObject, + } +} + +export class MethodDescriptorProto extends jspb.Message { + + hasName(): boolean; + clearName(): void; + getName(): string | undefined; + setName(value: string): MethodDescriptorProto; + + + hasInputType(): boolean; + clearInputType(): void; + getInputType(): string | undefined; + setInputType(value: string): MethodDescriptorProto; + + + hasOutputType(): boolean; + clearOutputType(): void; + getOutputType(): string | undefined; + setOutputType(value: string): MethodDescriptorProto; + + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): MethodOptions | undefined; + setOptions(value?: MethodOptions): MethodDescriptorProto; + + + hasClientStreaming(): boolean; + clearClientStreaming(): void; + getClientStreaming(): boolean | undefined; + setClientStreaming(value: boolean): MethodDescriptorProto; + + + hasServerStreaming(): boolean; + clearServerStreaming(): void; + getServerStreaming(): boolean | undefined; + setServerStreaming(value: boolean): MethodDescriptorProto; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MethodDescriptorProto.AsObject; + static toObject(includeInstance: boolean, msg: MethodDescriptorProto): MethodDescriptorProto.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MethodDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MethodDescriptorProto; + static deserializeBinaryFromReader(message: MethodDescriptorProto, reader: jspb.BinaryReader): MethodDescriptorProto; +} + +export namespace MethodDescriptorProto { + export type AsObject = { + name?: string, + inputType?: string, + outputType?: string, + options?: MethodOptions.AsObject, + clientStreaming?: boolean, + serverStreaming?: boolean, + } +} + +export class FileOptions extends jspb.Message { + + hasJavaPackage(): boolean; + clearJavaPackage(): void; + getJavaPackage(): string | undefined; + setJavaPackage(value: string): FileOptions; + + + hasJavaOuterClassname(): boolean; + clearJavaOuterClassname(): void; + getJavaOuterClassname(): string | undefined; + setJavaOuterClassname(value: string): FileOptions; + + + hasJavaMultipleFiles(): boolean; + clearJavaMultipleFiles(): void; + getJavaMultipleFiles(): boolean | undefined; + setJavaMultipleFiles(value: boolean): FileOptions; + + + hasJavaGenerateEqualsAndHash(): boolean; + clearJavaGenerateEqualsAndHash(): void; + getJavaGenerateEqualsAndHash(): boolean | undefined; + setJavaGenerateEqualsAndHash(value: boolean): FileOptions; + + + hasJavaStringCheckUtf8(): boolean; + clearJavaStringCheckUtf8(): void; + getJavaStringCheckUtf8(): boolean | undefined; + setJavaStringCheckUtf8(value: boolean): FileOptions; + + + hasOptimizeFor(): boolean; + clearOptimizeFor(): void; + getOptimizeFor(): FileOptions.OptimizeMode | undefined; + setOptimizeFor(value: FileOptions.OptimizeMode): FileOptions; + + + hasGoPackage(): boolean; + clearGoPackage(): void; + getGoPackage(): string | undefined; + setGoPackage(value: string): FileOptions; + + + hasCcGenericServices(): boolean; + clearCcGenericServices(): void; + getCcGenericServices(): boolean | undefined; + setCcGenericServices(value: boolean): FileOptions; + + + hasJavaGenericServices(): boolean; + clearJavaGenericServices(): void; + getJavaGenericServices(): boolean | undefined; + setJavaGenericServices(value: boolean): FileOptions; + + + hasPyGenericServices(): boolean; + clearPyGenericServices(): void; + getPyGenericServices(): boolean | undefined; + setPyGenericServices(value: boolean): FileOptions; + + + hasPhpGenericServices(): boolean; + clearPhpGenericServices(): void; + getPhpGenericServices(): boolean | undefined; + setPhpGenericServices(value: boolean): FileOptions; + + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean | undefined; + setDeprecated(value: boolean): FileOptions; + + + hasCcEnableArenas(): boolean; + clearCcEnableArenas(): void; + getCcEnableArenas(): boolean | undefined; + setCcEnableArenas(value: boolean): FileOptions; + + + hasObjcClassPrefix(): boolean; + clearObjcClassPrefix(): void; + getObjcClassPrefix(): string | undefined; + setObjcClassPrefix(value: string): FileOptions; + + + hasCsharpNamespace(): boolean; + clearCsharpNamespace(): void; + getCsharpNamespace(): string | undefined; + setCsharpNamespace(value: string): FileOptions; + + + hasSwiftPrefix(): boolean; + clearSwiftPrefix(): void; + getSwiftPrefix(): string | undefined; + setSwiftPrefix(value: string): FileOptions; + + + hasPhpClassPrefix(): boolean; + clearPhpClassPrefix(): void; + getPhpClassPrefix(): string | undefined; + setPhpClassPrefix(value: string): FileOptions; + + + hasPhpNamespace(): boolean; + clearPhpNamespace(): void; + getPhpNamespace(): string | undefined; + setPhpNamespace(value: string): FileOptions; + + + hasPhpMetadataNamespace(): boolean; + clearPhpMetadataNamespace(): void; + getPhpMetadataNamespace(): string | undefined; + setPhpMetadataNamespace(value: string): FileOptions; + + + hasRubyPackage(): boolean; + clearRubyPackage(): void; + getRubyPackage(): string | undefined; + setRubyPackage(value: string): FileOptions; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): FileOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FileOptions.AsObject; + static toObject(includeInstance: boolean, msg: FileOptions): FileOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FileOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FileOptions; + static deserializeBinaryFromReader(message: FileOptions, reader: jspb.BinaryReader): FileOptions; +} + +export namespace FileOptions { + export type AsObject = { + javaPackage?: string, + javaOuterClassname?: string, + javaMultipleFiles?: boolean, + javaGenerateEqualsAndHash?: boolean, + javaStringCheckUtf8?: boolean, + optimizeFor?: FileOptions.OptimizeMode, + goPackage?: string, + ccGenericServices?: boolean, + javaGenericServices?: boolean, + pyGenericServices?: boolean, + phpGenericServices?: boolean, + deprecated?: boolean, + ccEnableArenas?: boolean, + objcClassPrefix?: string, + csharpNamespace?: string, + swiftPrefix?: string, + phpClassPrefix?: string, + phpNamespace?: string, + phpMetadataNamespace?: string, + rubyPackage?: string, + uninterpretedOptionList: Array, + } + + export enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3, + } + +} + +export class MessageOptions extends jspb.Message { + + hasMessageSetWireFormat(): boolean; + clearMessageSetWireFormat(): void; + getMessageSetWireFormat(): boolean | undefined; + setMessageSetWireFormat(value: boolean): MessageOptions; + + + hasNoStandardDescriptorAccessor(): boolean; + clearNoStandardDescriptorAccessor(): void; + getNoStandardDescriptorAccessor(): boolean | undefined; + setNoStandardDescriptorAccessor(value: boolean): MessageOptions; + + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean | undefined; + setDeprecated(value: boolean): MessageOptions; + + + hasMapEntry(): boolean; + clearMapEntry(): void; + getMapEntry(): boolean | undefined; + setMapEntry(value: boolean): MessageOptions; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): MessageOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MessageOptions.AsObject; + static toObject(includeInstance: boolean, msg: MessageOptions): MessageOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MessageOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MessageOptions; + static deserializeBinaryFromReader(message: MessageOptions, reader: jspb.BinaryReader): MessageOptions; +} + +export namespace MessageOptions { + export type AsObject = { + messageSetWireFormat?: boolean, + noStandardDescriptorAccessor?: boolean, + deprecated?: boolean, + mapEntry?: boolean, + uninterpretedOptionList: Array, + } +} + +export class FieldOptions extends jspb.Message { + + hasCtype(): boolean; + clearCtype(): void; + getCtype(): FieldOptions.CType | undefined; + setCtype(value: FieldOptions.CType): FieldOptions; + + + hasPacked(): boolean; + clearPacked(): void; + getPacked(): boolean | undefined; + setPacked(value: boolean): FieldOptions; + + + hasJstype(): boolean; + clearJstype(): void; + getJstype(): FieldOptions.JSType | undefined; + setJstype(value: FieldOptions.JSType): FieldOptions; + + + hasLazy(): boolean; + clearLazy(): void; + getLazy(): boolean | undefined; + setLazy(value: boolean): FieldOptions; + + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean | undefined; + setDeprecated(value: boolean): FieldOptions; + + + hasWeak(): boolean; + clearWeak(): void; + getWeak(): boolean | undefined; + setWeak(value: boolean): FieldOptions; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): FieldOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FieldOptions.AsObject; + static toObject(includeInstance: boolean, msg: FieldOptions): FieldOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FieldOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FieldOptions; + static deserializeBinaryFromReader(message: FieldOptions, reader: jspb.BinaryReader): FieldOptions; +} + +export namespace FieldOptions { + export type AsObject = { + ctype?: FieldOptions.CType, + packed?: boolean, + jstype?: FieldOptions.JSType, + lazy?: boolean, + deprecated?: boolean, + weak?: boolean, + uninterpretedOptionList: Array, + } + + export enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + } + + export enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2, + } + +} + +export class OneofOptions extends jspb.Message { + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): OneofOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OneofOptions.AsObject; + static toObject(includeInstance: boolean, msg: OneofOptions): OneofOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OneofOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OneofOptions; + static deserializeBinaryFromReader(message: OneofOptions, reader: jspb.BinaryReader): OneofOptions; +} + +export namespace OneofOptions { + export type AsObject = { + uninterpretedOptionList: Array, + } +} + +export class EnumOptions extends jspb.Message { + + hasAllowAlias(): boolean; + clearAllowAlias(): void; + getAllowAlias(): boolean | undefined; + setAllowAlias(value: boolean): EnumOptions; + + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean | undefined; + setDeprecated(value: boolean): EnumOptions; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): EnumOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EnumOptions.AsObject; + static toObject(includeInstance: boolean, msg: EnumOptions): EnumOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumOptions; + static deserializeBinaryFromReader(message: EnumOptions, reader: jspb.BinaryReader): EnumOptions; +} + +export namespace EnumOptions { + export type AsObject = { + allowAlias?: boolean, + deprecated?: boolean, + uninterpretedOptionList: Array, + } +} + +export class EnumValueOptions extends jspb.Message { + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean | undefined; + setDeprecated(value: boolean): EnumValueOptions; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): EnumValueOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EnumValueOptions.AsObject; + static toObject(includeInstance: boolean, msg: EnumValueOptions): EnumValueOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumValueOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumValueOptions; + static deserializeBinaryFromReader(message: EnumValueOptions, reader: jspb.BinaryReader): EnumValueOptions; +} + +export namespace EnumValueOptions { + export type AsObject = { + deprecated?: boolean, + uninterpretedOptionList: Array, + } +} + +export class ServiceOptions extends jspb.Message { + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean | undefined; + setDeprecated(value: boolean): ServiceOptions; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): ServiceOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ServiceOptions.AsObject; + static toObject(includeInstance: boolean, msg: ServiceOptions): ServiceOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ServiceOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ServiceOptions; + static deserializeBinaryFromReader(message: ServiceOptions, reader: jspb.BinaryReader): ServiceOptions; +} + +export namespace ServiceOptions { + export type AsObject = { + deprecated?: boolean, + uninterpretedOptionList: Array, + } +} + +export class MethodOptions extends jspb.Message { + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean | undefined; + setDeprecated(value: boolean): MethodOptions; + + + hasIdempotencyLevel(): boolean; + clearIdempotencyLevel(): void; + getIdempotencyLevel(): MethodOptions.IdempotencyLevel | undefined; + setIdempotencyLevel(value: MethodOptions.IdempotencyLevel): MethodOptions; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): MethodOptions; + addUninterpretedOption(value?: UninterpretedOption, index?: number): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MethodOptions.AsObject; + static toObject(includeInstance: boolean, msg: MethodOptions): MethodOptions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MethodOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MethodOptions; + static deserializeBinaryFromReader(message: MethodOptions, reader: jspb.BinaryReader): MethodOptions; +} + +export namespace MethodOptions { + export type AsObject = { + deprecated?: boolean, + idempotencyLevel?: MethodOptions.IdempotencyLevel, + uninterpretedOptionList: Array, + } + + export enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2, + } + +} + +export class UninterpretedOption extends jspb.Message { + clearNameList(): void; + getNameList(): Array; + setNameList(value: Array): UninterpretedOption; + addName(value?: UninterpretedOption.NamePart, index?: number): UninterpretedOption.NamePart; + + + hasIdentifierValue(): boolean; + clearIdentifierValue(): void; + getIdentifierValue(): string | undefined; + setIdentifierValue(value: string): UninterpretedOption; + + + hasPositiveIntValue(): boolean; + clearPositiveIntValue(): void; + getPositiveIntValue(): number | undefined; + setPositiveIntValue(value: number): UninterpretedOption; + + + hasNegativeIntValue(): boolean; + clearNegativeIntValue(): void; + getNegativeIntValue(): number | undefined; + setNegativeIntValue(value: number): UninterpretedOption; + + + hasDoubleValue(): boolean; + clearDoubleValue(): void; + getDoubleValue(): number | undefined; + setDoubleValue(value: number): UninterpretedOption; + + + hasStringValue(): boolean; + clearStringValue(): void; + getStringValue(): Uint8Array | string; + getStringValue_asU8(): Uint8Array; + getStringValue_asB64(): string; + setStringValue(value: Uint8Array | string): UninterpretedOption; + + + hasAggregateValue(): boolean; + clearAggregateValue(): void; + getAggregateValue(): string | undefined; + setAggregateValue(value: string): UninterpretedOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UninterpretedOption.AsObject; + static toObject(includeInstance: boolean, msg: UninterpretedOption): UninterpretedOption.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UninterpretedOption, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UninterpretedOption; + static deserializeBinaryFromReader(message: UninterpretedOption, reader: jspb.BinaryReader): UninterpretedOption; +} + +export namespace UninterpretedOption { + export type AsObject = { + nameList: Array, + identifierValue?: string, + positiveIntValue?: number, + negativeIntValue?: number, + doubleValue?: number, + stringValue: Uint8Array | string, + aggregateValue?: string, + } + + + export class NamePart extends jspb.Message { + + hasNamePart(): boolean; + clearNamePart(): void; + getNamePart(): string | undefined; + setNamePart(value: string): NamePart; + + + hasIsExtension(): boolean; + clearIsExtension(): void; + getIsExtension(): boolean | undefined; + setIsExtension(value: boolean): NamePart; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NamePart.AsObject; + static toObject(includeInstance: boolean, msg: NamePart): NamePart.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NamePart, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NamePart; + static deserializeBinaryFromReader(message: NamePart, reader: jspb.BinaryReader): NamePart; + } + + export namespace NamePart { + export type AsObject = { + namePart?: string, + isExtension?: boolean, + } + } + +} + +export class SourceCodeInfo extends jspb.Message { + clearLocationList(): void; + getLocationList(): Array; + setLocationList(value: Array): SourceCodeInfo; + addLocation(value?: SourceCodeInfo.Location, index?: number): SourceCodeInfo.Location; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SourceCodeInfo.AsObject; + static toObject(includeInstance: boolean, msg: SourceCodeInfo): SourceCodeInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SourceCodeInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SourceCodeInfo; + static deserializeBinaryFromReader(message: SourceCodeInfo, reader: jspb.BinaryReader): SourceCodeInfo; +} + +export namespace SourceCodeInfo { + export type AsObject = { + locationList: Array, + } + + + export class Location extends jspb.Message { + clearPathList(): void; + getPathList(): Array; + setPathList(value: Array): Location; + addPath(value: number, index?: number): number; + + clearSpanList(): void; + getSpanList(): Array; + setSpanList(value: Array): Location; + addSpan(value: number, index?: number): number; + + + hasLeadingComments(): boolean; + clearLeadingComments(): void; + getLeadingComments(): string | undefined; + setLeadingComments(value: string): Location; + + + hasTrailingComments(): boolean; + clearTrailingComments(): void; + getTrailingComments(): string | undefined; + setTrailingComments(value: string): Location; + + clearLeadingDetachedCommentsList(): void; + getLeadingDetachedCommentsList(): Array; + setLeadingDetachedCommentsList(value: Array): Location; + addLeadingDetachedComments(value: string, index?: number): string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Location.AsObject; + static toObject(includeInstance: boolean, msg: Location): Location.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Location, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Location; + static deserializeBinaryFromReader(message: Location, reader: jspb.BinaryReader): Location; + } + + export namespace Location { + export type AsObject = { + pathList: Array, + spanList: Array, + leadingComments?: string, + trailingComments?: string, + leadingDetachedCommentsList: Array, + } + } + +} + +export class GeneratedCodeInfo extends jspb.Message { + clearAnnotationList(): void; + getAnnotationList(): Array; + setAnnotationList(value: Array): GeneratedCodeInfo; + addAnnotation(value?: GeneratedCodeInfo.Annotation, index?: number): GeneratedCodeInfo.Annotation; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GeneratedCodeInfo.AsObject; + static toObject(includeInstance: boolean, msg: GeneratedCodeInfo): GeneratedCodeInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GeneratedCodeInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GeneratedCodeInfo; + static deserializeBinaryFromReader(message: GeneratedCodeInfo, reader: jspb.BinaryReader): GeneratedCodeInfo; +} + +export namespace GeneratedCodeInfo { + export type AsObject = { + annotationList: Array, + } + + + export class Annotation extends jspb.Message { + clearPathList(): void; + getPathList(): Array; + setPathList(value: Array): Annotation; + addPath(value: number, index?: number): number; + + + hasSourceFile(): boolean; + clearSourceFile(): void; + getSourceFile(): string | undefined; + setSourceFile(value: string): Annotation; + + + hasBegin(): boolean; + clearBegin(): void; + getBegin(): number | undefined; + setBegin(value: number): Annotation; + + + hasEnd(): boolean; + clearEnd(): void; + getEnd(): number | undefined; + setEnd(value: number): Annotation; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Annotation.AsObject; + static toObject(includeInstance: boolean, msg: Annotation): Annotation.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Annotation, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Annotation; + static deserializeBinaryFromReader(message: Annotation, reader: jspb.BinaryReader): Annotation; + } + + export namespace Annotation { + export type AsObject = { + pathList: Array, + sourceFile?: string, + begin?: number, + end?: number, + } + } + +} diff --git a/js/proto/google/protobuf/descriptor_pb.js b/js/proto/google/protobuf/descriptor_pb.js new file mode 100644 index 000000000..4eb1fe08c --- /dev/null +++ b/js/proto/google/protobuf/descriptor_pb.js @@ -0,0 +1,10021 @@ +// source: google/protobuf/descriptor.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.google.protobuf.DescriptorProto', null, global); +goog.exportSymbol('proto.google.protobuf.DescriptorProto.ExtensionRange', null, global); +goog.exportSymbol('proto.google.protobuf.DescriptorProto.ReservedRange', null, global); +goog.exportSymbol('proto.google.protobuf.EnumDescriptorProto', null, global); +goog.exportSymbol('proto.google.protobuf.EnumDescriptorProto.EnumReservedRange', null, global); +goog.exportSymbol('proto.google.protobuf.EnumOptions', null, global); +goog.exportSymbol('proto.google.protobuf.EnumValueDescriptorProto', null, global); +goog.exportSymbol('proto.google.protobuf.EnumValueOptions', null, global); +goog.exportSymbol('proto.google.protobuf.ExtensionRangeOptions', null, global); +goog.exportSymbol('proto.google.protobuf.FieldDescriptorProto', null, global); +goog.exportSymbol('proto.google.protobuf.FieldDescriptorProto.Label', null, global); +goog.exportSymbol('proto.google.protobuf.FieldDescriptorProto.Type', null, global); +goog.exportSymbol('proto.google.protobuf.FieldOptions', null, global); +goog.exportSymbol('proto.google.protobuf.FieldOptions.CType', null, global); +goog.exportSymbol('proto.google.protobuf.FieldOptions.JSType', null, global); +goog.exportSymbol('proto.google.protobuf.FileDescriptorProto', null, global); +goog.exportSymbol('proto.google.protobuf.FileDescriptorSet', null, global); +goog.exportSymbol('proto.google.protobuf.FileOptions', null, global); +goog.exportSymbol('proto.google.protobuf.FileOptions.OptimizeMode', null, global); +goog.exportSymbol('proto.google.protobuf.GeneratedCodeInfo', null, global); +goog.exportSymbol('proto.google.protobuf.GeneratedCodeInfo.Annotation', null, global); +goog.exportSymbol('proto.google.protobuf.MessageOptions', null, global); +goog.exportSymbol('proto.google.protobuf.MethodDescriptorProto', null, global); +goog.exportSymbol('proto.google.protobuf.MethodOptions', null, global); +goog.exportSymbol('proto.google.protobuf.MethodOptions.IdempotencyLevel', null, global); +goog.exportSymbol('proto.google.protobuf.OneofDescriptorProto', null, global); +goog.exportSymbol('proto.google.protobuf.OneofOptions', null, global); +goog.exportSymbol('proto.google.protobuf.ServiceDescriptorProto', null, global); +goog.exportSymbol('proto.google.protobuf.ServiceOptions', null, global); +goog.exportSymbol('proto.google.protobuf.SourceCodeInfo', null, global); +goog.exportSymbol('proto.google.protobuf.SourceCodeInfo.Location', null, global); +goog.exportSymbol('proto.google.protobuf.UninterpretedOption', null, global); +goog.exportSymbol('proto.google.protobuf.UninterpretedOption.NamePart', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.FileDescriptorSet = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.FileDescriptorSet.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.FileDescriptorSet, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.FileDescriptorSet.displayName = 'proto.google.protobuf.FileDescriptorSet'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.FileDescriptorProto = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.FileDescriptorProto.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.FileDescriptorProto, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.FileDescriptorProto.displayName = 'proto.google.protobuf.FileDescriptorProto'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.DescriptorProto = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.DescriptorProto.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.DescriptorProto, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.DescriptorProto.displayName = 'proto.google.protobuf.DescriptorProto'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.DescriptorProto.ExtensionRange = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.DescriptorProto.ExtensionRange, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.DescriptorProto.ExtensionRange.displayName = 'proto.google.protobuf.DescriptorProto.ExtensionRange'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.DescriptorProto.ReservedRange = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.DescriptorProto.ReservedRange, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.DescriptorProto.ReservedRange.displayName = 'proto.google.protobuf.DescriptorProto.ReservedRange'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.ExtensionRangeOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.ExtensionRangeOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.ExtensionRangeOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.ExtensionRangeOptions.displayName = 'proto.google.protobuf.ExtensionRangeOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.ExtensionRangeOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.ExtensionRangeOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.FieldDescriptorProto = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.FieldDescriptorProto, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.FieldDescriptorProto.displayName = 'proto.google.protobuf.FieldDescriptorProto'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.OneofDescriptorProto = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.OneofDescriptorProto, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.OneofDescriptorProto.displayName = 'proto.google.protobuf.OneofDescriptorProto'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.EnumDescriptorProto = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.EnumDescriptorProto.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.EnumDescriptorProto, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.EnumDescriptorProto.displayName = 'proto.google.protobuf.EnumDescriptorProto'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.EnumDescriptorProto.EnumReservedRange, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.displayName = 'proto.google.protobuf.EnumDescriptorProto.EnumReservedRange'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.EnumValueDescriptorProto = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.EnumValueDescriptorProto, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.EnumValueDescriptorProto.displayName = 'proto.google.protobuf.EnumValueDescriptorProto'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.ServiceDescriptorProto = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.ServiceDescriptorProto.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.ServiceDescriptorProto, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.ServiceDescriptorProto.displayName = 'proto.google.protobuf.ServiceDescriptorProto'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.MethodDescriptorProto = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.MethodDescriptorProto, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.MethodDescriptorProto.displayName = 'proto.google.protobuf.MethodDescriptorProto'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.FileOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.FileOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.FileOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.FileOptions.displayName = 'proto.google.protobuf.FileOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.FileOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.FileOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.MessageOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.MessageOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.MessageOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.MessageOptions.displayName = 'proto.google.protobuf.MessageOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.MessageOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.MessageOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.FieldOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.FieldOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.FieldOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.FieldOptions.displayName = 'proto.google.protobuf.FieldOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.FieldOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.FieldOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.OneofOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.OneofOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.OneofOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.OneofOptions.displayName = 'proto.google.protobuf.OneofOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.OneofOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.OneofOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.EnumOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.EnumOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.EnumOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.EnumOptions.displayName = 'proto.google.protobuf.EnumOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.EnumOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.EnumOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.EnumValueOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.EnumValueOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.EnumValueOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.EnumValueOptions.displayName = 'proto.google.protobuf.EnumValueOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.EnumValueOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.EnumValueOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.ServiceOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.ServiceOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.ServiceOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.ServiceOptions.displayName = 'proto.google.protobuf.ServiceOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.ServiceOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.ServiceOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.MethodOptions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 500, proto.google.protobuf.MethodOptions.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.MethodOptions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.MethodOptions.displayName = 'proto.google.protobuf.MethodOptions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.MethodOptions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.MethodOptions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.UninterpretedOption = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.UninterpretedOption.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.UninterpretedOption, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.UninterpretedOption.displayName = 'proto.google.protobuf.UninterpretedOption'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.UninterpretedOption.NamePart = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.UninterpretedOption.NamePart, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.UninterpretedOption.NamePart.displayName = 'proto.google.protobuf.UninterpretedOption.NamePart'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.SourceCodeInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.SourceCodeInfo.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.SourceCodeInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.SourceCodeInfo.displayName = 'proto.google.protobuf.SourceCodeInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.SourceCodeInfo.Location = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.SourceCodeInfo.Location.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.SourceCodeInfo.Location, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.SourceCodeInfo.Location.displayName = 'proto.google.protobuf.SourceCodeInfo.Location'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.GeneratedCodeInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.GeneratedCodeInfo.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.GeneratedCodeInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.GeneratedCodeInfo.displayName = 'proto.google.protobuf.GeneratedCodeInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.GeneratedCodeInfo.Annotation.repeatedFields_, null); +}; +goog.inherits(proto.google.protobuf.GeneratedCodeInfo.Annotation, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.GeneratedCodeInfo.Annotation.displayName = 'proto.google.protobuf.GeneratedCodeInfo.Annotation'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.FileDescriptorSet.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.FileDescriptorSet.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.FileDescriptorSet.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.FileDescriptorSet} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FileDescriptorSet.toObject = function(includeInstance, msg) { + var f, obj = { + fileList: jspb.Message.toObjectList(msg.getFileList(), + proto.google.protobuf.FileDescriptorProto.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.FileDescriptorSet} + */ +proto.google.protobuf.FileDescriptorSet.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.FileDescriptorSet; + return proto.google.protobuf.FileDescriptorSet.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.FileDescriptorSet} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.FileDescriptorSet} + */ +proto.google.protobuf.FileDescriptorSet.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.google.protobuf.FileDescriptorProto; + reader.readMessage(value,proto.google.protobuf.FileDescriptorProto.deserializeBinaryFromReader); + msg.addFile(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.FileDescriptorSet.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.FileDescriptorSet.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.FileDescriptorSet} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FileDescriptorSet.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFileList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.google.protobuf.FileDescriptorProto.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated FileDescriptorProto file = 1; + * @return {!Array} + */ +proto.google.protobuf.FileDescriptorSet.prototype.getFileList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.FileDescriptorProto, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileDescriptorSet} returns this +*/ +proto.google.protobuf.FileDescriptorSet.prototype.setFileList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.google.protobuf.FileDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.FileDescriptorProto} + */ +proto.google.protobuf.FileDescriptorSet.prototype.addFile = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.google.protobuf.FileDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileDescriptorSet} returns this + */ +proto.google.protobuf.FileDescriptorSet.prototype.clearFileList = function() { + return this.setFileList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.FileDescriptorProto.repeatedFields_ = [3,10,11,4,5,6,7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.FileDescriptorProto.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.FileDescriptorProto.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.FileDescriptorProto} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FileDescriptorProto.toObject = function(includeInstance, msg) { + var f, obj = { + name: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + pb_package: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, + dependencyList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, + publicDependencyList: (f = jspb.Message.getRepeatedField(msg, 10)) == null ? undefined : f, + weakDependencyList: (f = jspb.Message.getRepeatedField(msg, 11)) == null ? undefined : f, + messageTypeList: jspb.Message.toObjectList(msg.getMessageTypeList(), + proto.google.protobuf.DescriptorProto.toObject, includeInstance), + enumTypeList: jspb.Message.toObjectList(msg.getEnumTypeList(), + proto.google.protobuf.EnumDescriptorProto.toObject, includeInstance), + serviceList: jspb.Message.toObjectList(msg.getServiceList(), + proto.google.protobuf.ServiceDescriptorProto.toObject, includeInstance), + extensionList: jspb.Message.toObjectList(msg.getExtensionList(), + proto.google.protobuf.FieldDescriptorProto.toObject, includeInstance), + options: (f = msg.getOptions()) && proto.google.protobuf.FileOptions.toObject(includeInstance, f), + sourceCodeInfo: (f = msg.getSourceCodeInfo()) && proto.google.protobuf.SourceCodeInfo.toObject(includeInstance, f), + syntax: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.FileDescriptorProto} + */ +proto.google.protobuf.FileDescriptorProto.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.FileDescriptorProto; + return proto.google.protobuf.FileDescriptorProto.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.FileDescriptorProto} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.FileDescriptorProto} + */ +proto.google.protobuf.FileDescriptorProto.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setPackage(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.addDependency(value); + break; + case 10: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedInt32() : [reader.readInt32()]); + for (var i = 0; i < values.length; i++) { + msg.addPublicDependency(values[i]); + } + break; + case 11: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedInt32() : [reader.readInt32()]); + for (var i = 0; i < values.length; i++) { + msg.addWeakDependency(values[i]); + } + break; + case 4: + var value = new proto.google.protobuf.DescriptorProto; + reader.readMessage(value,proto.google.protobuf.DescriptorProto.deserializeBinaryFromReader); + msg.addMessageType(value); + break; + case 5: + var value = new proto.google.protobuf.EnumDescriptorProto; + reader.readMessage(value,proto.google.protobuf.EnumDescriptorProto.deserializeBinaryFromReader); + msg.addEnumType(value); + break; + case 6: + var value = new proto.google.protobuf.ServiceDescriptorProto; + reader.readMessage(value,proto.google.protobuf.ServiceDescriptorProto.deserializeBinaryFromReader); + msg.addService(value); + break; + case 7: + var value = new proto.google.protobuf.FieldDescriptorProto; + reader.readMessage(value,proto.google.protobuf.FieldDescriptorProto.deserializeBinaryFromReader); + msg.addExtension$(value); + break; + case 8: + var value = new proto.google.protobuf.FileOptions; + reader.readMessage(value,proto.google.protobuf.FileOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + case 9: + var value = new proto.google.protobuf.SourceCodeInfo; + reader.readMessage(value,proto.google.protobuf.SourceCodeInfo.deserializeBinaryFromReader); + msg.setSourceCodeInfo(value); + break; + case 12: + var value = /** @type {string} */ (reader.readString()); + msg.setSyntax(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.FileDescriptorProto.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.FileDescriptorProto.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.FileDescriptorProto} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FileDescriptorProto.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = message.getDependencyList(); + if (f.length > 0) { + writer.writeRepeatedString( + 3, + f + ); + } + f = message.getPublicDependencyList(); + if (f.length > 0) { + writer.writeRepeatedInt32( + 10, + f + ); + } + f = message.getWeakDependencyList(); + if (f.length > 0) { + writer.writeRepeatedInt32( + 11, + f + ); + } + f = message.getMessageTypeList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.google.protobuf.DescriptorProto.serializeBinaryToWriter + ); + } + f = message.getEnumTypeList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.google.protobuf.EnumDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getServiceList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 6, + f, + proto.google.protobuf.ServiceDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getExtensionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 7, + f, + proto.google.protobuf.FieldDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.google.protobuf.FileOptions.serializeBinaryToWriter + ); + } + f = message.getSourceCodeInfo(); + if (f != null) { + writer.writeMessage( + 9, + f, + proto.google.protobuf.SourceCodeInfo.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 12)); + if (f != null) { + writer.writeString( + 12, + f + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.setName = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearName = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileDescriptorProto.prototype.hasName = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string package = 2; + * @return {string} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getPackage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.setPackage = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearPackage = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileDescriptorProto.prototype.hasPackage = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated string dependency = 3; + * @return {!Array} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getDependencyList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.setDependencyList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.addDependency = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearDependencyList = function() { + return this.setDependencyList([]); +}; + + +/** + * repeated int32 public_dependency = 10; + * @return {!Array} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getPublicDependencyList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 10)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.setPublicDependencyList = function(value) { + return jspb.Message.setField(this, 10, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.addPublicDependency = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 10, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearPublicDependencyList = function() { + return this.setPublicDependencyList([]); +}; + + +/** + * repeated int32 weak_dependency = 11; + * @return {!Array} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getWeakDependencyList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 11)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.setWeakDependencyList = function(value) { + return jspb.Message.setField(this, 11, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.addWeakDependency = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 11, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearWeakDependencyList = function() { + return this.setWeakDependencyList([]); +}; + + +/** + * repeated DescriptorProto message_type = 4; + * @return {!Array} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getMessageTypeList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.DescriptorProto, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this +*/ +proto.google.protobuf.FileDescriptorProto.prototype.setMessageTypeList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.google.protobuf.DescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.DescriptorProto} + */ +proto.google.protobuf.FileDescriptorProto.prototype.addMessageType = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.google.protobuf.DescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearMessageTypeList = function() { + return this.setMessageTypeList([]); +}; + + +/** + * repeated EnumDescriptorProto enum_type = 5; + * @return {!Array} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getEnumTypeList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.EnumDescriptorProto, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this +*/ +proto.google.protobuf.FileDescriptorProto.prototype.setEnumTypeList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.google.protobuf.EnumDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.EnumDescriptorProto} + */ +proto.google.protobuf.FileDescriptorProto.prototype.addEnumType = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.google.protobuf.EnumDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearEnumTypeList = function() { + return this.setEnumTypeList([]); +}; + + +/** + * repeated ServiceDescriptorProto service = 6; + * @return {!Array} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getServiceList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.ServiceDescriptorProto, 6)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this +*/ +proto.google.protobuf.FileDescriptorProto.prototype.setServiceList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 6, value); +}; + + +/** + * @param {!proto.google.protobuf.ServiceDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.ServiceDescriptorProto} + */ +proto.google.protobuf.FileDescriptorProto.prototype.addService = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 6, opt_value, proto.google.protobuf.ServiceDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearServiceList = function() { + return this.setServiceList([]); +}; + + +/** + * repeated FieldDescriptorProto extension = 7; + * @return {!Array} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getExtensionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.FieldDescriptorProto, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this +*/ +proto.google.protobuf.FileDescriptorProto.prototype.setExtensionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 7, value); +}; + + +/** + * @param {!proto.google.protobuf.FieldDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.FieldDescriptorProto} + */ +proto.google.protobuf.FileDescriptorProto.prototype.addExtension$ = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.google.protobuf.FieldDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearExtensionList = function() { + return this.setExtensionList([]); +}; + + +/** + * optional FileOptions options = 8; + * @return {?proto.google.protobuf.FileOptions} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.FileOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.FileOptions, 8)); +}; + + +/** + * @param {?proto.google.protobuf.FileOptions|undefined} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this +*/ +proto.google.protobuf.FileDescriptorProto.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileDescriptorProto.prototype.hasOptions = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional SourceCodeInfo source_code_info = 9; + * @return {?proto.google.protobuf.SourceCodeInfo} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getSourceCodeInfo = function() { + return /** @type{?proto.google.protobuf.SourceCodeInfo} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.SourceCodeInfo, 9)); +}; + + +/** + * @param {?proto.google.protobuf.SourceCodeInfo|undefined} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this +*/ +proto.google.protobuf.FileDescriptorProto.prototype.setSourceCodeInfo = function(value) { + return jspb.Message.setWrapperField(this, 9, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearSourceCodeInfo = function() { + return this.setSourceCodeInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileDescriptorProto.prototype.hasSourceCodeInfo = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional string syntax = 12; + * @return {string} + */ +proto.google.protobuf.FileDescriptorProto.prototype.getSyntax = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.setSyntax = function(value) { + return jspb.Message.setField(this, 12, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileDescriptorProto} returns this + */ +proto.google.protobuf.FileDescriptorProto.prototype.clearSyntax = function() { + return jspb.Message.setField(this, 12, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileDescriptorProto.prototype.hasSyntax = function() { + return jspb.Message.getField(this, 12) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.DescriptorProto.repeatedFields_ = [2,6,3,4,5,8,9,10]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.DescriptorProto.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.DescriptorProto.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.DescriptorProto} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.DescriptorProto.toObject = function(includeInstance, msg) { + var f, obj = { + name: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + fieldList: jspb.Message.toObjectList(msg.getFieldList(), + proto.google.protobuf.FieldDescriptorProto.toObject, includeInstance), + extensionList: jspb.Message.toObjectList(msg.getExtensionList(), + proto.google.protobuf.FieldDescriptorProto.toObject, includeInstance), + nestedTypeList: jspb.Message.toObjectList(msg.getNestedTypeList(), + proto.google.protobuf.DescriptorProto.toObject, includeInstance), + enumTypeList: jspb.Message.toObjectList(msg.getEnumTypeList(), + proto.google.protobuf.EnumDescriptorProto.toObject, includeInstance), + extensionRangeList: jspb.Message.toObjectList(msg.getExtensionRangeList(), + proto.google.protobuf.DescriptorProto.ExtensionRange.toObject, includeInstance), + oneofDeclList: jspb.Message.toObjectList(msg.getOneofDeclList(), + proto.google.protobuf.OneofDescriptorProto.toObject, includeInstance), + options: (f = msg.getOptions()) && proto.google.protobuf.MessageOptions.toObject(includeInstance, f), + reservedRangeList: jspb.Message.toObjectList(msg.getReservedRangeList(), + proto.google.protobuf.DescriptorProto.ReservedRange.toObject, includeInstance), + reservedNameList: (f = jspb.Message.getRepeatedField(msg, 10)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.DescriptorProto} + */ +proto.google.protobuf.DescriptorProto.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.DescriptorProto; + return proto.google.protobuf.DescriptorProto.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.DescriptorProto} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.DescriptorProto} + */ +proto.google.protobuf.DescriptorProto.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = new proto.google.protobuf.FieldDescriptorProto; + reader.readMessage(value,proto.google.protobuf.FieldDescriptorProto.deserializeBinaryFromReader); + msg.addField(value); + break; + case 6: + var value = new proto.google.protobuf.FieldDescriptorProto; + reader.readMessage(value,proto.google.protobuf.FieldDescriptorProto.deserializeBinaryFromReader); + msg.addExtension$(value); + break; + case 3: + var value = new proto.google.protobuf.DescriptorProto; + reader.readMessage(value,proto.google.protobuf.DescriptorProto.deserializeBinaryFromReader); + msg.addNestedType(value); + break; + case 4: + var value = new proto.google.protobuf.EnumDescriptorProto; + reader.readMessage(value,proto.google.protobuf.EnumDescriptorProto.deserializeBinaryFromReader); + msg.addEnumType(value); + break; + case 5: + var value = new proto.google.protobuf.DescriptorProto.ExtensionRange; + reader.readMessage(value,proto.google.protobuf.DescriptorProto.ExtensionRange.deserializeBinaryFromReader); + msg.addExtensionRange(value); + break; + case 8: + var value = new proto.google.protobuf.OneofDescriptorProto; + reader.readMessage(value,proto.google.protobuf.OneofDescriptorProto.deserializeBinaryFromReader); + msg.addOneofDecl(value); + break; + case 7: + var value = new proto.google.protobuf.MessageOptions; + reader.readMessage(value,proto.google.protobuf.MessageOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + case 9: + var value = new proto.google.protobuf.DescriptorProto.ReservedRange; + reader.readMessage(value,proto.google.protobuf.DescriptorProto.ReservedRange.deserializeBinaryFromReader); + msg.addReservedRange(value); + break; + case 10: + var value = /** @type {string} */ (reader.readString()); + msg.addReservedName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.DescriptorProto.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.DescriptorProto.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.DescriptorProto} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.DescriptorProto.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getFieldList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.google.protobuf.FieldDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getExtensionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 6, + f, + proto.google.protobuf.FieldDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getNestedTypeList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.google.protobuf.DescriptorProto.serializeBinaryToWriter + ); + } + f = message.getEnumTypeList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.google.protobuf.EnumDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getExtensionRangeList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.google.protobuf.DescriptorProto.ExtensionRange.serializeBinaryToWriter + ); + } + f = message.getOneofDeclList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 8, + f, + proto.google.protobuf.OneofDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.google.protobuf.MessageOptions.serializeBinaryToWriter + ); + } + f = message.getReservedRangeList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 9, + f, + proto.google.protobuf.DescriptorProto.ReservedRange.serializeBinaryToWriter + ); + } + f = message.getReservedNameList(); + if (f.length > 0) { + writer.writeRepeatedString( + 10, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.DescriptorProto.ExtensionRange.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.DescriptorProto.ExtensionRange} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.toObject = function(includeInstance, msg) { + var f, obj = { + start: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + end: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, + options: (f = msg.getOptions()) && proto.google.protobuf.ExtensionRangeOptions.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.DescriptorProto.ExtensionRange; + return proto.google.protobuf.DescriptorProto.ExtensionRange.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.DescriptorProto.ExtensionRange} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setStart(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setEnd(value); + break; + case 3: + var value = new proto.google.protobuf.ExtensionRangeOptions; + reader.readMessage(value,proto.google.protobuf.ExtensionRangeOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.DescriptorProto.ExtensionRange.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.DescriptorProto.ExtensionRange} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeInt32( + 2, + f + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.google.protobuf.ExtensionRangeOptions.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int32 start = 1; + * @return {number} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.getStart = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} returns this + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.setStart = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} returns this + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.clearStart = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.hasStart = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int32 end = 2; + * @return {number} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.getEnd = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} returns this + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.setEnd = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} returns this + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.clearEnd = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.hasEnd = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ExtensionRangeOptions options = 3; + * @return {?proto.google.protobuf.ExtensionRangeOptions} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.ExtensionRangeOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.ExtensionRangeOptions, 3)); +}; + + +/** + * @param {?proto.google.protobuf.ExtensionRangeOptions|undefined} value + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} returns this +*/ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} returns this + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.DescriptorProto.ExtensionRange.prototype.hasOptions = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.DescriptorProto.ReservedRange.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.DescriptorProto.ReservedRange} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.DescriptorProto.ReservedRange.toObject = function(includeInstance, msg) { + var f, obj = { + start: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + end: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.DescriptorProto.ReservedRange} + */ +proto.google.protobuf.DescriptorProto.ReservedRange.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.DescriptorProto.ReservedRange; + return proto.google.protobuf.DescriptorProto.ReservedRange.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.DescriptorProto.ReservedRange} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.DescriptorProto.ReservedRange} + */ +proto.google.protobuf.DescriptorProto.ReservedRange.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setStart(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setEnd(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.DescriptorProto.ReservedRange.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.DescriptorProto.ReservedRange} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.DescriptorProto.ReservedRange.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeInt32( + 2, + f + ); + } +}; + + +/** + * optional int32 start = 1; + * @return {number} + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.getStart = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.DescriptorProto.ReservedRange} returns this + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.setStart = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.DescriptorProto.ReservedRange} returns this + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.clearStart = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.hasStart = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int32 end = 2; + * @return {number} + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.getEnd = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.DescriptorProto.ReservedRange} returns this + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.setEnd = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.DescriptorProto.ReservedRange} returns this + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.clearEnd = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.DescriptorProto.ReservedRange.prototype.hasEnd = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.google.protobuf.DescriptorProto.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.setName = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearName = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.DescriptorProto.prototype.hasName = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated FieldDescriptorProto field = 2; + * @return {!Array} + */ +proto.google.protobuf.DescriptorProto.prototype.getFieldList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.FieldDescriptorProto, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.DescriptorProto} returns this +*/ +proto.google.protobuf.DescriptorProto.prototype.setFieldList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.google.protobuf.FieldDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.FieldDescriptorProto} + */ +proto.google.protobuf.DescriptorProto.prototype.addField = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.protobuf.FieldDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearFieldList = function() { + return this.setFieldList([]); +}; + + +/** + * repeated FieldDescriptorProto extension = 6; + * @return {!Array} + */ +proto.google.protobuf.DescriptorProto.prototype.getExtensionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.FieldDescriptorProto, 6)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.DescriptorProto} returns this +*/ +proto.google.protobuf.DescriptorProto.prototype.setExtensionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 6, value); +}; + + +/** + * @param {!proto.google.protobuf.FieldDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.FieldDescriptorProto} + */ +proto.google.protobuf.DescriptorProto.prototype.addExtension$ = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 6, opt_value, proto.google.protobuf.FieldDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearExtensionList = function() { + return this.setExtensionList([]); +}; + + +/** + * repeated DescriptorProto nested_type = 3; + * @return {!Array} + */ +proto.google.protobuf.DescriptorProto.prototype.getNestedTypeList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.DescriptorProto, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.DescriptorProto} returns this +*/ +proto.google.protobuf.DescriptorProto.prototype.setNestedTypeList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.google.protobuf.DescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.DescriptorProto} + */ +proto.google.protobuf.DescriptorProto.prototype.addNestedType = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.google.protobuf.DescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearNestedTypeList = function() { + return this.setNestedTypeList([]); +}; + + +/** + * repeated EnumDescriptorProto enum_type = 4; + * @return {!Array} + */ +proto.google.protobuf.DescriptorProto.prototype.getEnumTypeList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.EnumDescriptorProto, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.DescriptorProto} returns this +*/ +proto.google.protobuf.DescriptorProto.prototype.setEnumTypeList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.google.protobuf.EnumDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.EnumDescriptorProto} + */ +proto.google.protobuf.DescriptorProto.prototype.addEnumType = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.google.protobuf.EnumDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearEnumTypeList = function() { + return this.setEnumTypeList([]); +}; + + +/** + * repeated ExtensionRange extension_range = 5; + * @return {!Array} + */ +proto.google.protobuf.DescriptorProto.prototype.getExtensionRangeList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.DescriptorProto.ExtensionRange, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.DescriptorProto} returns this +*/ +proto.google.protobuf.DescriptorProto.prototype.setExtensionRangeList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.google.protobuf.DescriptorProto.ExtensionRange=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.DescriptorProto.ExtensionRange} + */ +proto.google.protobuf.DescriptorProto.prototype.addExtensionRange = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.google.protobuf.DescriptorProto.ExtensionRange, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearExtensionRangeList = function() { + return this.setExtensionRangeList([]); +}; + + +/** + * repeated OneofDescriptorProto oneof_decl = 8; + * @return {!Array} + */ +proto.google.protobuf.DescriptorProto.prototype.getOneofDeclList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.OneofDescriptorProto, 8)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.DescriptorProto} returns this +*/ +proto.google.protobuf.DescriptorProto.prototype.setOneofDeclList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 8, value); +}; + + +/** + * @param {!proto.google.protobuf.OneofDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.OneofDescriptorProto} + */ +proto.google.protobuf.DescriptorProto.prototype.addOneofDecl = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 8, opt_value, proto.google.protobuf.OneofDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearOneofDeclList = function() { + return this.setOneofDeclList([]); +}; + + +/** + * optional MessageOptions options = 7; + * @return {?proto.google.protobuf.MessageOptions} + */ +proto.google.protobuf.DescriptorProto.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.MessageOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.MessageOptions, 7)); +}; + + +/** + * @param {?proto.google.protobuf.MessageOptions|undefined} value + * @return {!proto.google.protobuf.DescriptorProto} returns this +*/ +proto.google.protobuf.DescriptorProto.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.DescriptorProto.prototype.hasOptions = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * repeated ReservedRange reserved_range = 9; + * @return {!Array} + */ +proto.google.protobuf.DescriptorProto.prototype.getReservedRangeList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.DescriptorProto.ReservedRange, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.DescriptorProto} returns this +*/ +proto.google.protobuf.DescriptorProto.prototype.setReservedRangeList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 9, value); +}; + + +/** + * @param {!proto.google.protobuf.DescriptorProto.ReservedRange=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.DescriptorProto.ReservedRange} + */ +proto.google.protobuf.DescriptorProto.prototype.addReservedRange = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 9, opt_value, proto.google.protobuf.DescriptorProto.ReservedRange, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearReservedRangeList = function() { + return this.setReservedRangeList([]); +}; + + +/** + * repeated string reserved_name = 10; + * @return {!Array} + */ +proto.google.protobuf.DescriptorProto.prototype.getReservedNameList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 10)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.setReservedNameList = function(value) { + return jspb.Message.setField(this, 10, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.addReservedName = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 10, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.DescriptorProto} returns this + */ +proto.google.protobuf.DescriptorProto.prototype.clearReservedNameList = function() { + return this.setReservedNameList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.ExtensionRangeOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.ExtensionRangeOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.ExtensionRangeOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.ExtensionRangeOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.ExtensionRangeOptions.toObject = function(includeInstance, msg) { + var f, obj = { + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.ExtensionRangeOptions.extensions, proto.google.protobuf.ExtensionRangeOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.ExtensionRangeOptions} + */ +proto.google.protobuf.ExtensionRangeOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.ExtensionRangeOptions; + return proto.google.protobuf.ExtensionRangeOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.ExtensionRangeOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.ExtensionRangeOptions} + */ +proto.google.protobuf.ExtensionRangeOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.ExtensionRangeOptions.extensionsBinary, + proto.google.protobuf.ExtensionRangeOptions.prototype.getExtension, + proto.google.protobuf.ExtensionRangeOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.ExtensionRangeOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.ExtensionRangeOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.ExtensionRangeOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.ExtensionRangeOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.ExtensionRangeOptions.extensionsBinary, proto.google.protobuf.ExtensionRangeOptions.prototype.getExtension); +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.ExtensionRangeOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.ExtensionRangeOptions} returns this +*/ +proto.google.protobuf.ExtensionRangeOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.ExtensionRangeOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.ExtensionRangeOptions} returns this + */ +proto.google.protobuf.ExtensionRangeOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.FieldDescriptorProto.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.FieldDescriptorProto} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FieldDescriptorProto.toObject = function(includeInstance, msg) { + var f, obj = { + name: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + number: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, + label: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, + type: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, + typeName: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f, + extendee: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, + defaultValue: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f, + oneofIndex: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f, + jsonName: (f = jspb.Message.getField(msg, 10)) == null ? undefined : f, + options: (f = msg.getOptions()) && proto.google.protobuf.FieldOptions.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.FieldDescriptorProto} + */ +proto.google.protobuf.FieldDescriptorProto.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.FieldDescriptorProto; + return proto.google.protobuf.FieldDescriptorProto.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.FieldDescriptorProto} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.FieldDescriptorProto} + */ +proto.google.protobuf.FieldDescriptorProto.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setNumber(value); + break; + case 4: + var value = /** @type {!proto.google.protobuf.FieldDescriptorProto.Label} */ (reader.readEnum()); + msg.setLabel(value); + break; + case 5: + var value = /** @type {!proto.google.protobuf.FieldDescriptorProto.Type} */ (reader.readEnum()); + msg.setType(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setTypeName(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setExtendee(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setDefaultValue(value); + break; + case 9: + var value = /** @type {number} */ (reader.readInt32()); + msg.setOneofIndex(value); + break; + case 10: + var value = /** @type {string} */ (reader.readString()); + msg.setJsonName(value); + break; + case 8: + var value = new proto.google.protobuf.FieldOptions; + reader.readMessage(value,proto.google.protobuf.FieldOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.FieldDescriptorProto.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.FieldDescriptorProto} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FieldDescriptorProto.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeInt32( + 3, + f + ); + } + f = /** @type {!proto.google.protobuf.FieldDescriptorProto.Label} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeEnum( + 4, + f + ); + } + f = /** @type {!proto.google.protobuf.FieldDescriptorProto.Type} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeEnum( + 5, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeString( + 6, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 9)); + if (f != null) { + writer.writeInt32( + 9, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeString( + 10, + f + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.google.protobuf.FieldOptions.serializeBinaryToWriter + ); + } +}; + + +/** + * @enum {number} + */ +proto.google.protobuf.FieldDescriptorProto.Type = { + TYPE_DOUBLE: 1, + TYPE_FLOAT: 2, + TYPE_INT64: 3, + TYPE_UINT64: 4, + TYPE_INT32: 5, + TYPE_FIXED64: 6, + TYPE_FIXED32: 7, + TYPE_BOOL: 8, + TYPE_STRING: 9, + TYPE_GROUP: 10, + TYPE_MESSAGE: 11, + TYPE_BYTES: 12, + TYPE_UINT32: 13, + TYPE_ENUM: 14, + TYPE_SFIXED32: 15, + TYPE_SFIXED64: 16, + TYPE_SINT32: 17, + TYPE_SINT64: 18 +}; + +/** + * @enum {number} + */ +proto.google.protobuf.FieldDescriptorProto.Label = { + LABEL_OPTIONAL: 1, + LABEL_REQUIRED: 2, + LABEL_REPEATED: 3 +}; + +/** + * optional string name = 1; + * @return {string} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setName = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearName = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasName = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int32 number = 3; + * @return {number} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setNumber = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearNumber = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasNumber = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional Label label = 4; + * @return {!proto.google.protobuf.FieldDescriptorProto.Label} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getLabel = function() { + return /** @type {!proto.google.protobuf.FieldDescriptorProto.Label} */ (jspb.Message.getFieldWithDefault(this, 4, 1)); +}; + + +/** + * @param {!proto.google.protobuf.FieldDescriptorProto.Label} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setLabel = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearLabel = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasLabel = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional Type type = 5; + * @return {!proto.google.protobuf.FieldDescriptorProto.Type} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getType = function() { + return /** @type {!proto.google.protobuf.FieldDescriptorProto.Type} */ (jspb.Message.getFieldWithDefault(this, 5, 1)); +}; + + +/** + * @param {!proto.google.protobuf.FieldDescriptorProto.Type} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setType = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearType = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasType = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional string type_name = 6; + * @return {string} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getTypeName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setTypeName = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearTypeName = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasTypeName = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional string extendee = 2; + * @return {string} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getExtendee = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setExtendee = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearExtendee = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasExtendee = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string default_value = 7; + * @return {string} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getDefaultValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setDefaultValue = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearDefaultValue = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasDefaultValue = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional int32 oneof_index = 9; + * @return {number} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getOneofIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setOneofIndex = function(value) { + return jspb.Message.setField(this, 9, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearOneofIndex = function() { + return jspb.Message.setField(this, 9, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasOneofIndex = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional string json_name = 10; + * @return {string} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getJsonName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.setJsonName = function(value) { + return jspb.Message.setField(this, 10, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearJsonName = function() { + return jspb.Message.setField(this, 10, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasJsonName = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional FieldOptions options = 8; + * @return {?proto.google.protobuf.FieldOptions} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.FieldOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.FieldOptions, 8)); +}; + + +/** + * @param {?proto.google.protobuf.FieldOptions|undefined} value + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this +*/ +proto.google.protobuf.FieldDescriptorProto.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.FieldDescriptorProto} returns this + */ +proto.google.protobuf.FieldDescriptorProto.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldDescriptorProto.prototype.hasOptions = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.OneofDescriptorProto.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.OneofDescriptorProto.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.OneofDescriptorProto} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.OneofDescriptorProto.toObject = function(includeInstance, msg) { + var f, obj = { + name: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + options: (f = msg.getOptions()) && proto.google.protobuf.OneofOptions.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.OneofDescriptorProto} + */ +proto.google.protobuf.OneofDescriptorProto.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.OneofDescriptorProto; + return proto.google.protobuf.OneofDescriptorProto.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.OneofDescriptorProto} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.OneofDescriptorProto} + */ +proto.google.protobuf.OneofDescriptorProto.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = new proto.google.protobuf.OneofOptions; + reader.readMessage(value,proto.google.protobuf.OneofOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.OneofDescriptorProto.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.OneofDescriptorProto.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.OneofDescriptorProto} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.OneofDescriptorProto.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.google.protobuf.OneofOptions.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.google.protobuf.OneofDescriptorProto.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.OneofDescriptorProto} returns this + */ +proto.google.protobuf.OneofDescriptorProto.prototype.setName = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.OneofDescriptorProto} returns this + */ +proto.google.protobuf.OneofDescriptorProto.prototype.clearName = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.OneofDescriptorProto.prototype.hasName = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional OneofOptions options = 2; + * @return {?proto.google.protobuf.OneofOptions} + */ +proto.google.protobuf.OneofDescriptorProto.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.OneofOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.OneofOptions, 2)); +}; + + +/** + * @param {?proto.google.protobuf.OneofOptions|undefined} value + * @return {!proto.google.protobuf.OneofDescriptorProto} returns this +*/ +proto.google.protobuf.OneofDescriptorProto.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.OneofDescriptorProto} returns this + */ +proto.google.protobuf.OneofDescriptorProto.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.OneofDescriptorProto.prototype.hasOptions = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.EnumDescriptorProto.repeatedFields_ = [2,4,5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.EnumDescriptorProto.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.EnumDescriptorProto} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumDescriptorProto.toObject = function(includeInstance, msg) { + var f, obj = { + name: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + valueList: jspb.Message.toObjectList(msg.getValueList(), + proto.google.protobuf.EnumValueDescriptorProto.toObject, includeInstance), + options: (f = msg.getOptions()) && proto.google.protobuf.EnumOptions.toObject(includeInstance, f), + reservedRangeList: jspb.Message.toObjectList(msg.getReservedRangeList(), + proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject, includeInstance), + reservedNameList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.EnumDescriptorProto} + */ +proto.google.protobuf.EnumDescriptorProto.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.EnumDescriptorProto; + return proto.google.protobuf.EnumDescriptorProto.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.EnumDescriptorProto} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.EnumDescriptorProto} + */ +proto.google.protobuf.EnumDescriptorProto.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = new proto.google.protobuf.EnumValueDescriptorProto; + reader.readMessage(value,proto.google.protobuf.EnumValueDescriptorProto.deserializeBinaryFromReader); + msg.addValue(value); + break; + case 3: + var value = new proto.google.protobuf.EnumOptions; + reader.readMessage(value,proto.google.protobuf.EnumOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + case 4: + var value = new proto.google.protobuf.EnumDescriptorProto.EnumReservedRange; + reader.readMessage(value,proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.deserializeBinaryFromReader); + msg.addReservedRange(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.addReservedName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.EnumDescriptorProto.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.EnumDescriptorProto} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumDescriptorProto.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getValueList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.google.protobuf.EnumValueDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.google.protobuf.EnumOptions.serializeBinaryToWriter + ); + } + f = message.getReservedRangeList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.serializeBinaryToWriter + ); + } + f = message.getReservedNameList(); + if (f.length > 0) { + writer.writeRepeatedString( + 5, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject = function(includeInstance, msg) { + var f, obj = { + start: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + end: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.EnumDescriptorProto.EnumReservedRange; + return proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setStart(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setEnd(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeInt32( + 2, + f + ); + } +}; + + +/** + * optional int32 start = 1; + * @return {number} + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.getStart = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} returns this + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.setStart = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} returns this + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.clearStart = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.hasStart = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int32 end = 2; + * @return {number} + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.getEnd = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} returns this + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.setEnd = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} returns this + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.clearEnd = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumDescriptorProto.EnumReservedRange.prototype.hasEnd = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this + */ +proto.google.protobuf.EnumDescriptorProto.prototype.setName = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this + */ +proto.google.protobuf.EnumDescriptorProto.prototype.clearName = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.hasName = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated EnumValueDescriptorProto value = 2; + * @return {!Array} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.getValueList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.EnumValueDescriptorProto, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this +*/ +proto.google.protobuf.EnumDescriptorProto.prototype.setValueList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.google.protobuf.EnumValueDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.EnumValueDescriptorProto} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.addValue = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.protobuf.EnumValueDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this + */ +proto.google.protobuf.EnumDescriptorProto.prototype.clearValueList = function() { + return this.setValueList([]); +}; + + +/** + * optional EnumOptions options = 3; + * @return {?proto.google.protobuf.EnumOptions} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.EnumOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.EnumOptions, 3)); +}; + + +/** + * @param {?proto.google.protobuf.EnumOptions|undefined} value + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this +*/ +proto.google.protobuf.EnumDescriptorProto.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this + */ +proto.google.protobuf.EnumDescriptorProto.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.hasOptions = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated EnumReservedRange reserved_range = 4; + * @return {!Array} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.getReservedRangeList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.EnumDescriptorProto.EnumReservedRange, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this +*/ +proto.google.protobuf.EnumDescriptorProto.prototype.setReservedRangeList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.EnumDescriptorProto.EnumReservedRange} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.addReservedRange = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.google.protobuf.EnumDescriptorProto.EnumReservedRange, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this + */ +proto.google.protobuf.EnumDescriptorProto.prototype.clearReservedRangeList = function() { + return this.setReservedRangeList([]); +}; + + +/** + * repeated string reserved_name = 5; + * @return {!Array} + */ +proto.google.protobuf.EnumDescriptorProto.prototype.getReservedNameList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this + */ +proto.google.protobuf.EnumDescriptorProto.prototype.setReservedNameList = function(value) { + return jspb.Message.setField(this, 5, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this + */ +proto.google.protobuf.EnumDescriptorProto.prototype.addReservedName = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.EnumDescriptorProto} returns this + */ +proto.google.protobuf.EnumDescriptorProto.prototype.clearReservedNameList = function() { + return this.setReservedNameList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.EnumValueDescriptorProto.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.EnumValueDescriptorProto} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumValueDescriptorProto.toObject = function(includeInstance, msg) { + var f, obj = { + name: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + number: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, + options: (f = msg.getOptions()) && proto.google.protobuf.EnumValueOptions.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.EnumValueDescriptorProto} + */ +proto.google.protobuf.EnumValueDescriptorProto.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.EnumValueDescriptorProto; + return proto.google.protobuf.EnumValueDescriptorProto.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.EnumValueDescriptorProto} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.EnumValueDescriptorProto} + */ +proto.google.protobuf.EnumValueDescriptorProto.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setNumber(value); + break; + case 3: + var value = new proto.google.protobuf.EnumValueOptions; + reader.readMessage(value,proto.google.protobuf.EnumValueOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.EnumValueDescriptorProto.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.EnumValueDescriptorProto} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumValueDescriptorProto.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeInt32( + 2, + f + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.google.protobuf.EnumValueOptions.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.EnumValueDescriptorProto} returns this + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.setName = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.EnumValueDescriptorProto} returns this + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.clearName = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.hasName = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int32 number = 2; + * @return {number} + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.getNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.EnumValueDescriptorProto} returns this + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.setNumber = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.EnumValueDescriptorProto} returns this + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.clearNumber = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.hasNumber = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional EnumValueOptions options = 3; + * @return {?proto.google.protobuf.EnumValueOptions} + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.EnumValueOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.EnumValueOptions, 3)); +}; + + +/** + * @param {?proto.google.protobuf.EnumValueOptions|undefined} value + * @return {!proto.google.protobuf.EnumValueDescriptorProto} returns this +*/ +proto.google.protobuf.EnumValueDescriptorProto.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.EnumValueDescriptorProto} returns this + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumValueDescriptorProto.prototype.hasOptions = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.ServiceDescriptorProto.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.ServiceDescriptorProto.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.ServiceDescriptorProto} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.ServiceDescriptorProto.toObject = function(includeInstance, msg) { + var f, obj = { + name: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + methodList: jspb.Message.toObjectList(msg.getMethodList(), + proto.google.protobuf.MethodDescriptorProto.toObject, includeInstance), + options: (f = msg.getOptions()) && proto.google.protobuf.ServiceOptions.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.ServiceDescriptorProto} + */ +proto.google.protobuf.ServiceDescriptorProto.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.ServiceDescriptorProto; + return proto.google.protobuf.ServiceDescriptorProto.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.ServiceDescriptorProto} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.ServiceDescriptorProto} + */ +proto.google.protobuf.ServiceDescriptorProto.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = new proto.google.protobuf.MethodDescriptorProto; + reader.readMessage(value,proto.google.protobuf.MethodDescriptorProto.deserializeBinaryFromReader); + msg.addMethod(value); + break; + case 3: + var value = new proto.google.protobuf.ServiceOptions; + reader.readMessage(value,proto.google.protobuf.ServiceOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.ServiceDescriptorProto.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.ServiceDescriptorProto} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.ServiceDescriptorProto.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getMethodList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.google.protobuf.MethodDescriptorProto.serializeBinaryToWriter + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.google.protobuf.ServiceOptions.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.ServiceDescriptorProto} returns this + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.setName = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.ServiceDescriptorProto} returns this + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.clearName = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.hasName = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated MethodDescriptorProto method = 2; + * @return {!Array} + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.getMethodList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.MethodDescriptorProto, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.ServiceDescriptorProto} returns this +*/ +proto.google.protobuf.ServiceDescriptorProto.prototype.setMethodList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.google.protobuf.MethodDescriptorProto=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.MethodDescriptorProto} + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.addMethod = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.protobuf.MethodDescriptorProto, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.ServiceDescriptorProto} returns this + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.clearMethodList = function() { + return this.setMethodList([]); +}; + + +/** + * optional ServiceOptions options = 3; + * @return {?proto.google.protobuf.ServiceOptions} + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.ServiceOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.ServiceOptions, 3)); +}; + + +/** + * @param {?proto.google.protobuf.ServiceOptions|undefined} value + * @return {!proto.google.protobuf.ServiceDescriptorProto} returns this +*/ +proto.google.protobuf.ServiceDescriptorProto.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.ServiceDescriptorProto} returns this + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.ServiceDescriptorProto.prototype.hasOptions = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.MethodDescriptorProto.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.MethodDescriptorProto} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.MethodDescriptorProto.toObject = function(includeInstance, msg) { + var f, obj = { + name: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + inputType: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, + outputType: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, + options: (f = msg.getOptions()) && proto.google.protobuf.MethodOptions.toObject(includeInstance, f), + clientStreaming: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), + serverStreaming: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.MethodDescriptorProto} + */ +proto.google.protobuf.MethodDescriptorProto.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.MethodDescriptorProto; + return proto.google.protobuf.MethodDescriptorProto.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.MethodDescriptorProto} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.MethodDescriptorProto} + */ +proto.google.protobuf.MethodDescriptorProto.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setInputType(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setOutputType(value); + break; + case 4: + var value = new proto.google.protobuf.MethodOptions; + reader.readMessage(value,proto.google.protobuf.MethodOptions.deserializeBinaryFromReader); + msg.setOptions(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setClientStreaming(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setServerStreaming(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.MethodDescriptorProto.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.MethodDescriptorProto} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.MethodDescriptorProto.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = message.getOptions(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.google.protobuf.MethodOptions.serializeBinaryToWriter + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeBool( + 5, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeBool( + 6, + f + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.setName = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.clearName = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.hasName = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string input_type = 2; + * @return {string} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.getInputType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.setInputType = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.clearInputType = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.hasInputType = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string output_type = 3; + * @return {string} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.getOutputType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.setOutputType = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.clearOutputType = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.hasOutputType = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional MethodOptions options = 4; + * @return {?proto.google.protobuf.MethodOptions} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.getOptions = function() { + return /** @type{?proto.google.protobuf.MethodOptions} */ ( + jspb.Message.getWrapperField(this, proto.google.protobuf.MethodOptions, 4)); +}; + + +/** + * @param {?proto.google.protobuf.MethodOptions|undefined} value + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this +*/ +proto.google.protobuf.MethodDescriptorProto.prototype.setOptions = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.clearOptions = function() { + return this.setOptions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.hasOptions = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional bool client_streaming = 5; + * @return {boolean} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.getClientStreaming = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.setClientStreaming = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.clearClientStreaming = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.hasClientStreaming = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional bool server_streaming = 6; + * @return {boolean} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.getServerStreaming = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.setServerStreaming = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MethodDescriptorProto} returns this + */ +proto.google.protobuf.MethodDescriptorProto.prototype.clearServerStreaming = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MethodDescriptorProto.prototype.hasServerStreaming = function() { + return jspb.Message.getField(this, 6) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.FileOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.FileOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.FileOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.FileOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FileOptions.toObject = function(includeInstance, msg) { + var f, obj = { + javaPackage: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + javaOuterClassname: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f, + javaMultipleFiles: jspb.Message.getBooleanFieldWithDefault(msg, 10, false), + javaGenerateEqualsAndHash: (f = jspb.Message.getBooleanField(msg, 20)) == null ? undefined : f, + javaStringCheckUtf8: jspb.Message.getBooleanFieldWithDefault(msg, 27, false), + optimizeFor: jspb.Message.getFieldWithDefault(msg, 9, 1), + goPackage: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f, + ccGenericServices: jspb.Message.getBooleanFieldWithDefault(msg, 16, false), + javaGenericServices: jspb.Message.getBooleanFieldWithDefault(msg, 17, false), + pyGenericServices: jspb.Message.getBooleanFieldWithDefault(msg, 18, false), + phpGenericServices: jspb.Message.getBooleanFieldWithDefault(msg, 42, false), + deprecated: jspb.Message.getBooleanFieldWithDefault(msg, 23, false), + ccEnableArenas: jspb.Message.getBooleanFieldWithDefault(msg, 31, false), + objcClassPrefix: (f = jspb.Message.getField(msg, 36)) == null ? undefined : f, + csharpNamespace: (f = jspb.Message.getField(msg, 37)) == null ? undefined : f, + swiftPrefix: (f = jspb.Message.getField(msg, 39)) == null ? undefined : f, + phpClassPrefix: (f = jspb.Message.getField(msg, 40)) == null ? undefined : f, + phpNamespace: (f = jspb.Message.getField(msg, 41)) == null ? undefined : f, + phpMetadataNamespace: (f = jspb.Message.getField(msg, 44)) == null ? undefined : f, + rubyPackage: (f = jspb.Message.getField(msg, 45)) == null ? undefined : f, + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.FileOptions.extensions, proto.google.protobuf.FileOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.FileOptions} + */ +proto.google.protobuf.FileOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.FileOptions; + return proto.google.protobuf.FileOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.FileOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.FileOptions} + */ +proto.google.protobuf.FileOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setJavaPackage(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setJavaOuterClassname(value); + break; + case 10: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setJavaMultipleFiles(value); + break; + case 20: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setJavaGenerateEqualsAndHash(value); + break; + case 27: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setJavaStringCheckUtf8(value); + break; + case 9: + var value = /** @type {!proto.google.protobuf.FileOptions.OptimizeMode} */ (reader.readEnum()); + msg.setOptimizeFor(value); + break; + case 11: + var value = /** @type {string} */ (reader.readString()); + msg.setGoPackage(value); + break; + case 16: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setCcGenericServices(value); + break; + case 17: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setJavaGenericServices(value); + break; + case 18: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setPyGenericServices(value); + break; + case 42: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setPhpGenericServices(value); + break; + case 23: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDeprecated(value); + break; + case 31: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setCcEnableArenas(value); + break; + case 36: + var value = /** @type {string} */ (reader.readString()); + msg.setObjcClassPrefix(value); + break; + case 37: + var value = /** @type {string} */ (reader.readString()); + msg.setCsharpNamespace(value); + break; + case 39: + var value = /** @type {string} */ (reader.readString()); + msg.setSwiftPrefix(value); + break; + case 40: + var value = /** @type {string} */ (reader.readString()); + msg.setPhpClassPrefix(value); + break; + case 41: + var value = /** @type {string} */ (reader.readString()); + msg.setPhpNamespace(value); + break; + case 44: + var value = /** @type {string} */ (reader.readString()); + msg.setPhpMetadataNamespace(value); + break; + case 45: + var value = /** @type {string} */ (reader.readString()); + msg.setRubyPackage(value); + break; + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.FileOptions.extensionsBinary, + proto.google.protobuf.FileOptions.prototype.getExtension, + proto.google.protobuf.FileOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.FileOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.FileOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.FileOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FileOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeString( + 8, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeBool( + 10, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 20)); + if (f != null) { + writer.writeBool( + 20, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 27)); + if (f != null) { + writer.writeBool( + 27, + f + ); + } + f = /** @type {!proto.google.protobuf.FileOptions.OptimizeMode} */ (jspb.Message.getField(message, 9)); + if (f != null) { + writer.writeEnum( + 9, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 11)); + if (f != null) { + writer.writeString( + 11, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 16)); + if (f != null) { + writer.writeBool( + 16, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 17)); + if (f != null) { + writer.writeBool( + 17, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 18)); + if (f != null) { + writer.writeBool( + 18, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 42)); + if (f != null) { + writer.writeBool( + 42, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 23)); + if (f != null) { + writer.writeBool( + 23, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 31)); + if (f != null) { + writer.writeBool( + 31, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 36)); + if (f != null) { + writer.writeString( + 36, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 37)); + if (f != null) { + writer.writeString( + 37, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 39)); + if (f != null) { + writer.writeString( + 39, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 40)); + if (f != null) { + writer.writeString( + 40, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 41)); + if (f != null) { + writer.writeString( + 41, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 44)); + if (f != null) { + writer.writeString( + 44, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 45)); + if (f != null) { + writer.writeString( + 45, + f + ); + } + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.FileOptions.extensionsBinary, proto.google.protobuf.FileOptions.prototype.getExtension); +}; + + +/** + * @enum {number} + */ +proto.google.protobuf.FileOptions.OptimizeMode = { + SPEED: 1, + CODE_SIZE: 2, + LITE_RUNTIME: 3 +}; + +/** + * optional string java_package = 1; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getJavaPackage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setJavaPackage = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearJavaPackage = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasJavaPackage = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string java_outer_classname = 8; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getJavaOuterClassname = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setJavaOuterClassname = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearJavaOuterClassname = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasJavaOuterClassname = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional bool java_multiple_files = 10; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getJavaMultipleFiles = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setJavaMultipleFiles = function(value) { + return jspb.Message.setField(this, 10, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearJavaMultipleFiles = function() { + return jspb.Message.setField(this, 10, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasJavaMultipleFiles = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional bool java_generate_equals_and_hash = 20; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getJavaGenerateEqualsAndHash = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 20, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setJavaGenerateEqualsAndHash = function(value) { + return jspb.Message.setField(this, 20, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearJavaGenerateEqualsAndHash = function() { + return jspb.Message.setField(this, 20, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasJavaGenerateEqualsAndHash = function() { + return jspb.Message.getField(this, 20) != null; +}; + + +/** + * optional bool java_string_check_utf8 = 27; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getJavaStringCheckUtf8 = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 27, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setJavaStringCheckUtf8 = function(value) { + return jspb.Message.setField(this, 27, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearJavaStringCheckUtf8 = function() { + return jspb.Message.setField(this, 27, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasJavaStringCheckUtf8 = function() { + return jspb.Message.getField(this, 27) != null; +}; + + +/** + * optional OptimizeMode optimize_for = 9; + * @return {!proto.google.protobuf.FileOptions.OptimizeMode} + */ +proto.google.protobuf.FileOptions.prototype.getOptimizeFor = function() { + return /** @type {!proto.google.protobuf.FileOptions.OptimizeMode} */ (jspb.Message.getFieldWithDefault(this, 9, 1)); +}; + + +/** + * @param {!proto.google.protobuf.FileOptions.OptimizeMode} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setOptimizeFor = function(value) { + return jspb.Message.setField(this, 9, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearOptimizeFor = function() { + return jspb.Message.setField(this, 9, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasOptimizeFor = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional string go_package = 11; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getGoPackage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 11, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setGoPackage = function(value) { + return jspb.Message.setField(this, 11, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearGoPackage = function() { + return jspb.Message.setField(this, 11, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasGoPackage = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * optional bool cc_generic_services = 16; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getCcGenericServices = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 16, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setCcGenericServices = function(value) { + return jspb.Message.setField(this, 16, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearCcGenericServices = function() { + return jspb.Message.setField(this, 16, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasCcGenericServices = function() { + return jspb.Message.getField(this, 16) != null; +}; + + +/** + * optional bool java_generic_services = 17; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getJavaGenericServices = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 17, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setJavaGenericServices = function(value) { + return jspb.Message.setField(this, 17, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearJavaGenericServices = function() { + return jspb.Message.setField(this, 17, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasJavaGenericServices = function() { + return jspb.Message.getField(this, 17) != null; +}; + + +/** + * optional bool py_generic_services = 18; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getPyGenericServices = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 18, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setPyGenericServices = function(value) { + return jspb.Message.setField(this, 18, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearPyGenericServices = function() { + return jspb.Message.setField(this, 18, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasPyGenericServices = function() { + return jspb.Message.getField(this, 18) != null; +}; + + +/** + * optional bool php_generic_services = 42; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getPhpGenericServices = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 42, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setPhpGenericServices = function(value) { + return jspb.Message.setField(this, 42, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearPhpGenericServices = function() { + return jspb.Message.setField(this, 42, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasPhpGenericServices = function() { + return jspb.Message.getField(this, 42) != null; +}; + + +/** + * optional bool deprecated = 23; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getDeprecated = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 23, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setDeprecated = function(value) { + return jspb.Message.setField(this, 23, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearDeprecated = function() { + return jspb.Message.setField(this, 23, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasDeprecated = function() { + return jspb.Message.getField(this, 23) != null; +}; + + +/** + * optional bool cc_enable_arenas = 31; + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.getCcEnableArenas = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 31, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setCcEnableArenas = function(value) { + return jspb.Message.setField(this, 31, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearCcEnableArenas = function() { + return jspb.Message.setField(this, 31, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasCcEnableArenas = function() { + return jspb.Message.getField(this, 31) != null; +}; + + +/** + * optional string objc_class_prefix = 36; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getObjcClassPrefix = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 36, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setObjcClassPrefix = function(value) { + return jspb.Message.setField(this, 36, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearObjcClassPrefix = function() { + return jspb.Message.setField(this, 36, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasObjcClassPrefix = function() { + return jspb.Message.getField(this, 36) != null; +}; + + +/** + * optional string csharp_namespace = 37; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getCsharpNamespace = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 37, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setCsharpNamespace = function(value) { + return jspb.Message.setField(this, 37, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearCsharpNamespace = function() { + return jspb.Message.setField(this, 37, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasCsharpNamespace = function() { + return jspb.Message.getField(this, 37) != null; +}; + + +/** + * optional string swift_prefix = 39; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getSwiftPrefix = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 39, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setSwiftPrefix = function(value) { + return jspb.Message.setField(this, 39, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearSwiftPrefix = function() { + return jspb.Message.setField(this, 39, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasSwiftPrefix = function() { + return jspb.Message.getField(this, 39) != null; +}; + + +/** + * optional string php_class_prefix = 40; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getPhpClassPrefix = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 40, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setPhpClassPrefix = function(value) { + return jspb.Message.setField(this, 40, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearPhpClassPrefix = function() { + return jspb.Message.setField(this, 40, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasPhpClassPrefix = function() { + return jspb.Message.getField(this, 40) != null; +}; + + +/** + * optional string php_namespace = 41; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getPhpNamespace = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 41, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setPhpNamespace = function(value) { + return jspb.Message.setField(this, 41, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearPhpNamespace = function() { + return jspb.Message.setField(this, 41, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasPhpNamespace = function() { + return jspb.Message.getField(this, 41) != null; +}; + + +/** + * optional string php_metadata_namespace = 44; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getPhpMetadataNamespace = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 44, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setPhpMetadataNamespace = function(value) { + return jspb.Message.setField(this, 44, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearPhpMetadataNamespace = function() { + return jspb.Message.setField(this, 44, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasPhpMetadataNamespace = function() { + return jspb.Message.getField(this, 44) != null; +}; + + +/** + * optional string ruby_package = 45; + * @return {string} + */ +proto.google.protobuf.FileOptions.prototype.getRubyPackage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 45, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.setRubyPackage = function(value) { + return jspb.Message.setField(this, 45, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearRubyPackage = function() { + return jspb.Message.setField(this, 45, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FileOptions.prototype.hasRubyPackage = function() { + return jspb.Message.getField(this, 45) != null; +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.FileOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FileOptions} returns this +*/ +proto.google.protobuf.FileOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.FileOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FileOptions} returns this + */ +proto.google.protobuf.FileOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.MessageOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.MessageOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.MessageOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.MessageOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.MessageOptions.toObject = function(includeInstance, msg) { + var f, obj = { + messageSetWireFormat: jspb.Message.getBooleanFieldWithDefault(msg, 1, false), + noStandardDescriptorAccessor: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), + deprecated: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + mapEntry: (f = jspb.Message.getBooleanField(msg, 7)) == null ? undefined : f, + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.MessageOptions.extensions, proto.google.protobuf.MessageOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.MessageOptions} + */ +proto.google.protobuf.MessageOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.MessageOptions; + return proto.google.protobuf.MessageOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.MessageOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.MessageOptions} + */ +proto.google.protobuf.MessageOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setMessageSetWireFormat(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setNoStandardDescriptorAccessor(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDeprecated(value); + break; + case 7: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setMapEntry(value); + break; + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.MessageOptions.extensionsBinary, + proto.google.protobuf.MessageOptions.prototype.getExtension, + proto.google.protobuf.MessageOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.MessageOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.MessageOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.MessageOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.MessageOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBool( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeBool( + 3, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeBool( + 7, + f + ); + } + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.MessageOptions.extensionsBinary, proto.google.protobuf.MessageOptions.prototype.getExtension); +}; + + +/** + * optional bool message_set_wire_format = 1; + * @return {boolean} + */ +proto.google.protobuf.MessageOptions.prototype.getMessageSetWireFormat = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.setMessageSetWireFormat = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.clearMessageSetWireFormat = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MessageOptions.prototype.hasMessageSetWireFormat = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool no_standard_descriptor_accessor = 2; + * @return {boolean} + */ +proto.google.protobuf.MessageOptions.prototype.getNoStandardDescriptorAccessor = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.setNoStandardDescriptorAccessor = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.clearNoStandardDescriptorAccessor = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MessageOptions.prototype.hasNoStandardDescriptorAccessor = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional bool deprecated = 3; + * @return {boolean} + */ +proto.google.protobuf.MessageOptions.prototype.getDeprecated = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.setDeprecated = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.clearDeprecated = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MessageOptions.prototype.hasDeprecated = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional bool map_entry = 7; + * @return {boolean} + */ +proto.google.protobuf.MessageOptions.prototype.getMapEntry = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.setMapEntry = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.clearMapEntry = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MessageOptions.prototype.hasMapEntry = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.MessageOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.MessageOptions} returns this +*/ +proto.google.protobuf.MessageOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.MessageOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.MessageOptions} returns this + */ +proto.google.protobuf.MessageOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.FieldOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.FieldOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.FieldOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.FieldOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FieldOptions.toObject = function(includeInstance, msg) { + var f, obj = { + ctype: jspb.Message.getFieldWithDefault(msg, 1, 0), + packed: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, + jstype: jspb.Message.getFieldWithDefault(msg, 6, 0), + lazy: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), + deprecated: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + weak: jspb.Message.getBooleanFieldWithDefault(msg, 10, false), + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.FieldOptions.extensions, proto.google.protobuf.FieldOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.FieldOptions} + */ +proto.google.protobuf.FieldOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.FieldOptions; + return proto.google.protobuf.FieldOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.FieldOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.FieldOptions} + */ +proto.google.protobuf.FieldOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.google.protobuf.FieldOptions.CType} */ (reader.readEnum()); + msg.setCtype(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setPacked(value); + break; + case 6: + var value = /** @type {!proto.google.protobuf.FieldOptions.JSType} */ (reader.readEnum()); + msg.setJstype(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setLazy(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDeprecated(value); + break; + case 10: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setWeak(value); + break; + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.FieldOptions.extensionsBinary, + proto.google.protobuf.FieldOptions.prototype.getExtension, + proto.google.protobuf.FieldOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.FieldOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.FieldOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.FieldOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.FieldOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {!proto.google.protobuf.FieldOptions.CType} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeEnum( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = /** @type {!proto.google.protobuf.FieldOptions.JSType} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeEnum( + 6, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeBool( + 5, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeBool( + 3, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeBool( + 10, + f + ); + } + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.FieldOptions.extensionsBinary, proto.google.protobuf.FieldOptions.prototype.getExtension); +}; + + +/** + * @enum {number} + */ +proto.google.protobuf.FieldOptions.CType = { + STRING: 0, + CORD: 1, + STRING_PIECE: 2 +}; + +/** + * @enum {number} + */ +proto.google.protobuf.FieldOptions.JSType = { + JS_NORMAL: 0, + JS_STRING: 1, + JS_NUMBER: 2 +}; + +/** + * optional CType ctype = 1; + * @return {!proto.google.protobuf.FieldOptions.CType} + */ +proto.google.protobuf.FieldOptions.prototype.getCtype = function() { + return /** @type {!proto.google.protobuf.FieldOptions.CType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.google.protobuf.FieldOptions.CType} value + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.setCtype = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.clearCtype = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.hasCtype = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool packed = 2; + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.getPacked = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.setPacked = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.clearPacked = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.hasPacked = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional JSType jstype = 6; + * @return {!proto.google.protobuf.FieldOptions.JSType} + */ +proto.google.protobuf.FieldOptions.prototype.getJstype = function() { + return /** @type {!proto.google.protobuf.FieldOptions.JSType} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {!proto.google.protobuf.FieldOptions.JSType} value + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.setJstype = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.clearJstype = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.hasJstype = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bool lazy = 5; + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.getLazy = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.setLazy = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.clearLazy = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.hasLazy = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional bool deprecated = 3; + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.getDeprecated = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.setDeprecated = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.clearDeprecated = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.hasDeprecated = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional bool weak = 10; + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.getWeak = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.setWeak = function(value) { + return jspb.Message.setField(this, 10, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.clearWeak = function() { + return jspb.Message.setField(this, 10, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.FieldOptions.prototype.hasWeak = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.FieldOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.FieldOptions} returns this +*/ +proto.google.protobuf.FieldOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.FieldOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.FieldOptions} returns this + */ +proto.google.protobuf.FieldOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.OneofOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.OneofOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.OneofOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.OneofOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.OneofOptions.toObject = function(includeInstance, msg) { + var f, obj = { + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.OneofOptions.extensions, proto.google.protobuf.OneofOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.OneofOptions} + */ +proto.google.protobuf.OneofOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.OneofOptions; + return proto.google.protobuf.OneofOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.OneofOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.OneofOptions} + */ +proto.google.protobuf.OneofOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.OneofOptions.extensionsBinary, + proto.google.protobuf.OneofOptions.prototype.getExtension, + proto.google.protobuf.OneofOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.OneofOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.OneofOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.OneofOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.OneofOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.OneofOptions.extensionsBinary, proto.google.protobuf.OneofOptions.prototype.getExtension); +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.OneofOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.OneofOptions} returns this +*/ +proto.google.protobuf.OneofOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.OneofOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.OneofOptions} returns this + */ +proto.google.protobuf.OneofOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.EnumOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.EnumOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.EnumOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.EnumOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumOptions.toObject = function(includeInstance, msg) { + var f, obj = { + allowAlias: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, + deprecated: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.EnumOptions.extensions, proto.google.protobuf.EnumOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.EnumOptions} + */ +proto.google.protobuf.EnumOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.EnumOptions; + return proto.google.protobuf.EnumOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.EnumOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.EnumOptions} + */ +proto.google.protobuf.EnumOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAllowAlias(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDeprecated(value); + break; + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.EnumOptions.extensionsBinary, + proto.google.protobuf.EnumOptions.prototype.getExtension, + proto.google.protobuf.EnumOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.EnumOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.EnumOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.EnumOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeBool( + 3, + f + ); + } + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.EnumOptions.extensionsBinary, proto.google.protobuf.EnumOptions.prototype.getExtension); +}; + + +/** + * optional bool allow_alias = 2; + * @return {boolean} + */ +proto.google.protobuf.EnumOptions.prototype.getAllowAlias = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.EnumOptions} returns this + */ +proto.google.protobuf.EnumOptions.prototype.setAllowAlias = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.EnumOptions} returns this + */ +proto.google.protobuf.EnumOptions.prototype.clearAllowAlias = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumOptions.prototype.hasAllowAlias = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional bool deprecated = 3; + * @return {boolean} + */ +proto.google.protobuf.EnumOptions.prototype.getDeprecated = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.EnumOptions} returns this + */ +proto.google.protobuf.EnumOptions.prototype.setDeprecated = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.EnumOptions} returns this + */ +proto.google.protobuf.EnumOptions.prototype.clearDeprecated = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumOptions.prototype.hasDeprecated = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.EnumOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.EnumOptions} returns this +*/ +proto.google.protobuf.EnumOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.EnumOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.EnumOptions} returns this + */ +proto.google.protobuf.EnumOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.EnumValueOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.EnumValueOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.EnumValueOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.EnumValueOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumValueOptions.toObject = function(includeInstance, msg) { + var f, obj = { + deprecated: jspb.Message.getBooleanFieldWithDefault(msg, 1, false), + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.EnumValueOptions.extensions, proto.google.protobuf.EnumValueOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.EnumValueOptions} + */ +proto.google.protobuf.EnumValueOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.EnumValueOptions; + return proto.google.protobuf.EnumValueOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.EnumValueOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.EnumValueOptions} + */ +proto.google.protobuf.EnumValueOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDeprecated(value); + break; + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.EnumValueOptions.extensionsBinary, + proto.google.protobuf.EnumValueOptions.prototype.getExtension, + proto.google.protobuf.EnumValueOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.EnumValueOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.EnumValueOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.EnumValueOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.EnumValueOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBool( + 1, + f + ); + } + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.EnumValueOptions.extensionsBinary, proto.google.protobuf.EnumValueOptions.prototype.getExtension); +}; + + +/** + * optional bool deprecated = 1; + * @return {boolean} + */ +proto.google.protobuf.EnumValueOptions.prototype.getDeprecated = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.EnumValueOptions} returns this + */ +proto.google.protobuf.EnumValueOptions.prototype.setDeprecated = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.EnumValueOptions} returns this + */ +proto.google.protobuf.EnumValueOptions.prototype.clearDeprecated = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.EnumValueOptions.prototype.hasDeprecated = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.EnumValueOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.EnumValueOptions} returns this +*/ +proto.google.protobuf.EnumValueOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.EnumValueOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.EnumValueOptions} returns this + */ +proto.google.protobuf.EnumValueOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.ServiceOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.ServiceOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.ServiceOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.ServiceOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.ServiceOptions.toObject = function(includeInstance, msg) { + var f, obj = { + deprecated: jspb.Message.getBooleanFieldWithDefault(msg, 33, false), + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.ServiceOptions.extensions, proto.google.protobuf.ServiceOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.ServiceOptions} + */ +proto.google.protobuf.ServiceOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.ServiceOptions; + return proto.google.protobuf.ServiceOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.ServiceOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.ServiceOptions} + */ +proto.google.protobuf.ServiceOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 33: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDeprecated(value); + break; + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.ServiceOptions.extensionsBinary, + proto.google.protobuf.ServiceOptions.prototype.getExtension, + proto.google.protobuf.ServiceOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.ServiceOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.ServiceOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.ServiceOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.ServiceOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 33)); + if (f != null) { + writer.writeBool( + 33, + f + ); + } + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.ServiceOptions.extensionsBinary, proto.google.protobuf.ServiceOptions.prototype.getExtension); +}; + + +/** + * optional bool deprecated = 33; + * @return {boolean} + */ +proto.google.protobuf.ServiceOptions.prototype.getDeprecated = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 33, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.ServiceOptions} returns this + */ +proto.google.protobuf.ServiceOptions.prototype.setDeprecated = function(value) { + return jspb.Message.setField(this, 33, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.ServiceOptions} returns this + */ +proto.google.protobuf.ServiceOptions.prototype.clearDeprecated = function() { + return jspb.Message.setField(this, 33, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.ServiceOptions.prototype.hasDeprecated = function() { + return jspb.Message.getField(this, 33) != null; +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.ServiceOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.ServiceOptions} returns this +*/ +proto.google.protobuf.ServiceOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.ServiceOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.ServiceOptions} returns this + */ +proto.google.protobuf.ServiceOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.MethodOptions.repeatedFields_ = [999]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.MethodOptions.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.MethodOptions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.MethodOptions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.MethodOptions.toObject = function(includeInstance, msg) { + var f, obj = { + deprecated: jspb.Message.getBooleanFieldWithDefault(msg, 33, false), + idempotencyLevel: jspb.Message.getFieldWithDefault(msg, 34, 0), + uninterpretedOptionList: jspb.Message.toObjectList(msg.getUninterpretedOptionList(), + proto.google.protobuf.UninterpretedOption.toObject, includeInstance) + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.MethodOptions.extensions, proto.google.protobuf.MethodOptions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.MethodOptions} + */ +proto.google.protobuf.MethodOptions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.MethodOptions; + return proto.google.protobuf.MethodOptions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.MethodOptions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.MethodOptions} + */ +proto.google.protobuf.MethodOptions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 33: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDeprecated(value); + break; + case 34: + var value = /** @type {!proto.google.protobuf.MethodOptions.IdempotencyLevel} */ (reader.readEnum()); + msg.setIdempotencyLevel(value); + break; + case 999: + var value = new proto.google.protobuf.UninterpretedOption; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader); + msg.addUninterpretedOption(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.MethodOptions.extensionsBinary, + proto.google.protobuf.MethodOptions.prototype.getExtension, + proto.google.protobuf.MethodOptions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.MethodOptions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.MethodOptions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.MethodOptions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.MethodOptions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 33)); + if (f != null) { + writer.writeBool( + 33, + f + ); + } + f = /** @type {!proto.google.protobuf.MethodOptions.IdempotencyLevel} */ (jspb.Message.getField(message, 34)); + if (f != null) { + writer.writeEnum( + 34, + f + ); + } + f = message.getUninterpretedOptionList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 999, + f, + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.MethodOptions.extensionsBinary, proto.google.protobuf.MethodOptions.prototype.getExtension); +}; + + +/** + * @enum {number} + */ +proto.google.protobuf.MethodOptions.IdempotencyLevel = { + IDEMPOTENCY_UNKNOWN: 0, + NO_SIDE_EFFECTS: 1, + IDEMPOTENT: 2 +}; + +/** + * optional bool deprecated = 33; + * @return {boolean} + */ +proto.google.protobuf.MethodOptions.prototype.getDeprecated = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 33, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.MethodOptions} returns this + */ +proto.google.protobuf.MethodOptions.prototype.setDeprecated = function(value) { + return jspb.Message.setField(this, 33, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MethodOptions} returns this + */ +proto.google.protobuf.MethodOptions.prototype.clearDeprecated = function() { + return jspb.Message.setField(this, 33, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MethodOptions.prototype.hasDeprecated = function() { + return jspb.Message.getField(this, 33) != null; +}; + + +/** + * optional IdempotencyLevel idempotency_level = 34; + * @return {!proto.google.protobuf.MethodOptions.IdempotencyLevel} + */ +proto.google.protobuf.MethodOptions.prototype.getIdempotencyLevel = function() { + return /** @type {!proto.google.protobuf.MethodOptions.IdempotencyLevel} */ (jspb.Message.getFieldWithDefault(this, 34, 0)); +}; + + +/** + * @param {!proto.google.protobuf.MethodOptions.IdempotencyLevel} value + * @return {!proto.google.protobuf.MethodOptions} returns this + */ +proto.google.protobuf.MethodOptions.prototype.setIdempotencyLevel = function(value) { + return jspb.Message.setField(this, 34, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.MethodOptions} returns this + */ +proto.google.protobuf.MethodOptions.prototype.clearIdempotencyLevel = function() { + return jspb.Message.setField(this, 34, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.MethodOptions.prototype.hasIdempotencyLevel = function() { + return jspb.Message.getField(this, 34) != null; +}; + + +/** + * repeated UninterpretedOption uninterpreted_option = 999; + * @return {!Array} + */ +proto.google.protobuf.MethodOptions.prototype.getUninterpretedOptionList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption, 999)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.MethodOptions} returns this +*/ +proto.google.protobuf.MethodOptions.prototype.setUninterpretedOptionList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 999, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.MethodOptions.prototype.addUninterpretedOption = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 999, opt_value, proto.google.protobuf.UninterpretedOption, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.MethodOptions} returns this + */ +proto.google.protobuf.MethodOptions.prototype.clearUninterpretedOptionList = function() { + return this.setUninterpretedOptionList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.UninterpretedOption.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.UninterpretedOption.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.UninterpretedOption.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.UninterpretedOption} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.UninterpretedOption.toObject = function(includeInstance, msg) { + var f, obj = { + nameList: jspb.Message.toObjectList(msg.getNameList(), + proto.google.protobuf.UninterpretedOption.NamePart.toObject, includeInstance), + identifierValue: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, + positiveIntValue: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, + negativeIntValue: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, + doubleValue: (f = jspb.Message.getOptionalFloatingPointField(msg, 6)) == null ? undefined : f, + stringValue: msg.getStringValue_asB64(), + aggregateValue: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.UninterpretedOption.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.UninterpretedOption; + return proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.UninterpretedOption} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.UninterpretedOption} + */ +proto.google.protobuf.UninterpretedOption.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = new proto.google.protobuf.UninterpretedOption.NamePart; + reader.readMessage(value,proto.google.protobuf.UninterpretedOption.NamePart.deserializeBinaryFromReader); + msg.addName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setIdentifierValue(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setPositiveIntValue(value); + break; + case 5: + var value = /** @type {number} */ (reader.readInt64()); + msg.setNegativeIntValue(value); + break; + case 6: + var value = /** @type {number} */ (reader.readDouble()); + msg.setDoubleValue(value); + break; + case 7: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setStringValue(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setAggregateValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.UninterpretedOption.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.UninterpretedOption} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.UninterpretedOption.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNameList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.google.protobuf.UninterpretedOption.NamePart.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeUint64( + 4, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeInt64( + 5, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeDouble( + 6, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeBytes( + 7, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeString( + 8, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.UninterpretedOption.NamePart.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.UninterpretedOption.NamePart} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.UninterpretedOption.NamePart.toObject = function(includeInstance, msg) { + var f, obj = { + namePart: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + isExtension: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.UninterpretedOption.NamePart} + */ +proto.google.protobuf.UninterpretedOption.NamePart.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.UninterpretedOption.NamePart; + return proto.google.protobuf.UninterpretedOption.NamePart.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.UninterpretedOption.NamePart} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.UninterpretedOption.NamePart} + */ +proto.google.protobuf.UninterpretedOption.NamePart.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setNamePart(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsExtension(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.UninterpretedOption.NamePart.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.UninterpretedOption.NamePart} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.UninterpretedOption.NamePart.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * required string name_part = 1; + * @return {string} + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.getNamePart = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.UninterpretedOption.NamePart} returns this + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.setNamePart = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.UninterpretedOption.NamePart} returns this + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.clearNamePart = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.hasNamePart = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required bool is_extension = 2; + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.getIsExtension = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.google.protobuf.UninterpretedOption.NamePart} returns this + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.setIsExtension = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.UninterpretedOption.NamePart} returns this + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.clearIsExtension = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.NamePart.prototype.hasIsExtension = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated NamePart name = 2; + * @return {!Array} + */ +proto.google.protobuf.UninterpretedOption.prototype.getNameList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.UninterpretedOption.NamePart, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.UninterpretedOption} returns this +*/ +proto.google.protobuf.UninterpretedOption.prototype.setNameList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.google.protobuf.UninterpretedOption.NamePart=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.UninterpretedOption.NamePart} + */ +proto.google.protobuf.UninterpretedOption.prototype.addName = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.protobuf.UninterpretedOption.NamePart, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.clearNameList = function() { + return this.setNameList([]); +}; + + +/** + * optional string identifier_value = 3; + * @return {string} + */ +proto.google.protobuf.UninterpretedOption.prototype.getIdentifierValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.setIdentifierValue = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.clearIdentifierValue = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.prototype.hasIdentifierValue = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional uint64 positive_int_value = 4; + * @return {number} + */ +proto.google.protobuf.UninterpretedOption.prototype.getPositiveIntValue = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.setPositiveIntValue = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.clearPositiveIntValue = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.prototype.hasPositiveIntValue = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional int64 negative_int_value = 5; + * @return {number} + */ +proto.google.protobuf.UninterpretedOption.prototype.getNegativeIntValue = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.setNegativeIntValue = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.clearNegativeIntValue = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.prototype.hasNegativeIntValue = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional double double_value = 6; + * @return {number} + */ +proto.google.protobuf.UninterpretedOption.prototype.getDoubleValue = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 6, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.setDoubleValue = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.clearDoubleValue = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.prototype.hasDoubleValue = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bytes string_value = 7; + * @return {!(string|Uint8Array)} + */ +proto.google.protobuf.UninterpretedOption.prototype.getStringValue = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * optional bytes string_value = 7; + * This is a type-conversion wrapper around `getStringValue()` + * @return {string} + */ +proto.google.protobuf.UninterpretedOption.prototype.getStringValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getStringValue())); +}; + + +/** + * optional bytes string_value = 7; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getStringValue()` + * @return {!Uint8Array} + */ +proto.google.protobuf.UninterpretedOption.prototype.getStringValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getStringValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.setStringValue = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.clearStringValue = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.prototype.hasStringValue = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional string aggregate_value = 8; + * @return {string} + */ +proto.google.protobuf.UninterpretedOption.prototype.getAggregateValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.setAggregateValue = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.UninterpretedOption} returns this + */ +proto.google.protobuf.UninterpretedOption.prototype.clearAggregateValue = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.UninterpretedOption.prototype.hasAggregateValue = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.SourceCodeInfo.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.SourceCodeInfo.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.SourceCodeInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.SourceCodeInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.SourceCodeInfo.toObject = function(includeInstance, msg) { + var f, obj = { + locationList: jspb.Message.toObjectList(msg.getLocationList(), + proto.google.protobuf.SourceCodeInfo.Location.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.SourceCodeInfo} + */ +proto.google.protobuf.SourceCodeInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.SourceCodeInfo; + return proto.google.protobuf.SourceCodeInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.SourceCodeInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.SourceCodeInfo} + */ +proto.google.protobuf.SourceCodeInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.google.protobuf.SourceCodeInfo.Location; + reader.readMessage(value,proto.google.protobuf.SourceCodeInfo.Location.deserializeBinaryFromReader); + msg.addLocation(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.SourceCodeInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.SourceCodeInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.SourceCodeInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.SourceCodeInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getLocationList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.google.protobuf.SourceCodeInfo.Location.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.SourceCodeInfo.Location.repeatedFields_ = [1,2,6]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.SourceCodeInfo.Location.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.SourceCodeInfo.Location} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.SourceCodeInfo.Location.toObject = function(includeInstance, msg) { + var f, obj = { + pathList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f, + spanList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, + leadingComments: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, + trailingComments: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, + leadingDetachedCommentsList: (f = jspb.Message.getRepeatedField(msg, 6)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.SourceCodeInfo.Location} + */ +proto.google.protobuf.SourceCodeInfo.Location.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.SourceCodeInfo.Location; + return proto.google.protobuf.SourceCodeInfo.Location.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.SourceCodeInfo.Location} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.SourceCodeInfo.Location} + */ +proto.google.protobuf.SourceCodeInfo.Location.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedInt32() : [reader.readInt32()]); + for (var i = 0; i < values.length; i++) { + msg.addPath(values[i]); + } + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedInt32() : [reader.readInt32()]); + for (var i = 0; i < values.length; i++) { + msg.addSpan(values[i]); + } + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setLeadingComments(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setTrailingComments(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.addLeadingDetachedComments(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.SourceCodeInfo.Location.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.SourceCodeInfo.Location} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.SourceCodeInfo.Location.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPathList(); + if (f.length > 0) { + writer.writePackedInt32( + 1, + f + ); + } + f = message.getSpanList(); + if (f.length > 0) { + writer.writePackedInt32( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } + f = message.getLeadingDetachedCommentsList(); + if (f.length > 0) { + writer.writeRepeatedString( + 6, + f + ); + } +}; + + +/** + * repeated int32 path = 1; + * @return {!Array} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.getPathList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.setPathList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.addPath = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.clearPathList = function() { + return this.setPathList([]); +}; + + +/** + * repeated int32 span = 2; + * @return {!Array} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.getSpanList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.setSpanList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.addSpan = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.clearSpanList = function() { + return this.setSpanList([]); +}; + + +/** + * optional string leading_comments = 3; + * @return {string} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.getLeadingComments = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.setLeadingComments = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.clearLeadingComments = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.hasLeadingComments = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string trailing_comments = 4; + * @return {string} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.getTrailingComments = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.setTrailingComments = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.clearTrailingComments = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.hasTrailingComments = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * repeated string leading_detached_comments = 6; + * @return {!Array} + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.getLeadingDetachedCommentsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 6)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.setLeadingDetachedCommentsList = function(value) { + return jspb.Message.setField(this, 6, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.addLeadingDetachedComments = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 6, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.SourceCodeInfo.Location} returns this + */ +proto.google.protobuf.SourceCodeInfo.Location.prototype.clearLeadingDetachedCommentsList = function() { + return this.setLeadingDetachedCommentsList([]); +}; + + +/** + * repeated Location location = 1; + * @return {!Array} + */ +proto.google.protobuf.SourceCodeInfo.prototype.getLocationList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.SourceCodeInfo.Location, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.SourceCodeInfo} returns this +*/ +proto.google.protobuf.SourceCodeInfo.prototype.setLocationList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.google.protobuf.SourceCodeInfo.Location=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.SourceCodeInfo.Location} + */ +proto.google.protobuf.SourceCodeInfo.prototype.addLocation = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.google.protobuf.SourceCodeInfo.Location, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.SourceCodeInfo} returns this + */ +proto.google.protobuf.SourceCodeInfo.prototype.clearLocationList = function() { + return this.setLocationList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.GeneratedCodeInfo.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.GeneratedCodeInfo.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.GeneratedCodeInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.GeneratedCodeInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.GeneratedCodeInfo.toObject = function(includeInstance, msg) { + var f, obj = { + annotationList: jspb.Message.toObjectList(msg.getAnnotationList(), + proto.google.protobuf.GeneratedCodeInfo.Annotation.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.GeneratedCodeInfo} + */ +proto.google.protobuf.GeneratedCodeInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.GeneratedCodeInfo; + return proto.google.protobuf.GeneratedCodeInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.GeneratedCodeInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.GeneratedCodeInfo} + */ +proto.google.protobuf.GeneratedCodeInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.google.protobuf.GeneratedCodeInfo.Annotation; + reader.readMessage(value,proto.google.protobuf.GeneratedCodeInfo.Annotation.deserializeBinaryFromReader); + msg.addAnnotation(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.GeneratedCodeInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.GeneratedCodeInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.GeneratedCodeInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.GeneratedCodeInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAnnotationList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.google.protobuf.GeneratedCodeInfo.Annotation.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.GeneratedCodeInfo.Annotation.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.GeneratedCodeInfo.Annotation} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.toObject = function(includeInstance, msg) { + var f, obj = { + pathList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f, + sourceFile: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, + begin: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, + end: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.GeneratedCodeInfo.Annotation; + return proto.google.protobuf.GeneratedCodeInfo.Annotation.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.GeneratedCodeInfo.Annotation} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedInt32() : [reader.readInt32()]); + for (var i = 0; i < values.length; i++) { + msg.addPath(values[i]); + } + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setSourceFile(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBegin(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt32()); + msg.setEnd(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.GeneratedCodeInfo.Annotation.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.GeneratedCodeInfo.Annotation} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPathList(); + if (f.length > 0) { + writer.writePackedInt32( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeInt32( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeInt32( + 4, + f + ); + } +}; + + +/** + * repeated int32 path = 1; + * @return {!Array} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.getPathList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.setPathList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.addPath = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.clearPathList = function() { + return this.setPathList([]); +}; + + +/** + * optional string source_file = 2; + * @return {string} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.getSourceFile = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.setSourceFile = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.clearSourceFile = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.hasSourceFile = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int32 begin = 3; + * @return {number} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.getBegin = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.setBegin = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.clearBegin = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.hasBegin = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional int32 end = 4; + * @return {number} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.getEnd = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.setEnd = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.clearEnd = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.google.protobuf.GeneratedCodeInfo.Annotation.prototype.hasEnd = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * repeated Annotation annotation = 1; + * @return {!Array} + */ +proto.google.protobuf.GeneratedCodeInfo.prototype.getAnnotationList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.google.protobuf.GeneratedCodeInfo.Annotation, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.google.protobuf.GeneratedCodeInfo} returns this +*/ +proto.google.protobuf.GeneratedCodeInfo.prototype.setAnnotationList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.google.protobuf.GeneratedCodeInfo.Annotation=} opt_value + * @param {number=} opt_index + * @return {!proto.google.protobuf.GeneratedCodeInfo.Annotation} + */ +proto.google.protobuf.GeneratedCodeInfo.prototype.addAnnotation = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.google.protobuf.GeneratedCodeInfo.Annotation, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.google.protobuf.GeneratedCodeInfo} returns this + */ +proto.google.protobuf.GeneratedCodeInfo.prototype.clearAnnotationList = function() { + return this.setAnnotationList([]); +}; + + +goog.object.extend(exports, proto.google.protobuf); diff --git a/js/proto/google/protobuf/timestamp_grpc_pb.js b/js/proto/google/protobuf/timestamp_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/google/protobuf/timestamp_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/google/protobuf/timestamp_pb.d.ts b/js/proto/google/protobuf/timestamp_pb.d.ts new file mode 100644 index 000000000..e91fcdeec --- /dev/null +++ b/js/proto/google/protobuf/timestamp_pb.d.ts @@ -0,0 +1,32 @@ +// package: google.protobuf +// file: google/protobuf/timestamp.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class Timestamp extends jspb.Message { + getSeconds(): number; + setSeconds(value: number): Timestamp; + + getNanos(): number; + setNanos(value: number): Timestamp; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Timestamp.AsObject; + static toObject(includeInstance: boolean, msg: Timestamp): Timestamp.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Timestamp, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Timestamp; + static deserializeBinaryFromReader(message: Timestamp, reader: jspb.BinaryReader): Timestamp; +} + +export namespace Timestamp { + export type AsObject = { + seconds: number, + nanos: number, + } +} diff --git a/js/proto/google/protobuf/timestamp_pb.js b/js/proto/google/protobuf/timestamp_pb.js new file mode 100644 index 000000000..6881a1d93 --- /dev/null +++ b/js/proto/google/protobuf/timestamp_pb.js @@ -0,0 +1,235 @@ +// source: google/protobuf/timestamp.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.google.protobuf.Timestamp', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.Timestamp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.Timestamp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.Timestamp.displayName = 'proto.google.protobuf.Timestamp'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.Timestamp.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.Timestamp.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.Timestamp} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.Timestamp.toObject = function(includeInstance, msg) { + var f, obj = { + seconds: jspb.Message.getFieldWithDefault(msg, 1, 0), + nanos: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.Timestamp} + */ +proto.google.protobuf.Timestamp.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.Timestamp; + return proto.google.protobuf.Timestamp.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.Timestamp} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.Timestamp} + */ +proto.google.protobuf.Timestamp.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setSeconds(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setNanos(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.Timestamp.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.Timestamp.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.Timestamp} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.Timestamp.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSeconds(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getNanos(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } +}; + + +/** + * optional int64 seconds = 1; + * @return {number} + */ +proto.google.protobuf.Timestamp.prototype.getSeconds = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.Timestamp} returns this + */ +proto.google.protobuf.Timestamp.prototype.setSeconds = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 nanos = 2; + * @return {number} + */ +proto.google.protobuf.Timestamp.prototype.getNanos = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.google.protobuf.Timestamp} returns this + */ +proto.google.protobuf.Timestamp.prototype.setNanos = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +goog.object.extend(exports, proto.google.protobuf); +/* This code will be inserted into generated code for + * google/protobuf/timestamp.proto. */ + +/** + * Returns a JavaScript 'Date' object corresponding to this Timestamp. + * @return {!Date} + */ +proto.google.protobuf.Timestamp.prototype.toDate = function() { + var seconds = this.getSeconds(); + var nanos = this.getNanos(); + + return new Date((seconds * 1000) + (nanos / 1000000)); +}; + + +/** + * Sets the value of this Timestamp object to be the given Date. + * @param {!Date} value The value to set. + */ +proto.google.protobuf.Timestamp.prototype.fromDate = function(value) { + this.setSeconds(Math.floor(value.getTime() / 1000)); + this.setNanos(value.getMilliseconds() * 1000000); +}; + + +/** + * Factory method that returns a Timestamp object with value equal to + * the given Date. + * @param {!Date} value The value to set. + * @return {!proto.google.protobuf.Timestamp} + */ +proto.google.protobuf.Timestamp.fromDate = function(value) { + var timestamp = new proto.google.protobuf.Timestamp(); + timestamp.fromDate(value); + return timestamp; +}; diff --git a/js/proto/keys_grpc_pb.d.ts b/js/proto/keys_grpc_pb.d.ts new file mode 100644 index 000000000..abeb0e1e9 --- /dev/null +++ b/js/proto/keys_grpc_pb.d.ts @@ -0,0 +1,214 @@ +// package: keys +// file: keys.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; +import * as keys_pb from "./keys_pb"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as crypto_pb from "./crypto_pb"; + +interface IKeysService extends grpc.ServiceDefinition { + generateKey: IKeysService_IGenerateKey; + publicKey: IKeysService_IPublicKey; + sign: IKeysService_ISign; + verify: IKeysService_IVerify; + import: IKeysService_IImport; + importJSON: IKeysService_IImportJSON; + export: IKeysService_IExport; + hash: IKeysService_IHash; + removeName: IKeysService_IRemoveName; + list: IKeysService_IList; + addName: IKeysService_IAddName; +} + +interface IKeysService_IGenerateKey extends grpc.MethodDefinition { + path: "/keys.Keys/GenerateKey"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IPublicKey extends grpc.MethodDefinition { + path: "/keys.Keys/PublicKey"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_ISign extends grpc.MethodDefinition { + path: "/keys.Keys/Sign"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IVerify extends grpc.MethodDefinition { + path: "/keys.Keys/Verify"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IImport extends grpc.MethodDefinition { + path: "/keys.Keys/Import"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IImportJSON extends grpc.MethodDefinition { + path: "/keys.Keys/ImportJSON"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IExport extends grpc.MethodDefinition { + path: "/keys.Keys/Export"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IHash extends grpc.MethodDefinition { + path: "/keys.Keys/Hash"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IRemoveName extends grpc.MethodDefinition { + path: "/keys.Keys/RemoveName"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IList extends grpc.MethodDefinition { + path: "/keys.Keys/List"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IKeysService_IAddName extends grpc.MethodDefinition { + path: "/keys.Keys/AddName"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const KeysService: IKeysService; + +export interface IKeysServer extends grpc.UntypedServiceImplementation { + generateKey: grpc.handleUnaryCall; + publicKey: grpc.handleUnaryCall; + sign: grpc.handleUnaryCall; + verify: grpc.handleUnaryCall; + import: grpc.handleUnaryCall; + importJSON: grpc.handleUnaryCall; + export: grpc.handleUnaryCall; + hash: grpc.handleUnaryCall; + removeName: grpc.handleUnaryCall; + list: grpc.handleUnaryCall; + addName: grpc.handleUnaryCall; +} + +export interface IKeysClient { + generateKey(request: keys_pb.GenRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.GenResponse) => void): grpc.ClientUnaryCall; + generateKey(request: keys_pb.GenRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.GenResponse) => void): grpc.ClientUnaryCall; + generateKey(request: keys_pb.GenRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.GenResponse) => void): grpc.ClientUnaryCall; + publicKey(request: keys_pb.PubRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.PubResponse) => void): grpc.ClientUnaryCall; + publicKey(request: keys_pb.PubRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.PubResponse) => void): grpc.ClientUnaryCall; + publicKey(request: keys_pb.PubRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.PubResponse) => void): grpc.ClientUnaryCall; + sign(request: keys_pb.SignRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.SignResponse) => void): grpc.ClientUnaryCall; + sign(request: keys_pb.SignRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.SignResponse) => void): grpc.ClientUnaryCall; + sign(request: keys_pb.SignRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.SignResponse) => void): grpc.ClientUnaryCall; + verify(request: keys_pb.VerifyRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.VerifyResponse) => void): grpc.ClientUnaryCall; + verify(request: keys_pb.VerifyRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.VerifyResponse) => void): grpc.ClientUnaryCall; + verify(request: keys_pb.VerifyRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.VerifyResponse) => void): grpc.ClientUnaryCall; + import(request: keys_pb.ImportRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + import(request: keys_pb.ImportRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + import(request: keys_pb.ImportRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + importJSON(request: keys_pb.ImportJSONRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + importJSON(request: keys_pb.ImportJSONRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + importJSON(request: keys_pb.ImportJSONRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + export(request: keys_pb.ExportRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.ExportResponse) => void): grpc.ClientUnaryCall; + export(request: keys_pb.ExportRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.ExportResponse) => void): grpc.ClientUnaryCall; + export(request: keys_pb.ExportRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.ExportResponse) => void): grpc.ClientUnaryCall; + hash(request: keys_pb.HashRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.HashResponse) => void): grpc.ClientUnaryCall; + hash(request: keys_pb.HashRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.HashResponse) => void): grpc.ClientUnaryCall; + hash(request: keys_pb.HashRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.HashResponse) => void): grpc.ClientUnaryCall; + removeName(request: keys_pb.RemoveNameRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.RemoveNameResponse) => void): grpc.ClientUnaryCall; + removeName(request: keys_pb.RemoveNameRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.RemoveNameResponse) => void): grpc.ClientUnaryCall; + removeName(request: keys_pb.RemoveNameRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.RemoveNameResponse) => void): grpc.ClientUnaryCall; + list(request: keys_pb.ListRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.ListResponse) => void): grpc.ClientUnaryCall; + list(request: keys_pb.ListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.ListResponse) => void): grpc.ClientUnaryCall; + list(request: keys_pb.ListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.ListResponse) => void): grpc.ClientUnaryCall; + addName(request: keys_pb.AddNameRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.AddNameResponse) => void): grpc.ClientUnaryCall; + addName(request: keys_pb.AddNameRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.AddNameResponse) => void): grpc.ClientUnaryCall; + addName(request: keys_pb.AddNameRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.AddNameResponse) => void): grpc.ClientUnaryCall; +} + +export class KeysClient extends grpc.Client implements IKeysClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public generateKey(request: keys_pb.GenRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.GenResponse) => void): grpc.ClientUnaryCall; + public generateKey(request: keys_pb.GenRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.GenResponse) => void): grpc.ClientUnaryCall; + public generateKey(request: keys_pb.GenRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.GenResponse) => void): grpc.ClientUnaryCall; + public publicKey(request: keys_pb.PubRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.PubResponse) => void): grpc.ClientUnaryCall; + public publicKey(request: keys_pb.PubRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.PubResponse) => void): grpc.ClientUnaryCall; + public publicKey(request: keys_pb.PubRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.PubResponse) => void): grpc.ClientUnaryCall; + public sign(request: keys_pb.SignRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.SignResponse) => void): grpc.ClientUnaryCall; + public sign(request: keys_pb.SignRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.SignResponse) => void): grpc.ClientUnaryCall; + public sign(request: keys_pb.SignRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.SignResponse) => void): grpc.ClientUnaryCall; + public verify(request: keys_pb.VerifyRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.VerifyResponse) => void): grpc.ClientUnaryCall; + public verify(request: keys_pb.VerifyRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.VerifyResponse) => void): grpc.ClientUnaryCall; + public verify(request: keys_pb.VerifyRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.VerifyResponse) => void): grpc.ClientUnaryCall; + public import(request: keys_pb.ImportRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + public import(request: keys_pb.ImportRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + public import(request: keys_pb.ImportRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + public importJSON(request: keys_pb.ImportJSONRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + public importJSON(request: keys_pb.ImportJSONRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + public importJSON(request: keys_pb.ImportJSONRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.ImportResponse) => void): grpc.ClientUnaryCall; + public export(request: keys_pb.ExportRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.ExportResponse) => void): grpc.ClientUnaryCall; + public export(request: keys_pb.ExportRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.ExportResponse) => void): grpc.ClientUnaryCall; + public export(request: keys_pb.ExportRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.ExportResponse) => void): grpc.ClientUnaryCall; + public hash(request: keys_pb.HashRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.HashResponse) => void): grpc.ClientUnaryCall; + public hash(request: keys_pb.HashRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.HashResponse) => void): grpc.ClientUnaryCall; + public hash(request: keys_pb.HashRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.HashResponse) => void): grpc.ClientUnaryCall; + public removeName(request: keys_pb.RemoveNameRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.RemoveNameResponse) => void): grpc.ClientUnaryCall; + public removeName(request: keys_pb.RemoveNameRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.RemoveNameResponse) => void): grpc.ClientUnaryCall; + public removeName(request: keys_pb.RemoveNameRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.RemoveNameResponse) => void): grpc.ClientUnaryCall; + public list(request: keys_pb.ListRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.ListResponse) => void): grpc.ClientUnaryCall; + public list(request: keys_pb.ListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.ListResponse) => void): grpc.ClientUnaryCall; + public list(request: keys_pb.ListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.ListResponse) => void): grpc.ClientUnaryCall; + public addName(request: keys_pb.AddNameRequest, callback: (error: grpc.ServiceError | null, response: keys_pb.AddNameResponse) => void): grpc.ClientUnaryCall; + public addName(request: keys_pb.AddNameRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: keys_pb.AddNameResponse) => void): grpc.ClientUnaryCall; + public addName(request: keys_pb.AddNameRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: keys_pb.AddNameResponse) => void): grpc.ClientUnaryCall; +} diff --git a/js/proto/keys_grpc_pb.js b/js/proto/keys_grpc_pb.js new file mode 100644 index 000000000..a263a57d0 --- /dev/null +++ b/js/proto/keys_grpc_pb.js @@ -0,0 +1,363 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var keys_pb = require('./keys_pb.js'); +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +var crypto_pb = require('./crypto_pb.js'); + +function serialize_keys_AddNameRequest(arg) { + if (!(arg instanceof keys_pb.AddNameRequest)) { + throw new Error('Expected argument of type keys.AddNameRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_AddNameRequest(buffer_arg) { + return keys_pb.AddNameRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_AddNameResponse(arg) { + if (!(arg instanceof keys_pb.AddNameResponse)) { + throw new Error('Expected argument of type keys.AddNameResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_AddNameResponse(buffer_arg) { + return keys_pb.AddNameResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_ExportRequest(arg) { + if (!(arg instanceof keys_pb.ExportRequest)) { + throw new Error('Expected argument of type keys.ExportRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_ExportRequest(buffer_arg) { + return keys_pb.ExportRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_ExportResponse(arg) { + if (!(arg instanceof keys_pb.ExportResponse)) { + throw new Error('Expected argument of type keys.ExportResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_ExportResponse(buffer_arg) { + return keys_pb.ExportResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_GenRequest(arg) { + if (!(arg instanceof keys_pb.GenRequest)) { + throw new Error('Expected argument of type keys.GenRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_GenRequest(buffer_arg) { + return keys_pb.GenRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_GenResponse(arg) { + if (!(arg instanceof keys_pb.GenResponse)) { + throw new Error('Expected argument of type keys.GenResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_GenResponse(buffer_arg) { + return keys_pb.GenResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_HashRequest(arg) { + if (!(arg instanceof keys_pb.HashRequest)) { + throw new Error('Expected argument of type keys.HashRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_HashRequest(buffer_arg) { + return keys_pb.HashRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_HashResponse(arg) { + if (!(arg instanceof keys_pb.HashResponse)) { + throw new Error('Expected argument of type keys.HashResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_HashResponse(buffer_arg) { + return keys_pb.HashResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_ImportJSONRequest(arg) { + if (!(arg instanceof keys_pb.ImportJSONRequest)) { + throw new Error('Expected argument of type keys.ImportJSONRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_ImportJSONRequest(buffer_arg) { + return keys_pb.ImportJSONRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_ImportRequest(arg) { + if (!(arg instanceof keys_pb.ImportRequest)) { + throw new Error('Expected argument of type keys.ImportRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_ImportRequest(buffer_arg) { + return keys_pb.ImportRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_ImportResponse(arg) { + if (!(arg instanceof keys_pb.ImportResponse)) { + throw new Error('Expected argument of type keys.ImportResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_ImportResponse(buffer_arg) { + return keys_pb.ImportResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_ListRequest(arg) { + if (!(arg instanceof keys_pb.ListRequest)) { + throw new Error('Expected argument of type keys.ListRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_ListRequest(buffer_arg) { + return keys_pb.ListRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_ListResponse(arg) { + if (!(arg instanceof keys_pb.ListResponse)) { + throw new Error('Expected argument of type keys.ListResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_ListResponse(buffer_arg) { + return keys_pb.ListResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_PubRequest(arg) { + if (!(arg instanceof keys_pb.PubRequest)) { + throw new Error('Expected argument of type keys.PubRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_PubRequest(buffer_arg) { + return keys_pb.PubRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_PubResponse(arg) { + if (!(arg instanceof keys_pb.PubResponse)) { + throw new Error('Expected argument of type keys.PubResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_PubResponse(buffer_arg) { + return keys_pb.PubResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_RemoveNameRequest(arg) { + if (!(arg instanceof keys_pb.RemoveNameRequest)) { + throw new Error('Expected argument of type keys.RemoveNameRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_RemoveNameRequest(buffer_arg) { + return keys_pb.RemoveNameRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_RemoveNameResponse(arg) { + if (!(arg instanceof keys_pb.RemoveNameResponse)) { + throw new Error('Expected argument of type keys.RemoveNameResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_RemoveNameResponse(buffer_arg) { + return keys_pb.RemoveNameResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_SignRequest(arg) { + if (!(arg instanceof keys_pb.SignRequest)) { + throw new Error('Expected argument of type keys.SignRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_SignRequest(buffer_arg) { + return keys_pb.SignRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_SignResponse(arg) { + if (!(arg instanceof keys_pb.SignResponse)) { + throw new Error('Expected argument of type keys.SignResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_SignResponse(buffer_arg) { + return keys_pb.SignResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_VerifyRequest(arg) { + if (!(arg instanceof keys_pb.VerifyRequest)) { + throw new Error('Expected argument of type keys.VerifyRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_VerifyRequest(buffer_arg) { + return keys_pb.VerifyRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_keys_VerifyResponse(arg) { + if (!(arg instanceof keys_pb.VerifyResponse)) { + throw new Error('Expected argument of type keys.VerifyResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_keys_VerifyResponse(buffer_arg) { + return keys_pb.VerifyResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +var KeysService = exports['keys.Keys'] = { + generateKey: { + path: '/keys.Keys/GenerateKey', + requestStream: false, + responseStream: false, + requestType: keys_pb.GenRequest, + responseType: keys_pb.GenResponse, + requestSerialize: serialize_keys_GenRequest, + requestDeserialize: deserialize_keys_GenRequest, + responseSerialize: serialize_keys_GenResponse, + responseDeserialize: deserialize_keys_GenResponse, + }, + publicKey: { + path: '/keys.Keys/PublicKey', + requestStream: false, + responseStream: false, + requestType: keys_pb.PubRequest, + responseType: keys_pb.PubResponse, + requestSerialize: serialize_keys_PubRequest, + requestDeserialize: deserialize_keys_PubRequest, + responseSerialize: serialize_keys_PubResponse, + responseDeserialize: deserialize_keys_PubResponse, + }, + sign: { + path: '/keys.Keys/Sign', + requestStream: false, + responseStream: false, + requestType: keys_pb.SignRequest, + responseType: keys_pb.SignResponse, + requestSerialize: serialize_keys_SignRequest, + requestDeserialize: deserialize_keys_SignRequest, + responseSerialize: serialize_keys_SignResponse, + responseDeserialize: deserialize_keys_SignResponse, + }, + verify: { + path: '/keys.Keys/Verify', + requestStream: false, + responseStream: false, + requestType: keys_pb.VerifyRequest, + responseType: keys_pb.VerifyResponse, + requestSerialize: serialize_keys_VerifyRequest, + requestDeserialize: deserialize_keys_VerifyRequest, + responseSerialize: serialize_keys_VerifyResponse, + responseDeserialize: deserialize_keys_VerifyResponse, + }, + import: { + path: '/keys.Keys/Import', + requestStream: false, + responseStream: false, + requestType: keys_pb.ImportRequest, + responseType: keys_pb.ImportResponse, + requestSerialize: serialize_keys_ImportRequest, + requestDeserialize: deserialize_keys_ImportRequest, + responseSerialize: serialize_keys_ImportResponse, + responseDeserialize: deserialize_keys_ImportResponse, + }, + importJSON: { + path: '/keys.Keys/ImportJSON', + requestStream: false, + responseStream: false, + requestType: keys_pb.ImportJSONRequest, + responseType: keys_pb.ImportResponse, + requestSerialize: serialize_keys_ImportJSONRequest, + requestDeserialize: deserialize_keys_ImportJSONRequest, + responseSerialize: serialize_keys_ImportResponse, + responseDeserialize: deserialize_keys_ImportResponse, + }, + export: { + path: '/keys.Keys/Export', + requestStream: false, + responseStream: false, + requestType: keys_pb.ExportRequest, + responseType: keys_pb.ExportResponse, + requestSerialize: serialize_keys_ExportRequest, + requestDeserialize: deserialize_keys_ExportRequest, + responseSerialize: serialize_keys_ExportResponse, + responseDeserialize: deserialize_keys_ExportResponse, + }, + hash: { + path: '/keys.Keys/Hash', + requestStream: false, + responseStream: false, + requestType: keys_pb.HashRequest, + responseType: keys_pb.HashResponse, + requestSerialize: serialize_keys_HashRequest, + requestDeserialize: deserialize_keys_HashRequest, + responseSerialize: serialize_keys_HashResponse, + responseDeserialize: deserialize_keys_HashResponse, + }, + removeName: { + path: '/keys.Keys/RemoveName', + requestStream: false, + responseStream: false, + requestType: keys_pb.RemoveNameRequest, + responseType: keys_pb.RemoveNameResponse, + requestSerialize: serialize_keys_RemoveNameRequest, + requestDeserialize: deserialize_keys_RemoveNameRequest, + responseSerialize: serialize_keys_RemoveNameResponse, + responseDeserialize: deserialize_keys_RemoveNameResponse, + }, + list: { + path: '/keys.Keys/List', + requestStream: false, + responseStream: false, + requestType: keys_pb.ListRequest, + responseType: keys_pb.ListResponse, + requestSerialize: serialize_keys_ListRequest, + requestDeserialize: deserialize_keys_ListRequest, + responseSerialize: serialize_keys_ListResponse, + responseDeserialize: deserialize_keys_ListResponse, + }, + addName: { + path: '/keys.Keys/AddName', + requestStream: false, + responseStream: false, + requestType: keys_pb.AddNameRequest, + responseType: keys_pb.AddNameResponse, + requestSerialize: serialize_keys_AddNameRequest, + requestDeserialize: deserialize_keys_AddNameRequest, + responseSerialize: serialize_keys_AddNameResponse, + responseDeserialize: deserialize_keys_AddNameResponse, + }, +}; + diff --git a/js/proto/keys_pb.d.ts b/js/proto/keys_pb.d.ts new file mode 100644 index 000000000..93b0635d1 --- /dev/null +++ b/js/proto/keys_pb.d.ts @@ -0,0 +1,571 @@ +// package: keys +// file: keys.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as crypto_pb from "./crypto_pb"; + +export class ListRequest extends jspb.Message { + getKeyname(): string; + setKeyname(value: string): ListRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListRequest.AsObject; + static toObject(includeInstance: boolean, msg: ListRequest): ListRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListRequest; + static deserializeBinaryFromReader(message: ListRequest, reader: jspb.BinaryReader): ListRequest; +} + +export namespace ListRequest { + export type AsObject = { + keyname: string, + } +} + +export class VerifyResponse extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): VerifyResponse.AsObject; + static toObject(includeInstance: boolean, msg: VerifyResponse): VerifyResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: VerifyResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): VerifyResponse; + static deserializeBinaryFromReader(message: VerifyResponse, reader: jspb.BinaryReader): VerifyResponse; +} + +export namespace VerifyResponse { + export type AsObject = { + } +} + +export class RemoveNameResponse extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RemoveNameResponse.AsObject; + static toObject(includeInstance: boolean, msg: RemoveNameResponse): RemoveNameResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RemoveNameResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RemoveNameResponse; + static deserializeBinaryFromReader(message: RemoveNameResponse, reader: jspb.BinaryReader): RemoveNameResponse; +} + +export namespace RemoveNameResponse { + export type AsObject = { + } +} + +export class AddNameResponse extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): AddNameResponse.AsObject; + static toObject(includeInstance: boolean, msg: AddNameResponse): AddNameResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: AddNameResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AddNameResponse; + static deserializeBinaryFromReader(message: AddNameResponse, reader: jspb.BinaryReader): AddNameResponse; +} + +export namespace AddNameResponse { + export type AsObject = { + } +} + +export class RemoveNameRequest extends jspb.Message { + getKeyname(): string; + setKeyname(value: string): RemoveNameRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RemoveNameRequest.AsObject; + static toObject(includeInstance: boolean, msg: RemoveNameRequest): RemoveNameRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RemoveNameRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RemoveNameRequest; + static deserializeBinaryFromReader(message: RemoveNameRequest, reader: jspb.BinaryReader): RemoveNameRequest; +} + +export namespace RemoveNameRequest { + export type AsObject = { + keyname: string, + } +} + +export class GenRequest extends jspb.Message { + getPassphrase(): string; + setPassphrase(value: string): GenRequest; + + getCurvetype(): string; + setCurvetype(value: string): GenRequest; + + getKeyname(): string; + setKeyname(value: string): GenRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GenRequest.AsObject; + static toObject(includeInstance: boolean, msg: GenRequest): GenRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GenRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GenRequest; + static deserializeBinaryFromReader(message: GenRequest, reader: jspb.BinaryReader): GenRequest; +} + +export namespace GenRequest { + export type AsObject = { + passphrase: string, + curvetype: string, + keyname: string, + } +} + +export class GenResponse extends jspb.Message { + getAddress(): string; + setAddress(value: string): GenResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GenResponse.AsObject; + static toObject(includeInstance: boolean, msg: GenResponse): GenResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GenResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GenResponse; + static deserializeBinaryFromReader(message: GenResponse, reader: jspb.BinaryReader): GenResponse; +} + +export namespace GenResponse { + export type AsObject = { + address: string, + } +} + +export class PubRequest extends jspb.Message { + getAddress(): string; + setAddress(value: string): PubRequest; + + getName(): string; + setName(value: string): PubRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PubRequest.AsObject; + static toObject(includeInstance: boolean, msg: PubRequest): PubRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PubRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PubRequest; + static deserializeBinaryFromReader(message: PubRequest, reader: jspb.BinaryReader): PubRequest; +} + +export namespace PubRequest { + export type AsObject = { + address: string, + name: string, + } +} + +export class PubResponse extends jspb.Message { + getPublickey(): Uint8Array | string; + getPublickey_asU8(): Uint8Array; + getPublickey_asB64(): string; + setPublickey(value: Uint8Array | string): PubResponse; + + getCurvetype(): string; + setCurvetype(value: string): PubResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PubResponse.AsObject; + static toObject(includeInstance: boolean, msg: PubResponse): PubResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PubResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PubResponse; + static deserializeBinaryFromReader(message: PubResponse, reader: jspb.BinaryReader): PubResponse; +} + +export namespace PubResponse { + export type AsObject = { + publickey: Uint8Array | string, + curvetype: string, + } +} + +export class ImportJSONRequest extends jspb.Message { + getPassphrase(): string; + setPassphrase(value: string): ImportJSONRequest; + + getJson(): string; + setJson(value: string): ImportJSONRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ImportJSONRequest.AsObject; + static toObject(includeInstance: boolean, msg: ImportJSONRequest): ImportJSONRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ImportJSONRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ImportJSONRequest; + static deserializeBinaryFromReader(message: ImportJSONRequest, reader: jspb.BinaryReader): ImportJSONRequest; +} + +export namespace ImportJSONRequest { + export type AsObject = { + passphrase: string, + json: string, + } +} + +export class ImportResponse extends jspb.Message { + getAddress(): string; + setAddress(value: string): ImportResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ImportResponse.AsObject; + static toObject(includeInstance: boolean, msg: ImportResponse): ImportResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ImportResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ImportResponse; + static deserializeBinaryFromReader(message: ImportResponse, reader: jspb.BinaryReader): ImportResponse; +} + +export namespace ImportResponse { + export type AsObject = { + address: string, + } +} + +export class ImportRequest extends jspb.Message { + getPassphrase(): string; + setPassphrase(value: string): ImportRequest; + + getName(): string; + setName(value: string): ImportRequest; + + getCurvetype(): string; + setCurvetype(value: string): ImportRequest; + + getKeybytes(): Uint8Array | string; + getKeybytes_asU8(): Uint8Array; + getKeybytes_asB64(): string; + setKeybytes(value: Uint8Array | string): ImportRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ImportRequest.AsObject; + static toObject(includeInstance: boolean, msg: ImportRequest): ImportRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ImportRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ImportRequest; + static deserializeBinaryFromReader(message: ImportRequest, reader: jspb.BinaryReader): ImportRequest; +} + +export namespace ImportRequest { + export type AsObject = { + passphrase: string, + name: string, + curvetype: string, + keybytes: Uint8Array | string, + } +} + +export class ExportRequest extends jspb.Message { + getPassphrase(): string; + setPassphrase(value: string): ExportRequest; + + getName(): string; + setName(value: string): ExportRequest; + + getAddress(): string; + setAddress(value: string): ExportRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ExportRequest.AsObject; + static toObject(includeInstance: boolean, msg: ExportRequest): ExportRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ExportRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ExportRequest; + static deserializeBinaryFromReader(message: ExportRequest, reader: jspb.BinaryReader): ExportRequest; +} + +export namespace ExportRequest { + export type AsObject = { + passphrase: string, + name: string, + address: string, + } +} + +export class ExportResponse extends jspb.Message { + getPublickey(): Uint8Array | string; + getPublickey_asU8(): Uint8Array; + getPublickey_asB64(): string; + setPublickey(value: Uint8Array | string): ExportResponse; + + getPrivatekey(): Uint8Array | string; + getPrivatekey_asU8(): Uint8Array; + getPrivatekey_asB64(): string; + setPrivatekey(value: Uint8Array | string): ExportResponse; + + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): ExportResponse; + + getCurvetype(): string; + setCurvetype(value: string): ExportResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ExportResponse.AsObject; + static toObject(includeInstance: boolean, msg: ExportResponse): ExportResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ExportResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ExportResponse; + static deserializeBinaryFromReader(message: ExportResponse, reader: jspb.BinaryReader): ExportResponse; +} + +export namespace ExportResponse { + export type AsObject = { + publickey: Uint8Array | string, + privatekey: Uint8Array | string, + address: Uint8Array | string, + curvetype: string, + } +} + +export class SignRequest extends jspb.Message { + getPassphrase(): string; + setPassphrase(value: string): SignRequest; + + getAddress(): string; + setAddress(value: string): SignRequest; + + getName(): string; + setName(value: string): SignRequest; + + getMessage(): Uint8Array | string; + getMessage_asU8(): Uint8Array; + getMessage_asB64(): string; + setMessage(value: Uint8Array | string): SignRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SignRequest.AsObject; + static toObject(includeInstance: boolean, msg: SignRequest): SignRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SignRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SignRequest; + static deserializeBinaryFromReader(message: SignRequest, reader: jspb.BinaryReader): SignRequest; +} + +export namespace SignRequest { + export type AsObject = { + passphrase: string, + address: string, + name: string, + message: Uint8Array | string, + } +} + +export class SignResponse extends jspb.Message { + + hasSignature(): boolean; + clearSignature(): void; + getSignature(): crypto_pb.Signature | undefined; + setSignature(value?: crypto_pb.Signature): SignResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SignResponse.AsObject; + static toObject(includeInstance: boolean, msg: SignResponse): SignResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SignResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SignResponse; + static deserializeBinaryFromReader(message: SignResponse, reader: jspb.BinaryReader): SignResponse; +} + +export namespace SignResponse { + export type AsObject = { + signature?: crypto_pb.Signature.AsObject, + } +} + +export class VerifyRequest extends jspb.Message { + getPublickey(): Uint8Array | string; + getPublickey_asU8(): Uint8Array; + getPublickey_asB64(): string; + setPublickey(value: Uint8Array | string): VerifyRequest; + + getMessage(): Uint8Array | string; + getMessage_asU8(): Uint8Array; + getMessage_asB64(): string; + setMessage(value: Uint8Array | string): VerifyRequest; + + + hasSignature(): boolean; + clearSignature(): void; + getSignature(): crypto_pb.Signature | undefined; + setSignature(value?: crypto_pb.Signature): VerifyRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): VerifyRequest.AsObject; + static toObject(includeInstance: boolean, msg: VerifyRequest): VerifyRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: VerifyRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): VerifyRequest; + static deserializeBinaryFromReader(message: VerifyRequest, reader: jspb.BinaryReader): VerifyRequest; +} + +export namespace VerifyRequest { + export type AsObject = { + publickey: Uint8Array | string, + message: Uint8Array | string, + signature?: crypto_pb.Signature.AsObject, + } +} + +export class HashRequest extends jspb.Message { + getHashtype(): string; + setHashtype(value: string): HashRequest; + + getMessage(): Uint8Array | string; + getMessage_asU8(): Uint8Array; + getMessage_asB64(): string; + setMessage(value: Uint8Array | string): HashRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): HashRequest.AsObject; + static toObject(includeInstance: boolean, msg: HashRequest): HashRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: HashRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): HashRequest; + static deserializeBinaryFromReader(message: HashRequest, reader: jspb.BinaryReader): HashRequest; +} + +export namespace HashRequest { + export type AsObject = { + hashtype: string, + message: Uint8Array | string, + } +} + +export class HashResponse extends jspb.Message { + getHash(): string; + setHash(value: string): HashResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): HashResponse.AsObject; + static toObject(includeInstance: boolean, msg: HashResponse): HashResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: HashResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): HashResponse; + static deserializeBinaryFromReader(message: HashResponse, reader: jspb.BinaryReader): HashResponse; +} + +export namespace HashResponse { + export type AsObject = { + hash: string, + } +} + +export class KeyID extends jspb.Message { + getAddress(): string; + setAddress(value: string): KeyID; + + clearKeynameList(): void; + getKeynameList(): Array; + setKeynameList(value: Array): KeyID; + addKeyname(value: string, index?: number): string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): KeyID.AsObject; + static toObject(includeInstance: boolean, msg: KeyID): KeyID.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: KeyID, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): KeyID; + static deserializeBinaryFromReader(message: KeyID, reader: jspb.BinaryReader): KeyID; +} + +export namespace KeyID { + export type AsObject = { + address: string, + keynameList: Array, + } +} + +export class ListResponse extends jspb.Message { + clearKeyList(): void; + getKeyList(): Array; + setKeyList(value: Array): ListResponse; + addKey(value?: KeyID, index?: number): KeyID; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListResponse.AsObject; + static toObject(includeInstance: boolean, msg: ListResponse): ListResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListResponse; + static deserializeBinaryFromReader(message: ListResponse, reader: jspb.BinaryReader): ListResponse; +} + +export namespace ListResponse { + export type AsObject = { + keyList: Array, + } +} + +export class AddNameRequest extends jspb.Message { + getKeyname(): string; + setKeyname(value: string): AddNameRequest; + + getAddress(): string; + setAddress(value: string): AddNameRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): AddNameRequest.AsObject; + static toObject(includeInstance: boolean, msg: AddNameRequest): AddNameRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: AddNameRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AddNameRequest; + static deserializeBinaryFromReader(message: AddNameRequest, reader: jspb.BinaryReader): AddNameRequest; +} + +export namespace AddNameRequest { + export type AsObject = { + keyname: string, + address: string, + } +} diff --git a/js/proto/keys_pb.js b/js/proto/keys_pb.js new file mode 100644 index 000000000..aa08580cc --- /dev/null +++ b/js/proto/keys_pb.js @@ -0,0 +1,4222 @@ +// source: keys.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var crypto_pb = require('./crypto_pb.js'); +goog.object.extend(proto, crypto_pb); +goog.exportSymbol('proto.keys.AddNameRequest', null, global); +goog.exportSymbol('proto.keys.AddNameResponse', null, global); +goog.exportSymbol('proto.keys.ExportRequest', null, global); +goog.exportSymbol('proto.keys.ExportResponse', null, global); +goog.exportSymbol('proto.keys.GenRequest', null, global); +goog.exportSymbol('proto.keys.GenResponse', null, global); +goog.exportSymbol('proto.keys.HashRequest', null, global); +goog.exportSymbol('proto.keys.HashResponse', null, global); +goog.exportSymbol('proto.keys.ImportJSONRequest', null, global); +goog.exportSymbol('proto.keys.ImportRequest', null, global); +goog.exportSymbol('proto.keys.ImportResponse', null, global); +goog.exportSymbol('proto.keys.KeyID', null, global); +goog.exportSymbol('proto.keys.ListRequest', null, global); +goog.exportSymbol('proto.keys.ListResponse', null, global); +goog.exportSymbol('proto.keys.PubRequest', null, global); +goog.exportSymbol('proto.keys.PubResponse', null, global); +goog.exportSymbol('proto.keys.RemoveNameRequest', null, global); +goog.exportSymbol('proto.keys.RemoveNameResponse', null, global); +goog.exportSymbol('proto.keys.SignRequest', null, global); +goog.exportSymbol('proto.keys.SignResponse', null, global); +goog.exportSymbol('proto.keys.VerifyRequest', null, global); +goog.exportSymbol('proto.keys.VerifyResponse', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.ListRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.ListRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.ListRequest.displayName = 'proto.keys.ListRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.VerifyResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.VerifyResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.VerifyResponse.displayName = 'proto.keys.VerifyResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.RemoveNameResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.RemoveNameResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.RemoveNameResponse.displayName = 'proto.keys.RemoveNameResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.AddNameResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.AddNameResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.AddNameResponse.displayName = 'proto.keys.AddNameResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.RemoveNameRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.RemoveNameRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.RemoveNameRequest.displayName = 'proto.keys.RemoveNameRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.GenRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.GenRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.GenRequest.displayName = 'proto.keys.GenRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.GenResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.GenResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.GenResponse.displayName = 'proto.keys.GenResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.PubRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.PubRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.PubRequest.displayName = 'proto.keys.PubRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.PubResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.PubResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.PubResponse.displayName = 'proto.keys.PubResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.ImportJSONRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.ImportJSONRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.ImportJSONRequest.displayName = 'proto.keys.ImportJSONRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.ImportResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.ImportResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.ImportResponse.displayName = 'proto.keys.ImportResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.ImportRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.ImportRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.ImportRequest.displayName = 'proto.keys.ImportRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.ExportRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.ExportRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.ExportRequest.displayName = 'proto.keys.ExportRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.ExportResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.ExportResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.ExportResponse.displayName = 'proto.keys.ExportResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.SignRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.SignRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.SignRequest.displayName = 'proto.keys.SignRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.SignResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.SignResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.SignResponse.displayName = 'proto.keys.SignResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.VerifyRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.VerifyRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.VerifyRequest.displayName = 'proto.keys.VerifyRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.HashRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.HashRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.HashRequest.displayName = 'proto.keys.HashRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.HashResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.HashResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.HashResponse.displayName = 'proto.keys.HashResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.KeyID = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.keys.KeyID.repeatedFields_, null); +}; +goog.inherits(proto.keys.KeyID, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.KeyID.displayName = 'proto.keys.KeyID'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.ListResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.keys.ListResponse.repeatedFields_, null); +}; +goog.inherits(proto.keys.ListResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.ListResponse.displayName = 'proto.keys.ListResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.keys.AddNameRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.keys.AddNameRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.keys.AddNameRequest.displayName = 'proto.keys.AddNameRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.ListRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.ListRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.ListRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ListRequest.toObject = function(includeInstance, msg) { + var f, obj = { + keyname: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.ListRequest} + */ +proto.keys.ListRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.ListRequest; + return proto.keys.ListRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.ListRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.ListRequest} + */ +proto.keys.ListRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setKeyname(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.ListRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.ListRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.ListRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ListRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeyname(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string KeyName = 1; + * @return {string} + */ +proto.keys.ListRequest.prototype.getKeyname = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ListRequest} returns this + */ +proto.keys.ListRequest.prototype.setKeyname = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.VerifyResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.VerifyResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.VerifyResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.VerifyResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.VerifyResponse} + */ +proto.keys.VerifyResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.VerifyResponse; + return proto.keys.VerifyResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.VerifyResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.VerifyResponse} + */ +proto.keys.VerifyResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.VerifyResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.VerifyResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.VerifyResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.VerifyResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.RemoveNameResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.RemoveNameResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.RemoveNameResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.RemoveNameResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.RemoveNameResponse} + */ +proto.keys.RemoveNameResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.RemoveNameResponse; + return proto.keys.RemoveNameResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.RemoveNameResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.RemoveNameResponse} + */ +proto.keys.RemoveNameResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.RemoveNameResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.RemoveNameResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.RemoveNameResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.RemoveNameResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.AddNameResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.AddNameResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.AddNameResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.AddNameResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.AddNameResponse} + */ +proto.keys.AddNameResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.AddNameResponse; + return proto.keys.AddNameResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.AddNameResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.AddNameResponse} + */ +proto.keys.AddNameResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.AddNameResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.AddNameResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.AddNameResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.AddNameResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.RemoveNameRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.RemoveNameRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.RemoveNameRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.RemoveNameRequest.toObject = function(includeInstance, msg) { + var f, obj = { + keyname: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.RemoveNameRequest} + */ +proto.keys.RemoveNameRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.RemoveNameRequest; + return proto.keys.RemoveNameRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.RemoveNameRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.RemoveNameRequest} + */ +proto.keys.RemoveNameRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setKeyname(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.RemoveNameRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.RemoveNameRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.RemoveNameRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.RemoveNameRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeyname(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string KeyName = 1; + * @return {string} + */ +proto.keys.RemoveNameRequest.prototype.getKeyname = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.RemoveNameRequest} returns this + */ +proto.keys.RemoveNameRequest.prototype.setKeyname = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.GenRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.GenRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.GenRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.GenRequest.toObject = function(includeInstance, msg) { + var f, obj = { + passphrase: jspb.Message.getFieldWithDefault(msg, 1, ""), + curvetype: jspb.Message.getFieldWithDefault(msg, 2, ""), + keyname: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.GenRequest} + */ +proto.keys.GenRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.GenRequest; + return proto.keys.GenRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.GenRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.GenRequest} + */ +proto.keys.GenRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPassphrase(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setCurvetype(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setKeyname(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.GenRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.GenRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.GenRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.GenRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPassphrase(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getCurvetype(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getKeyname(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string Passphrase = 1; + * @return {string} + */ +proto.keys.GenRequest.prototype.getPassphrase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.GenRequest} returns this + */ +proto.keys.GenRequest.prototype.setPassphrase = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string CurveType = 2; + * @return {string} + */ +proto.keys.GenRequest.prototype.getCurvetype = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.GenRequest} returns this + */ +proto.keys.GenRequest.prototype.setCurvetype = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string KeyName = 3; + * @return {string} + */ +proto.keys.GenRequest.prototype.getKeyname = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.GenRequest} returns this + */ +proto.keys.GenRequest.prototype.setKeyname = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.GenResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.GenResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.GenResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.GenResponse.toObject = function(includeInstance, msg) { + var f, obj = { + address: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.GenResponse} + */ +proto.keys.GenResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.GenResponse; + return proto.keys.GenResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.GenResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.GenResponse} + */ +proto.keys.GenResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.GenResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.GenResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.GenResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.GenResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string Address = 1; + * @return {string} + */ +proto.keys.GenResponse.prototype.getAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.GenResponse} returns this + */ +proto.keys.GenResponse.prototype.setAddress = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.PubRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.PubRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.PubRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.PubRequest.toObject = function(includeInstance, msg) { + var f, obj = { + address: jspb.Message.getFieldWithDefault(msg, 1, ""), + name: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.PubRequest} + */ +proto.keys.PubRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.PubRequest; + return proto.keys.PubRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.PubRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.PubRequest} + */ +proto.keys.PubRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.PubRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.PubRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.PubRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.PubRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string Address = 1; + * @return {string} + */ +proto.keys.PubRequest.prototype.getAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.PubRequest} returns this + */ +proto.keys.PubRequest.prototype.setAddress = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string Name = 2; + * @return {string} + */ +proto.keys.PubRequest.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.PubRequest} returns this + */ +proto.keys.PubRequest.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.PubResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.PubResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.PubResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.PubResponse.toObject = function(includeInstance, msg) { + var f, obj = { + publickey: msg.getPublickey_asB64(), + curvetype: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.PubResponse} + */ +proto.keys.PubResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.PubResponse; + return proto.keys.PubResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.PubResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.PubResponse} + */ +proto.keys.PubResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPublickey(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setCurvetype(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.PubResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.PubResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.PubResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.PubResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPublickey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getCurvetype(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional bytes PublicKey = 1; + * @return {!(string|Uint8Array)} + */ +proto.keys.PubResponse.prototype.getPublickey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes PublicKey = 1; + * This is a type-conversion wrapper around `getPublickey()` + * @return {string} + */ +proto.keys.PubResponse.prototype.getPublickey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublickey())); +}; + + +/** + * optional bytes PublicKey = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPublickey()` + * @return {!Uint8Array} + */ +proto.keys.PubResponse.prototype.getPublickey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublickey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.PubResponse} returns this + */ +proto.keys.PubResponse.prototype.setPublickey = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string CurveType = 2; + * @return {string} + */ +proto.keys.PubResponse.prototype.getCurvetype = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.PubResponse} returns this + */ +proto.keys.PubResponse.prototype.setCurvetype = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.ImportJSONRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.ImportJSONRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.ImportJSONRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ImportJSONRequest.toObject = function(includeInstance, msg) { + var f, obj = { + passphrase: jspb.Message.getFieldWithDefault(msg, 1, ""), + json: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.ImportJSONRequest} + */ +proto.keys.ImportJSONRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.ImportJSONRequest; + return proto.keys.ImportJSONRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.ImportJSONRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.ImportJSONRequest} + */ +proto.keys.ImportJSONRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPassphrase(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setJson(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.ImportJSONRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.ImportJSONRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.ImportJSONRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ImportJSONRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPassphrase(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getJson(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string Passphrase = 1; + * @return {string} + */ +proto.keys.ImportJSONRequest.prototype.getPassphrase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ImportJSONRequest} returns this + */ +proto.keys.ImportJSONRequest.prototype.setPassphrase = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string JSON = 2; + * @return {string} + */ +proto.keys.ImportJSONRequest.prototype.getJson = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ImportJSONRequest} returns this + */ +proto.keys.ImportJSONRequest.prototype.setJson = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.ImportResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.ImportResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.ImportResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ImportResponse.toObject = function(includeInstance, msg) { + var f, obj = { + address: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.ImportResponse} + */ +proto.keys.ImportResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.ImportResponse; + return proto.keys.ImportResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.ImportResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.ImportResponse} + */ +proto.keys.ImportResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.ImportResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.ImportResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.ImportResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ImportResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string Address = 1; + * @return {string} + */ +proto.keys.ImportResponse.prototype.getAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ImportResponse} returns this + */ +proto.keys.ImportResponse.prototype.setAddress = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.ImportRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.ImportRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.ImportRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ImportRequest.toObject = function(includeInstance, msg) { + var f, obj = { + passphrase: jspb.Message.getFieldWithDefault(msg, 1, ""), + name: jspb.Message.getFieldWithDefault(msg, 2, ""), + curvetype: jspb.Message.getFieldWithDefault(msg, 3, ""), + keybytes: msg.getKeybytes_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.ImportRequest} + */ +proto.keys.ImportRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.ImportRequest; + return proto.keys.ImportRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.ImportRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.ImportRequest} + */ +proto.keys.ImportRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPassphrase(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setCurvetype(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setKeybytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.ImportRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.ImportRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.ImportRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ImportRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPassphrase(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getCurvetype(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getKeybytes_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional string Passphrase = 1; + * @return {string} + */ +proto.keys.ImportRequest.prototype.getPassphrase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ImportRequest} returns this + */ +proto.keys.ImportRequest.prototype.setPassphrase = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string Name = 2; + * @return {string} + */ +proto.keys.ImportRequest.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ImportRequest} returns this + */ +proto.keys.ImportRequest.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string CurveType = 3; + * @return {string} + */ +proto.keys.ImportRequest.prototype.getCurvetype = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ImportRequest} returns this + */ +proto.keys.ImportRequest.prototype.setCurvetype = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional bytes KeyBytes = 4; + * @return {!(string|Uint8Array)} + */ +proto.keys.ImportRequest.prototype.getKeybytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes KeyBytes = 4; + * This is a type-conversion wrapper around `getKeybytes()` + * @return {string} + */ +proto.keys.ImportRequest.prototype.getKeybytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getKeybytes())); +}; + + +/** + * optional bytes KeyBytes = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeybytes()` + * @return {!Uint8Array} + */ +proto.keys.ImportRequest.prototype.getKeybytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getKeybytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.ImportRequest} returns this + */ +proto.keys.ImportRequest.prototype.setKeybytes = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.ExportRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.ExportRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.ExportRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ExportRequest.toObject = function(includeInstance, msg) { + var f, obj = { + passphrase: jspb.Message.getFieldWithDefault(msg, 1, ""), + name: jspb.Message.getFieldWithDefault(msg, 2, ""), + address: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.ExportRequest} + */ +proto.keys.ExportRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.ExportRequest; + return proto.keys.ExportRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.ExportRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.ExportRequest} + */ +proto.keys.ExportRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPassphrase(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.ExportRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.ExportRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.ExportRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ExportRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPassphrase(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getAddress(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string Passphrase = 1; + * @return {string} + */ +proto.keys.ExportRequest.prototype.getPassphrase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ExportRequest} returns this + */ +proto.keys.ExportRequest.prototype.setPassphrase = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string Name = 2; + * @return {string} + */ +proto.keys.ExportRequest.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ExportRequest} returns this + */ +proto.keys.ExportRequest.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string Address = 3; + * @return {string} + */ +proto.keys.ExportRequest.prototype.getAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ExportRequest} returns this + */ +proto.keys.ExportRequest.prototype.setAddress = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.ExportResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.ExportResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.ExportResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ExportResponse.toObject = function(includeInstance, msg) { + var f, obj = { + publickey: msg.getPublickey_asB64(), + privatekey: msg.getPrivatekey_asB64(), + address: msg.getAddress_asB64(), + curvetype: jspb.Message.getFieldWithDefault(msg, 4, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.ExportResponse} + */ +proto.keys.ExportResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.ExportResponse; + return proto.keys.ExportResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.ExportResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.ExportResponse} + */ +proto.keys.ExportResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPublickey(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPrivatekey(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setCurvetype(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.ExportResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.ExportResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.ExportResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ExportResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPublickey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPrivatekey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getCurvetype(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * optional bytes Publickey = 1; + * @return {!(string|Uint8Array)} + */ +proto.keys.ExportResponse.prototype.getPublickey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Publickey = 1; + * This is a type-conversion wrapper around `getPublickey()` + * @return {string} + */ +proto.keys.ExportResponse.prototype.getPublickey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublickey())); +}; + + +/** + * optional bytes Publickey = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPublickey()` + * @return {!Uint8Array} + */ +proto.keys.ExportResponse.prototype.getPublickey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublickey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.ExportResponse} returns this + */ +proto.keys.ExportResponse.prototype.setPublickey = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes Privatekey = 2; + * @return {!(string|Uint8Array)} + */ +proto.keys.ExportResponse.prototype.getPrivatekey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Privatekey = 2; + * This is a type-conversion wrapper around `getPrivatekey()` + * @return {string} + */ +proto.keys.ExportResponse.prototype.getPrivatekey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPrivatekey())); +}; + + +/** + * optional bytes Privatekey = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPrivatekey()` + * @return {!Uint8Array} + */ +proto.keys.ExportResponse.prototype.getPrivatekey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPrivatekey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.ExportResponse} returns this + */ +proto.keys.ExportResponse.prototype.setPrivatekey = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes Address = 3; + * @return {!(string|Uint8Array)} + */ +proto.keys.ExportResponse.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes Address = 3; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.keys.ExportResponse.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.keys.ExportResponse.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.ExportResponse} returns this + */ +proto.keys.ExportResponse.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional string CurveType = 4; + * @return {string} + */ +proto.keys.ExportResponse.prototype.getCurvetype = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.ExportResponse} returns this + */ +proto.keys.ExportResponse.prototype.setCurvetype = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.SignRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.SignRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.SignRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.SignRequest.toObject = function(includeInstance, msg) { + var f, obj = { + passphrase: jspb.Message.getFieldWithDefault(msg, 1, ""), + address: jspb.Message.getFieldWithDefault(msg, 2, ""), + name: jspb.Message.getFieldWithDefault(msg, 3, ""), + message: msg.getMessage_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.SignRequest} + */ +proto.keys.SignRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.SignRequest; + return proto.keys.SignRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.SignRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.SignRequest} + */ +proto.keys.SignRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPassphrase(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setAddress(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.SignRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.SignRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.SignRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.SignRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPassphrase(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getAddress(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getMessage_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional string Passphrase = 1; + * @return {string} + */ +proto.keys.SignRequest.prototype.getPassphrase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.SignRequest} returns this + */ +proto.keys.SignRequest.prototype.setPassphrase = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string Address = 2; + * @return {string} + */ +proto.keys.SignRequest.prototype.getAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.SignRequest} returns this + */ +proto.keys.SignRequest.prototype.setAddress = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string Name = 3; + * @return {string} + */ +proto.keys.SignRequest.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.SignRequest} returns this + */ +proto.keys.SignRequest.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional bytes Message = 4; + * @return {!(string|Uint8Array)} + */ +proto.keys.SignRequest.prototype.getMessage = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes Message = 4; + * This is a type-conversion wrapper around `getMessage()` + * @return {string} + */ +proto.keys.SignRequest.prototype.getMessage_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMessage())); +}; + + +/** + * optional bytes Message = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMessage()` + * @return {!Uint8Array} + */ +proto.keys.SignRequest.prototype.getMessage_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMessage())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.SignRequest} returns this + */ +proto.keys.SignRequest.prototype.setMessage = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.SignResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.SignResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.SignResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.SignResponse.toObject = function(includeInstance, msg) { + var f, obj = { + signature: (f = msg.getSignature()) && crypto_pb.Signature.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.SignResponse} + */ +proto.keys.SignResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.SignResponse; + return proto.keys.SignResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.SignResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.SignResponse} + */ +proto.keys.SignResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 3: + var value = new crypto_pb.Signature; + reader.readMessage(value,crypto_pb.Signature.deserializeBinaryFromReader); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.SignResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.SignResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.SignResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.SignResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSignature(); + if (f != null) { + writer.writeMessage( + 3, + f, + crypto_pb.Signature.serializeBinaryToWriter + ); + } +}; + + +/** + * optional crypto.Signature Signature = 3; + * @return {?proto.crypto.Signature} + */ +proto.keys.SignResponse.prototype.getSignature = function() { + return /** @type{?proto.crypto.Signature} */ ( + jspb.Message.getWrapperField(this, crypto_pb.Signature, 3)); +}; + + +/** + * @param {?proto.crypto.Signature|undefined} value + * @return {!proto.keys.SignResponse} returns this +*/ +proto.keys.SignResponse.prototype.setSignature = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.keys.SignResponse} returns this + */ +proto.keys.SignResponse.prototype.clearSignature = function() { + return this.setSignature(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.keys.SignResponse.prototype.hasSignature = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.VerifyRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.VerifyRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.VerifyRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.VerifyRequest.toObject = function(includeInstance, msg) { + var f, obj = { + publickey: msg.getPublickey_asB64(), + message: msg.getMessage_asB64(), + signature: (f = msg.getSignature()) && crypto_pb.Signature.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.VerifyRequest} + */ +proto.keys.VerifyRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.VerifyRequest; + return proto.keys.VerifyRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.VerifyRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.VerifyRequest} + */ +proto.keys.VerifyRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPublickey(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMessage(value); + break; + case 5: + var value = new crypto_pb.Signature; + reader.readMessage(value,crypto_pb.Signature.deserializeBinaryFromReader); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.VerifyRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.VerifyRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.VerifyRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.VerifyRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPublickey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getMessage_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getSignature(); + if (f != null) { + writer.writeMessage( + 5, + f, + crypto_pb.Signature.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes PublicKey = 2; + * @return {!(string|Uint8Array)} + */ +proto.keys.VerifyRequest.prototype.getPublickey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes PublicKey = 2; + * This is a type-conversion wrapper around `getPublickey()` + * @return {string} + */ +proto.keys.VerifyRequest.prototype.getPublickey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPublickey())); +}; + + +/** + * optional bytes PublicKey = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPublickey()` + * @return {!Uint8Array} + */ +proto.keys.VerifyRequest.prototype.getPublickey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPublickey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.VerifyRequest} returns this + */ +proto.keys.VerifyRequest.prototype.setPublickey = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes Message = 3; + * @return {!(string|Uint8Array)} + */ +proto.keys.VerifyRequest.prototype.getMessage = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes Message = 3; + * This is a type-conversion wrapper around `getMessage()` + * @return {string} + */ +proto.keys.VerifyRequest.prototype.getMessage_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMessage())); +}; + + +/** + * optional bytes Message = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMessage()` + * @return {!Uint8Array} + */ +proto.keys.VerifyRequest.prototype.getMessage_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMessage())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.VerifyRequest} returns this + */ +proto.keys.VerifyRequest.prototype.setMessage = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional crypto.Signature Signature = 5; + * @return {?proto.crypto.Signature} + */ +proto.keys.VerifyRequest.prototype.getSignature = function() { + return /** @type{?proto.crypto.Signature} */ ( + jspb.Message.getWrapperField(this, crypto_pb.Signature, 5)); +}; + + +/** + * @param {?proto.crypto.Signature|undefined} value + * @return {!proto.keys.VerifyRequest} returns this +*/ +proto.keys.VerifyRequest.prototype.setSignature = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.keys.VerifyRequest} returns this + */ +proto.keys.VerifyRequest.prototype.clearSignature = function() { + return this.setSignature(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.keys.VerifyRequest.prototype.hasSignature = function() { + return jspb.Message.getField(this, 5) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.HashRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.HashRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.HashRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.HashRequest.toObject = function(includeInstance, msg) { + var f, obj = { + hashtype: jspb.Message.getFieldWithDefault(msg, 1, ""), + message: msg.getMessage_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.HashRequest} + */ +proto.keys.HashRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.HashRequest; + return proto.keys.HashRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.HashRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.HashRequest} + */ +proto.keys.HashRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setHashtype(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.HashRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.HashRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.HashRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.HashRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHashtype(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getMessage_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional string Hashtype = 1; + * @return {string} + */ +proto.keys.HashRequest.prototype.getHashtype = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.HashRequest} returns this + */ +proto.keys.HashRequest.prototype.setHashtype = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bytes Message = 2; + * @return {!(string|Uint8Array)} + */ +proto.keys.HashRequest.prototype.getMessage = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Message = 2; + * This is a type-conversion wrapper around `getMessage()` + * @return {string} + */ +proto.keys.HashRequest.prototype.getMessage_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMessage())); +}; + + +/** + * optional bytes Message = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMessage()` + * @return {!Uint8Array} + */ +proto.keys.HashRequest.prototype.getMessage_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMessage())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.keys.HashRequest} returns this + */ +proto.keys.HashRequest.prototype.setMessage = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.HashResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.HashResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.HashResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.HashResponse.toObject = function(includeInstance, msg) { + var f, obj = { + hash: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.HashResponse} + */ +proto.keys.HashResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.HashResponse; + return proto.keys.HashResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.HashResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.HashResponse} + */ +proto.keys.HashResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.HashResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.HashResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.HashResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.HashResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHash(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string Hash = 1; + * @return {string} + */ +proto.keys.HashResponse.prototype.getHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.HashResponse} returns this + */ +proto.keys.HashResponse.prototype.setHash = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.keys.KeyID.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.KeyID.prototype.toObject = function(opt_includeInstance) { + return proto.keys.KeyID.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.KeyID} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.KeyID.toObject = function(includeInstance, msg) { + var f, obj = { + address: jspb.Message.getFieldWithDefault(msg, 1, ""), + keynameList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.KeyID} + */ +proto.keys.KeyID.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.KeyID; + return proto.keys.KeyID.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.KeyID} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.KeyID} + */ +proto.keys.KeyID.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addKeyname(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.KeyID.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.KeyID.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.KeyID} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.KeyID.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getKeynameList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } +}; + + +/** + * optional string Address = 1; + * @return {string} + */ +proto.keys.KeyID.prototype.getAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.KeyID} returns this + */ +proto.keys.KeyID.prototype.setAddress = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * repeated string KeyName = 2; + * @return {!Array} + */ +proto.keys.KeyID.prototype.getKeynameList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.keys.KeyID} returns this + */ +proto.keys.KeyID.prototype.setKeynameList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.keys.KeyID} returns this + */ +proto.keys.KeyID.prototype.addKeyname = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.keys.KeyID} returns this + */ +proto.keys.KeyID.prototype.clearKeynameList = function() { + return this.setKeynameList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.keys.ListResponse.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.ListResponse.prototype.toObject = function(opt_includeInstance) { + return proto.keys.ListResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.ListResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ListResponse.toObject = function(includeInstance, msg) { + var f, obj = { + keyList: jspb.Message.toObjectList(msg.getKeyList(), + proto.keys.KeyID.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.ListResponse} + */ +proto.keys.ListResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.ListResponse; + return proto.keys.ListResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.ListResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.ListResponse} + */ +proto.keys.ListResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.keys.KeyID; + reader.readMessage(value,proto.keys.KeyID.deserializeBinaryFromReader); + msg.addKey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.ListResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.ListResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.ListResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.ListResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeyList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.keys.KeyID.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated KeyID key = 1; + * @return {!Array} + */ +proto.keys.ListResponse.prototype.getKeyList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.keys.KeyID, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.keys.ListResponse} returns this +*/ +proto.keys.ListResponse.prototype.setKeyList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.keys.KeyID=} opt_value + * @param {number=} opt_index + * @return {!proto.keys.KeyID} + */ +proto.keys.ListResponse.prototype.addKey = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.keys.KeyID, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.keys.ListResponse} returns this + */ +proto.keys.ListResponse.prototype.clearKeyList = function() { + return this.setKeyList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.keys.AddNameRequest.prototype.toObject = function(opt_includeInstance) { + return proto.keys.AddNameRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.keys.AddNameRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.AddNameRequest.toObject = function(includeInstance, msg) { + var f, obj = { + keyname: jspb.Message.getFieldWithDefault(msg, 1, ""), + address: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.keys.AddNameRequest} + */ +proto.keys.AddNameRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.keys.AddNameRequest; + return proto.keys.AddNameRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.keys.AddNameRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.keys.AddNameRequest} + */ +proto.keys.AddNameRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setKeyname(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.keys.AddNameRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.keys.AddNameRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.keys.AddNameRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.keys.AddNameRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKeyname(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getAddress(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string Keyname = 1; + * @return {string} + */ +proto.keys.AddNameRequest.prototype.getKeyname = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.AddNameRequest} returns this + */ +proto.keys.AddNameRequest.prototype.setKeyname = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string Address = 2; + * @return {string} + */ +proto.keys.AddNameRequest.prototype.getAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.keys.AddNameRequest} returns this + */ +proto.keys.AddNameRequest.prototype.setAddress = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +goog.object.extend(exports, proto.keys); diff --git a/js/proto/names_grpc_pb.js b/js/proto/names_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/names_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/names_pb.d.ts b/js/proto/names_pb.d.ts new file mode 100644 index 000000000..b9a40b41a --- /dev/null +++ b/js/proto/names_pb.d.ts @@ -0,0 +1,43 @@ +// package: names +// file: names.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class Entry extends jspb.Message { + getName(): string; + setName(value: string): Entry; + + getOwner(): Uint8Array | string; + getOwner_asU8(): Uint8Array; + getOwner_asB64(): string; + setOwner(value: Uint8Array | string): Entry; + + getData(): string; + setData(value: string): Entry; + + getExpires(): number; + setExpires(value: number): Entry; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Entry.AsObject; + static toObject(includeInstance: boolean, msg: Entry): Entry.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Entry, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Entry; + static deserializeBinaryFromReader(message: Entry, reader: jspb.BinaryReader): Entry; +} + +export namespace Entry { + export type AsObject = { + name: string, + owner: Uint8Array | string, + data: string, + expires: number, + } +} diff --git a/js/proto/names_pb.js b/js/proto/names_pb.js new file mode 100644 index 000000000..b034421dc --- /dev/null +++ b/js/proto/names_pb.js @@ -0,0 +1,285 @@ +// source: names.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.names.Entry', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.names.Entry = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.names.Entry, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.names.Entry.displayName = 'proto.names.Entry'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.names.Entry.prototype.toObject = function(opt_includeInstance) { + return proto.names.Entry.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.names.Entry} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.names.Entry.toObject = function(includeInstance, msg) { + var f, obj = { + name: jspb.Message.getFieldWithDefault(msg, 1, ""), + owner: msg.getOwner_asB64(), + data: jspb.Message.getFieldWithDefault(msg, 3, ""), + expires: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.names.Entry} + */ +proto.names.Entry.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.names.Entry; + return proto.names.Entry.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.names.Entry} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.names.Entry} + */ +proto.names.Entry.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOwner(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setData(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setExpires(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.names.Entry.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.names.Entry.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.names.Entry} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.names.Entry.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getOwner_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getData(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getExpires(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } +}; + + +/** + * optional string Name = 1; + * @return {string} + */ +proto.names.Entry.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.names.Entry} returns this + */ +proto.names.Entry.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bytes Owner = 2; + * @return {!(string|Uint8Array)} + */ +proto.names.Entry.prototype.getOwner = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Owner = 2; + * This is a type-conversion wrapper around `getOwner()` + * @return {string} + */ +proto.names.Entry.prototype.getOwner_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOwner())); +}; + + +/** + * optional bytes Owner = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOwner()` + * @return {!Uint8Array} + */ +proto.names.Entry.prototype.getOwner_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOwner())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.names.Entry} returns this + */ +proto.names.Entry.prototype.setOwner = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional string Data = 3; + * @return {string} + */ +proto.names.Entry.prototype.getData = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.names.Entry} returns this + */ +proto.names.Entry.prototype.setData = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional uint64 Expires = 4; + * @return {number} + */ +proto.names.Entry.prototype.getExpires = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.names.Entry} returns this + */ +proto.names.Entry.prototype.setExpires = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +goog.object.extend(exports, proto.names); diff --git a/js/proto/payload_grpc_pb.js b/js/proto/payload_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/payload_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/payload_pb.d.ts b/js/proto/payload_pb.d.ts new file mode 100644 index 000000000..bec6b2546 --- /dev/null +++ b/js/proto/payload_pb.d.ts @@ -0,0 +1,629 @@ +// package: payload +// file: payload.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as permission_pb from "./permission_pb"; +import * as registry_pb from "./registry_pb"; +import * as spec_pb from "./spec_pb"; + +export class Any extends jspb.Message { + + hasCalltx(): boolean; + clearCalltx(): void; + getCalltx(): CallTx | undefined; + setCalltx(value?: CallTx): Any; + + + hasSendtx(): boolean; + clearSendtx(): void; + getSendtx(): SendTx | undefined; + setSendtx(value?: SendTx): Any; + + + hasNametx(): boolean; + clearNametx(): void; + getNametx(): NameTx | undefined; + setNametx(value?: NameTx): Any; + + + hasPermstx(): boolean; + clearPermstx(): void; + getPermstx(): PermsTx | undefined; + setPermstx(value?: PermsTx): Any; + + + hasGovtx(): boolean; + clearGovtx(): void; + getGovtx(): GovTx | undefined; + setGovtx(value?: GovTx): Any; + + + hasBondtx(): boolean; + clearBondtx(): void; + getBondtx(): BondTx | undefined; + setBondtx(value?: BondTx): Any; + + + hasUnbondtx(): boolean; + clearUnbondtx(): void; + getUnbondtx(): UnbondTx | undefined; + setUnbondtx(value?: UnbondTx): Any; + + + hasBatchtx(): boolean; + clearBatchtx(): void; + getBatchtx(): BatchTx | undefined; + setBatchtx(value?: BatchTx): Any; + + + hasProposaltx(): boolean; + clearProposaltx(): void; + getProposaltx(): ProposalTx | undefined; + setProposaltx(value?: ProposalTx): Any; + + + hasIdentifytx(): boolean; + clearIdentifytx(): void; + getIdentifytx(): IdentifyTx | undefined; + setIdentifytx(value?: IdentifyTx): Any; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Any.AsObject; + static toObject(includeInstance: boolean, msg: Any): Any.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Any, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Any; + static deserializeBinaryFromReader(message: Any, reader: jspb.BinaryReader): Any; +} + +export namespace Any { + export type AsObject = { + calltx?: CallTx.AsObject, + sendtx?: SendTx.AsObject, + nametx?: NameTx.AsObject, + permstx?: PermsTx.AsObject, + govtx?: GovTx.AsObject, + bondtx?: BondTx.AsObject, + unbondtx?: UnbondTx.AsObject, + batchtx?: BatchTx.AsObject, + proposaltx?: ProposalTx.AsObject, + identifytx?: IdentifyTx.AsObject, + } +} + +export class TxInput extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): TxInput; + + getAmount(): number; + setAmount(value: number): TxInput; + + getSequence(): number; + setSequence(value: number): TxInput; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxInput.AsObject; + static toObject(includeInstance: boolean, msg: TxInput): TxInput.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxInput, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxInput; + static deserializeBinaryFromReader(message: TxInput, reader: jspb.BinaryReader): TxInput; +} + +export namespace TxInput { + export type AsObject = { + address: Uint8Array | string, + amount: number, + sequence: number, + } +} + +export class TxOutput extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): TxOutput; + + getAmount(): number; + setAmount(value: number): TxOutput; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxOutput.AsObject; + static toObject(includeInstance: boolean, msg: TxOutput): TxOutput.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxOutput, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxOutput; + static deserializeBinaryFromReader(message: TxOutput, reader: jspb.BinaryReader): TxOutput; +} + +export namespace TxOutput { + export type AsObject = { + address: Uint8Array | string, + amount: number, + } +} + +export class CallTx extends jspb.Message { + + hasInput(): boolean; + clearInput(): void; + getInput(): TxInput | undefined; + setInput(value?: TxInput): CallTx; + + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): CallTx; + + getGaslimit(): number; + setGaslimit(value: number): CallTx; + + getFee(): number; + setFee(value: number): CallTx; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): CallTx; + + getWasm(): Uint8Array | string; + getWasm_asU8(): Uint8Array; + getWasm_asB64(): string; + setWasm(value: Uint8Array | string): CallTx; + + clearContractmetaList(): void; + getContractmetaList(): Array; + setContractmetaList(value: Array): CallTx; + addContractmeta(value?: ContractMeta, index?: number): ContractMeta; + + getGasprice(): number; + setGasprice(value: number): CallTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CallTx.AsObject; + static toObject(includeInstance: boolean, msg: CallTx): CallTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CallTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CallTx; + static deserializeBinaryFromReader(message: CallTx, reader: jspb.BinaryReader): CallTx; +} + +export namespace CallTx { + export type AsObject = { + input?: TxInput.AsObject, + address: Uint8Array | string, + gaslimit: number, + fee: number, + data: Uint8Array | string, + wasm: Uint8Array | string, + contractmetaList: Array, + gasprice: number, + } +} + +export class ContractMeta extends jspb.Message { + getCodehash(): Uint8Array | string; + getCodehash_asU8(): Uint8Array; + getCodehash_asB64(): string; + setCodehash(value: Uint8Array | string): ContractMeta; + + getMeta(): string; + setMeta(value: string): ContractMeta; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ContractMeta.AsObject; + static toObject(includeInstance: boolean, msg: ContractMeta): ContractMeta.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ContractMeta, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ContractMeta; + static deserializeBinaryFromReader(message: ContractMeta, reader: jspb.BinaryReader): ContractMeta; +} + +export namespace ContractMeta { + export type AsObject = { + codehash: Uint8Array | string, + meta: string, + } +} + +export class SendTx extends jspb.Message { + clearInputsList(): void; + getInputsList(): Array; + setInputsList(value: Array): SendTx; + addInputs(value?: TxInput, index?: number): TxInput; + + clearOutputsList(): void; + getOutputsList(): Array; + setOutputsList(value: Array): SendTx; + addOutputs(value?: TxOutput, index?: number): TxOutput; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SendTx.AsObject; + static toObject(includeInstance: boolean, msg: SendTx): SendTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SendTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SendTx; + static deserializeBinaryFromReader(message: SendTx, reader: jspb.BinaryReader): SendTx; +} + +export namespace SendTx { + export type AsObject = { + inputsList: Array, + outputsList: Array, + } +} + +export class PermsTx extends jspb.Message { + + hasInput(): boolean; + clearInput(): void; + getInput(): TxInput | undefined; + setInput(value?: TxInput): PermsTx; + + + hasPermargs(): boolean; + clearPermargs(): void; + getPermargs(): permission_pb.PermArgs | undefined; + setPermargs(value?: permission_pb.PermArgs): PermsTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PermsTx.AsObject; + static toObject(includeInstance: boolean, msg: PermsTx): PermsTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PermsTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PermsTx; + static deserializeBinaryFromReader(message: PermsTx, reader: jspb.BinaryReader): PermsTx; +} + +export namespace PermsTx { + export type AsObject = { + input?: TxInput.AsObject, + permargs?: permission_pb.PermArgs.AsObject, + } +} + +export class NameTx extends jspb.Message { + + hasInput(): boolean; + clearInput(): void; + getInput(): TxInput | undefined; + setInput(value?: TxInput): NameTx; + + getName(): string; + setName(value: string): NameTx; + + getData(): string; + setData(value: string): NameTx; + + getFee(): number; + setFee(value: number): NameTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NameTx.AsObject; + static toObject(includeInstance: boolean, msg: NameTx): NameTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NameTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NameTx; + static deserializeBinaryFromReader(message: NameTx, reader: jspb.BinaryReader): NameTx; +} + +export namespace NameTx { + export type AsObject = { + input?: TxInput.AsObject, + name: string, + data: string, + fee: number, + } +} + +export class BondTx extends jspb.Message { + + hasInput(): boolean; + clearInput(): void; + getInput(): TxInput | undefined; + setInput(value?: TxInput): BondTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BondTx.AsObject; + static toObject(includeInstance: boolean, msg: BondTx): BondTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BondTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BondTx; + static deserializeBinaryFromReader(message: BondTx, reader: jspb.BinaryReader): BondTx; +} + +export namespace BondTx { + export type AsObject = { + input?: TxInput.AsObject, + } +} + +export class UnbondTx extends jspb.Message { + + hasInput(): boolean; + clearInput(): void; + getInput(): TxInput | undefined; + setInput(value?: TxInput): UnbondTx; + + + hasOutput(): boolean; + clearOutput(): void; + getOutput(): TxOutput | undefined; + setOutput(value?: TxOutput): UnbondTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UnbondTx.AsObject; + static toObject(includeInstance: boolean, msg: UnbondTx): UnbondTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UnbondTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UnbondTx; + static deserializeBinaryFromReader(message: UnbondTx, reader: jspb.BinaryReader): UnbondTx; +} + +export namespace UnbondTx { + export type AsObject = { + input?: TxInput.AsObject, + output?: TxOutput.AsObject, + } +} + +export class GovTx extends jspb.Message { + clearInputsList(): void; + getInputsList(): Array; + setInputsList(value: Array): GovTx; + addInputs(value?: TxInput, index?: number): TxInput; + + clearAccountupdatesList(): void; + getAccountupdatesList(): Array; + setAccountupdatesList(value: Array): GovTx; + addAccountupdates(value?: spec_pb.TemplateAccount, index?: number): spec_pb.TemplateAccount; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GovTx.AsObject; + static toObject(includeInstance: boolean, msg: GovTx): GovTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GovTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GovTx; + static deserializeBinaryFromReader(message: GovTx, reader: jspb.BinaryReader): GovTx; +} + +export namespace GovTx { + export type AsObject = { + inputsList: Array, + accountupdatesList: Array, + } +} + +export class ProposalTx extends jspb.Message { + + hasInput(): boolean; + clearInput(): void; + getInput(): TxInput | undefined; + setInput(value?: TxInput): ProposalTx; + + getVotingweight(): number; + setVotingweight(value: number): ProposalTx; + + getProposalhash(): Uint8Array | string; + getProposalhash_asU8(): Uint8Array; + getProposalhash_asB64(): string; + setProposalhash(value: Uint8Array | string): ProposalTx; + + + hasProposal(): boolean; + clearProposal(): void; + getProposal(): Proposal | undefined; + setProposal(value?: Proposal): ProposalTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProposalTx.AsObject; + static toObject(includeInstance: boolean, msg: ProposalTx): ProposalTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProposalTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProposalTx; + static deserializeBinaryFromReader(message: ProposalTx, reader: jspb.BinaryReader): ProposalTx; +} + +export namespace ProposalTx { + export type AsObject = { + input?: TxInput.AsObject, + votingweight: number, + proposalhash: Uint8Array | string, + proposal?: Proposal.AsObject, + } +} + +export class IdentifyTx extends jspb.Message { + clearInputsList(): void; + getInputsList(): Array; + setInputsList(value: Array): IdentifyTx; + addInputs(value?: TxInput, index?: number): TxInput; + + + hasNode(): boolean; + clearNode(): void; + getNode(): registry_pb.NodeIdentity | undefined; + setNode(value?: registry_pb.NodeIdentity): IdentifyTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): IdentifyTx.AsObject; + static toObject(includeInstance: boolean, msg: IdentifyTx): IdentifyTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: IdentifyTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): IdentifyTx; + static deserializeBinaryFromReader(message: IdentifyTx, reader: jspb.BinaryReader): IdentifyTx; +} + +export namespace IdentifyTx { + export type AsObject = { + inputsList: Array, + node?: registry_pb.NodeIdentity.AsObject, + } +} + +export class BatchTx extends jspb.Message { + clearInputsList(): void; + getInputsList(): Array; + setInputsList(value: Array): BatchTx; + addInputs(value?: TxInput, index?: number): TxInput; + + clearTxsList(): void; + getTxsList(): Array; + setTxsList(value: Array): BatchTx; + addTxs(value?: Any, index?: number): Any; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BatchTx.AsObject; + static toObject(includeInstance: boolean, msg: BatchTx): BatchTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BatchTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BatchTx; + static deserializeBinaryFromReader(message: BatchTx, reader: jspb.BinaryReader): BatchTx; +} + +export namespace BatchTx { + export type AsObject = { + inputsList: Array, + txsList: Array, + } +} + +export class Vote extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): Vote; + + getVotingweight(): number; + setVotingweight(value: number): Vote; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Vote.AsObject; + static toObject(includeInstance: boolean, msg: Vote): Vote.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Vote, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Vote; + static deserializeBinaryFromReader(message: Vote, reader: jspb.BinaryReader): Vote; +} + +export namespace Vote { + export type AsObject = { + address: Uint8Array | string, + votingweight: number, + } +} + +export class Proposal extends jspb.Message { + getName(): string; + setName(value: string): Proposal; + + getDescription(): string; + setDescription(value: string): Proposal; + + + hasBatchtx(): boolean; + clearBatchtx(): void; + getBatchtx(): BatchTx | undefined; + setBatchtx(value?: BatchTx): Proposal; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Proposal.AsObject; + static toObject(includeInstance: boolean, msg: Proposal): Proposal.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Proposal, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Proposal; + static deserializeBinaryFromReader(message: Proposal, reader: jspb.BinaryReader): Proposal; +} + +export namespace Proposal { + export type AsObject = { + name: string, + description: string, + batchtx?: BatchTx.AsObject, + } +} + +export class Ballot extends jspb.Message { + + hasProposal(): boolean; + clearProposal(): void; + getProposal(): Proposal | undefined; + setProposal(value?: Proposal): Ballot; + + getFinalizingtx(): Uint8Array | string; + getFinalizingtx_asU8(): Uint8Array; + getFinalizingtx_asB64(): string; + setFinalizingtx(value: Uint8Array | string): Ballot; + + getProposalstate(): Ballot.ProposalState; + setProposalstate(value: Ballot.ProposalState): Ballot; + + clearVotesList(): void; + getVotesList(): Array; + setVotesList(value: Array): Ballot; + addVotes(value?: Vote, index?: number): Vote; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Ballot.AsObject; + static toObject(includeInstance: boolean, msg: Ballot): Ballot.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Ballot, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Ballot; + static deserializeBinaryFromReader(message: Ballot, reader: jspb.BinaryReader): Ballot; +} + +export namespace Ballot { + export type AsObject = { + proposal?: Proposal.AsObject, + finalizingtx: Uint8Array | string, + proposalstate: Ballot.ProposalState, + votesList: Array, + } + + export enum ProposalState { + PROPOSED = 0, + EXECUTED = 1, + FAILED = 2, + } + +} diff --git a/js/proto/payload_pb.js b/js/proto/payload_pb.js new file mode 100644 index 000000000..595e53a13 --- /dev/null +++ b/js/proto/payload_pb.js @@ -0,0 +1,4686 @@ +// source: payload.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var permission_pb = require('./permission_pb.js'); +goog.object.extend(proto, permission_pb); +var registry_pb = require('./registry_pb.js'); +goog.object.extend(proto, registry_pb); +var spec_pb = require('./spec_pb.js'); +goog.object.extend(proto, spec_pb); +goog.exportSymbol('proto.payload.Any', null, global); +goog.exportSymbol('proto.payload.Ballot', null, global); +goog.exportSymbol('proto.payload.Ballot.ProposalState', null, global); +goog.exportSymbol('proto.payload.BatchTx', null, global); +goog.exportSymbol('proto.payload.BondTx', null, global); +goog.exportSymbol('proto.payload.CallTx', null, global); +goog.exportSymbol('proto.payload.ContractMeta', null, global); +goog.exportSymbol('proto.payload.GovTx', null, global); +goog.exportSymbol('proto.payload.IdentifyTx', null, global); +goog.exportSymbol('proto.payload.NameTx', null, global); +goog.exportSymbol('proto.payload.PermsTx', null, global); +goog.exportSymbol('proto.payload.Proposal', null, global); +goog.exportSymbol('proto.payload.ProposalTx', null, global); +goog.exportSymbol('proto.payload.SendTx', null, global); +goog.exportSymbol('proto.payload.TxInput', null, global); +goog.exportSymbol('proto.payload.TxOutput', null, global); +goog.exportSymbol('proto.payload.UnbondTx', null, global); +goog.exportSymbol('proto.payload.Vote', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.Any = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.Any, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.Any.displayName = 'proto.payload.Any'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.TxInput = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.TxInput, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.TxInput.displayName = 'proto.payload.TxInput'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.TxOutput = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.TxOutput, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.TxOutput.displayName = 'proto.payload.TxOutput'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.CallTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.payload.CallTx.repeatedFields_, null); +}; +goog.inherits(proto.payload.CallTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.CallTx.displayName = 'proto.payload.CallTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.ContractMeta = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.ContractMeta, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.ContractMeta.displayName = 'proto.payload.ContractMeta'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.SendTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.payload.SendTx.repeatedFields_, null); +}; +goog.inherits(proto.payload.SendTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.SendTx.displayName = 'proto.payload.SendTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.PermsTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.PermsTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.PermsTx.displayName = 'proto.payload.PermsTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.NameTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.NameTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.NameTx.displayName = 'proto.payload.NameTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.BondTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.BondTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.BondTx.displayName = 'proto.payload.BondTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.UnbondTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.UnbondTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.UnbondTx.displayName = 'proto.payload.UnbondTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.GovTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.payload.GovTx.repeatedFields_, null); +}; +goog.inherits(proto.payload.GovTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.GovTx.displayName = 'proto.payload.GovTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.ProposalTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.ProposalTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.ProposalTx.displayName = 'proto.payload.ProposalTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.IdentifyTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.payload.IdentifyTx.repeatedFields_, null); +}; +goog.inherits(proto.payload.IdentifyTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.IdentifyTx.displayName = 'proto.payload.IdentifyTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.BatchTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.payload.BatchTx.repeatedFields_, null); +}; +goog.inherits(proto.payload.BatchTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.BatchTx.displayName = 'proto.payload.BatchTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.Vote = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.Vote, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.Vote.displayName = 'proto.payload.Vote'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.Proposal = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.payload.Proposal, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.Proposal.displayName = 'proto.payload.Proposal'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.payload.Ballot = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.payload.Ballot.repeatedFields_, null); +}; +goog.inherits(proto.payload.Ballot, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.payload.Ballot.displayName = 'proto.payload.Ballot'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.Any.prototype.toObject = function(opt_includeInstance) { + return proto.payload.Any.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.Any} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.Any.toObject = function(includeInstance, msg) { + var f, obj = { + calltx: (f = msg.getCalltx()) && proto.payload.CallTx.toObject(includeInstance, f), + sendtx: (f = msg.getSendtx()) && proto.payload.SendTx.toObject(includeInstance, f), + nametx: (f = msg.getNametx()) && proto.payload.NameTx.toObject(includeInstance, f), + permstx: (f = msg.getPermstx()) && proto.payload.PermsTx.toObject(includeInstance, f), + govtx: (f = msg.getGovtx()) && proto.payload.GovTx.toObject(includeInstance, f), + bondtx: (f = msg.getBondtx()) && proto.payload.BondTx.toObject(includeInstance, f), + unbondtx: (f = msg.getUnbondtx()) && proto.payload.UnbondTx.toObject(includeInstance, f), + batchtx: (f = msg.getBatchtx()) && proto.payload.BatchTx.toObject(includeInstance, f), + proposaltx: (f = msg.getProposaltx()) && proto.payload.ProposalTx.toObject(includeInstance, f), + identifytx: (f = msg.getIdentifytx()) && proto.payload.IdentifyTx.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.Any} + */ +proto.payload.Any.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.Any; + return proto.payload.Any.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.Any} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.Any} + */ +proto.payload.Any.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.CallTx; + reader.readMessage(value,proto.payload.CallTx.deserializeBinaryFromReader); + msg.setCalltx(value); + break; + case 2: + var value = new proto.payload.SendTx; + reader.readMessage(value,proto.payload.SendTx.deserializeBinaryFromReader); + msg.setSendtx(value); + break; + case 3: + var value = new proto.payload.NameTx; + reader.readMessage(value,proto.payload.NameTx.deserializeBinaryFromReader); + msg.setNametx(value); + break; + case 4: + var value = new proto.payload.PermsTx; + reader.readMessage(value,proto.payload.PermsTx.deserializeBinaryFromReader); + msg.setPermstx(value); + break; + case 5: + var value = new proto.payload.GovTx; + reader.readMessage(value,proto.payload.GovTx.deserializeBinaryFromReader); + msg.setGovtx(value); + break; + case 6: + var value = new proto.payload.BondTx; + reader.readMessage(value,proto.payload.BondTx.deserializeBinaryFromReader); + msg.setBondtx(value); + break; + case 7: + var value = new proto.payload.UnbondTx; + reader.readMessage(value,proto.payload.UnbondTx.deserializeBinaryFromReader); + msg.setUnbondtx(value); + break; + case 8: + var value = new proto.payload.BatchTx; + reader.readMessage(value,proto.payload.BatchTx.deserializeBinaryFromReader); + msg.setBatchtx(value); + break; + case 9: + var value = new proto.payload.ProposalTx; + reader.readMessage(value,proto.payload.ProposalTx.deserializeBinaryFromReader); + msg.setProposaltx(value); + break; + case 10: + var value = new proto.payload.IdentifyTx; + reader.readMessage(value,proto.payload.IdentifyTx.deserializeBinaryFromReader); + msg.setIdentifytx(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.Any.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.Any.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.Any} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.Any.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCalltx(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.payload.CallTx.serializeBinaryToWriter + ); + } + f = message.getSendtx(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.payload.SendTx.serializeBinaryToWriter + ); + } + f = message.getNametx(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.payload.NameTx.serializeBinaryToWriter + ); + } + f = message.getPermstx(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.payload.PermsTx.serializeBinaryToWriter + ); + } + f = message.getGovtx(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.payload.GovTx.serializeBinaryToWriter + ); + } + f = message.getBondtx(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.payload.BondTx.serializeBinaryToWriter + ); + } + f = message.getUnbondtx(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.payload.UnbondTx.serializeBinaryToWriter + ); + } + f = message.getBatchtx(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.payload.BatchTx.serializeBinaryToWriter + ); + } + f = message.getProposaltx(); + if (f != null) { + writer.writeMessage( + 9, + f, + proto.payload.ProposalTx.serializeBinaryToWriter + ); + } + f = message.getIdentifytx(); + if (f != null) { + writer.writeMessage( + 10, + f, + proto.payload.IdentifyTx.serializeBinaryToWriter + ); + } +}; + + +/** + * optional CallTx CallTx = 1; + * @return {?proto.payload.CallTx} + */ +proto.payload.Any.prototype.getCalltx = function() { + return /** @type{?proto.payload.CallTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.CallTx, 1)); +}; + + +/** + * @param {?proto.payload.CallTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setCalltx = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearCalltx = function() { + return this.setCalltx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasCalltx = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional SendTx SendTx = 2; + * @return {?proto.payload.SendTx} + */ +proto.payload.Any.prototype.getSendtx = function() { + return /** @type{?proto.payload.SendTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.SendTx, 2)); +}; + + +/** + * @param {?proto.payload.SendTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setSendtx = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearSendtx = function() { + return this.setSendtx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasSendtx = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional NameTx NameTx = 3; + * @return {?proto.payload.NameTx} + */ +proto.payload.Any.prototype.getNametx = function() { + return /** @type{?proto.payload.NameTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.NameTx, 3)); +}; + + +/** + * @param {?proto.payload.NameTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setNametx = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearNametx = function() { + return this.setNametx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasNametx = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional PermsTx PermsTx = 4; + * @return {?proto.payload.PermsTx} + */ +proto.payload.Any.prototype.getPermstx = function() { + return /** @type{?proto.payload.PermsTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.PermsTx, 4)); +}; + + +/** + * @param {?proto.payload.PermsTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setPermstx = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearPermstx = function() { + return this.setPermstx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasPermstx = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional GovTx GovTx = 5; + * @return {?proto.payload.GovTx} + */ +proto.payload.Any.prototype.getGovtx = function() { + return /** @type{?proto.payload.GovTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.GovTx, 5)); +}; + + +/** + * @param {?proto.payload.GovTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setGovtx = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearGovtx = function() { + return this.setGovtx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasGovtx = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional BondTx BondTx = 6; + * @return {?proto.payload.BondTx} + */ +proto.payload.Any.prototype.getBondtx = function() { + return /** @type{?proto.payload.BondTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.BondTx, 6)); +}; + + +/** + * @param {?proto.payload.BondTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setBondtx = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearBondtx = function() { + return this.setBondtx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasBondtx = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional UnbondTx UnbondTx = 7; + * @return {?proto.payload.UnbondTx} + */ +proto.payload.Any.prototype.getUnbondtx = function() { + return /** @type{?proto.payload.UnbondTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.UnbondTx, 7)); +}; + + +/** + * @param {?proto.payload.UnbondTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setUnbondtx = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearUnbondtx = function() { + return this.setUnbondtx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasUnbondtx = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional BatchTx BatchTx = 8; + * @return {?proto.payload.BatchTx} + */ +proto.payload.Any.prototype.getBatchtx = function() { + return /** @type{?proto.payload.BatchTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.BatchTx, 8)); +}; + + +/** + * @param {?proto.payload.BatchTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setBatchtx = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearBatchtx = function() { + return this.setBatchtx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasBatchtx = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional ProposalTx ProposalTx = 9; + * @return {?proto.payload.ProposalTx} + */ +proto.payload.Any.prototype.getProposaltx = function() { + return /** @type{?proto.payload.ProposalTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.ProposalTx, 9)); +}; + + +/** + * @param {?proto.payload.ProposalTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setProposaltx = function(value) { + return jspb.Message.setWrapperField(this, 9, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearProposaltx = function() { + return this.setProposaltx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasProposaltx = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional IdentifyTx IdentifyTx = 10; + * @return {?proto.payload.IdentifyTx} + */ +proto.payload.Any.prototype.getIdentifytx = function() { + return /** @type{?proto.payload.IdentifyTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.IdentifyTx, 10)); +}; + + +/** + * @param {?proto.payload.IdentifyTx|undefined} value + * @return {!proto.payload.Any} returns this +*/ +proto.payload.Any.prototype.setIdentifytx = function(value) { + return jspb.Message.setWrapperField(this, 10, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Any} returns this + */ +proto.payload.Any.prototype.clearIdentifytx = function() { + return this.setIdentifytx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Any.prototype.hasIdentifytx = function() { + return jspb.Message.getField(this, 10) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.TxInput.prototype.toObject = function(opt_includeInstance) { + return proto.payload.TxInput.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.TxInput} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.TxInput.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + amount: jspb.Message.getFieldWithDefault(msg, 2, 0), + sequence: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.TxInput} + */ +proto.payload.TxInput.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.TxInput; + return proto.payload.TxInput.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.TxInput} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.TxInput} + */ +proto.payload.TxInput.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAmount(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setSequence(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.TxInput.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.TxInput.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.TxInput} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.TxInput.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getAmount(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getSequence(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.payload.TxInput.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.payload.TxInput.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.payload.TxInput.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.TxInput} returns this + */ +proto.payload.TxInput.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional uint64 Amount = 2; + * @return {number} + */ +proto.payload.TxInput.prototype.getAmount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.TxInput} returns this + */ +proto.payload.TxInput.prototype.setAmount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint64 Sequence = 3; + * @return {number} + */ +proto.payload.TxInput.prototype.getSequence = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.TxInput} returns this + */ +proto.payload.TxInput.prototype.setSequence = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.TxOutput.prototype.toObject = function(opt_includeInstance) { + return proto.payload.TxOutput.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.TxOutput} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.TxOutput.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + amount: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.TxOutput} + */ +proto.payload.TxOutput.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.TxOutput; + return proto.payload.TxOutput.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.TxOutput} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.TxOutput} + */ +proto.payload.TxOutput.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAmount(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.TxOutput.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.TxOutput.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.TxOutput} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.TxOutput.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getAmount(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.payload.TxOutput.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.payload.TxOutput.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.payload.TxOutput.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.TxOutput} returns this + */ +proto.payload.TxOutput.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional uint64 Amount = 2; + * @return {number} + */ +proto.payload.TxOutput.prototype.getAmount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.TxOutput} returns this + */ +proto.payload.TxOutput.prototype.setAmount = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.payload.CallTx.repeatedFields_ = [7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.CallTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.CallTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.CallTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.CallTx.toObject = function(includeInstance, msg) { + var f, obj = { + input: (f = msg.getInput()) && proto.payload.TxInput.toObject(includeInstance, f), + address: msg.getAddress_asB64(), + gaslimit: jspb.Message.getFieldWithDefault(msg, 3, 0), + fee: jspb.Message.getFieldWithDefault(msg, 4, 0), + data: msg.getData_asB64(), + wasm: msg.getWasm_asB64(), + contractmetaList: jspb.Message.toObjectList(msg.getContractmetaList(), + proto.payload.ContractMeta.toObject, includeInstance), + gasprice: jspb.Message.getFieldWithDefault(msg, 8, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.CallTx} + */ +proto.payload.CallTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.CallTx; + return proto.payload.CallTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.CallTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.CallTx} + */ +proto.payload.CallTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.setInput(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setGaslimit(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFee(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setWasm(value); + break; + case 7: + var value = new proto.payload.ContractMeta; + reader.readMessage(value,proto.payload.ContractMeta.deserializeBinaryFromReader); + msg.addContractmeta(value); + break; + case 8: + var value = /** @type {number} */ (reader.readUint64()); + msg.setGasprice(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.CallTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.CallTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.CallTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.CallTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInput(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getGaslimit(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getFee(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getWasm_asU8(); + if (f.length > 0) { + writer.writeBytes( + 6, + f + ); + } + f = message.getContractmetaList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 7, + f, + proto.payload.ContractMeta.serializeBinaryToWriter + ); + } + f = message.getGasprice(); + if (f !== 0) { + writer.writeUint64( + 8, + f + ); + } +}; + + +/** + * optional TxInput Input = 1; + * @return {?proto.payload.TxInput} + */ +proto.payload.CallTx.prototype.getInput = function() { + return /** @type{?proto.payload.TxInput} */ ( + jspb.Message.getWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {?proto.payload.TxInput|undefined} value + * @return {!proto.payload.CallTx} returns this +*/ +proto.payload.CallTx.prototype.setInput = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.CallTx} returns this + */ +proto.payload.CallTx.prototype.clearInput = function() { + return this.setInput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.CallTx.prototype.hasInput = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes Address = 2; + * @return {!(string|Uint8Array)} + */ +proto.payload.CallTx.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Address = 2; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.payload.CallTx.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.payload.CallTx.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.CallTx} returns this + */ +proto.payload.CallTx.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional uint64 GasLimit = 3; + * @return {number} + */ +proto.payload.CallTx.prototype.getGaslimit = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.CallTx} returns this + */ +proto.payload.CallTx.prototype.setGaslimit = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint64 Fee = 4; + * @return {number} + */ +proto.payload.CallTx.prototype.getFee = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.CallTx} returns this + */ +proto.payload.CallTx.prototype.setFee = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional bytes Data = 5; + * @return {!(string|Uint8Array)} + */ +proto.payload.CallTx.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes Data = 5; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.payload.CallTx.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes Data = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.payload.CallTx.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.CallTx} returns this + */ +proto.payload.CallTx.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * optional bytes WASM = 6; + * @return {!(string|Uint8Array)} + */ +proto.payload.CallTx.prototype.getWasm = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes WASM = 6; + * This is a type-conversion wrapper around `getWasm()` + * @return {string} + */ +proto.payload.CallTx.prototype.getWasm_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getWasm())); +}; + + +/** + * optional bytes WASM = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getWasm()` + * @return {!Uint8Array} + */ +proto.payload.CallTx.prototype.getWasm_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getWasm())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.CallTx} returns this + */ +proto.payload.CallTx.prototype.setWasm = function(value) { + return jspb.Message.setProto3BytesField(this, 6, value); +}; + + +/** + * repeated ContractMeta ContractMeta = 7; + * @return {!Array} + */ +proto.payload.CallTx.prototype.getContractmetaList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.payload.ContractMeta, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.CallTx} returns this +*/ +proto.payload.CallTx.prototype.setContractmetaList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 7, value); +}; + + +/** + * @param {!proto.payload.ContractMeta=} opt_value + * @param {number=} opt_index + * @return {!proto.payload.ContractMeta} + */ +proto.payload.CallTx.prototype.addContractmeta = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.payload.ContractMeta, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.CallTx} returns this + */ +proto.payload.CallTx.prototype.clearContractmetaList = function() { + return this.setContractmetaList([]); +}; + + +/** + * optional uint64 GasPrice = 8; + * @return {number} + */ +proto.payload.CallTx.prototype.getGasprice = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.CallTx} returns this + */ +proto.payload.CallTx.prototype.setGasprice = function(value) { + return jspb.Message.setProto3IntField(this, 8, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.ContractMeta.prototype.toObject = function(opt_includeInstance) { + return proto.payload.ContractMeta.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.ContractMeta} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.ContractMeta.toObject = function(includeInstance, msg) { + var f, obj = { + codehash: msg.getCodehash_asB64(), + meta: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.ContractMeta} + */ +proto.payload.ContractMeta.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.ContractMeta; + return proto.payload.ContractMeta.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.ContractMeta} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.ContractMeta} + */ +proto.payload.ContractMeta.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCodehash(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMeta(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.ContractMeta.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.ContractMeta.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.ContractMeta} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.ContractMeta.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCodehash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getMeta(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional bytes CodeHash = 1; + * @return {!(string|Uint8Array)} + */ +proto.payload.ContractMeta.prototype.getCodehash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes CodeHash = 1; + * This is a type-conversion wrapper around `getCodehash()` + * @return {string} + */ +proto.payload.ContractMeta.prototype.getCodehash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCodehash())); +}; + + +/** + * optional bytes CodeHash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCodehash()` + * @return {!Uint8Array} + */ +proto.payload.ContractMeta.prototype.getCodehash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCodehash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.ContractMeta} returns this + */ +proto.payload.ContractMeta.prototype.setCodehash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string Meta = 2; + * @return {string} + */ +proto.payload.ContractMeta.prototype.getMeta = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.payload.ContractMeta} returns this + */ +proto.payload.ContractMeta.prototype.setMeta = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.payload.SendTx.repeatedFields_ = [1,2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.SendTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.SendTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.SendTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.SendTx.toObject = function(includeInstance, msg) { + var f, obj = { + inputsList: jspb.Message.toObjectList(msg.getInputsList(), + proto.payload.TxInput.toObject, includeInstance), + outputsList: jspb.Message.toObjectList(msg.getOutputsList(), + proto.payload.TxOutput.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.SendTx} + */ +proto.payload.SendTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.SendTx; + return proto.payload.SendTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.SendTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.SendTx} + */ +proto.payload.SendTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.addInputs(value); + break; + case 2: + var value = new proto.payload.TxOutput; + reader.readMessage(value,proto.payload.TxOutput.deserializeBinaryFromReader); + msg.addOutputs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.SendTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.SendTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.SendTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.SendTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInputsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getOutputsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.payload.TxOutput.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated TxInput Inputs = 1; + * @return {!Array} + */ +proto.payload.SendTx.prototype.getInputsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.SendTx} returns this +*/ +proto.payload.SendTx.prototype.setInputsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.payload.TxInput=} opt_value + * @param {number=} opt_index + * @return {!proto.payload.TxInput} + */ +proto.payload.SendTx.prototype.addInputs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.payload.TxInput, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.SendTx} returns this + */ +proto.payload.SendTx.prototype.clearInputsList = function() { + return this.setInputsList([]); +}; + + +/** + * repeated TxOutput Outputs = 2; + * @return {!Array} + */ +proto.payload.SendTx.prototype.getOutputsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.payload.TxOutput, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.SendTx} returns this +*/ +proto.payload.SendTx.prototype.setOutputsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.payload.TxOutput=} opt_value + * @param {number=} opt_index + * @return {!proto.payload.TxOutput} + */ +proto.payload.SendTx.prototype.addOutputs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.payload.TxOutput, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.SendTx} returns this + */ +proto.payload.SendTx.prototype.clearOutputsList = function() { + return this.setOutputsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.PermsTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.PermsTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.PermsTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.PermsTx.toObject = function(includeInstance, msg) { + var f, obj = { + input: (f = msg.getInput()) && proto.payload.TxInput.toObject(includeInstance, f), + permargs: (f = msg.getPermargs()) && permission_pb.PermArgs.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.PermsTx} + */ +proto.payload.PermsTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.PermsTx; + return proto.payload.PermsTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.PermsTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.PermsTx} + */ +proto.payload.PermsTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.setInput(value); + break; + case 2: + var value = new permission_pb.PermArgs; + reader.readMessage(value,permission_pb.PermArgs.deserializeBinaryFromReader); + msg.setPermargs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.PermsTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.PermsTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.PermsTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.PermsTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInput(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getPermargs(); + if (f != null) { + writer.writeMessage( + 2, + f, + permission_pb.PermArgs.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TxInput Input = 1; + * @return {?proto.payload.TxInput} + */ +proto.payload.PermsTx.prototype.getInput = function() { + return /** @type{?proto.payload.TxInput} */ ( + jspb.Message.getWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {?proto.payload.TxInput|undefined} value + * @return {!proto.payload.PermsTx} returns this +*/ +proto.payload.PermsTx.prototype.setInput = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.PermsTx} returns this + */ +proto.payload.PermsTx.prototype.clearInput = function() { + return this.setInput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.PermsTx.prototype.hasInput = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional permission.PermArgs PermArgs = 2; + * @return {?proto.permission.PermArgs} + */ +proto.payload.PermsTx.prototype.getPermargs = function() { + return /** @type{?proto.permission.PermArgs} */ ( + jspb.Message.getWrapperField(this, permission_pb.PermArgs, 2)); +}; + + +/** + * @param {?proto.permission.PermArgs|undefined} value + * @return {!proto.payload.PermsTx} returns this +*/ +proto.payload.PermsTx.prototype.setPermargs = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.PermsTx} returns this + */ +proto.payload.PermsTx.prototype.clearPermargs = function() { + return this.setPermargs(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.PermsTx.prototype.hasPermargs = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.NameTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.NameTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.NameTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.NameTx.toObject = function(includeInstance, msg) { + var f, obj = { + input: (f = msg.getInput()) && proto.payload.TxInput.toObject(includeInstance, f), + name: jspb.Message.getFieldWithDefault(msg, 2, ""), + data: jspb.Message.getFieldWithDefault(msg, 3, ""), + fee: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.NameTx} + */ +proto.payload.NameTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.NameTx; + return proto.payload.NameTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.NameTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.NameTx} + */ +proto.payload.NameTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.setInput(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setData(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint64()); + msg.setFee(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.NameTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.NameTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.NameTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.NameTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInput(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getData(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getFee(); + if (f !== 0) { + writer.writeUint64( + 4, + f + ); + } +}; + + +/** + * optional TxInput Input = 1; + * @return {?proto.payload.TxInput} + */ +proto.payload.NameTx.prototype.getInput = function() { + return /** @type{?proto.payload.TxInput} */ ( + jspb.Message.getWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {?proto.payload.TxInput|undefined} value + * @return {!proto.payload.NameTx} returns this +*/ +proto.payload.NameTx.prototype.setInput = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.NameTx} returns this + */ +proto.payload.NameTx.prototype.clearInput = function() { + return this.setInput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.NameTx.prototype.hasInput = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string Name = 2; + * @return {string} + */ +proto.payload.NameTx.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.payload.NameTx} returns this + */ +proto.payload.NameTx.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string Data = 3; + * @return {string} + */ +proto.payload.NameTx.prototype.getData = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.payload.NameTx} returns this + */ +proto.payload.NameTx.prototype.setData = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional uint64 Fee = 4; + * @return {number} + */ +proto.payload.NameTx.prototype.getFee = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.NameTx} returns this + */ +proto.payload.NameTx.prototype.setFee = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.BondTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.BondTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.BondTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.BondTx.toObject = function(includeInstance, msg) { + var f, obj = { + input: (f = msg.getInput()) && proto.payload.TxInput.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.BondTx} + */ +proto.payload.BondTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.BondTx; + return proto.payload.BondTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.BondTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.BondTx} + */ +proto.payload.BondTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.setInput(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.BondTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.BondTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.BondTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.BondTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInput(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TxInput Input = 1; + * @return {?proto.payload.TxInput} + */ +proto.payload.BondTx.prototype.getInput = function() { + return /** @type{?proto.payload.TxInput} */ ( + jspb.Message.getWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {?proto.payload.TxInput|undefined} value + * @return {!proto.payload.BondTx} returns this +*/ +proto.payload.BondTx.prototype.setInput = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.BondTx} returns this + */ +proto.payload.BondTx.prototype.clearInput = function() { + return this.setInput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.BondTx.prototype.hasInput = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.UnbondTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.UnbondTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.UnbondTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.UnbondTx.toObject = function(includeInstance, msg) { + var f, obj = { + input: (f = msg.getInput()) && proto.payload.TxInput.toObject(includeInstance, f), + output: (f = msg.getOutput()) && proto.payload.TxOutput.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.UnbondTx} + */ +proto.payload.UnbondTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.UnbondTx; + return proto.payload.UnbondTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.UnbondTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.UnbondTx} + */ +proto.payload.UnbondTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.setInput(value); + break; + case 2: + var value = new proto.payload.TxOutput; + reader.readMessage(value,proto.payload.TxOutput.deserializeBinaryFromReader); + msg.setOutput(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.UnbondTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.UnbondTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.UnbondTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.UnbondTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInput(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getOutput(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.payload.TxOutput.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TxInput Input = 1; + * @return {?proto.payload.TxInput} + */ +proto.payload.UnbondTx.prototype.getInput = function() { + return /** @type{?proto.payload.TxInput} */ ( + jspb.Message.getWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {?proto.payload.TxInput|undefined} value + * @return {!proto.payload.UnbondTx} returns this +*/ +proto.payload.UnbondTx.prototype.setInput = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.UnbondTx} returns this + */ +proto.payload.UnbondTx.prototype.clearInput = function() { + return this.setInput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.UnbondTx.prototype.hasInput = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional TxOutput Output = 2; + * @return {?proto.payload.TxOutput} + */ +proto.payload.UnbondTx.prototype.getOutput = function() { + return /** @type{?proto.payload.TxOutput} */ ( + jspb.Message.getWrapperField(this, proto.payload.TxOutput, 2)); +}; + + +/** + * @param {?proto.payload.TxOutput|undefined} value + * @return {!proto.payload.UnbondTx} returns this +*/ +proto.payload.UnbondTx.prototype.setOutput = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.UnbondTx} returns this + */ +proto.payload.UnbondTx.prototype.clearOutput = function() { + return this.setOutput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.UnbondTx.prototype.hasOutput = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.payload.GovTx.repeatedFields_ = [1,2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.GovTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.GovTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.GovTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.GovTx.toObject = function(includeInstance, msg) { + var f, obj = { + inputsList: jspb.Message.toObjectList(msg.getInputsList(), + proto.payload.TxInput.toObject, includeInstance), + accountupdatesList: jspb.Message.toObjectList(msg.getAccountupdatesList(), + spec_pb.TemplateAccount.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.GovTx} + */ +proto.payload.GovTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.GovTx; + return proto.payload.GovTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.GovTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.GovTx} + */ +proto.payload.GovTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.addInputs(value); + break; + case 2: + var value = new spec_pb.TemplateAccount; + reader.readMessage(value,spec_pb.TemplateAccount.deserializeBinaryFromReader); + msg.addAccountupdates(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.GovTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.GovTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.GovTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.GovTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInputsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getAccountupdatesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + spec_pb.TemplateAccount.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated TxInput Inputs = 1; + * @return {!Array} + */ +proto.payload.GovTx.prototype.getInputsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.GovTx} returns this +*/ +proto.payload.GovTx.prototype.setInputsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.payload.TxInput=} opt_value + * @param {number=} opt_index + * @return {!proto.payload.TxInput} + */ +proto.payload.GovTx.prototype.addInputs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.payload.TxInput, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.GovTx} returns this + */ +proto.payload.GovTx.prototype.clearInputsList = function() { + return this.setInputsList([]); +}; + + +/** + * repeated spec.TemplateAccount AccountUpdates = 2; + * @return {!Array} + */ +proto.payload.GovTx.prototype.getAccountupdatesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, spec_pb.TemplateAccount, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.GovTx} returns this +*/ +proto.payload.GovTx.prototype.setAccountupdatesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.spec.TemplateAccount=} opt_value + * @param {number=} opt_index + * @return {!proto.spec.TemplateAccount} + */ +proto.payload.GovTx.prototype.addAccountupdates = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.spec.TemplateAccount, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.GovTx} returns this + */ +proto.payload.GovTx.prototype.clearAccountupdatesList = function() { + return this.setAccountupdatesList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.ProposalTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.ProposalTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.ProposalTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.ProposalTx.toObject = function(includeInstance, msg) { + var f, obj = { + input: (f = msg.getInput()) && proto.payload.TxInput.toObject(includeInstance, f), + votingweight: jspb.Message.getFieldWithDefault(msg, 2, 0), + proposalhash: msg.getProposalhash_asB64(), + proposal: (f = msg.getProposal()) && proto.payload.Proposal.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.ProposalTx} + */ +proto.payload.ProposalTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.ProposalTx; + return proto.payload.ProposalTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.ProposalTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.ProposalTx} + */ +proto.payload.ProposalTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.setInput(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setVotingweight(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setProposalhash(value); + break; + case 4: + var value = new proto.payload.Proposal; + reader.readMessage(value,proto.payload.Proposal.deserializeBinaryFromReader); + msg.setProposal(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.ProposalTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.ProposalTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.ProposalTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.ProposalTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInput(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getVotingweight(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getProposalhash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getProposal(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.payload.Proposal.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TxInput Input = 1; + * @return {?proto.payload.TxInput} + */ +proto.payload.ProposalTx.prototype.getInput = function() { + return /** @type{?proto.payload.TxInput} */ ( + jspb.Message.getWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {?proto.payload.TxInput|undefined} value + * @return {!proto.payload.ProposalTx} returns this +*/ +proto.payload.ProposalTx.prototype.setInput = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.ProposalTx} returns this + */ +proto.payload.ProposalTx.prototype.clearInput = function() { + return this.setInput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.ProposalTx.prototype.hasInput = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int64 VotingWeight = 2; + * @return {number} + */ +proto.payload.ProposalTx.prototype.getVotingweight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.ProposalTx} returns this + */ +proto.payload.ProposalTx.prototype.setVotingweight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bytes ProposalHash = 3; + * @return {!(string|Uint8Array)} + */ +proto.payload.ProposalTx.prototype.getProposalhash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes ProposalHash = 3; + * This is a type-conversion wrapper around `getProposalhash()` + * @return {string} + */ +proto.payload.ProposalTx.prototype.getProposalhash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getProposalhash())); +}; + + +/** + * optional bytes ProposalHash = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getProposalhash()` + * @return {!Uint8Array} + */ +proto.payload.ProposalTx.prototype.getProposalhash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getProposalhash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.ProposalTx} returns this + */ +proto.payload.ProposalTx.prototype.setProposalhash = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional Proposal Proposal = 4; + * @return {?proto.payload.Proposal} + */ +proto.payload.ProposalTx.prototype.getProposal = function() { + return /** @type{?proto.payload.Proposal} */ ( + jspb.Message.getWrapperField(this, proto.payload.Proposal, 4)); +}; + + +/** + * @param {?proto.payload.Proposal|undefined} value + * @return {!proto.payload.ProposalTx} returns this +*/ +proto.payload.ProposalTx.prototype.setProposal = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.ProposalTx} returns this + */ +proto.payload.ProposalTx.prototype.clearProposal = function() { + return this.setProposal(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.ProposalTx.prototype.hasProposal = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.payload.IdentifyTx.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.IdentifyTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.IdentifyTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.IdentifyTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.IdentifyTx.toObject = function(includeInstance, msg) { + var f, obj = { + inputsList: jspb.Message.toObjectList(msg.getInputsList(), + proto.payload.TxInput.toObject, includeInstance), + node: (f = msg.getNode()) && registry_pb.NodeIdentity.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.IdentifyTx} + */ +proto.payload.IdentifyTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.IdentifyTx; + return proto.payload.IdentifyTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.IdentifyTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.IdentifyTx} + */ +proto.payload.IdentifyTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.addInputs(value); + break; + case 2: + var value = new registry_pb.NodeIdentity; + reader.readMessage(value,registry_pb.NodeIdentity.deserializeBinaryFromReader); + msg.setNode(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.IdentifyTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.IdentifyTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.IdentifyTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.IdentifyTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInputsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getNode(); + if (f != null) { + writer.writeMessage( + 2, + f, + registry_pb.NodeIdentity.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated TxInput Inputs = 1; + * @return {!Array} + */ +proto.payload.IdentifyTx.prototype.getInputsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.IdentifyTx} returns this +*/ +proto.payload.IdentifyTx.prototype.setInputsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.payload.TxInput=} opt_value + * @param {number=} opt_index + * @return {!proto.payload.TxInput} + */ +proto.payload.IdentifyTx.prototype.addInputs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.payload.TxInput, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.IdentifyTx} returns this + */ +proto.payload.IdentifyTx.prototype.clearInputsList = function() { + return this.setInputsList([]); +}; + + +/** + * optional registry.NodeIdentity Node = 2; + * @return {?proto.registry.NodeIdentity} + */ +proto.payload.IdentifyTx.prototype.getNode = function() { + return /** @type{?proto.registry.NodeIdentity} */ ( + jspb.Message.getWrapperField(this, registry_pb.NodeIdentity, 2)); +}; + + +/** + * @param {?proto.registry.NodeIdentity|undefined} value + * @return {!proto.payload.IdentifyTx} returns this +*/ +proto.payload.IdentifyTx.prototype.setNode = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.IdentifyTx} returns this + */ +proto.payload.IdentifyTx.prototype.clearNode = function() { + return this.setNode(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.IdentifyTx.prototype.hasNode = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.payload.BatchTx.repeatedFields_ = [1,2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.BatchTx.prototype.toObject = function(opt_includeInstance) { + return proto.payload.BatchTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.BatchTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.BatchTx.toObject = function(includeInstance, msg) { + var f, obj = { + inputsList: jspb.Message.toObjectList(msg.getInputsList(), + proto.payload.TxInput.toObject, includeInstance), + txsList: jspb.Message.toObjectList(msg.getTxsList(), + proto.payload.Any.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.BatchTx} + */ +proto.payload.BatchTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.BatchTx; + return proto.payload.BatchTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.BatchTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.BatchTx} + */ +proto.payload.BatchTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.TxInput; + reader.readMessage(value,proto.payload.TxInput.deserializeBinaryFromReader); + msg.addInputs(value); + break; + case 2: + var value = new proto.payload.Any; + reader.readMessage(value,proto.payload.Any.deserializeBinaryFromReader); + msg.addTxs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.BatchTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.BatchTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.BatchTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.BatchTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInputsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.payload.TxInput.serializeBinaryToWriter + ); + } + f = message.getTxsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.payload.Any.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated TxInput Inputs = 1; + * @return {!Array} + */ +proto.payload.BatchTx.prototype.getInputsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.payload.TxInput, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.BatchTx} returns this +*/ +proto.payload.BatchTx.prototype.setInputsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.payload.TxInput=} opt_value + * @param {number=} opt_index + * @return {!proto.payload.TxInput} + */ +proto.payload.BatchTx.prototype.addInputs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.payload.TxInput, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.BatchTx} returns this + */ +proto.payload.BatchTx.prototype.clearInputsList = function() { + return this.setInputsList([]); +}; + + +/** + * repeated Any Txs = 2; + * @return {!Array} + */ +proto.payload.BatchTx.prototype.getTxsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.payload.Any, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.BatchTx} returns this +*/ +proto.payload.BatchTx.prototype.setTxsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.payload.Any=} opt_value + * @param {number=} opt_index + * @return {!proto.payload.Any} + */ +proto.payload.BatchTx.prototype.addTxs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.payload.Any, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.BatchTx} returns this + */ +proto.payload.BatchTx.prototype.clearTxsList = function() { + return this.setTxsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.Vote.prototype.toObject = function(opt_includeInstance) { + return proto.payload.Vote.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.Vote} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.Vote.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + votingweight: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.Vote} + */ +proto.payload.Vote.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.Vote; + return proto.payload.Vote.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.Vote} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.Vote} + */ +proto.payload.Vote.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setVotingweight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.Vote.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.Vote.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.Vote} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.Vote.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getVotingweight(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.payload.Vote.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.payload.Vote.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.payload.Vote.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.Vote} returns this + */ +proto.payload.Vote.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional int64 VotingWeight = 2; + * @return {number} + */ +proto.payload.Vote.prototype.getVotingweight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.payload.Vote} returns this + */ +proto.payload.Vote.prototype.setVotingweight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.Proposal.prototype.toObject = function(opt_includeInstance) { + return proto.payload.Proposal.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.Proposal} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.Proposal.toObject = function(includeInstance, msg) { + var f, obj = { + name: jspb.Message.getFieldWithDefault(msg, 1, ""), + description: jspb.Message.getFieldWithDefault(msg, 2, ""), + batchtx: (f = msg.getBatchtx()) && proto.payload.BatchTx.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.Proposal} + */ +proto.payload.Proposal.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.Proposal; + return proto.payload.Proposal.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.Proposal} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.Proposal} + */ +proto.payload.Proposal.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDescription(value); + break; + case 3: + var value = new proto.payload.BatchTx; + reader.readMessage(value,proto.payload.BatchTx.deserializeBinaryFromReader); + msg.setBatchtx(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.Proposal.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.Proposal.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.Proposal} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.Proposal.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getDescription(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getBatchtx(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.payload.BatchTx.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string Name = 1; + * @return {string} + */ +proto.payload.Proposal.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.payload.Proposal} returns this + */ +proto.payload.Proposal.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string Description = 2; + * @return {string} + */ +proto.payload.Proposal.prototype.getDescription = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.payload.Proposal} returns this + */ +proto.payload.Proposal.prototype.setDescription = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional BatchTx BatchTx = 3; + * @return {?proto.payload.BatchTx} + */ +proto.payload.Proposal.prototype.getBatchtx = function() { + return /** @type{?proto.payload.BatchTx} */ ( + jspb.Message.getWrapperField(this, proto.payload.BatchTx, 3)); +}; + + +/** + * @param {?proto.payload.BatchTx|undefined} value + * @return {!proto.payload.Proposal} returns this +*/ +proto.payload.Proposal.prototype.setBatchtx = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Proposal} returns this + */ +proto.payload.Proposal.prototype.clearBatchtx = function() { + return this.setBatchtx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Proposal.prototype.hasBatchtx = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.payload.Ballot.repeatedFields_ = [5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.payload.Ballot.prototype.toObject = function(opt_includeInstance) { + return proto.payload.Ballot.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.payload.Ballot} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.Ballot.toObject = function(includeInstance, msg) { + var f, obj = { + proposal: (f = msg.getProposal()) && proto.payload.Proposal.toObject(includeInstance, f), + finalizingtx: msg.getFinalizingtx_asB64(), + proposalstate: jspb.Message.getFieldWithDefault(msg, 4, 0), + votesList: jspb.Message.toObjectList(msg.getVotesList(), + proto.payload.Vote.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.payload.Ballot} + */ +proto.payload.Ballot.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.payload.Ballot; + return proto.payload.Ballot.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.payload.Ballot} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.payload.Ballot} + */ +proto.payload.Ballot.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.payload.Proposal; + reader.readMessage(value,proto.payload.Proposal.deserializeBinaryFromReader); + msg.setProposal(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setFinalizingtx(value); + break; + case 4: + var value = /** @type {!proto.payload.Ballot.ProposalState} */ (reader.readEnum()); + msg.setProposalstate(value); + break; + case 5: + var value = new proto.payload.Vote; + reader.readMessage(value,proto.payload.Vote.deserializeBinaryFromReader); + msg.addVotes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.payload.Ballot.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.payload.Ballot.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.payload.Ballot} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.payload.Ballot.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProposal(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.payload.Proposal.serializeBinaryToWriter + ); + } + f = message.getFinalizingtx_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getProposalstate(); + if (f !== 0.0) { + writer.writeEnum( + 4, + f + ); + } + f = message.getVotesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.payload.Vote.serializeBinaryToWriter + ); + } +}; + + +/** + * @enum {number} + */ +proto.payload.Ballot.ProposalState = { + PROPOSED: 0, + EXECUTED: 1, + FAILED: 2 +}; + +/** + * optional Proposal Proposal = 1; + * @return {?proto.payload.Proposal} + */ +proto.payload.Ballot.prototype.getProposal = function() { + return /** @type{?proto.payload.Proposal} */ ( + jspb.Message.getWrapperField(this, proto.payload.Proposal, 1)); +}; + + +/** + * @param {?proto.payload.Proposal|undefined} value + * @return {!proto.payload.Ballot} returns this +*/ +proto.payload.Ballot.prototype.setProposal = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.payload.Ballot} returns this + */ +proto.payload.Ballot.prototype.clearProposal = function() { + return this.setProposal(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.payload.Ballot.prototype.hasProposal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes FinalizingTx = 2; + * @return {!(string|Uint8Array)} + */ +proto.payload.Ballot.prototype.getFinalizingtx = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes FinalizingTx = 2; + * This is a type-conversion wrapper around `getFinalizingtx()` + * @return {string} + */ +proto.payload.Ballot.prototype.getFinalizingtx_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getFinalizingtx())); +}; + + +/** + * optional bytes FinalizingTx = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getFinalizingtx()` + * @return {!Uint8Array} + */ +proto.payload.Ballot.prototype.getFinalizingtx_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getFinalizingtx())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.payload.Ballot} returns this + */ +proto.payload.Ballot.prototype.setFinalizingtx = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional ProposalState proposalState = 4; + * @return {!proto.payload.Ballot.ProposalState} + */ +proto.payload.Ballot.prototype.getProposalstate = function() { + return /** @type {!proto.payload.Ballot.ProposalState} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {!proto.payload.Ballot.ProposalState} value + * @return {!proto.payload.Ballot} returns this + */ +proto.payload.Ballot.prototype.setProposalstate = function(value) { + return jspb.Message.setProto3EnumField(this, 4, value); +}; + + +/** + * repeated Vote Votes = 5; + * @return {!Array} + */ +proto.payload.Ballot.prototype.getVotesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.payload.Vote, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.payload.Ballot} returns this +*/ +proto.payload.Ballot.prototype.setVotesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.payload.Vote=} opt_value + * @param {number=} opt_index + * @return {!proto.payload.Vote} + */ +proto.payload.Ballot.prototype.addVotes = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.payload.Vote, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.payload.Ballot} returns this + */ +proto.payload.Ballot.prototype.clearVotesList = function() { + return this.setVotesList([]); +}; + + +goog.object.extend(exports, proto.payload); diff --git a/js/proto/permission_grpc_pb.js b/js/proto/permission_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/permission_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/permission_pb.d.ts b/js/proto/permission_pb.d.ts new file mode 100644 index 000000000..d6d7a5b8f --- /dev/null +++ b/js/proto/permission_pb.d.ts @@ -0,0 +1,123 @@ +// package: permission +// file: permission.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class AccountPermissions extends jspb.Message { + + hasBase(): boolean; + clearBase(): void; + getBase(): BasePermissions | undefined; + setBase(value?: BasePermissions): AccountPermissions; + + clearRolesList(): void; + getRolesList(): Array; + setRolesList(value: Array): AccountPermissions; + addRoles(value: string, index?: number): string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): AccountPermissions.AsObject; + static toObject(includeInstance: boolean, msg: AccountPermissions): AccountPermissions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: AccountPermissions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AccountPermissions; + static deserializeBinaryFromReader(message: AccountPermissions, reader: jspb.BinaryReader): AccountPermissions; +} + +export namespace AccountPermissions { + export type AsObject = { + base?: BasePermissions.AsObject, + rolesList: Array, + } +} + +export class BasePermissions extends jspb.Message { + + hasPerms(): boolean; + clearPerms(): void; + getPerms(): number | undefined; + setPerms(value: number): BasePermissions; + + + hasSetbit(): boolean; + clearSetbit(): void; + getSetbit(): number | undefined; + setSetbit(value: number): BasePermissions; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BasePermissions.AsObject; + static toObject(includeInstance: boolean, msg: BasePermissions): BasePermissions.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BasePermissions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BasePermissions; + static deserializeBinaryFromReader(message: BasePermissions, reader: jspb.BinaryReader): BasePermissions; +} + +export namespace BasePermissions { + export type AsObject = { + perms?: number, + setbit?: number, + } +} + +export class PermArgs extends jspb.Message { + + hasAction(): boolean; + clearAction(): void; + getAction(): number | undefined; + setAction(value: number): PermArgs; + + + hasTarget(): boolean; + clearTarget(): void; + getTarget(): Uint8Array | string; + getTarget_asU8(): Uint8Array; + getTarget_asB64(): string; + setTarget(value: Uint8Array | string): PermArgs; + + + hasPermission(): boolean; + clearPermission(): void; + getPermission(): number | undefined; + setPermission(value: number): PermArgs; + + + hasRole(): boolean; + clearRole(): void; + getRole(): string | undefined; + setRole(value: string): PermArgs; + + + hasValue(): boolean; + clearValue(): void; + getValue(): boolean | undefined; + setValue(value: boolean): PermArgs; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PermArgs.AsObject; + static toObject(includeInstance: boolean, msg: PermArgs): PermArgs.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PermArgs, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PermArgs; + static deserializeBinaryFromReader(message: PermArgs, reader: jspb.BinaryReader): PermArgs; +} + +export namespace PermArgs { + export type AsObject = { + action?: number, + target: Uint8Array | string, + permission?: number, + role?: string, + value?: boolean, + } +} diff --git a/js/proto/permission_pb.js b/js/proto/permission_pb.js new file mode 100644 index 000000000..aafc3b089 --- /dev/null +++ b/js/proto/permission_pb.js @@ -0,0 +1,852 @@ +// source: permission.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.permission.AccountPermissions', null, global); +goog.exportSymbol('proto.permission.BasePermissions', null, global); +goog.exportSymbol('proto.permission.PermArgs', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.permission.AccountPermissions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.permission.AccountPermissions.repeatedFields_, null); +}; +goog.inherits(proto.permission.AccountPermissions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.permission.AccountPermissions.displayName = 'proto.permission.AccountPermissions'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.permission.BasePermissions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.permission.BasePermissions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.permission.BasePermissions.displayName = 'proto.permission.BasePermissions'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.permission.PermArgs = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.permission.PermArgs, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.permission.PermArgs.displayName = 'proto.permission.PermArgs'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.permission.AccountPermissions.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.permission.AccountPermissions.prototype.toObject = function(opt_includeInstance) { + return proto.permission.AccountPermissions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.permission.AccountPermissions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.permission.AccountPermissions.toObject = function(includeInstance, msg) { + var f, obj = { + base: (f = msg.getBase()) && proto.permission.BasePermissions.toObject(includeInstance, f), + rolesList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.permission.AccountPermissions} + */ +proto.permission.AccountPermissions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.permission.AccountPermissions; + return proto.permission.AccountPermissions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.permission.AccountPermissions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.permission.AccountPermissions} + */ +proto.permission.AccountPermissions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.permission.BasePermissions; + reader.readMessage(value,proto.permission.BasePermissions.deserializeBinaryFromReader); + msg.setBase(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addRoles(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.permission.AccountPermissions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.permission.AccountPermissions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.permission.AccountPermissions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.permission.AccountPermissions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBase(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.permission.BasePermissions.serializeBinaryToWriter + ); + } + f = message.getRolesList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } +}; + + +/** + * optional BasePermissions Base = 1; + * @return {?proto.permission.BasePermissions} + */ +proto.permission.AccountPermissions.prototype.getBase = function() { + return /** @type{?proto.permission.BasePermissions} */ ( + jspb.Message.getWrapperField(this, proto.permission.BasePermissions, 1)); +}; + + +/** + * @param {?proto.permission.BasePermissions|undefined} value + * @return {!proto.permission.AccountPermissions} returns this +*/ +proto.permission.AccountPermissions.prototype.setBase = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.permission.AccountPermissions} returns this + */ +proto.permission.AccountPermissions.prototype.clearBase = function() { + return this.setBase(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.permission.AccountPermissions.prototype.hasBase = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated string Roles = 2; + * @return {!Array} + */ +proto.permission.AccountPermissions.prototype.getRolesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.permission.AccountPermissions} returns this + */ +proto.permission.AccountPermissions.prototype.setRolesList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.permission.AccountPermissions} returns this + */ +proto.permission.AccountPermissions.prototype.addRoles = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.permission.AccountPermissions} returns this + */ +proto.permission.AccountPermissions.prototype.clearRolesList = function() { + return this.setRolesList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.permission.BasePermissions.prototype.toObject = function(opt_includeInstance) { + return proto.permission.BasePermissions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.permission.BasePermissions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.permission.BasePermissions.toObject = function(includeInstance, msg) { + var f, obj = { + perms: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + setbit: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.permission.BasePermissions} + */ +proto.permission.BasePermissions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.permission.BasePermissions; + return proto.permission.BasePermissions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.permission.BasePermissions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.permission.BasePermissions} + */ +proto.permission.BasePermissions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setPerms(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setSetbit(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.permission.BasePermissions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.permission.BasePermissions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.permission.BasePermissions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.permission.BasePermissions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional uint64 Perms = 1; + * @return {number} + */ +proto.permission.BasePermissions.prototype.getPerms = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.permission.BasePermissions} returns this + */ +proto.permission.BasePermissions.prototype.setPerms = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.permission.BasePermissions} returns this + */ +proto.permission.BasePermissions.prototype.clearPerms = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.permission.BasePermissions.prototype.hasPerms = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional uint64 SetBit = 2; + * @return {number} + */ +proto.permission.BasePermissions.prototype.getSetbit = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.permission.BasePermissions} returns this + */ +proto.permission.BasePermissions.prototype.setSetbit = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.permission.BasePermissions} returns this + */ +proto.permission.BasePermissions.prototype.clearSetbit = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.permission.BasePermissions.prototype.hasSetbit = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.permission.PermArgs.prototype.toObject = function(opt_includeInstance) { + return proto.permission.PermArgs.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.permission.PermArgs} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.permission.PermArgs.toObject = function(includeInstance, msg) { + var f, obj = { + action: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + target: msg.getTarget_asB64(), + permission: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, + role: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, + value: (f = jspb.Message.getBooleanField(msg, 5)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.permission.PermArgs} + */ +proto.permission.PermArgs.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.permission.PermArgs; + return proto.permission.PermArgs.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.permission.PermArgs} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.permission.PermArgs} + */ +proto.permission.PermArgs.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAction(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTarget(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setPermission(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setRole(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.permission.PermArgs.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.permission.PermArgs.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.permission.PermArgs} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.permission.PermArgs.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeUint64( + 1, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint64( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * optional uint64 Action = 1; + * @return {number} + */ +proto.permission.PermArgs.prototype.getAction = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.setAction = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.clearAction = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.permission.PermArgs.prototype.hasAction = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes Target = 2; + * @return {!(string|Uint8Array)} + */ +proto.permission.PermArgs.prototype.getTarget = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Target = 2; + * This is a type-conversion wrapper around `getTarget()` + * @return {string} + */ +proto.permission.PermArgs.prototype.getTarget_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTarget())); +}; + + +/** + * optional bytes Target = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTarget()` + * @return {!Uint8Array} + */ +proto.permission.PermArgs.prototype.getTarget_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTarget())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.setTarget = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.clearTarget = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.permission.PermArgs.prototype.hasTarget = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint64 Permission = 3; + * @return {number} + */ +proto.permission.PermArgs.prototype.getPermission = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.setPermission = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.clearPermission = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.permission.PermArgs.prototype.hasPermission = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string Role = 4; + * @return {string} + */ +proto.permission.PermArgs.prototype.getRole = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.setRole = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.clearRole = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.permission.PermArgs.prototype.hasRole = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional bool Value = 5; + * @return {boolean} + */ +proto.permission.PermArgs.prototype.getValue = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.setValue = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.permission.PermArgs} returns this + */ +proto.permission.PermArgs.prototype.clearValue = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.permission.PermArgs.prototype.hasValue = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +goog.object.extend(exports, proto.permission); diff --git a/js/proto/registry_grpc_pb.js b/js/proto/registry_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/registry_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/registry_pb.d.ts b/js/proto/registry_pb.d.ts new file mode 100644 index 000000000..4d04df7e6 --- /dev/null +++ b/js/proto/registry_pb.d.ts @@ -0,0 +1,45 @@ +// package: registry +// file: registry.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class NodeIdentity extends jspb.Message { + getMoniker(): string; + setMoniker(value: string): NodeIdentity; + + getNetworkaddress(): string; + setNetworkaddress(value: string): NodeIdentity; + + getTendermintnodeid(): Uint8Array | string; + getTendermintnodeid_asU8(): Uint8Array; + getTendermintnodeid_asB64(): string; + setTendermintnodeid(value: Uint8Array | string): NodeIdentity; + + getValidatorpublickey(): Uint8Array | string; + getValidatorpublickey_asU8(): Uint8Array; + getValidatorpublickey_asB64(): string; + setValidatorpublickey(value: Uint8Array | string): NodeIdentity; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NodeIdentity.AsObject; + static toObject(includeInstance: boolean, msg: NodeIdentity): NodeIdentity.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NodeIdentity, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NodeIdentity; + static deserializeBinaryFromReader(message: NodeIdentity, reader: jspb.BinaryReader): NodeIdentity; +} + +export namespace NodeIdentity { + export type AsObject = { + moniker: string, + networkaddress: string, + tendermintnodeid: Uint8Array | string, + validatorpublickey: Uint8Array | string, + } +} diff --git a/js/proto/registry_pb.js b/js/proto/registry_pb.js new file mode 100644 index 000000000..0b9136295 --- /dev/null +++ b/js/proto/registry_pb.js @@ -0,0 +1,309 @@ +// source: registry.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.registry.NodeIdentity', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.registry.NodeIdentity = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.registry.NodeIdentity, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.registry.NodeIdentity.displayName = 'proto.registry.NodeIdentity'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.registry.NodeIdentity.prototype.toObject = function(opt_includeInstance) { + return proto.registry.NodeIdentity.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.registry.NodeIdentity} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.registry.NodeIdentity.toObject = function(includeInstance, msg) { + var f, obj = { + moniker: jspb.Message.getFieldWithDefault(msg, 1, ""), + networkaddress: jspb.Message.getFieldWithDefault(msg, 2, ""), + tendermintnodeid: msg.getTendermintnodeid_asB64(), + validatorpublickey: msg.getValidatorpublickey_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.registry.NodeIdentity} + */ +proto.registry.NodeIdentity.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.registry.NodeIdentity; + return proto.registry.NodeIdentity.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.registry.NodeIdentity} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.registry.NodeIdentity} + */ +proto.registry.NodeIdentity.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMoniker(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setNetworkaddress(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTendermintnodeid(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValidatorpublickey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.registry.NodeIdentity.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.registry.NodeIdentity.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.registry.NodeIdentity} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.registry.NodeIdentity.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMoniker(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getNetworkaddress(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getTendermintnodeid_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getValidatorpublickey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional string Moniker = 1; + * @return {string} + */ +proto.registry.NodeIdentity.prototype.getMoniker = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.registry.NodeIdentity} returns this + */ +proto.registry.NodeIdentity.prototype.setMoniker = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string NetworkAddress = 2; + * @return {string} + */ +proto.registry.NodeIdentity.prototype.getNetworkaddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.registry.NodeIdentity} returns this + */ +proto.registry.NodeIdentity.prototype.setNetworkaddress = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bytes TendermintNodeID = 3; + * @return {!(string|Uint8Array)} + */ +proto.registry.NodeIdentity.prototype.getTendermintnodeid = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes TendermintNodeID = 3; + * This is a type-conversion wrapper around `getTendermintnodeid()` + * @return {string} + */ +proto.registry.NodeIdentity.prototype.getTendermintnodeid_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTendermintnodeid())); +}; + + +/** + * optional bytes TendermintNodeID = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTendermintnodeid()` + * @return {!Uint8Array} + */ +proto.registry.NodeIdentity.prototype.getTendermintnodeid_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTendermintnodeid())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.registry.NodeIdentity} returns this + */ +proto.registry.NodeIdentity.prototype.setTendermintnodeid = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional bytes ValidatorPublicKey = 4; + * @return {!(string|Uint8Array)} + */ +proto.registry.NodeIdentity.prototype.getValidatorpublickey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes ValidatorPublicKey = 4; + * This is a type-conversion wrapper around `getValidatorpublickey()` + * @return {string} + */ +proto.registry.NodeIdentity.prototype.getValidatorpublickey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValidatorpublickey())); +}; + + +/** + * optional bytes ValidatorPublicKey = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValidatorpublickey()` + * @return {!Uint8Array} + */ +proto.registry.NodeIdentity.prototype.getValidatorpublickey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValidatorpublickey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.registry.NodeIdentity} returns this + */ +proto.registry.NodeIdentity.prototype.setValidatorpublickey = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +goog.object.extend(exports, proto.registry); diff --git a/js/proto/rpc_grpc_pb.js b/js/proto/rpc_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/rpc_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/rpc_pb.d.ts b/js/proto/rpc_pb.d.ts new file mode 100644 index 000000000..97771b2c0 --- /dev/null +++ b/js/proto/rpc_pb.d.ts @@ -0,0 +1,71 @@ +// package: rpc +// file: rpc.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as tendermint_pb from "./tendermint_pb"; +import * as validator_pb from "./validator_pb"; +import * as bcm_pb from "./bcm_pb"; + +export class ResultStatus extends jspb.Message { + getChainid(): string; + setChainid(value: string): ResultStatus; + + getRunid(): string; + setRunid(value: string): ResultStatus; + + getBurrowversion(): string; + setBurrowversion(value: string): ResultStatus; + + getGenesishash(): Uint8Array | string; + getGenesishash_asU8(): Uint8Array; + getGenesishash_asB64(): string; + setGenesishash(value: Uint8Array | string): ResultStatus; + + + hasNodeinfo(): boolean; + clearNodeinfo(): void; + getNodeinfo(): tendermint_pb.NodeInfo | undefined; + setNodeinfo(value?: tendermint_pb.NodeInfo): ResultStatus; + + + hasSyncinfo(): boolean; + clearSyncinfo(): void; + getSyncinfo(): bcm_pb.SyncInfo | undefined; + setSyncinfo(value?: bcm_pb.SyncInfo): ResultStatus; + + getCatchingup(): boolean; + setCatchingup(value: boolean): ResultStatus; + + + hasValidatorinfo(): boolean; + clearValidatorinfo(): void; + getValidatorinfo(): validator_pb.Validator | undefined; + setValidatorinfo(value?: validator_pb.Validator): ResultStatus; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResultStatus.AsObject; + static toObject(includeInstance: boolean, msg: ResultStatus): ResultStatus.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResultStatus, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResultStatus; + static deserializeBinaryFromReader(message: ResultStatus, reader: jspb.BinaryReader): ResultStatus; +} + +export namespace ResultStatus { + export type AsObject = { + chainid: string, + runid: string, + burrowversion: string, + genesishash: Uint8Array | string, + nodeinfo?: tendermint_pb.NodeInfo.AsObject, + syncinfo?: bcm_pb.SyncInfo.AsObject, + catchingup: boolean, + validatorinfo?: validator_pb.Validator.AsObject, + } +} diff --git a/js/proto/rpc_pb.js b/js/proto/rpc_pb.js new file mode 100644 index 000000000..fb9146be6 --- /dev/null +++ b/js/proto/rpc_pb.js @@ -0,0 +1,474 @@ +// source: rpc.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_pb = require('./tendermint_pb.js'); +goog.object.extend(proto, tendermint_pb); +var validator_pb = require('./validator_pb.js'); +goog.object.extend(proto, validator_pb); +var bcm_pb = require('./bcm_pb.js'); +goog.object.extend(proto, bcm_pb); +goog.exportSymbol('proto.rpc.ResultStatus', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpc.ResultStatus = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpc.ResultStatus, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpc.ResultStatus.displayName = 'proto.rpc.ResultStatus'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpc.ResultStatus.prototype.toObject = function(opt_includeInstance) { + return proto.rpc.ResultStatus.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpc.ResultStatus} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpc.ResultStatus.toObject = function(includeInstance, msg) { + var f, obj = { + chainid: jspb.Message.getFieldWithDefault(msg, 1, ""), + runid: jspb.Message.getFieldWithDefault(msg, 2, ""), + burrowversion: jspb.Message.getFieldWithDefault(msg, 3, ""), + genesishash: msg.getGenesishash_asB64(), + nodeinfo: (f = msg.getNodeinfo()) && tendermint_pb.NodeInfo.toObject(includeInstance, f), + syncinfo: (f = msg.getSyncinfo()) && bcm_pb.SyncInfo.toObject(includeInstance, f), + catchingup: jspb.Message.getBooleanFieldWithDefault(msg, 8, false), + validatorinfo: (f = msg.getValidatorinfo()) && validator_pb.Validator.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpc.ResultStatus} + */ +proto.rpc.ResultStatus.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpc.ResultStatus; + return proto.rpc.ResultStatus.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpc.ResultStatus} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpc.ResultStatus} + */ +proto.rpc.ResultStatus.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setChainid(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setRunid(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setBurrowversion(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setGenesishash(value); + break; + case 5: + var value = new tendermint_pb.NodeInfo; + reader.readMessage(value,tendermint_pb.NodeInfo.deserializeBinaryFromReader); + msg.setNodeinfo(value); + break; + case 6: + var value = new bcm_pb.SyncInfo; + reader.readMessage(value,bcm_pb.SyncInfo.deserializeBinaryFromReader); + msg.setSyncinfo(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setCatchingup(value); + break; + case 7: + var value = new validator_pb.Validator; + reader.readMessage(value,validator_pb.Validator.deserializeBinaryFromReader); + msg.setValidatorinfo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpc.ResultStatus.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpc.ResultStatus.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpc.ResultStatus} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpc.ResultStatus.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getChainid(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getRunid(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getBurrowversion(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getGenesishash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getNodeinfo(); + if (f != null) { + writer.writeMessage( + 5, + f, + tendermint_pb.NodeInfo.serializeBinaryToWriter + ); + } + f = message.getSyncinfo(); + if (f != null) { + writer.writeMessage( + 6, + f, + bcm_pb.SyncInfo.serializeBinaryToWriter + ); + } + f = message.getCatchingup(); + if (f) { + writer.writeBool( + 8, + f + ); + } + f = message.getValidatorinfo(); + if (f != null) { + writer.writeMessage( + 7, + f, + validator_pb.Validator.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string ChainID = 1; + * @return {string} + */ +proto.rpc.ResultStatus.prototype.getChainid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpc.ResultStatus} returns this + */ +proto.rpc.ResultStatus.prototype.setChainid = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string RunID = 2; + * @return {string} + */ +proto.rpc.ResultStatus.prototype.getRunid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpc.ResultStatus} returns this + */ +proto.rpc.ResultStatus.prototype.setRunid = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string BurrowVersion = 3; + * @return {string} + */ +proto.rpc.ResultStatus.prototype.getBurrowversion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpc.ResultStatus} returns this + */ +proto.rpc.ResultStatus.prototype.setBurrowversion = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional bytes GenesisHash = 4; + * @return {!(string|Uint8Array)} + */ +proto.rpc.ResultStatus.prototype.getGenesishash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes GenesisHash = 4; + * This is a type-conversion wrapper around `getGenesishash()` + * @return {string} + */ +proto.rpc.ResultStatus.prototype.getGenesishash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getGenesishash())); +}; + + +/** + * optional bytes GenesisHash = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getGenesishash()` + * @return {!Uint8Array} + */ +proto.rpc.ResultStatus.prototype.getGenesishash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getGenesishash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpc.ResultStatus} returns this + */ +proto.rpc.ResultStatus.prototype.setGenesishash = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional tendermint.NodeInfo NodeInfo = 5; + * @return {?proto.tendermint.NodeInfo} + */ +proto.rpc.ResultStatus.prototype.getNodeinfo = function() { + return /** @type{?proto.tendermint.NodeInfo} */ ( + jspb.Message.getWrapperField(this, tendermint_pb.NodeInfo, 5)); +}; + + +/** + * @param {?proto.tendermint.NodeInfo|undefined} value + * @return {!proto.rpc.ResultStatus} returns this +*/ +proto.rpc.ResultStatus.prototype.setNodeinfo = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpc.ResultStatus} returns this + */ +proto.rpc.ResultStatus.prototype.clearNodeinfo = function() { + return this.setNodeinfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpc.ResultStatus.prototype.hasNodeinfo = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional bcm.SyncInfo SyncInfo = 6; + * @return {?proto.bcm.SyncInfo} + */ +proto.rpc.ResultStatus.prototype.getSyncinfo = function() { + return /** @type{?proto.bcm.SyncInfo} */ ( + jspb.Message.getWrapperField(this, bcm_pb.SyncInfo, 6)); +}; + + +/** + * @param {?proto.bcm.SyncInfo|undefined} value + * @return {!proto.rpc.ResultStatus} returns this +*/ +proto.rpc.ResultStatus.prototype.setSyncinfo = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpc.ResultStatus} returns this + */ +proto.rpc.ResultStatus.prototype.clearSyncinfo = function() { + return this.setSyncinfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpc.ResultStatus.prototype.hasSyncinfo = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bool CatchingUp = 8; + * @return {boolean} + */ +proto.rpc.ResultStatus.prototype.getCatchingup = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.rpc.ResultStatus} returns this + */ +proto.rpc.ResultStatus.prototype.setCatchingup = function(value) { + return jspb.Message.setProto3BooleanField(this, 8, value); +}; + + +/** + * optional validator.Validator ValidatorInfo = 7; + * @return {?proto.validator.Validator} + */ +proto.rpc.ResultStatus.prototype.getValidatorinfo = function() { + return /** @type{?proto.validator.Validator} */ ( + jspb.Message.getWrapperField(this, validator_pb.Validator, 7)); +}; + + +/** + * @param {?proto.validator.Validator|undefined} value + * @return {!proto.rpc.ResultStatus} returns this +*/ +proto.rpc.ResultStatus.prototype.setValidatorinfo = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpc.ResultStatus} returns this + */ +proto.rpc.ResultStatus.prototype.clearValidatorinfo = function() { + return this.setValidatorinfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpc.ResultStatus.prototype.hasValidatorinfo = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +goog.object.extend(exports, proto.rpc); diff --git a/js/proto/rpcdump_grpc_pb.d.ts b/js/proto/rpcdump_grpc_pb.d.ts new file mode 100644 index 000000000..9ae564151 --- /dev/null +++ b/js/proto/rpcdump_grpc_pb.d.ts @@ -0,0 +1,42 @@ +// package: rpcdump +// file: rpcdump.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; +import * as rpcdump_pb from "./rpcdump_pb"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as dump_pb from "./dump_pb"; + +interface IDumpService extends grpc.ServiceDefinition { + getDump: IDumpService_IGetDump; +} + +interface IDumpService_IGetDump extends grpc.MethodDefinition { + path: "/rpcdump.Dump/GetDump"; + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const DumpService: IDumpService; + +export interface IDumpServer extends grpc.UntypedServiceImplementation { + getDump: grpc.handleServerStreamingCall; +} + +export interface IDumpClient { + getDump(request: rpcdump_pb.GetDumpParam, options?: Partial): grpc.ClientReadableStream; + getDump(request: rpcdump_pb.GetDumpParam, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; +} + +export class DumpClient extends grpc.Client implements IDumpClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public getDump(request: rpcdump_pb.GetDumpParam, options?: Partial): grpc.ClientReadableStream; + public getDump(request: rpcdump_pb.GetDumpParam, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; +} diff --git a/js/proto/rpcdump_grpc_pb.js b/js/proto/rpcdump_grpc_pb.js new file mode 100644 index 000000000..0ff25ed95 --- /dev/null +++ b/js/proto/rpcdump_grpc_pb.js @@ -0,0 +1,44 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var rpcdump_pb = require('./rpcdump_pb.js'); +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +var dump_pb = require('./dump_pb.js'); + +function serialize_dump_Dump(arg) { + if (!(arg instanceof dump_pb.Dump)) { + throw new Error('Expected argument of type dump.Dump'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_dump_Dump(buffer_arg) { + return dump_pb.Dump.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcdump_GetDumpParam(arg) { + if (!(arg instanceof rpcdump_pb.GetDumpParam)) { + throw new Error('Expected argument of type rpcdump.GetDumpParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcdump_GetDumpParam(buffer_arg) { + return rpcdump_pb.GetDumpParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +var DumpService = exports['rpcdump.Dump'] = { + getDump: { + path: '/rpcdump.Dump/GetDump', + requestStream: false, + responseStream: true, + requestType: rpcdump_pb.GetDumpParam, + responseType: dump_pb.Dump, + requestSerialize: serialize_rpcdump_GetDumpParam, + requestDeserialize: deserialize_rpcdump_GetDumpParam, + responseSerialize: serialize_dump_Dump, + responseDeserialize: deserialize_dump_Dump, + }, +}; + diff --git a/js/proto/rpcdump_pb.d.ts b/js/proto/rpcdump_pb.d.ts new file mode 100644 index 000000000..a9ce2be97 --- /dev/null +++ b/js/proto/rpcdump_pb.d.ts @@ -0,0 +1,30 @@ +// package: rpcdump +// file: rpcdump.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as dump_pb from "./dump_pb"; + +export class GetDumpParam extends jspb.Message { + getHeight(): number; + setHeight(value: number): GetDumpParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetDumpParam.AsObject; + static toObject(includeInstance: boolean, msg: GetDumpParam): GetDumpParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetDumpParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetDumpParam; + static deserializeBinaryFromReader(message: GetDumpParam, reader: jspb.BinaryReader): GetDumpParam; +} + +export namespace GetDumpParam { + export type AsObject = { + height: number, + } +} diff --git a/js/proto/rpcdump_pb.js b/js/proto/rpcdump_pb.js new file mode 100644 index 000000000..0a67429c2 --- /dev/null +++ b/js/proto/rpcdump_pb.js @@ -0,0 +1,173 @@ +// source: rpcdump.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var dump_pb = require('./dump_pb.js'); +goog.object.extend(proto, dump_pb); +goog.exportSymbol('proto.rpcdump.GetDumpParam', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcdump.GetDumpParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcdump.GetDumpParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcdump.GetDumpParam.displayName = 'proto.rpcdump.GetDumpParam'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcdump.GetDumpParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcdump.GetDumpParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcdump.GetDumpParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcdump.GetDumpParam.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcdump.GetDumpParam} + */ +proto.rpcdump.GetDumpParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcdump.GetDumpParam; + return proto.rpcdump.GetDumpParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcdump.GetDumpParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcdump.GetDumpParam} + */ +proto.rpcdump.GetDumpParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcdump.GetDumpParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcdump.GetDumpParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcdump.GetDumpParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcdump.GetDumpParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.rpcdump.GetDumpParam.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcdump.GetDumpParam} returns this + */ +proto.rpcdump.GetDumpParam.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +goog.object.extend(exports, proto.rpcdump); diff --git a/js/proto/rpcevents_grpc_pb.d.ts b/js/proto/rpcevents_grpc_pb.d.ts new file mode 100644 index 000000000..f902bcc89 --- /dev/null +++ b/js/proto/rpcevents_grpc_pb.d.ts @@ -0,0 +1,74 @@ +// package: rpcevents +// file: rpcevents.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; +import * as rpcevents_pb from "./rpcevents_pb"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as exec_pb from "./exec_pb"; + +interface IExecutionEventsService extends grpc.ServiceDefinition { + stream: IExecutionEventsService_IStream; + tx: IExecutionEventsService_ITx; + events: IExecutionEventsService_IEvents; +} + +interface IExecutionEventsService_IStream extends grpc.MethodDefinition { + path: "/rpcevents.ExecutionEvents/Stream"; + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IExecutionEventsService_ITx extends grpc.MethodDefinition { + path: "/rpcevents.ExecutionEvents/Tx"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IExecutionEventsService_IEvents extends grpc.MethodDefinition { + path: "/rpcevents.ExecutionEvents/Events"; + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const ExecutionEventsService: IExecutionEventsService; + +export interface IExecutionEventsServer extends grpc.UntypedServiceImplementation { + stream: grpc.handleServerStreamingCall; + tx: grpc.handleUnaryCall; + events: grpc.handleServerStreamingCall; +} + +export interface IExecutionEventsClient { + stream(request: rpcevents_pb.BlocksRequest, options?: Partial): grpc.ClientReadableStream; + stream(request: rpcevents_pb.BlocksRequest, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + tx(request: rpcevents_pb.TxRequest, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + tx(request: rpcevents_pb.TxRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + tx(request: rpcevents_pb.TxRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + events(request: rpcevents_pb.BlocksRequest, options?: Partial): grpc.ClientReadableStream; + events(request: rpcevents_pb.BlocksRequest, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; +} + +export class ExecutionEventsClient extends grpc.Client implements IExecutionEventsClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public stream(request: rpcevents_pb.BlocksRequest, options?: Partial): grpc.ClientReadableStream; + public stream(request: rpcevents_pb.BlocksRequest, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + public tx(request: rpcevents_pb.TxRequest, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public tx(request: rpcevents_pb.TxRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public tx(request: rpcevents_pb.TxRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public events(request: rpcevents_pb.BlocksRequest, options?: Partial): grpc.ClientReadableStream; + public events(request: rpcevents_pb.BlocksRequest, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; +} diff --git a/js/proto/rpcevents_grpc_pb.js b/js/proto/rpcevents_grpc_pb.js new file mode 100644 index 000000000..73e4b7c4d --- /dev/null +++ b/js/proto/rpcevents_grpc_pb.js @@ -0,0 +1,105 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var rpcevents_pb = require('./rpcevents_pb.js'); +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +var exec_pb = require('./exec_pb.js'); + +function serialize_exec_StreamEvent(arg) { + if (!(arg instanceof exec_pb.StreamEvent)) { + throw new Error('Expected argument of type exec.StreamEvent'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_exec_StreamEvent(buffer_arg) { + return exec_pb.StreamEvent.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_exec_TxExecution(arg) { + if (!(arg instanceof exec_pb.TxExecution)) { + throw new Error('Expected argument of type exec.TxExecution'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_exec_TxExecution(buffer_arg) { + return exec_pb.TxExecution.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcevents_BlocksRequest(arg) { + if (!(arg instanceof rpcevents_pb.BlocksRequest)) { + throw new Error('Expected argument of type rpcevents.BlocksRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcevents_BlocksRequest(buffer_arg) { + return rpcevents_pb.BlocksRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcevents_EventsResponse(arg) { + if (!(arg instanceof rpcevents_pb.EventsResponse)) { + throw new Error('Expected argument of type rpcevents.EventsResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcevents_EventsResponse(buffer_arg) { + return rpcevents_pb.EventsResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcevents_TxRequest(arg) { + if (!(arg instanceof rpcevents_pb.TxRequest)) { + throw new Error('Expected argument of type rpcevents.TxRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcevents_TxRequest(buffer_arg) { + return rpcevents_pb.TxRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +// -------------------------------------------------- +// Execution events +var ExecutionEventsService = exports['rpcevents.ExecutionEvents'] = { + // Get StreamEvents (including transactions) for a range of block heights +stream: { + path: '/rpcevents.ExecutionEvents/Stream', + requestStream: false, + responseStream: true, + requestType: rpcevents_pb.BlocksRequest, + responseType: exec_pb.StreamEvent, + requestSerialize: serialize_rpcevents_BlocksRequest, + requestDeserialize: deserialize_rpcevents_BlocksRequest, + responseSerialize: serialize_exec_StreamEvent, + responseDeserialize: deserialize_exec_StreamEvent, + }, + // Get a particular TxExecution by hash +tx: { + path: '/rpcevents.ExecutionEvents/Tx', + requestStream: false, + responseStream: false, + requestType: rpcevents_pb.TxRequest, + responseType: exec_pb.TxExecution, + requestSerialize: serialize_rpcevents_TxRequest, + requestDeserialize: deserialize_rpcevents_TxRequest, + responseSerialize: serialize_exec_TxExecution, + responseDeserialize: deserialize_exec_TxExecution, + }, + // GetEvents provides events streaming one block at a time - that is all events emitted in a particular block +// are guaranteed to be delivered in each GetEventsResponse +events: { + path: '/rpcevents.ExecutionEvents/Events', + requestStream: false, + responseStream: true, + requestType: rpcevents_pb.BlocksRequest, + responseType: rpcevents_pb.EventsResponse, + requestSerialize: serialize_rpcevents_BlocksRequest, + requestDeserialize: deserialize_rpcevents_BlocksRequest, + responseSerialize: serialize_rpcevents_EventsResponse, + responseDeserialize: deserialize_rpcevents_EventsResponse, + }, +}; + diff --git a/js/proto/rpcevents_pb.d.ts b/js/proto/rpcevents_pb.d.ts new file mode 100644 index 000000000..2ee0e4556 --- /dev/null +++ b/js/proto/rpcevents_pb.d.ts @@ -0,0 +1,237 @@ +// package: rpcevents +// file: rpcevents.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as exec_pb from "./exec_pb"; + +export class GetBlockRequest extends jspb.Message { + getHeight(): number; + setHeight(value: number): GetBlockRequest; + + getWait(): boolean; + setWait(value: boolean): GetBlockRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBlockRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetBlockRequest): GetBlockRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetBlockRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBlockRequest; + static deserializeBinaryFromReader(message: GetBlockRequest, reader: jspb.BinaryReader): GetBlockRequest; +} + +export namespace GetBlockRequest { + export type AsObject = { + height: number, + wait: boolean, + } +} + +export class TxRequest extends jspb.Message { + getTxhash(): Uint8Array | string; + getTxhash_asU8(): Uint8Array; + getTxhash_asB64(): string; + setTxhash(value: Uint8Array | string): TxRequest; + + getWait(): boolean; + setWait(value: boolean): TxRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxRequest.AsObject; + static toObject(includeInstance: boolean, msg: TxRequest): TxRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxRequest; + static deserializeBinaryFromReader(message: TxRequest, reader: jspb.BinaryReader): TxRequest; +} + +export namespace TxRequest { + export type AsObject = { + txhash: Uint8Array | string, + wait: boolean, + } +} + +export class BlocksRequest extends jspb.Message { + + hasBlockrange(): boolean; + clearBlockrange(): void; + getBlockrange(): BlockRange | undefined; + setBlockrange(value?: BlockRange): BlocksRequest; + + getQuery(): string; + setQuery(value: string): BlocksRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlocksRequest.AsObject; + static toObject(includeInstance: boolean, msg: BlocksRequest): BlocksRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlocksRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlocksRequest; + static deserializeBinaryFromReader(message: BlocksRequest, reader: jspb.BinaryReader): BlocksRequest; +} + +export namespace BlocksRequest { + export type AsObject = { + blockrange?: BlockRange.AsObject, + query: string, + } +} + +export class EventsResponse extends jspb.Message { + getHeight(): number; + setHeight(value: number): EventsResponse; + + clearEventsList(): void; + getEventsList(): Array; + setEventsList(value: Array): EventsResponse; + addEvents(value?: exec_pb.Event, index?: number): exec_pb.Event; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EventsResponse.AsObject; + static toObject(includeInstance: boolean, msg: EventsResponse): EventsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EventsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EventsResponse; + static deserializeBinaryFromReader(message: EventsResponse, reader: jspb.BinaryReader): EventsResponse; +} + +export namespace EventsResponse { + export type AsObject = { + height: number, + eventsList: Array, + } +} + +export class GetTxsRequest extends jspb.Message { + getStartheight(): number; + setStartheight(value: number): GetTxsRequest; + + getEndheight(): number; + setEndheight(value: number): GetTxsRequest; + + getQuery(): string; + setQuery(value: string): GetTxsRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetTxsRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetTxsRequest): GetTxsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetTxsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetTxsRequest; + static deserializeBinaryFromReader(message: GetTxsRequest, reader: jspb.BinaryReader): GetTxsRequest; +} + +export namespace GetTxsRequest { + export type AsObject = { + startheight: number, + endheight: number, + query: string, + } +} + +export class GetTxsResponse extends jspb.Message { + getHeight(): number; + setHeight(value: number): GetTxsResponse; + + clearTxexecutionsList(): void; + getTxexecutionsList(): Array; + setTxexecutionsList(value: Array): GetTxsResponse; + addTxexecutions(value?: exec_pb.TxExecution, index?: number): exec_pb.TxExecution; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetTxsResponse.AsObject; + static toObject(includeInstance: boolean, msg: GetTxsResponse): GetTxsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetTxsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetTxsResponse; + static deserializeBinaryFromReader(message: GetTxsResponse, reader: jspb.BinaryReader): GetTxsResponse; +} + +export namespace GetTxsResponse { + export type AsObject = { + height: number, + txexecutionsList: Array, + } +} + +export class Bound extends jspb.Message { + getType(): Bound.BoundType; + setType(value: Bound.BoundType): Bound; + + getIndex(): number; + setIndex(value: number): Bound; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Bound.AsObject; + static toObject(includeInstance: boolean, msg: Bound): Bound.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Bound, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Bound; + static deserializeBinaryFromReader(message: Bound, reader: jspb.BinaryReader): Bound; +} + +export namespace Bound { + export type AsObject = { + type: Bound.BoundType, + index: number, + } + + export enum BoundType { + ABSOLUTE = 0, + RELATIVE = 1, + FIRST = 2, + LATEST = 3, + STREAM = 4, + } + +} + +export class BlockRange extends jspb.Message { + + hasStart(): boolean; + clearStart(): void; + getStart(): Bound | undefined; + setStart(value?: Bound): BlockRange; + + + hasEnd(): boolean; + clearEnd(): void; + getEnd(): Bound | undefined; + setEnd(value?: Bound): BlockRange; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockRange.AsObject; + static toObject(includeInstance: boolean, msg: BlockRange): BlockRange.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockRange, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockRange; + static deserializeBinaryFromReader(message: BlockRange, reader: jspb.BinaryReader): BlockRange; +} + +export namespace BlockRange { + export type AsObject = { + start?: Bound.AsObject, + end?: Bound.AsObject, + } +} diff --git a/js/proto/rpcevents_pb.js b/js/proto/rpcevents_pb.js new file mode 100644 index 000000000..b60eb96fa --- /dev/null +++ b/js/proto/rpcevents_pb.js @@ -0,0 +1,1666 @@ +// source: rpcevents.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var exec_pb = require('./exec_pb.js'); +goog.object.extend(proto, exec_pb); +goog.exportSymbol('proto.rpcevents.BlockRange', null, global); +goog.exportSymbol('proto.rpcevents.BlocksRequest', null, global); +goog.exportSymbol('proto.rpcevents.Bound', null, global); +goog.exportSymbol('proto.rpcevents.Bound.BoundType', null, global); +goog.exportSymbol('proto.rpcevents.EventsResponse', null, global); +goog.exportSymbol('proto.rpcevents.GetBlockRequest', null, global); +goog.exportSymbol('proto.rpcevents.GetTxsRequest', null, global); +goog.exportSymbol('proto.rpcevents.GetTxsResponse', null, global); +goog.exportSymbol('proto.rpcevents.TxRequest', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcevents.GetBlockRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcevents.GetBlockRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcevents.GetBlockRequest.displayName = 'proto.rpcevents.GetBlockRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcevents.TxRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcevents.TxRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcevents.TxRequest.displayName = 'proto.rpcevents.TxRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcevents.BlocksRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcevents.BlocksRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcevents.BlocksRequest.displayName = 'proto.rpcevents.BlocksRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcevents.EventsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.rpcevents.EventsResponse.repeatedFields_, null); +}; +goog.inherits(proto.rpcevents.EventsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcevents.EventsResponse.displayName = 'proto.rpcevents.EventsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcevents.GetTxsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcevents.GetTxsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcevents.GetTxsRequest.displayName = 'proto.rpcevents.GetTxsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcevents.GetTxsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.rpcevents.GetTxsResponse.repeatedFields_, null); +}; +goog.inherits(proto.rpcevents.GetTxsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcevents.GetTxsResponse.displayName = 'proto.rpcevents.GetTxsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcevents.Bound = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcevents.Bound, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcevents.Bound.displayName = 'proto.rpcevents.Bound'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcevents.BlockRange = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcevents.BlockRange, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcevents.BlockRange.displayName = 'proto.rpcevents.BlockRange'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcevents.GetBlockRequest.prototype.toObject = function(opt_includeInstance) { + return proto.rpcevents.GetBlockRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcevents.GetBlockRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.GetBlockRequest.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + wait: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcevents.GetBlockRequest} + */ +proto.rpcevents.GetBlockRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcevents.GetBlockRequest; + return proto.rpcevents.GetBlockRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcevents.GetBlockRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcevents.GetBlockRequest} + */ +proto.rpcevents.GetBlockRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setWait(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcevents.GetBlockRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcevents.GetBlockRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcevents.GetBlockRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.GetBlockRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getWait(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.rpcevents.GetBlockRequest.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcevents.GetBlockRequest} returns this + */ +proto.rpcevents.GetBlockRequest.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bool Wait = 2; + * @return {boolean} + */ +proto.rpcevents.GetBlockRequest.prototype.getWait = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.rpcevents.GetBlockRequest} returns this + */ +proto.rpcevents.GetBlockRequest.prototype.setWait = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcevents.TxRequest.prototype.toObject = function(opt_includeInstance) { + return proto.rpcevents.TxRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcevents.TxRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.TxRequest.toObject = function(includeInstance, msg) { + var f, obj = { + txhash: msg.getTxhash_asB64(), + wait: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcevents.TxRequest} + */ +proto.rpcevents.TxRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcevents.TxRequest; + return proto.rpcevents.TxRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcevents.TxRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcevents.TxRequest} + */ +proto.rpcevents.TxRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTxhash(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setWait(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcevents.TxRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcevents.TxRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcevents.TxRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.TxRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxhash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getWait(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional bytes TxHash = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpcevents.TxRequest.prototype.getTxhash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes TxHash = 1; + * This is a type-conversion wrapper around `getTxhash()` + * @return {string} + */ +proto.rpcevents.TxRequest.prototype.getTxhash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTxhash())); +}; + + +/** + * optional bytes TxHash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTxhash()` + * @return {!Uint8Array} + */ +proto.rpcevents.TxRequest.prototype.getTxhash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTxhash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcevents.TxRequest} returns this + */ +proto.rpcevents.TxRequest.prototype.setTxhash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bool Wait = 2; + * @return {boolean} + */ +proto.rpcevents.TxRequest.prototype.getWait = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.rpcevents.TxRequest} returns this + */ +proto.rpcevents.TxRequest.prototype.setWait = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcevents.BlocksRequest.prototype.toObject = function(opt_includeInstance) { + return proto.rpcevents.BlocksRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcevents.BlocksRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.BlocksRequest.toObject = function(includeInstance, msg) { + var f, obj = { + blockrange: (f = msg.getBlockrange()) && proto.rpcevents.BlockRange.toObject(includeInstance, f), + query: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcevents.BlocksRequest} + */ +proto.rpcevents.BlocksRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcevents.BlocksRequest; + return proto.rpcevents.BlocksRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcevents.BlocksRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcevents.BlocksRequest} + */ +proto.rpcevents.BlocksRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.rpcevents.BlockRange; + reader.readMessage(value,proto.rpcevents.BlockRange.deserializeBinaryFromReader); + msg.setBlockrange(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setQuery(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcevents.BlocksRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcevents.BlocksRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcevents.BlocksRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.BlocksRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlockrange(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.rpcevents.BlockRange.serializeBinaryToWriter + ); + } + f = message.getQuery(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional BlockRange BlockRange = 1; + * @return {?proto.rpcevents.BlockRange} + */ +proto.rpcevents.BlocksRequest.prototype.getBlockrange = function() { + return /** @type{?proto.rpcevents.BlockRange} */ ( + jspb.Message.getWrapperField(this, proto.rpcevents.BlockRange, 1)); +}; + + +/** + * @param {?proto.rpcevents.BlockRange|undefined} value + * @return {!proto.rpcevents.BlocksRequest} returns this +*/ +proto.rpcevents.BlocksRequest.prototype.setBlockrange = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpcevents.BlocksRequest} returns this + */ +proto.rpcevents.BlocksRequest.prototype.clearBlockrange = function() { + return this.setBlockrange(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpcevents.BlocksRequest.prototype.hasBlockrange = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string Query = 2; + * @return {string} + */ +proto.rpcevents.BlocksRequest.prototype.getQuery = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpcevents.BlocksRequest} returns this + */ +proto.rpcevents.BlocksRequest.prototype.setQuery = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.rpcevents.EventsResponse.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcevents.EventsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.rpcevents.EventsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcevents.EventsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.EventsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + eventsList: jspb.Message.toObjectList(msg.getEventsList(), + exec_pb.Event.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcevents.EventsResponse} + */ +proto.rpcevents.EventsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcevents.EventsResponse; + return proto.rpcevents.EventsResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcevents.EventsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcevents.EventsResponse} + */ +proto.rpcevents.EventsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = new exec_pb.Event; + reader.readMessage(value,exec_pb.Event.deserializeBinaryFromReader); + msg.addEvents(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcevents.EventsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcevents.EventsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcevents.EventsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.EventsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getEventsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + exec_pb.Event.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.rpcevents.EventsResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcevents.EventsResponse} returns this + */ +proto.rpcevents.EventsResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * repeated exec.Event Events = 2; + * @return {!Array} + */ +proto.rpcevents.EventsResponse.prototype.getEventsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, exec_pb.Event, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.rpcevents.EventsResponse} returns this +*/ +proto.rpcevents.EventsResponse.prototype.setEventsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.exec.Event=} opt_value + * @param {number=} opt_index + * @return {!proto.exec.Event} + */ +proto.rpcevents.EventsResponse.prototype.addEvents = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.exec.Event, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.rpcevents.EventsResponse} returns this + */ +proto.rpcevents.EventsResponse.prototype.clearEventsList = function() { + return this.setEventsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcevents.GetTxsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.rpcevents.GetTxsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcevents.GetTxsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.GetTxsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + startheight: jspb.Message.getFieldWithDefault(msg, 1, 0), + endheight: jspb.Message.getFieldWithDefault(msg, 2, 0), + query: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcevents.GetTxsRequest} + */ +proto.rpcevents.GetTxsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcevents.GetTxsRequest; + return proto.rpcevents.GetTxsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcevents.GetTxsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcevents.GetTxsRequest} + */ +proto.rpcevents.GetTxsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setStartheight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setEndheight(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setQuery(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcevents.GetTxsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcevents.GetTxsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcevents.GetTxsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.GetTxsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStartheight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getEndheight(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getQuery(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional uint64 StartHeight = 1; + * @return {number} + */ +proto.rpcevents.GetTxsRequest.prototype.getStartheight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcevents.GetTxsRequest} returns this + */ +proto.rpcevents.GetTxsRequest.prototype.setStartheight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 EndHeight = 2; + * @return {number} + */ +proto.rpcevents.GetTxsRequest.prototype.getEndheight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcevents.GetTxsRequest} returns this + */ +proto.rpcevents.GetTxsRequest.prototype.setEndheight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional string Query = 3; + * @return {string} + */ +proto.rpcevents.GetTxsRequest.prototype.getQuery = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpcevents.GetTxsRequest} returns this + */ +proto.rpcevents.GetTxsRequest.prototype.setQuery = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.rpcevents.GetTxsResponse.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcevents.GetTxsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.rpcevents.GetTxsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcevents.GetTxsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.GetTxsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + txexecutionsList: jspb.Message.toObjectList(msg.getTxexecutionsList(), + exec_pb.TxExecution.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcevents.GetTxsResponse} + */ +proto.rpcevents.GetTxsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcevents.GetTxsResponse; + return proto.rpcevents.GetTxsResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcevents.GetTxsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcevents.GetTxsResponse} + */ +proto.rpcevents.GetTxsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = new exec_pb.TxExecution; + reader.readMessage(value,exec_pb.TxExecution.deserializeBinaryFromReader); + msg.addTxexecutions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcevents.GetTxsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcevents.GetTxsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcevents.GetTxsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.GetTxsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getTxexecutionsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + exec_pb.TxExecution.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.rpcevents.GetTxsResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcevents.GetTxsResponse} returns this + */ +proto.rpcevents.GetTxsResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * repeated exec.TxExecution TxExecutions = 2; + * @return {!Array} + */ +proto.rpcevents.GetTxsResponse.prototype.getTxexecutionsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, exec_pb.TxExecution, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.rpcevents.GetTxsResponse} returns this +*/ +proto.rpcevents.GetTxsResponse.prototype.setTxexecutionsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.exec.TxExecution=} opt_value + * @param {number=} opt_index + * @return {!proto.exec.TxExecution} + */ +proto.rpcevents.GetTxsResponse.prototype.addTxexecutions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.exec.TxExecution, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.rpcevents.GetTxsResponse} returns this + */ +proto.rpcevents.GetTxsResponse.prototype.clearTxexecutionsList = function() { + return this.setTxexecutionsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcevents.Bound.prototype.toObject = function(opt_includeInstance) { + return proto.rpcevents.Bound.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcevents.Bound} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.Bound.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + index: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcevents.Bound} + */ +proto.rpcevents.Bound.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcevents.Bound; + return proto.rpcevents.Bound.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcevents.Bound} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcevents.Bound} + */ +proto.rpcevents.Bound.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.rpcevents.Bound.BoundType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIndex(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcevents.Bound.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcevents.Bound.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcevents.Bound} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.Bound.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.rpcevents.Bound.BoundType = { + ABSOLUTE: 0, + RELATIVE: 1, + FIRST: 2, + LATEST: 3, + STREAM: 4 +}; + +/** + * optional BoundType Type = 1; + * @return {!proto.rpcevents.Bound.BoundType} + */ +proto.rpcevents.Bound.prototype.getType = function() { + return /** @type {!proto.rpcevents.Bound.BoundType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.rpcevents.Bound.BoundType} value + * @return {!proto.rpcevents.Bound} returns this + */ +proto.rpcevents.Bound.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional uint64 Index = 2; + * @return {number} + */ +proto.rpcevents.Bound.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcevents.Bound} returns this + */ +proto.rpcevents.Bound.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcevents.BlockRange.prototype.toObject = function(opt_includeInstance) { + return proto.rpcevents.BlockRange.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcevents.BlockRange} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.BlockRange.toObject = function(includeInstance, msg) { + var f, obj = { + start: (f = msg.getStart()) && proto.rpcevents.Bound.toObject(includeInstance, f), + end: (f = msg.getEnd()) && proto.rpcevents.Bound.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcevents.BlockRange} + */ +proto.rpcevents.BlockRange.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcevents.BlockRange; + return proto.rpcevents.BlockRange.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcevents.BlockRange} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcevents.BlockRange} + */ +proto.rpcevents.BlockRange.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.rpcevents.Bound; + reader.readMessage(value,proto.rpcevents.Bound.deserializeBinaryFromReader); + msg.setStart(value); + break; + case 2: + var value = new proto.rpcevents.Bound; + reader.readMessage(value,proto.rpcevents.Bound.deserializeBinaryFromReader); + msg.setEnd(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcevents.BlockRange.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcevents.BlockRange.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcevents.BlockRange} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcevents.BlockRange.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStart(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.rpcevents.Bound.serializeBinaryToWriter + ); + } + f = message.getEnd(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.rpcevents.Bound.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Bound Start = 1; + * @return {?proto.rpcevents.Bound} + */ +proto.rpcevents.BlockRange.prototype.getStart = function() { + return /** @type{?proto.rpcevents.Bound} */ ( + jspb.Message.getWrapperField(this, proto.rpcevents.Bound, 1)); +}; + + +/** + * @param {?proto.rpcevents.Bound|undefined} value + * @return {!proto.rpcevents.BlockRange} returns this +*/ +proto.rpcevents.BlockRange.prototype.setStart = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpcevents.BlockRange} returns this + */ +proto.rpcevents.BlockRange.prototype.clearStart = function() { + return this.setStart(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpcevents.BlockRange.prototype.hasStart = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Bound End = 2; + * @return {?proto.rpcevents.Bound} + */ +proto.rpcevents.BlockRange.prototype.getEnd = function() { + return /** @type{?proto.rpcevents.Bound} */ ( + jspb.Message.getWrapperField(this, proto.rpcevents.Bound, 2)); +}; + + +/** + * @param {?proto.rpcevents.Bound|undefined} value + * @return {!proto.rpcevents.BlockRange} returns this +*/ +proto.rpcevents.BlockRange.prototype.setEnd = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpcevents.BlockRange} returns this + */ +proto.rpcevents.BlockRange.prototype.clearEnd = function() { + return this.setEnd(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpcevents.BlockRange.prototype.hasEnd = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +goog.object.extend(exports, proto.rpcevents); diff --git a/js/proto/rpcquery_grpc_pb.d.ts b/js/proto/rpcquery_grpc_pb.d.ts new file mode 100644 index 000000000..2b674d9db --- /dev/null +++ b/js/proto/rpcquery_grpc_pb.d.ts @@ -0,0 +1,265 @@ +// package: rpcquery +// file: rpcquery.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; +import * as rpcquery_pb from "./rpcquery_pb"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as tendermint_types_types_pb from "./tendermint/types/types_pb"; +import * as names_pb from "./names_pb"; +import * as acm_pb from "./acm_pb"; +import * as validator_pb from "./validator_pb"; +import * as registry_pb from "./registry_pb"; +import * as rpc_pb from "./rpc_pb"; +import * as payload_pb from "./payload_pb"; + +interface IQueryService extends grpc.ServiceDefinition { + status: IQueryService_IStatus; + getAccount: IQueryService_IGetAccount; + getMetadata: IQueryService_IGetMetadata; + getStorage: IQueryService_IGetStorage; + listAccounts: IQueryService_IListAccounts; + getName: IQueryService_IGetName; + listNames: IQueryService_IListNames; + getNetworkRegistry: IQueryService_IGetNetworkRegistry; + getValidatorSet: IQueryService_IGetValidatorSet; + getValidatorSetHistory: IQueryService_IGetValidatorSetHistory; + getProposal: IQueryService_IGetProposal; + listProposals: IQueryService_IListProposals; + getStats: IQueryService_IGetStats; + getBlockHeader: IQueryService_IGetBlockHeader; +} + +interface IQueryService_IStatus extends grpc.MethodDefinition { + path: "/rpcquery.Query/Status"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetAccount extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetAccount"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetMetadata extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetMetadata"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetStorage extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetStorage"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IListAccounts extends grpc.MethodDefinition { + path: "/rpcquery.Query/ListAccounts"; + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetName extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetName"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IListNames extends grpc.MethodDefinition { + path: "/rpcquery.Query/ListNames"; + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetNetworkRegistry extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetNetworkRegistry"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetValidatorSet extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetValidatorSet"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetValidatorSetHistory extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetValidatorSetHistory"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetProposal extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetProposal"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IListProposals extends grpc.MethodDefinition { + path: "/rpcquery.Query/ListProposals"; + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetStats extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetStats"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IQueryService_IGetBlockHeader extends grpc.MethodDefinition { + path: "/rpcquery.Query/GetBlockHeader"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const QueryService: IQueryService; + +export interface IQueryServer extends grpc.UntypedServiceImplementation { + status: grpc.handleUnaryCall; + getAccount: grpc.handleUnaryCall; + getMetadata: grpc.handleUnaryCall; + getStorage: grpc.handleUnaryCall; + listAccounts: grpc.handleServerStreamingCall; + getName: grpc.handleUnaryCall; + listNames: grpc.handleServerStreamingCall; + getNetworkRegistry: grpc.handleUnaryCall; + getValidatorSet: grpc.handleUnaryCall; + getValidatorSetHistory: grpc.handleUnaryCall; + getProposal: grpc.handleUnaryCall; + listProposals: grpc.handleServerStreamingCall; + getStats: grpc.handleUnaryCall; + getBlockHeader: grpc.handleUnaryCall; +} + +export interface IQueryClient { + status(request: rpcquery_pb.StatusParam, callback: (error: grpc.ServiceError | null, response: rpc_pb.ResultStatus) => void): grpc.ClientUnaryCall; + status(request: rpcquery_pb.StatusParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpc_pb.ResultStatus) => void): grpc.ClientUnaryCall; + status(request: rpcquery_pb.StatusParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpc_pb.ResultStatus) => void): grpc.ClientUnaryCall; + getAccount(request: rpcquery_pb.GetAccountParam, callback: (error: grpc.ServiceError | null, response: acm_pb.Account) => void): grpc.ClientUnaryCall; + getAccount(request: rpcquery_pb.GetAccountParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: acm_pb.Account) => void): grpc.ClientUnaryCall; + getAccount(request: rpcquery_pb.GetAccountParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: acm_pb.Account) => void): grpc.ClientUnaryCall; + getMetadata(request: rpcquery_pb.GetMetadataParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.MetadataResult) => void): grpc.ClientUnaryCall; + getMetadata(request: rpcquery_pb.GetMetadataParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.MetadataResult) => void): grpc.ClientUnaryCall; + getMetadata(request: rpcquery_pb.GetMetadataParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.MetadataResult) => void): grpc.ClientUnaryCall; + getStorage(request: rpcquery_pb.GetStorageParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.StorageValue) => void): grpc.ClientUnaryCall; + getStorage(request: rpcquery_pb.GetStorageParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.StorageValue) => void): grpc.ClientUnaryCall; + getStorage(request: rpcquery_pb.GetStorageParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.StorageValue) => void): grpc.ClientUnaryCall; + listAccounts(request: rpcquery_pb.ListAccountsParam, options?: Partial): grpc.ClientReadableStream; + listAccounts(request: rpcquery_pb.ListAccountsParam, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + getName(request: rpcquery_pb.GetNameParam, callback: (error: grpc.ServiceError | null, response: names_pb.Entry) => void): grpc.ClientUnaryCall; + getName(request: rpcquery_pb.GetNameParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: names_pb.Entry) => void): grpc.ClientUnaryCall; + getName(request: rpcquery_pb.GetNameParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: names_pb.Entry) => void): grpc.ClientUnaryCall; + listNames(request: rpcquery_pb.ListNamesParam, options?: Partial): grpc.ClientReadableStream; + listNames(request: rpcquery_pb.ListNamesParam, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + getNetworkRegistry(request: rpcquery_pb.GetNetworkRegistryParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.NetworkRegistry) => void): grpc.ClientUnaryCall; + getNetworkRegistry(request: rpcquery_pb.GetNetworkRegistryParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.NetworkRegistry) => void): grpc.ClientUnaryCall; + getNetworkRegistry(request: rpcquery_pb.GetNetworkRegistryParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.NetworkRegistry) => void): grpc.ClientUnaryCall; + getValidatorSet(request: rpcquery_pb.GetValidatorSetParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSet) => void): grpc.ClientUnaryCall; + getValidatorSet(request: rpcquery_pb.GetValidatorSetParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSet) => void): grpc.ClientUnaryCall; + getValidatorSet(request: rpcquery_pb.GetValidatorSetParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSet) => void): grpc.ClientUnaryCall; + getValidatorSetHistory(request: rpcquery_pb.GetValidatorSetHistoryParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSetHistory) => void): grpc.ClientUnaryCall; + getValidatorSetHistory(request: rpcquery_pb.GetValidatorSetHistoryParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSetHistory) => void): grpc.ClientUnaryCall; + getValidatorSetHistory(request: rpcquery_pb.GetValidatorSetHistoryParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSetHistory) => void): grpc.ClientUnaryCall; + getProposal(request: rpcquery_pb.GetProposalParam, callback: (error: grpc.ServiceError | null, response: payload_pb.Ballot) => void): grpc.ClientUnaryCall; + getProposal(request: rpcquery_pb.GetProposalParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: payload_pb.Ballot) => void): grpc.ClientUnaryCall; + getProposal(request: rpcquery_pb.GetProposalParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: payload_pb.Ballot) => void): grpc.ClientUnaryCall; + listProposals(request: rpcquery_pb.ListProposalsParam, options?: Partial): grpc.ClientReadableStream; + listProposals(request: rpcquery_pb.ListProposalsParam, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + getStats(request: rpcquery_pb.GetStatsParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.Stats) => void): grpc.ClientUnaryCall; + getStats(request: rpcquery_pb.GetStatsParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.Stats) => void): grpc.ClientUnaryCall; + getStats(request: rpcquery_pb.GetStatsParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.Stats) => void): grpc.ClientUnaryCall; + getBlockHeader(request: rpcquery_pb.GetBlockParam, callback: (error: grpc.ServiceError | null, response: tendermint_types_types_pb.Header) => void): grpc.ClientUnaryCall; + getBlockHeader(request: rpcquery_pb.GetBlockParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_types_types_pb.Header) => void): grpc.ClientUnaryCall; + getBlockHeader(request: rpcquery_pb.GetBlockParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_types_types_pb.Header) => void): grpc.ClientUnaryCall; +} + +export class QueryClient extends grpc.Client implements IQueryClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public status(request: rpcquery_pb.StatusParam, callback: (error: grpc.ServiceError | null, response: rpc_pb.ResultStatus) => void): grpc.ClientUnaryCall; + public status(request: rpcquery_pb.StatusParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpc_pb.ResultStatus) => void): grpc.ClientUnaryCall; + public status(request: rpcquery_pb.StatusParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpc_pb.ResultStatus) => void): grpc.ClientUnaryCall; + public getAccount(request: rpcquery_pb.GetAccountParam, callback: (error: grpc.ServiceError | null, response: acm_pb.Account) => void): grpc.ClientUnaryCall; + public getAccount(request: rpcquery_pb.GetAccountParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: acm_pb.Account) => void): grpc.ClientUnaryCall; + public getAccount(request: rpcquery_pb.GetAccountParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: acm_pb.Account) => void): grpc.ClientUnaryCall; + public getMetadata(request: rpcquery_pb.GetMetadataParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.MetadataResult) => void): grpc.ClientUnaryCall; + public getMetadata(request: rpcquery_pb.GetMetadataParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.MetadataResult) => void): grpc.ClientUnaryCall; + public getMetadata(request: rpcquery_pb.GetMetadataParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.MetadataResult) => void): grpc.ClientUnaryCall; + public getStorage(request: rpcquery_pb.GetStorageParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.StorageValue) => void): grpc.ClientUnaryCall; + public getStorage(request: rpcquery_pb.GetStorageParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.StorageValue) => void): grpc.ClientUnaryCall; + public getStorage(request: rpcquery_pb.GetStorageParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.StorageValue) => void): grpc.ClientUnaryCall; + public listAccounts(request: rpcquery_pb.ListAccountsParam, options?: Partial): grpc.ClientReadableStream; + public listAccounts(request: rpcquery_pb.ListAccountsParam, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + public getName(request: rpcquery_pb.GetNameParam, callback: (error: grpc.ServiceError | null, response: names_pb.Entry) => void): grpc.ClientUnaryCall; + public getName(request: rpcquery_pb.GetNameParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: names_pb.Entry) => void): grpc.ClientUnaryCall; + public getName(request: rpcquery_pb.GetNameParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: names_pb.Entry) => void): grpc.ClientUnaryCall; + public listNames(request: rpcquery_pb.ListNamesParam, options?: Partial): grpc.ClientReadableStream; + public listNames(request: rpcquery_pb.ListNamesParam, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + public getNetworkRegistry(request: rpcquery_pb.GetNetworkRegistryParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.NetworkRegistry) => void): grpc.ClientUnaryCall; + public getNetworkRegistry(request: rpcquery_pb.GetNetworkRegistryParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.NetworkRegistry) => void): grpc.ClientUnaryCall; + public getNetworkRegistry(request: rpcquery_pb.GetNetworkRegistryParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.NetworkRegistry) => void): grpc.ClientUnaryCall; + public getValidatorSet(request: rpcquery_pb.GetValidatorSetParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSet) => void): grpc.ClientUnaryCall; + public getValidatorSet(request: rpcquery_pb.GetValidatorSetParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSet) => void): grpc.ClientUnaryCall; + public getValidatorSet(request: rpcquery_pb.GetValidatorSetParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSet) => void): grpc.ClientUnaryCall; + public getValidatorSetHistory(request: rpcquery_pb.GetValidatorSetHistoryParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSetHistory) => void): grpc.ClientUnaryCall; + public getValidatorSetHistory(request: rpcquery_pb.GetValidatorSetHistoryParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSetHistory) => void): grpc.ClientUnaryCall; + public getValidatorSetHistory(request: rpcquery_pb.GetValidatorSetHistoryParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.ValidatorSetHistory) => void): grpc.ClientUnaryCall; + public getProposal(request: rpcquery_pb.GetProposalParam, callback: (error: grpc.ServiceError | null, response: payload_pb.Ballot) => void): grpc.ClientUnaryCall; + public getProposal(request: rpcquery_pb.GetProposalParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: payload_pb.Ballot) => void): grpc.ClientUnaryCall; + public getProposal(request: rpcquery_pb.GetProposalParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: payload_pb.Ballot) => void): grpc.ClientUnaryCall; + public listProposals(request: rpcquery_pb.ListProposalsParam, options?: Partial): grpc.ClientReadableStream; + public listProposals(request: rpcquery_pb.ListProposalsParam, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + public getStats(request: rpcquery_pb.GetStatsParam, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.Stats) => void): grpc.ClientUnaryCall; + public getStats(request: rpcquery_pb.GetStatsParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.Stats) => void): grpc.ClientUnaryCall; + public getStats(request: rpcquery_pb.GetStatsParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpcquery_pb.Stats) => void): grpc.ClientUnaryCall; + public getBlockHeader(request: rpcquery_pb.GetBlockParam, callback: (error: grpc.ServiceError | null, response: tendermint_types_types_pb.Header) => void): grpc.ClientUnaryCall; + public getBlockHeader(request: rpcquery_pb.GetBlockParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_types_types_pb.Header) => void): grpc.ClientUnaryCall; + public getBlockHeader(request: rpcquery_pb.GetBlockParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_types_types_pb.Header) => void): grpc.ClientUnaryCall; +} diff --git a/js/proto/rpcquery_grpc_pb.js b/js/proto/rpcquery_grpc_pb.js new file mode 100644 index 000000000..167b96146 --- /dev/null +++ b/js/proto/rpcquery_grpc_pb.js @@ -0,0 +1,458 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var rpcquery_pb = require('./rpcquery_pb.js'); +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +var tendermint_types_types_pb = require('./tendermint/types/types_pb.js'); +var names_pb = require('./names_pb.js'); +var acm_pb = require('./acm_pb.js'); +var validator_pb = require('./validator_pb.js'); +var registry_pb = require('./registry_pb.js'); +var rpc_pb = require('./rpc_pb.js'); +var payload_pb = require('./payload_pb.js'); + +function serialize_acm_Account(arg) { + if (!(arg instanceof acm_pb.Account)) { + throw new Error('Expected argument of type acm.Account'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_acm_Account(buffer_arg) { + return acm_pb.Account.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_names_Entry(arg) { + if (!(arg instanceof names_pb.Entry)) { + throw new Error('Expected argument of type names.Entry'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_names_Entry(buffer_arg) { + return names_pb.Entry.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_payload_Ballot(arg) { + if (!(arg instanceof payload_pb.Ballot)) { + throw new Error('Expected argument of type payload.Ballot'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_payload_Ballot(buffer_arg) { + return payload_pb.Ballot.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpc_ResultStatus(arg) { + if (!(arg instanceof rpc_pb.ResultStatus)) { + throw new Error('Expected argument of type rpc.ResultStatus'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpc_ResultStatus(buffer_arg) { + return rpc_pb.ResultStatus.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetAccountParam(arg) { + if (!(arg instanceof rpcquery_pb.GetAccountParam)) { + throw new Error('Expected argument of type rpcquery.GetAccountParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetAccountParam(buffer_arg) { + return rpcquery_pb.GetAccountParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetBlockParam(arg) { + if (!(arg instanceof rpcquery_pb.GetBlockParam)) { + throw new Error('Expected argument of type rpcquery.GetBlockParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetBlockParam(buffer_arg) { + return rpcquery_pb.GetBlockParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetMetadataParam(arg) { + if (!(arg instanceof rpcquery_pb.GetMetadataParam)) { + throw new Error('Expected argument of type rpcquery.GetMetadataParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetMetadataParam(buffer_arg) { + return rpcquery_pb.GetMetadataParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetNameParam(arg) { + if (!(arg instanceof rpcquery_pb.GetNameParam)) { + throw new Error('Expected argument of type rpcquery.GetNameParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetNameParam(buffer_arg) { + return rpcquery_pb.GetNameParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetNetworkRegistryParam(arg) { + if (!(arg instanceof rpcquery_pb.GetNetworkRegistryParam)) { + throw new Error('Expected argument of type rpcquery.GetNetworkRegistryParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetNetworkRegistryParam(buffer_arg) { + return rpcquery_pb.GetNetworkRegistryParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetProposalParam(arg) { + if (!(arg instanceof rpcquery_pb.GetProposalParam)) { + throw new Error('Expected argument of type rpcquery.GetProposalParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetProposalParam(buffer_arg) { + return rpcquery_pb.GetProposalParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetStatsParam(arg) { + if (!(arg instanceof rpcquery_pb.GetStatsParam)) { + throw new Error('Expected argument of type rpcquery.GetStatsParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetStatsParam(buffer_arg) { + return rpcquery_pb.GetStatsParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetStorageParam(arg) { + if (!(arg instanceof rpcquery_pb.GetStorageParam)) { + throw new Error('Expected argument of type rpcquery.GetStorageParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetStorageParam(buffer_arg) { + return rpcquery_pb.GetStorageParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetValidatorSetHistoryParam(arg) { + if (!(arg instanceof rpcquery_pb.GetValidatorSetHistoryParam)) { + throw new Error('Expected argument of type rpcquery.GetValidatorSetHistoryParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetValidatorSetHistoryParam(buffer_arg) { + return rpcquery_pb.GetValidatorSetHistoryParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_GetValidatorSetParam(arg) { + if (!(arg instanceof rpcquery_pb.GetValidatorSetParam)) { + throw new Error('Expected argument of type rpcquery.GetValidatorSetParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_GetValidatorSetParam(buffer_arg) { + return rpcquery_pb.GetValidatorSetParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_ListAccountsParam(arg) { + if (!(arg instanceof rpcquery_pb.ListAccountsParam)) { + throw new Error('Expected argument of type rpcquery.ListAccountsParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_ListAccountsParam(buffer_arg) { + return rpcquery_pb.ListAccountsParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_ListNamesParam(arg) { + if (!(arg instanceof rpcquery_pb.ListNamesParam)) { + throw new Error('Expected argument of type rpcquery.ListNamesParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_ListNamesParam(buffer_arg) { + return rpcquery_pb.ListNamesParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_ListProposalsParam(arg) { + if (!(arg instanceof rpcquery_pb.ListProposalsParam)) { + throw new Error('Expected argument of type rpcquery.ListProposalsParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_ListProposalsParam(buffer_arg) { + return rpcquery_pb.ListProposalsParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_MetadataResult(arg) { + if (!(arg instanceof rpcquery_pb.MetadataResult)) { + throw new Error('Expected argument of type rpcquery.MetadataResult'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_MetadataResult(buffer_arg) { + return rpcquery_pb.MetadataResult.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_NetworkRegistry(arg) { + if (!(arg instanceof rpcquery_pb.NetworkRegistry)) { + throw new Error('Expected argument of type rpcquery.NetworkRegistry'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_NetworkRegistry(buffer_arg) { + return rpcquery_pb.NetworkRegistry.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_ProposalResult(arg) { + if (!(arg instanceof rpcquery_pb.ProposalResult)) { + throw new Error('Expected argument of type rpcquery.ProposalResult'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_ProposalResult(buffer_arg) { + return rpcquery_pb.ProposalResult.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_Stats(arg) { + if (!(arg instanceof rpcquery_pb.Stats)) { + throw new Error('Expected argument of type rpcquery.Stats'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_Stats(buffer_arg) { + return rpcquery_pb.Stats.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_StatusParam(arg) { + if (!(arg instanceof rpcquery_pb.StatusParam)) { + throw new Error('Expected argument of type rpcquery.StatusParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_StatusParam(buffer_arg) { + return rpcquery_pb.StatusParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_StorageValue(arg) { + if (!(arg instanceof rpcquery_pb.StorageValue)) { + throw new Error('Expected argument of type rpcquery.StorageValue'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_StorageValue(buffer_arg) { + return rpcquery_pb.StorageValue.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_ValidatorSet(arg) { + if (!(arg instanceof rpcquery_pb.ValidatorSet)) { + throw new Error('Expected argument of type rpcquery.ValidatorSet'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_ValidatorSet(buffer_arg) { + return rpcquery_pb.ValidatorSet.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpcquery_ValidatorSetHistory(arg) { + if (!(arg instanceof rpcquery_pb.ValidatorSetHistory)) { + throw new Error('Expected argument of type rpcquery.ValidatorSetHistory'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpcquery_ValidatorSetHistory(buffer_arg) { + return rpcquery_pb.ValidatorSetHistory.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_types_Header(arg) { + if (!(arg instanceof tendermint_types_types_pb.Header)) { + throw new Error('Expected argument of type tendermint.types.Header'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_types_Header(buffer_arg) { + return tendermint_types_types_pb.Header.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +var QueryService = exports['rpcquery.Query'] = { + status: { + path: '/rpcquery.Query/Status', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.StatusParam, + responseType: rpc_pb.ResultStatus, + requestSerialize: serialize_rpcquery_StatusParam, + requestDeserialize: deserialize_rpcquery_StatusParam, + responseSerialize: serialize_rpc_ResultStatus, + responseDeserialize: deserialize_rpc_ResultStatus, + }, + getAccount: { + path: '/rpcquery.Query/GetAccount', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetAccountParam, + responseType: acm_pb.Account, + requestSerialize: serialize_rpcquery_GetAccountParam, + requestDeserialize: deserialize_rpcquery_GetAccountParam, + responseSerialize: serialize_acm_Account, + responseDeserialize: deserialize_acm_Account, + }, + getMetadata: { + path: '/rpcquery.Query/GetMetadata', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetMetadataParam, + responseType: rpcquery_pb.MetadataResult, + requestSerialize: serialize_rpcquery_GetMetadataParam, + requestDeserialize: deserialize_rpcquery_GetMetadataParam, + responseSerialize: serialize_rpcquery_MetadataResult, + responseDeserialize: deserialize_rpcquery_MetadataResult, + }, + getStorage: { + path: '/rpcquery.Query/GetStorage', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetStorageParam, + responseType: rpcquery_pb.StorageValue, + requestSerialize: serialize_rpcquery_GetStorageParam, + requestDeserialize: deserialize_rpcquery_GetStorageParam, + responseSerialize: serialize_rpcquery_StorageValue, + responseDeserialize: deserialize_rpcquery_StorageValue, + }, + listAccounts: { + path: '/rpcquery.Query/ListAccounts', + requestStream: false, + responseStream: true, + requestType: rpcquery_pb.ListAccountsParam, + responseType: acm_pb.Account, + requestSerialize: serialize_rpcquery_ListAccountsParam, + requestDeserialize: deserialize_rpcquery_ListAccountsParam, + responseSerialize: serialize_acm_Account, + responseDeserialize: deserialize_acm_Account, + }, + getName: { + path: '/rpcquery.Query/GetName', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetNameParam, + responseType: names_pb.Entry, + requestSerialize: serialize_rpcquery_GetNameParam, + requestDeserialize: deserialize_rpcquery_GetNameParam, + responseSerialize: serialize_names_Entry, + responseDeserialize: deserialize_names_Entry, + }, + listNames: { + path: '/rpcquery.Query/ListNames', + requestStream: false, + responseStream: true, + requestType: rpcquery_pb.ListNamesParam, + responseType: names_pb.Entry, + requestSerialize: serialize_rpcquery_ListNamesParam, + requestDeserialize: deserialize_rpcquery_ListNamesParam, + responseSerialize: serialize_names_Entry, + responseDeserialize: deserialize_names_Entry, + }, + // GetNetworkRegistry returns for each validator address, the list of their identified node at the current state +getNetworkRegistry: { + path: '/rpcquery.Query/GetNetworkRegistry', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetNetworkRegistryParam, + responseType: rpcquery_pb.NetworkRegistry, + requestSerialize: serialize_rpcquery_GetNetworkRegistryParam, + requestDeserialize: deserialize_rpcquery_GetNetworkRegistryParam, + responseSerialize: serialize_rpcquery_NetworkRegistry, + responseDeserialize: deserialize_rpcquery_NetworkRegistry, + }, + getValidatorSet: { + path: '/rpcquery.Query/GetValidatorSet', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetValidatorSetParam, + responseType: rpcquery_pb.ValidatorSet, + requestSerialize: serialize_rpcquery_GetValidatorSetParam, + requestDeserialize: deserialize_rpcquery_GetValidatorSetParam, + responseSerialize: serialize_rpcquery_ValidatorSet, + responseDeserialize: deserialize_rpcquery_ValidatorSet, + }, + getValidatorSetHistory: { + path: '/rpcquery.Query/GetValidatorSetHistory', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetValidatorSetHistoryParam, + responseType: rpcquery_pb.ValidatorSetHistory, + requestSerialize: serialize_rpcquery_GetValidatorSetHistoryParam, + requestDeserialize: deserialize_rpcquery_GetValidatorSetHistoryParam, + responseSerialize: serialize_rpcquery_ValidatorSetHistory, + responseDeserialize: deserialize_rpcquery_ValidatorSetHistory, + }, + getProposal: { + path: '/rpcquery.Query/GetProposal', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetProposalParam, + responseType: payload_pb.Ballot, + requestSerialize: serialize_rpcquery_GetProposalParam, + requestDeserialize: deserialize_rpcquery_GetProposalParam, + responseSerialize: serialize_payload_Ballot, + responseDeserialize: deserialize_payload_Ballot, + }, + listProposals: { + path: '/rpcquery.Query/ListProposals', + requestStream: false, + responseStream: true, + requestType: rpcquery_pb.ListProposalsParam, + responseType: rpcquery_pb.ProposalResult, + requestSerialize: serialize_rpcquery_ListProposalsParam, + requestDeserialize: deserialize_rpcquery_ListProposalsParam, + responseSerialize: serialize_rpcquery_ProposalResult, + responseDeserialize: deserialize_rpcquery_ProposalResult, + }, + getStats: { + path: '/rpcquery.Query/GetStats', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetStatsParam, + responseType: rpcquery_pb.Stats, + requestSerialize: serialize_rpcquery_GetStatsParam, + requestDeserialize: deserialize_rpcquery_GetStatsParam, + responseSerialize: serialize_rpcquery_Stats, + responseDeserialize: deserialize_rpcquery_Stats, + }, + getBlockHeader: { + path: '/rpcquery.Query/GetBlockHeader', + requestStream: false, + responseStream: false, + requestType: rpcquery_pb.GetBlockParam, + responseType: tendermint_types_types_pb.Header, + requestSerialize: serialize_rpcquery_GetBlockParam, + requestDeserialize: deserialize_rpcquery_GetBlockParam, + responseSerialize: serialize_tendermint_types_Header, + responseDeserialize: deserialize_tendermint_types_Header, + }, +}; + diff --git a/js/proto/rpcquery_pb.d.ts b/js/proto/rpcquery_pb.d.ts new file mode 100644 index 000000000..4b0a6db91 --- /dev/null +++ b/js/proto/rpcquery_pb.d.ts @@ -0,0 +1,523 @@ +// package: rpcquery +// file: rpcquery.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as tendermint_types_types_pb from "./tendermint/types/types_pb"; +import * as names_pb from "./names_pb"; +import * as acm_pb from "./acm_pb"; +import * as validator_pb from "./validator_pb"; +import * as registry_pb from "./registry_pb"; +import * as rpc_pb from "./rpc_pb"; +import * as payload_pb from "./payload_pb"; + +export class StatusParam extends jspb.Message { + getBlocktimewithin(): string; + setBlocktimewithin(value: string): StatusParam; + + getBlockseentimewithin(): string; + setBlockseentimewithin(value: string): StatusParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StatusParam.AsObject; + static toObject(includeInstance: boolean, msg: StatusParam): StatusParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StatusParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StatusParam; + static deserializeBinaryFromReader(message: StatusParam, reader: jspb.BinaryReader): StatusParam; +} + +export namespace StatusParam { + export type AsObject = { + blocktimewithin: string, + blockseentimewithin: string, + } +} + +export class GetAccountParam extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): GetAccountParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetAccountParam.AsObject; + static toObject(includeInstance: boolean, msg: GetAccountParam): GetAccountParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetAccountParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetAccountParam; + static deserializeBinaryFromReader(message: GetAccountParam, reader: jspb.BinaryReader): GetAccountParam; +} + +export namespace GetAccountParam { + export type AsObject = { + address: Uint8Array | string, + } +} + +export class GetMetadataParam extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): GetMetadataParam; + + getMetadatahash(): Uint8Array | string; + getMetadatahash_asU8(): Uint8Array; + getMetadatahash_asB64(): string; + setMetadatahash(value: Uint8Array | string): GetMetadataParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetMetadataParam.AsObject; + static toObject(includeInstance: boolean, msg: GetMetadataParam): GetMetadataParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetMetadataParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetMetadataParam; + static deserializeBinaryFromReader(message: GetMetadataParam, reader: jspb.BinaryReader): GetMetadataParam; +} + +export namespace GetMetadataParam { + export type AsObject = { + address: Uint8Array | string, + metadatahash: Uint8Array | string, + } +} + +export class MetadataResult extends jspb.Message { + getMetadata(): string; + setMetadata(value: string): MetadataResult; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MetadataResult.AsObject; + static toObject(includeInstance: boolean, msg: MetadataResult): MetadataResult.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MetadataResult, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MetadataResult; + static deserializeBinaryFromReader(message: MetadataResult, reader: jspb.BinaryReader): MetadataResult; +} + +export namespace MetadataResult { + export type AsObject = { + metadata: string, + } +} + +export class GetStorageParam extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): GetStorageParam; + + getKey(): Uint8Array | string; + getKey_asU8(): Uint8Array; + getKey_asB64(): string; + setKey(value: Uint8Array | string): GetStorageParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetStorageParam.AsObject; + static toObject(includeInstance: boolean, msg: GetStorageParam): GetStorageParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetStorageParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetStorageParam; + static deserializeBinaryFromReader(message: GetStorageParam, reader: jspb.BinaryReader): GetStorageParam; +} + +export namespace GetStorageParam { + export type AsObject = { + address: Uint8Array | string, + key: Uint8Array | string, + } +} + +export class StorageValue extends jspb.Message { + getValue(): Uint8Array | string; + getValue_asU8(): Uint8Array; + getValue_asB64(): string; + setValue(value: Uint8Array | string): StorageValue; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StorageValue.AsObject; + static toObject(includeInstance: boolean, msg: StorageValue): StorageValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StorageValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StorageValue; + static deserializeBinaryFromReader(message: StorageValue, reader: jspb.BinaryReader): StorageValue; +} + +export namespace StorageValue { + export type AsObject = { + value: Uint8Array | string, + } +} + +export class ListAccountsParam extends jspb.Message { + getQuery(): string; + setQuery(value: string): ListAccountsParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListAccountsParam.AsObject; + static toObject(includeInstance: boolean, msg: ListAccountsParam): ListAccountsParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListAccountsParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListAccountsParam; + static deserializeBinaryFromReader(message: ListAccountsParam, reader: jspb.BinaryReader): ListAccountsParam; +} + +export namespace ListAccountsParam { + export type AsObject = { + query: string, + } +} + +export class GetNameParam extends jspb.Message { + getName(): string; + setName(value: string): GetNameParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetNameParam.AsObject; + static toObject(includeInstance: boolean, msg: GetNameParam): GetNameParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetNameParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetNameParam; + static deserializeBinaryFromReader(message: GetNameParam, reader: jspb.BinaryReader): GetNameParam; +} + +export namespace GetNameParam { + export type AsObject = { + name: string, + } +} + +export class ListNamesParam extends jspb.Message { + getQuery(): string; + setQuery(value: string): ListNamesParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListNamesParam.AsObject; + static toObject(includeInstance: boolean, msg: ListNamesParam): ListNamesParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListNamesParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListNamesParam; + static deserializeBinaryFromReader(message: ListNamesParam, reader: jspb.BinaryReader): ListNamesParam; +} + +export namespace ListNamesParam { + export type AsObject = { + query: string, + } +} + +export class GetNetworkRegistryParam extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetNetworkRegistryParam.AsObject; + static toObject(includeInstance: boolean, msg: GetNetworkRegistryParam): GetNetworkRegistryParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetNetworkRegistryParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetNetworkRegistryParam; + static deserializeBinaryFromReader(message: GetNetworkRegistryParam, reader: jspb.BinaryReader): GetNetworkRegistryParam; +} + +export namespace GetNetworkRegistryParam { + export type AsObject = { + } +} + +export class GetValidatorSetParam extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetValidatorSetParam.AsObject; + static toObject(includeInstance: boolean, msg: GetValidatorSetParam): GetValidatorSetParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetValidatorSetParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetValidatorSetParam; + static deserializeBinaryFromReader(message: GetValidatorSetParam, reader: jspb.BinaryReader): GetValidatorSetParam; +} + +export namespace GetValidatorSetParam { + export type AsObject = { + } +} + +export class GetValidatorSetHistoryParam extends jspb.Message { + getIncludeprevious(): number; + setIncludeprevious(value: number): GetValidatorSetHistoryParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetValidatorSetHistoryParam.AsObject; + static toObject(includeInstance: boolean, msg: GetValidatorSetHistoryParam): GetValidatorSetHistoryParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetValidatorSetHistoryParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetValidatorSetHistoryParam; + static deserializeBinaryFromReader(message: GetValidatorSetHistoryParam, reader: jspb.BinaryReader): GetValidatorSetHistoryParam; +} + +export namespace GetValidatorSetHistoryParam { + export type AsObject = { + includeprevious: number, + } +} + +export class NetworkRegistry extends jspb.Message { + clearSetList(): void; + getSetList(): Array; + setSetList(value: Array): NetworkRegistry; + addSet(value?: RegisteredValidator, index?: number): RegisteredValidator; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NetworkRegistry.AsObject; + static toObject(includeInstance: boolean, msg: NetworkRegistry): NetworkRegistry.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NetworkRegistry, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NetworkRegistry; + static deserializeBinaryFromReader(message: NetworkRegistry, reader: jspb.BinaryReader): NetworkRegistry; +} + +export namespace NetworkRegistry { + export type AsObject = { + setList: Array, + } +} + +export class RegisteredValidator extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): RegisteredValidator; + + + hasNode(): boolean; + clearNode(): void; + getNode(): registry_pb.NodeIdentity | undefined; + setNode(value?: registry_pb.NodeIdentity): RegisteredValidator; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RegisteredValidator.AsObject; + static toObject(includeInstance: boolean, msg: RegisteredValidator): RegisteredValidator.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RegisteredValidator, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RegisteredValidator; + static deserializeBinaryFromReader(message: RegisteredValidator, reader: jspb.BinaryReader): RegisteredValidator; +} + +export namespace RegisteredValidator { + export type AsObject = { + address: Uint8Array | string, + node?: registry_pb.NodeIdentity.AsObject, + } +} + +export class ValidatorSetHistory extends jspb.Message { + clearHistoryList(): void; + getHistoryList(): Array; + setHistoryList(value: Array): ValidatorSetHistory; + addHistory(value?: ValidatorSet, index?: number): ValidatorSet; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ValidatorSetHistory.AsObject; + static toObject(includeInstance: boolean, msg: ValidatorSetHistory): ValidatorSetHistory.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ValidatorSetHistory, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ValidatorSetHistory; + static deserializeBinaryFromReader(message: ValidatorSetHistory, reader: jspb.BinaryReader): ValidatorSetHistory; +} + +export namespace ValidatorSetHistory { + export type AsObject = { + historyList: Array, + } +} + +export class ValidatorSet extends jspb.Message { + getHeight(): number; + setHeight(value: number): ValidatorSet; + + clearSetList(): void; + getSetList(): Array; + setSetList(value: Array): ValidatorSet; + addSet(value?: validator_pb.Validator, index?: number): validator_pb.Validator; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ValidatorSet.AsObject; + static toObject(includeInstance: boolean, msg: ValidatorSet): ValidatorSet.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ValidatorSet, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ValidatorSet; + static deserializeBinaryFromReader(message: ValidatorSet, reader: jspb.BinaryReader): ValidatorSet; +} + +export namespace ValidatorSet { + export type AsObject = { + height: number, + setList: Array, + } +} + +export class GetProposalParam extends jspb.Message { + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): GetProposalParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetProposalParam.AsObject; + static toObject(includeInstance: boolean, msg: GetProposalParam): GetProposalParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetProposalParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetProposalParam; + static deserializeBinaryFromReader(message: GetProposalParam, reader: jspb.BinaryReader): GetProposalParam; +} + +export namespace GetProposalParam { + export type AsObject = { + hash: Uint8Array | string, + } +} + +export class ListProposalsParam extends jspb.Message { + getProposed(): boolean; + setProposed(value: boolean): ListProposalsParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListProposalsParam.AsObject; + static toObject(includeInstance: boolean, msg: ListProposalsParam): ListProposalsParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListProposalsParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListProposalsParam; + static deserializeBinaryFromReader(message: ListProposalsParam, reader: jspb.BinaryReader): ListProposalsParam; +} + +export namespace ListProposalsParam { + export type AsObject = { + proposed: boolean, + } +} + +export class ProposalResult extends jspb.Message { + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): ProposalResult; + + + hasBallot(): boolean; + clearBallot(): void; + getBallot(): payload_pb.Ballot | undefined; + setBallot(value?: payload_pb.Ballot): ProposalResult; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProposalResult.AsObject; + static toObject(includeInstance: boolean, msg: ProposalResult): ProposalResult.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProposalResult, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProposalResult; + static deserializeBinaryFromReader(message: ProposalResult, reader: jspb.BinaryReader): ProposalResult; +} + +export namespace ProposalResult { + export type AsObject = { + hash: Uint8Array | string, + ballot?: payload_pb.Ballot.AsObject, + } +} + +export class GetStatsParam extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetStatsParam.AsObject; + static toObject(includeInstance: boolean, msg: GetStatsParam): GetStatsParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetStatsParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetStatsParam; + static deserializeBinaryFromReader(message: GetStatsParam, reader: jspb.BinaryReader): GetStatsParam; +} + +export namespace GetStatsParam { + export type AsObject = { + } +} + +export class Stats extends jspb.Message { + getAccountswithcode(): number; + setAccountswithcode(value: number): Stats; + + getAccountswithoutcode(): number; + setAccountswithoutcode(value: number): Stats; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Stats.AsObject; + static toObject(includeInstance: boolean, msg: Stats): Stats.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Stats, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Stats; + static deserializeBinaryFromReader(message: Stats, reader: jspb.BinaryReader): Stats; +} + +export namespace Stats { + export type AsObject = { + accountswithcode: number, + accountswithoutcode: number, + } +} + +export class GetBlockParam extends jspb.Message { + getHeight(): number; + setHeight(value: number): GetBlockParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBlockParam.AsObject; + static toObject(includeInstance: boolean, msg: GetBlockParam): GetBlockParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetBlockParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBlockParam; + static deserializeBinaryFromReader(message: GetBlockParam, reader: jspb.BinaryReader): GetBlockParam; +} + +export namespace GetBlockParam { + export type AsObject = { + height: number, + } +} diff --git a/js/proto/rpcquery_pb.js b/js/proto/rpcquery_pb.js new file mode 100644 index 000000000..aa0524dab --- /dev/null +++ b/js/proto/rpcquery_pb.js @@ -0,0 +1,3848 @@ +// source: rpcquery.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_types_types_pb = require('./tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var names_pb = require('./names_pb.js'); +goog.object.extend(proto, names_pb); +var acm_pb = require('./acm_pb.js'); +goog.object.extend(proto, acm_pb); +var validator_pb = require('./validator_pb.js'); +goog.object.extend(proto, validator_pb); +var registry_pb = require('./registry_pb.js'); +goog.object.extend(proto, registry_pb); +var rpc_pb = require('./rpc_pb.js'); +goog.object.extend(proto, rpc_pb); +var payload_pb = require('./payload_pb.js'); +goog.object.extend(proto, payload_pb); +goog.exportSymbol('proto.rpcquery.GetAccountParam', null, global); +goog.exportSymbol('proto.rpcquery.GetBlockParam', null, global); +goog.exportSymbol('proto.rpcquery.GetMetadataParam', null, global); +goog.exportSymbol('proto.rpcquery.GetNameParam', null, global); +goog.exportSymbol('proto.rpcquery.GetNetworkRegistryParam', null, global); +goog.exportSymbol('proto.rpcquery.GetProposalParam', null, global); +goog.exportSymbol('proto.rpcquery.GetStatsParam', null, global); +goog.exportSymbol('proto.rpcquery.GetStorageParam', null, global); +goog.exportSymbol('proto.rpcquery.GetValidatorSetHistoryParam', null, global); +goog.exportSymbol('proto.rpcquery.GetValidatorSetParam', null, global); +goog.exportSymbol('proto.rpcquery.ListAccountsParam', null, global); +goog.exportSymbol('proto.rpcquery.ListNamesParam', null, global); +goog.exportSymbol('proto.rpcquery.ListProposalsParam', null, global); +goog.exportSymbol('proto.rpcquery.MetadataResult', null, global); +goog.exportSymbol('proto.rpcquery.NetworkRegistry', null, global); +goog.exportSymbol('proto.rpcquery.ProposalResult', null, global); +goog.exportSymbol('proto.rpcquery.RegisteredValidator', null, global); +goog.exportSymbol('proto.rpcquery.Stats', null, global); +goog.exportSymbol('proto.rpcquery.StatusParam', null, global); +goog.exportSymbol('proto.rpcquery.StorageValue', null, global); +goog.exportSymbol('proto.rpcquery.ValidatorSet', null, global); +goog.exportSymbol('proto.rpcquery.ValidatorSetHistory', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.StatusParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.StatusParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.StatusParam.displayName = 'proto.rpcquery.StatusParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetAccountParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetAccountParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetAccountParam.displayName = 'proto.rpcquery.GetAccountParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetMetadataParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetMetadataParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetMetadataParam.displayName = 'proto.rpcquery.GetMetadataParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.MetadataResult = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.MetadataResult, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.MetadataResult.displayName = 'proto.rpcquery.MetadataResult'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetStorageParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetStorageParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetStorageParam.displayName = 'proto.rpcquery.GetStorageParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.StorageValue = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.StorageValue, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.StorageValue.displayName = 'proto.rpcquery.StorageValue'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.ListAccountsParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.ListAccountsParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.ListAccountsParam.displayName = 'proto.rpcquery.ListAccountsParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetNameParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetNameParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetNameParam.displayName = 'proto.rpcquery.GetNameParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.ListNamesParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.ListNamesParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.ListNamesParam.displayName = 'proto.rpcquery.ListNamesParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetNetworkRegistryParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetNetworkRegistryParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetNetworkRegistryParam.displayName = 'proto.rpcquery.GetNetworkRegistryParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetValidatorSetParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetValidatorSetParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetValidatorSetParam.displayName = 'proto.rpcquery.GetValidatorSetParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetValidatorSetHistoryParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetValidatorSetHistoryParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetValidatorSetHistoryParam.displayName = 'proto.rpcquery.GetValidatorSetHistoryParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.NetworkRegistry = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.rpcquery.NetworkRegistry.repeatedFields_, null); +}; +goog.inherits(proto.rpcquery.NetworkRegistry, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.NetworkRegistry.displayName = 'proto.rpcquery.NetworkRegistry'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.RegisteredValidator = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.RegisteredValidator, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.RegisteredValidator.displayName = 'proto.rpcquery.RegisteredValidator'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.ValidatorSetHistory = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.rpcquery.ValidatorSetHistory.repeatedFields_, null); +}; +goog.inherits(proto.rpcquery.ValidatorSetHistory, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.ValidatorSetHistory.displayName = 'proto.rpcquery.ValidatorSetHistory'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.ValidatorSet = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.rpcquery.ValidatorSet.repeatedFields_, null); +}; +goog.inherits(proto.rpcquery.ValidatorSet, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.ValidatorSet.displayName = 'proto.rpcquery.ValidatorSet'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetProposalParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetProposalParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetProposalParam.displayName = 'proto.rpcquery.GetProposalParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.ListProposalsParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.ListProposalsParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.ListProposalsParam.displayName = 'proto.rpcquery.ListProposalsParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.ProposalResult = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.ProposalResult, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.ProposalResult.displayName = 'proto.rpcquery.ProposalResult'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetStatsParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetStatsParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetStatsParam.displayName = 'proto.rpcquery.GetStatsParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.Stats = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.Stats, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.Stats.displayName = 'proto.rpcquery.Stats'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpcquery.GetBlockParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpcquery.GetBlockParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpcquery.GetBlockParam.displayName = 'proto.rpcquery.GetBlockParam'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.StatusParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.StatusParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.StatusParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.StatusParam.toObject = function(includeInstance, msg) { + var f, obj = { + blocktimewithin: jspb.Message.getFieldWithDefault(msg, 1, ""), + blockseentimewithin: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.StatusParam} + */ +proto.rpcquery.StatusParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.StatusParam; + return proto.rpcquery.StatusParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.StatusParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.StatusParam} + */ +proto.rpcquery.StatusParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBlocktimewithin(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setBlockseentimewithin(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.StatusParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.StatusParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.StatusParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.StatusParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlocktimewithin(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getBlockseentimewithin(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string BlockTimeWithin = 1; + * @return {string} + */ +proto.rpcquery.StatusParam.prototype.getBlocktimewithin = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpcquery.StatusParam} returns this + */ +proto.rpcquery.StatusParam.prototype.setBlocktimewithin = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string BlockSeenTimeWithin = 2; + * @return {string} + */ +proto.rpcquery.StatusParam.prototype.getBlockseentimewithin = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpcquery.StatusParam} returns this + */ +proto.rpcquery.StatusParam.prototype.setBlockseentimewithin = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetAccountParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetAccountParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetAccountParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetAccountParam.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetAccountParam} + */ +proto.rpcquery.GetAccountParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetAccountParam; + return proto.rpcquery.GetAccountParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetAccountParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetAccountParam} + */ +proto.rpcquery.GetAccountParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetAccountParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetAccountParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetAccountParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetAccountParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.GetAccountParam.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.rpcquery.GetAccountParam.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.rpcquery.GetAccountParam.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.GetAccountParam} returns this + */ +proto.rpcquery.GetAccountParam.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetMetadataParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetMetadataParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetMetadataParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetMetadataParam.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + metadatahash: msg.getMetadatahash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetMetadataParam} + */ +proto.rpcquery.GetMetadataParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetMetadataParam; + return proto.rpcquery.GetMetadataParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetMetadataParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetMetadataParam} + */ +proto.rpcquery.GetMetadataParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMetadatahash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetMetadataParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetMetadataParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetMetadataParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetMetadataParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getMetadatahash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.GetMetadataParam.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.rpcquery.GetMetadataParam.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.rpcquery.GetMetadataParam.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.GetMetadataParam} returns this + */ +proto.rpcquery.GetMetadataParam.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes MetadataHash = 2; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.GetMetadataParam.prototype.getMetadatahash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes MetadataHash = 2; + * This is a type-conversion wrapper around `getMetadatahash()` + * @return {string} + */ +proto.rpcquery.GetMetadataParam.prototype.getMetadatahash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMetadatahash())); +}; + + +/** + * optional bytes MetadataHash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMetadatahash()` + * @return {!Uint8Array} + */ +proto.rpcquery.GetMetadataParam.prototype.getMetadatahash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMetadatahash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.GetMetadataParam} returns this + */ +proto.rpcquery.GetMetadataParam.prototype.setMetadatahash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.MetadataResult.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.MetadataResult.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.MetadataResult} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.MetadataResult.toObject = function(includeInstance, msg) { + var f, obj = { + metadata: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.MetadataResult} + */ +proto.rpcquery.MetadataResult.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.MetadataResult; + return proto.rpcquery.MetadataResult.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.MetadataResult} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.MetadataResult} + */ +proto.rpcquery.MetadataResult.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.MetadataResult.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.MetadataResult.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.MetadataResult} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.MetadataResult.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMetadata(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string Metadata = 1; + * @return {string} + */ +proto.rpcquery.MetadataResult.prototype.getMetadata = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpcquery.MetadataResult} returns this + */ +proto.rpcquery.MetadataResult.prototype.setMetadata = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetStorageParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetStorageParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetStorageParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetStorageParam.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + key: msg.getKey_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetStorageParam} + */ +proto.rpcquery.GetStorageParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetStorageParam; + return proto.rpcquery.GetStorageParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetStorageParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetStorageParam} + */ +proto.rpcquery.GetStorageParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setKey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetStorageParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetStorageParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetStorageParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetStorageParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getKey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.GetStorageParam.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.rpcquery.GetStorageParam.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.rpcquery.GetStorageParam.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.GetStorageParam} returns this + */ +proto.rpcquery.GetStorageParam.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes Key = 2; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.GetStorageParam.prototype.getKey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Key = 2; + * This is a type-conversion wrapper around `getKey()` + * @return {string} + */ +proto.rpcquery.GetStorageParam.prototype.getKey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getKey())); +}; + + +/** + * optional bytes Key = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKey()` + * @return {!Uint8Array} + */ +proto.rpcquery.GetStorageParam.prototype.getKey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getKey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.GetStorageParam} returns this + */ +proto.rpcquery.GetStorageParam.prototype.setKey = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.StorageValue.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.StorageValue.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.StorageValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.StorageValue.toObject = function(includeInstance, msg) { + var f, obj = { + value: msg.getValue_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.StorageValue} + */ +proto.rpcquery.StorageValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.StorageValue; + return proto.rpcquery.StorageValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.StorageValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.StorageValue} + */ +proto.rpcquery.StorageValue.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.StorageValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.StorageValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.StorageValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.StorageValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getValue_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes Value = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.StorageValue.prototype.getValue = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Value = 1; + * This is a type-conversion wrapper around `getValue()` + * @return {string} + */ +proto.rpcquery.StorageValue.prototype.getValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValue())); +}; + + +/** + * optional bytes Value = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValue()` + * @return {!Uint8Array} + */ +proto.rpcquery.StorageValue.prototype.getValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.StorageValue} returns this + */ +proto.rpcquery.StorageValue.prototype.setValue = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.ListAccountsParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.ListAccountsParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.ListAccountsParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ListAccountsParam.toObject = function(includeInstance, msg) { + var f, obj = { + query: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.ListAccountsParam} + */ +proto.rpcquery.ListAccountsParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.ListAccountsParam; + return proto.rpcquery.ListAccountsParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.ListAccountsParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.ListAccountsParam} + */ +proto.rpcquery.ListAccountsParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setQuery(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.ListAccountsParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.ListAccountsParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.ListAccountsParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ListAccountsParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getQuery(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string Query = 1; + * @return {string} + */ +proto.rpcquery.ListAccountsParam.prototype.getQuery = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpcquery.ListAccountsParam} returns this + */ +proto.rpcquery.ListAccountsParam.prototype.setQuery = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetNameParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetNameParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetNameParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetNameParam.toObject = function(includeInstance, msg) { + var f, obj = { + name: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetNameParam} + */ +proto.rpcquery.GetNameParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetNameParam; + return proto.rpcquery.GetNameParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetNameParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetNameParam} + */ +proto.rpcquery.GetNameParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetNameParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetNameParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetNameParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetNameParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string Name = 1; + * @return {string} + */ +proto.rpcquery.GetNameParam.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpcquery.GetNameParam} returns this + */ +proto.rpcquery.GetNameParam.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.ListNamesParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.ListNamesParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.ListNamesParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ListNamesParam.toObject = function(includeInstance, msg) { + var f, obj = { + query: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.ListNamesParam} + */ +proto.rpcquery.ListNamesParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.ListNamesParam; + return proto.rpcquery.ListNamesParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.ListNamesParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.ListNamesParam} + */ +proto.rpcquery.ListNamesParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setQuery(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.ListNamesParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.ListNamesParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.ListNamesParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ListNamesParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getQuery(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string Query = 1; + * @return {string} + */ +proto.rpcquery.ListNamesParam.prototype.getQuery = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.rpcquery.ListNamesParam} returns this + */ +proto.rpcquery.ListNamesParam.prototype.setQuery = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetNetworkRegistryParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetNetworkRegistryParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetNetworkRegistryParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetNetworkRegistryParam.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetNetworkRegistryParam} + */ +proto.rpcquery.GetNetworkRegistryParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetNetworkRegistryParam; + return proto.rpcquery.GetNetworkRegistryParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetNetworkRegistryParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetNetworkRegistryParam} + */ +proto.rpcquery.GetNetworkRegistryParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetNetworkRegistryParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetNetworkRegistryParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetNetworkRegistryParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetNetworkRegistryParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetValidatorSetParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetValidatorSetParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetValidatorSetParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetValidatorSetParam.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetValidatorSetParam} + */ +proto.rpcquery.GetValidatorSetParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetValidatorSetParam; + return proto.rpcquery.GetValidatorSetParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetValidatorSetParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetValidatorSetParam} + */ +proto.rpcquery.GetValidatorSetParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetValidatorSetParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetValidatorSetParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetValidatorSetParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetValidatorSetParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetValidatorSetHistoryParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetValidatorSetHistoryParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetValidatorSetHistoryParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetValidatorSetHistoryParam.toObject = function(includeInstance, msg) { + var f, obj = { + includeprevious: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetValidatorSetHistoryParam} + */ +proto.rpcquery.GetValidatorSetHistoryParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetValidatorSetHistoryParam; + return proto.rpcquery.GetValidatorSetHistoryParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetValidatorSetHistoryParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetValidatorSetHistoryParam} + */ +proto.rpcquery.GetValidatorSetHistoryParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setIncludeprevious(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetValidatorSetHistoryParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetValidatorSetHistoryParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetValidatorSetHistoryParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetValidatorSetHistoryParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIncludeprevious(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } +}; + + +/** + * optional int64 IncludePrevious = 1; + * @return {number} + */ +proto.rpcquery.GetValidatorSetHistoryParam.prototype.getIncludeprevious = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcquery.GetValidatorSetHistoryParam} returns this + */ +proto.rpcquery.GetValidatorSetHistoryParam.prototype.setIncludeprevious = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.rpcquery.NetworkRegistry.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.NetworkRegistry.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.NetworkRegistry.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.NetworkRegistry} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.NetworkRegistry.toObject = function(includeInstance, msg) { + var f, obj = { + setList: jspb.Message.toObjectList(msg.getSetList(), + proto.rpcquery.RegisteredValidator.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.NetworkRegistry} + */ +proto.rpcquery.NetworkRegistry.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.NetworkRegistry; + return proto.rpcquery.NetworkRegistry.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.NetworkRegistry} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.NetworkRegistry} + */ +proto.rpcquery.NetworkRegistry.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.rpcquery.RegisteredValidator; + reader.readMessage(value,proto.rpcquery.RegisteredValidator.deserializeBinaryFromReader); + msg.addSet(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.NetworkRegistry.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.NetworkRegistry.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.NetworkRegistry} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.NetworkRegistry.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSetList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.rpcquery.RegisteredValidator.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated RegisteredValidator Set = 1; + * @return {!Array} + */ +proto.rpcquery.NetworkRegistry.prototype.getSetList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.rpcquery.RegisteredValidator, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.rpcquery.NetworkRegistry} returns this +*/ +proto.rpcquery.NetworkRegistry.prototype.setSetList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.rpcquery.RegisteredValidator=} opt_value + * @param {number=} opt_index + * @return {!proto.rpcquery.RegisteredValidator} + */ +proto.rpcquery.NetworkRegistry.prototype.addSet = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.rpcquery.RegisteredValidator, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.rpcquery.NetworkRegistry} returns this + */ +proto.rpcquery.NetworkRegistry.prototype.clearSetList = function() { + return this.setSetList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.RegisteredValidator.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.RegisteredValidator.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.RegisteredValidator} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.RegisteredValidator.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + node: (f = msg.getNode()) && registry_pb.NodeIdentity.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.RegisteredValidator} + */ +proto.rpcquery.RegisteredValidator.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.RegisteredValidator; + return proto.rpcquery.RegisteredValidator.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.RegisteredValidator} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.RegisteredValidator} + */ +proto.rpcquery.RegisteredValidator.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = new registry_pb.NodeIdentity; + reader.readMessage(value,registry_pb.NodeIdentity.deserializeBinaryFromReader); + msg.setNode(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.RegisteredValidator.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.RegisteredValidator.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.RegisteredValidator} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.RegisteredValidator.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getNode(); + if (f != null) { + writer.writeMessage( + 2, + f, + registry_pb.NodeIdentity.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.RegisteredValidator.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.rpcquery.RegisteredValidator.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.rpcquery.RegisteredValidator.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.RegisteredValidator} returns this + */ +proto.rpcquery.RegisteredValidator.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional registry.NodeIdentity Node = 2; + * @return {?proto.registry.NodeIdentity} + */ +proto.rpcquery.RegisteredValidator.prototype.getNode = function() { + return /** @type{?proto.registry.NodeIdentity} */ ( + jspb.Message.getWrapperField(this, registry_pb.NodeIdentity, 2)); +}; + + +/** + * @param {?proto.registry.NodeIdentity|undefined} value + * @return {!proto.rpcquery.RegisteredValidator} returns this +*/ +proto.rpcquery.RegisteredValidator.prototype.setNode = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpcquery.RegisteredValidator} returns this + */ +proto.rpcquery.RegisteredValidator.prototype.clearNode = function() { + return this.setNode(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpcquery.RegisteredValidator.prototype.hasNode = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.rpcquery.ValidatorSetHistory.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.ValidatorSetHistory.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.ValidatorSetHistory.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.ValidatorSetHistory} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ValidatorSetHistory.toObject = function(includeInstance, msg) { + var f, obj = { + historyList: jspb.Message.toObjectList(msg.getHistoryList(), + proto.rpcquery.ValidatorSet.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.ValidatorSetHistory} + */ +proto.rpcquery.ValidatorSetHistory.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.ValidatorSetHistory; + return proto.rpcquery.ValidatorSetHistory.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.ValidatorSetHistory} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.ValidatorSetHistory} + */ +proto.rpcquery.ValidatorSetHistory.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.rpcquery.ValidatorSet; + reader.readMessage(value,proto.rpcquery.ValidatorSet.deserializeBinaryFromReader); + msg.addHistory(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.ValidatorSetHistory.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.ValidatorSetHistory.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.ValidatorSetHistory} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ValidatorSetHistory.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHistoryList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.rpcquery.ValidatorSet.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated ValidatorSet History = 1; + * @return {!Array} + */ +proto.rpcquery.ValidatorSetHistory.prototype.getHistoryList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.rpcquery.ValidatorSet, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.rpcquery.ValidatorSetHistory} returns this +*/ +proto.rpcquery.ValidatorSetHistory.prototype.setHistoryList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.rpcquery.ValidatorSet=} opt_value + * @param {number=} opt_index + * @return {!proto.rpcquery.ValidatorSet} + */ +proto.rpcquery.ValidatorSetHistory.prototype.addHistory = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.rpcquery.ValidatorSet, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.rpcquery.ValidatorSetHistory} returns this + */ +proto.rpcquery.ValidatorSetHistory.prototype.clearHistoryList = function() { + return this.setHistoryList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.rpcquery.ValidatorSet.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.ValidatorSet.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.ValidatorSet.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.ValidatorSet} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ValidatorSet.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + setList: jspb.Message.toObjectList(msg.getSetList(), + validator_pb.Validator.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.ValidatorSet} + */ +proto.rpcquery.ValidatorSet.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.ValidatorSet; + return proto.rpcquery.ValidatorSet.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.ValidatorSet} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.ValidatorSet} + */ +proto.rpcquery.ValidatorSet.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = new validator_pb.Validator; + reader.readMessage(value,validator_pb.Validator.deserializeBinaryFromReader); + msg.addSet(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.ValidatorSet.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.ValidatorSet.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.ValidatorSet} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ValidatorSet.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getSetList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + validator_pb.Validator.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.rpcquery.ValidatorSet.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcquery.ValidatorSet} returns this + */ +proto.rpcquery.ValidatorSet.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * repeated validator.Validator Set = 2; + * @return {!Array} + */ +proto.rpcquery.ValidatorSet.prototype.getSetList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, validator_pb.Validator, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.rpcquery.ValidatorSet} returns this +*/ +proto.rpcquery.ValidatorSet.prototype.setSetList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.validator.Validator=} opt_value + * @param {number=} opt_index + * @return {!proto.validator.Validator} + */ +proto.rpcquery.ValidatorSet.prototype.addSet = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.validator.Validator, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.rpcquery.ValidatorSet} returns this + */ +proto.rpcquery.ValidatorSet.prototype.clearSetList = function() { + return this.setSetList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetProposalParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetProposalParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetProposalParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetProposalParam.toObject = function(includeInstance, msg) { + var f, obj = { + hash: msg.getHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetProposalParam} + */ +proto.rpcquery.GetProposalParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetProposalParam; + return proto.rpcquery.GetProposalParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetProposalParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetProposalParam} + */ +proto.rpcquery.GetProposalParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetProposalParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetProposalParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetProposalParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetProposalParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes Hash = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.GetProposalParam.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Hash = 1; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.rpcquery.GetProposalParam.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes Hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.rpcquery.GetProposalParam.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.GetProposalParam} returns this + */ +proto.rpcquery.GetProposalParam.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.ListProposalsParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.ListProposalsParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.ListProposalsParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ListProposalsParam.toObject = function(includeInstance, msg) { + var f, obj = { + proposed: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.ListProposalsParam} + */ +proto.rpcquery.ListProposalsParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.ListProposalsParam; + return proto.rpcquery.ListProposalsParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.ListProposalsParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.ListProposalsParam} + */ +proto.rpcquery.ListProposalsParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProposed(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.ListProposalsParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.ListProposalsParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.ListProposalsParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ListProposalsParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProposed(); + if (f) { + writer.writeBool( + 1, + f + ); + } +}; + + +/** + * optional bool Proposed = 1; + * @return {boolean} + */ +proto.rpcquery.ListProposalsParam.prototype.getProposed = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.rpcquery.ListProposalsParam} returns this + */ +proto.rpcquery.ListProposalsParam.prototype.setProposed = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.ProposalResult.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.ProposalResult.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.ProposalResult} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ProposalResult.toObject = function(includeInstance, msg) { + var f, obj = { + hash: msg.getHash_asB64(), + ballot: (f = msg.getBallot()) && payload_pb.Ballot.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.ProposalResult} + */ +proto.rpcquery.ProposalResult.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.ProposalResult; + return proto.rpcquery.ProposalResult.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.ProposalResult} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.ProposalResult} + */ +proto.rpcquery.ProposalResult.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 2: + var value = new payload_pb.Ballot; + reader.readMessage(value,payload_pb.Ballot.deserializeBinaryFromReader); + msg.setBallot(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.ProposalResult.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.ProposalResult.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.ProposalResult} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.ProposalResult.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getBallot(); + if (f != null) { + writer.writeMessage( + 2, + f, + payload_pb.Ballot.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes Hash = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpcquery.ProposalResult.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Hash = 1; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.rpcquery.ProposalResult.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes Hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.rpcquery.ProposalResult.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpcquery.ProposalResult} returns this + */ +proto.rpcquery.ProposalResult.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional payload.Ballot Ballot = 2; + * @return {?proto.payload.Ballot} + */ +proto.rpcquery.ProposalResult.prototype.getBallot = function() { + return /** @type{?proto.payload.Ballot} */ ( + jspb.Message.getWrapperField(this, payload_pb.Ballot, 2)); +}; + + +/** + * @param {?proto.payload.Ballot|undefined} value + * @return {!proto.rpcquery.ProposalResult} returns this +*/ +proto.rpcquery.ProposalResult.prototype.setBallot = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpcquery.ProposalResult} returns this + */ +proto.rpcquery.ProposalResult.prototype.clearBallot = function() { + return this.setBallot(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpcquery.ProposalResult.prototype.hasBallot = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetStatsParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetStatsParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetStatsParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetStatsParam.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetStatsParam} + */ +proto.rpcquery.GetStatsParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetStatsParam; + return proto.rpcquery.GetStatsParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetStatsParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetStatsParam} + */ +proto.rpcquery.GetStatsParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetStatsParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetStatsParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetStatsParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetStatsParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.Stats.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.Stats.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.Stats} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.Stats.toObject = function(includeInstance, msg) { + var f, obj = { + accountswithcode: jspb.Message.getFieldWithDefault(msg, 1, 0), + accountswithoutcode: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.Stats} + */ +proto.rpcquery.Stats.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.Stats; + return proto.rpcquery.Stats.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.Stats} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.Stats} + */ +proto.rpcquery.Stats.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAccountswithcode(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAccountswithoutcode(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.Stats.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.Stats.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.Stats} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.Stats.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAccountswithcode(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getAccountswithoutcode(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional uint64 AccountsWithCode = 1; + * @return {number} + */ +proto.rpcquery.Stats.prototype.getAccountswithcode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcquery.Stats} returns this + */ +proto.rpcquery.Stats.prototype.setAccountswithcode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 AccountsWithoutCode = 2; + * @return {number} + */ +proto.rpcquery.Stats.prototype.getAccountswithoutcode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcquery.Stats} returns this + */ +proto.rpcquery.Stats.prototype.setAccountswithoutcode = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpcquery.GetBlockParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpcquery.GetBlockParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpcquery.GetBlockParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetBlockParam.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpcquery.GetBlockParam} + */ +proto.rpcquery.GetBlockParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpcquery.GetBlockParam; + return proto.rpcquery.GetBlockParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpcquery.GetBlockParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpcquery.GetBlockParam} + */ +proto.rpcquery.GetBlockParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpcquery.GetBlockParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpcquery.GetBlockParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpcquery.GetBlockParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpcquery.GetBlockParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } +}; + + +/** + * optional uint64 Height = 1; + * @return {number} + */ +proto.rpcquery.GetBlockParam.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.rpcquery.GetBlockParam} returns this + */ +proto.rpcquery.GetBlockParam.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +goog.object.extend(exports, proto.rpcquery); diff --git a/js/proto/rpctransact_grpc_pb.d.ts b/js/proto/rpctransact_grpc_pb.d.ts new file mode 100644 index 000000000..eccd3ef64 --- /dev/null +++ b/js/proto/rpctransact_grpc_pb.d.ts @@ -0,0 +1,234 @@ +// package: rpctransact +// file: rpctransact.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; +import * as rpctransact_pb from "./rpctransact_pb"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb"; +import * as exec_pb from "./exec_pb"; +import * as payload_pb from "./payload_pb"; +import * as txs_pb from "./txs_pb"; + +interface ITransactService extends grpc.ServiceDefinition { + broadcastTxSync: ITransactService_IBroadcastTxSync; + broadcastTxAsync: ITransactService_IBroadcastTxAsync; + signTx: ITransactService_ISignTx; + formulateTx: ITransactService_IFormulateTx; + callTxSync: ITransactService_ICallTxSync; + callTxAsync: ITransactService_ICallTxAsync; + callTxSim: ITransactService_ICallTxSim; + callCodeSim: ITransactService_ICallCodeSim; + sendTxSync: ITransactService_ISendTxSync; + sendTxAsync: ITransactService_ISendTxAsync; + nameTxSync: ITransactService_INameTxSync; + nameTxAsync: ITransactService_INameTxAsync; +} + +interface ITransactService_IBroadcastTxSync extends grpc.MethodDefinition { + path: "/rpctransact.Transact/BroadcastTxSync"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_IBroadcastTxAsync extends grpc.MethodDefinition { + path: "/rpctransact.Transact/BroadcastTxAsync"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_ISignTx extends grpc.MethodDefinition { + path: "/rpctransact.Transact/SignTx"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_IFormulateTx extends grpc.MethodDefinition { + path: "/rpctransact.Transact/FormulateTx"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_ICallTxSync extends grpc.MethodDefinition { + path: "/rpctransact.Transact/CallTxSync"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_ICallTxAsync extends grpc.MethodDefinition { + path: "/rpctransact.Transact/CallTxAsync"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_ICallTxSim extends grpc.MethodDefinition { + path: "/rpctransact.Transact/CallTxSim"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_ICallCodeSim extends grpc.MethodDefinition { + path: "/rpctransact.Transact/CallCodeSim"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_ISendTxSync extends grpc.MethodDefinition { + path: "/rpctransact.Transact/SendTxSync"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_ISendTxAsync extends grpc.MethodDefinition { + path: "/rpctransact.Transact/SendTxAsync"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_INameTxSync extends grpc.MethodDefinition { + path: "/rpctransact.Transact/NameTxSync"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface ITransactService_INameTxAsync extends grpc.MethodDefinition { + path: "/rpctransact.Transact/NameTxAsync"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const TransactService: ITransactService; + +export interface ITransactServer extends grpc.UntypedServiceImplementation { + broadcastTxSync: grpc.handleUnaryCall; + broadcastTxAsync: grpc.handleUnaryCall; + signTx: grpc.handleUnaryCall; + formulateTx: grpc.handleUnaryCall; + callTxSync: grpc.handleUnaryCall; + callTxAsync: grpc.handleUnaryCall; + callTxSim: grpc.handleUnaryCall; + callCodeSim: grpc.handleUnaryCall; + sendTxSync: grpc.handleUnaryCall; + sendTxAsync: grpc.handleUnaryCall; + nameTxSync: grpc.handleUnaryCall; + nameTxAsync: grpc.handleUnaryCall; +} + +export interface ITransactClient { + broadcastTxSync(request: rpctransact_pb.TxEnvelopeParam, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + broadcastTxSync(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + broadcastTxSync(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + broadcastTxAsync(request: rpctransact_pb.TxEnvelopeParam, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + broadcastTxAsync(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + broadcastTxAsync(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + signTx(request: rpctransact_pb.TxEnvelopeParam, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + signTx(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + signTx(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + formulateTx(request: payload_pb.Any, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + formulateTx(request: payload_pb.Any, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + formulateTx(request: payload_pb.Any, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + callTxSync(request: payload_pb.CallTx, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + callTxSync(request: payload_pb.CallTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + callTxSync(request: payload_pb.CallTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + callTxAsync(request: payload_pb.CallTx, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + callTxAsync(request: payload_pb.CallTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + callTxAsync(request: payload_pb.CallTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + callTxSim(request: payload_pb.CallTx, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + callTxSim(request: payload_pb.CallTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + callTxSim(request: payload_pb.CallTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + callCodeSim(request: rpctransact_pb.CallCodeParam, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + callCodeSim(request: rpctransact_pb.CallCodeParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + callCodeSim(request: rpctransact_pb.CallCodeParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + sendTxSync(request: payload_pb.SendTx, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + sendTxSync(request: payload_pb.SendTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + sendTxSync(request: payload_pb.SendTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + sendTxAsync(request: payload_pb.SendTx, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + sendTxAsync(request: payload_pb.SendTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + sendTxAsync(request: payload_pb.SendTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + nameTxSync(request: payload_pb.NameTx, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + nameTxSync(request: payload_pb.NameTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + nameTxSync(request: payload_pb.NameTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + nameTxAsync(request: payload_pb.NameTx, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + nameTxAsync(request: payload_pb.NameTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + nameTxAsync(request: payload_pb.NameTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; +} + +export class TransactClient extends grpc.Client implements ITransactClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public broadcastTxSync(request: rpctransact_pb.TxEnvelopeParam, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public broadcastTxSync(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public broadcastTxSync(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public broadcastTxAsync(request: rpctransact_pb.TxEnvelopeParam, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public broadcastTxAsync(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public broadcastTxAsync(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public signTx(request: rpctransact_pb.TxEnvelopeParam, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + public signTx(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + public signTx(request: rpctransact_pb.TxEnvelopeParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + public formulateTx(request: payload_pb.Any, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + public formulateTx(request: payload_pb.Any, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + public formulateTx(request: payload_pb.Any, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: rpctransact_pb.TxEnvelope) => void): grpc.ClientUnaryCall; + public callTxSync(request: payload_pb.CallTx, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public callTxSync(request: payload_pb.CallTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public callTxSync(request: payload_pb.CallTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public callTxAsync(request: payload_pb.CallTx, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public callTxAsync(request: payload_pb.CallTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public callTxAsync(request: payload_pb.CallTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public callTxSim(request: payload_pb.CallTx, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public callTxSim(request: payload_pb.CallTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public callTxSim(request: payload_pb.CallTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public callCodeSim(request: rpctransact_pb.CallCodeParam, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public callCodeSim(request: rpctransact_pb.CallCodeParam, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public callCodeSim(request: rpctransact_pb.CallCodeParam, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public sendTxSync(request: payload_pb.SendTx, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public sendTxSync(request: payload_pb.SendTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public sendTxSync(request: payload_pb.SendTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public sendTxAsync(request: payload_pb.SendTx, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public sendTxAsync(request: payload_pb.SendTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public sendTxAsync(request: payload_pb.SendTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public nameTxSync(request: payload_pb.NameTx, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public nameTxSync(request: payload_pb.NameTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public nameTxSync(request: payload_pb.NameTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: exec_pb.TxExecution) => void): grpc.ClientUnaryCall; + public nameTxAsync(request: payload_pb.NameTx, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public nameTxAsync(request: payload_pb.NameTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; + public nameTxAsync(request: payload_pb.NameTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: txs_pb.Receipt) => void): grpc.ClientUnaryCall; +} diff --git a/js/proto/rpctransact_grpc_pb.js b/js/proto/rpctransact_grpc_pb.js new file mode 100644 index 000000000..906833532 --- /dev/null +++ b/js/proto/rpctransact_grpc_pb.js @@ -0,0 +1,260 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var rpctransact_pb = require('./rpctransact_pb.js'); +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js'); +var exec_pb = require('./exec_pb.js'); +var payload_pb = require('./payload_pb.js'); +var txs_pb = require('./txs_pb.js'); + +function serialize_exec_TxExecution(arg) { + if (!(arg instanceof exec_pb.TxExecution)) { + throw new Error('Expected argument of type exec.TxExecution'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_exec_TxExecution(buffer_arg) { + return exec_pb.TxExecution.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_payload_Any(arg) { + if (!(arg instanceof payload_pb.Any)) { + throw new Error('Expected argument of type payload.Any'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_payload_Any(buffer_arg) { + return payload_pb.Any.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_payload_CallTx(arg) { + if (!(arg instanceof payload_pb.CallTx)) { + throw new Error('Expected argument of type payload.CallTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_payload_CallTx(buffer_arg) { + return payload_pb.CallTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_payload_NameTx(arg) { + if (!(arg instanceof payload_pb.NameTx)) { + throw new Error('Expected argument of type payload.NameTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_payload_NameTx(buffer_arg) { + return payload_pb.NameTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_payload_SendTx(arg) { + if (!(arg instanceof payload_pb.SendTx)) { + throw new Error('Expected argument of type payload.SendTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_payload_SendTx(buffer_arg) { + return payload_pb.SendTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpctransact_CallCodeParam(arg) { + if (!(arg instanceof rpctransact_pb.CallCodeParam)) { + throw new Error('Expected argument of type rpctransact.CallCodeParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpctransact_CallCodeParam(buffer_arg) { + return rpctransact_pb.CallCodeParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpctransact_TxEnvelope(arg) { + if (!(arg instanceof rpctransact_pb.TxEnvelope)) { + throw new Error('Expected argument of type rpctransact.TxEnvelope'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpctransact_TxEnvelope(buffer_arg) { + return rpctransact_pb.TxEnvelope.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_rpctransact_TxEnvelopeParam(arg) { + if (!(arg instanceof rpctransact_pb.TxEnvelopeParam)) { + throw new Error('Expected argument of type rpctransact.TxEnvelopeParam'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_rpctransact_TxEnvelopeParam(buffer_arg) { + return rpctransact_pb.TxEnvelopeParam.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_txs_Receipt(arg) { + if (!(arg instanceof txs_pb.Receipt)) { + throw new Error('Expected argument of type txs.Receipt'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_txs_Receipt(buffer_arg) { + return txs_pb.Receipt.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +// Transaction Service Definition +var TransactService = exports['rpctransact.Transact'] = { + // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side +// and wait for it to be included in block +broadcastTxSync: { + path: '/rpctransact.Transact/BroadcastTxSync', + requestStream: false, + responseStream: false, + requestType: rpctransact_pb.TxEnvelopeParam, + responseType: exec_pb.TxExecution, + requestSerialize: serialize_rpctransact_TxEnvelopeParam, + requestDeserialize: deserialize_rpctransact_TxEnvelopeParam, + responseSerialize: serialize_exec_TxExecution, + responseDeserialize: deserialize_exec_TxExecution, + }, + // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side +broadcastTxAsync: { + path: '/rpctransact.Transact/BroadcastTxAsync', + requestStream: false, + responseStream: false, + requestType: rpctransact_pb.TxEnvelopeParam, + responseType: txs_pb.Receipt, + requestSerialize: serialize_rpctransact_TxEnvelopeParam, + requestDeserialize: deserialize_rpctransact_TxEnvelopeParam, + responseSerialize: serialize_txs_Receipt, + responseDeserialize: deserialize_txs_Receipt, + }, + // Sign transaction server-side +signTx: { + path: '/rpctransact.Transact/SignTx', + requestStream: false, + responseStream: false, + requestType: rpctransact_pb.TxEnvelopeParam, + responseType: rpctransact_pb.TxEnvelope, + requestSerialize: serialize_rpctransact_TxEnvelopeParam, + requestDeserialize: deserialize_rpctransact_TxEnvelopeParam, + responseSerialize: serialize_rpctransact_TxEnvelope, + responseDeserialize: deserialize_rpctransact_TxEnvelope, + }, + // Formulate a transaction from a Payload and retrun the envelop with the Tx bytes ready to sign +formulateTx: { + path: '/rpctransact.Transact/FormulateTx', + requestStream: false, + responseStream: false, + requestType: payload_pb.Any, + responseType: rpctransact_pb.TxEnvelope, + requestSerialize: serialize_payload_Any, + requestDeserialize: deserialize_payload_Any, + responseSerialize: serialize_rpctransact_TxEnvelope, + responseDeserialize: deserialize_rpctransact_TxEnvelope, + }, + // Formulate and sign a CallTx transaction signed server-side and wait for it to be included in a block, retrieving response +callTxSync: { + path: '/rpctransact.Transact/CallTxSync', + requestStream: false, + responseStream: false, + requestType: payload_pb.CallTx, + responseType: exec_pb.TxExecution, + requestSerialize: serialize_payload_CallTx, + requestDeserialize: deserialize_payload_CallTx, + responseSerialize: serialize_exec_TxExecution, + responseDeserialize: deserialize_exec_TxExecution, + }, + // Formulate and sign a CallTx transaction signed server-side +callTxAsync: { + path: '/rpctransact.Transact/CallTxAsync', + requestStream: false, + responseStream: false, + requestType: payload_pb.CallTx, + responseType: txs_pb.Receipt, + requestSerialize: serialize_payload_CallTx, + requestDeserialize: deserialize_payload_CallTx, + responseSerialize: serialize_txs_Receipt, + responseDeserialize: deserialize_txs_Receipt, + }, + // Perform a 'simulated' call of a contract against the current committed EVM state without any changes been saved +// and wait for the transaction to be included in a block +callTxSim: { + path: '/rpctransact.Transact/CallTxSim', + requestStream: false, + responseStream: false, + requestType: payload_pb.CallTx, + responseType: exec_pb.TxExecution, + requestSerialize: serialize_payload_CallTx, + requestDeserialize: deserialize_payload_CallTx, + responseSerialize: serialize_exec_TxExecution, + responseDeserialize: deserialize_exec_TxExecution, + }, + // Perform a 'simulated' execution of provided code against the current committed EVM state without any changes been saved +callCodeSim: { + path: '/rpctransact.Transact/CallCodeSim', + requestStream: false, + responseStream: false, + requestType: rpctransact_pb.CallCodeParam, + responseType: exec_pb.TxExecution, + requestSerialize: serialize_rpctransact_CallCodeParam, + requestDeserialize: deserialize_rpctransact_CallCodeParam, + responseSerialize: serialize_exec_TxExecution, + responseDeserialize: deserialize_exec_TxExecution, + }, + // Formulate a SendTx transaction signed server-side and wait for it to be included in a block, retrieving response +sendTxSync: { + path: '/rpctransact.Transact/SendTxSync', + requestStream: false, + responseStream: false, + requestType: payload_pb.SendTx, + responseType: exec_pb.TxExecution, + requestSerialize: serialize_payload_SendTx, + requestDeserialize: deserialize_payload_SendTx, + responseSerialize: serialize_exec_TxExecution, + responseDeserialize: deserialize_exec_TxExecution, + }, + // Formulate and SendTx transaction signed server-side +sendTxAsync: { + path: '/rpctransact.Transact/SendTxAsync', + requestStream: false, + responseStream: false, + requestType: payload_pb.SendTx, + responseType: txs_pb.Receipt, + requestSerialize: serialize_payload_SendTx, + requestDeserialize: deserialize_payload_SendTx, + responseSerialize: serialize_txs_Receipt, + responseDeserialize: deserialize_txs_Receipt, + }, + // Formulate a NameTx signed server-side and wait for it to be included in a block returning the registered name +nameTxSync: { + path: '/rpctransact.Transact/NameTxSync', + requestStream: false, + responseStream: false, + requestType: payload_pb.NameTx, + responseType: exec_pb.TxExecution, + requestSerialize: serialize_payload_NameTx, + requestDeserialize: deserialize_payload_NameTx, + responseSerialize: serialize_exec_TxExecution, + responseDeserialize: deserialize_exec_TxExecution, + }, + // Formulate a NameTx signed server-side +nameTxAsync: { + path: '/rpctransact.Transact/NameTxAsync', + requestStream: false, + responseStream: false, + requestType: payload_pb.NameTx, + responseType: txs_pb.Receipt, + requestSerialize: serialize_payload_NameTx, + requestDeserialize: deserialize_payload_NameTx, + responseSerialize: serialize_txs_Receipt, + responseDeserialize: deserialize_txs_Receipt, + }, +}; + diff --git a/js/proto/rpctransact_pb.d.ts b/js/proto/rpctransact_pb.d.ts new file mode 100644 index 000000000..800a5be2a --- /dev/null +++ b/js/proto/rpctransact_pb.d.ts @@ -0,0 +1,109 @@ +// package: rpctransact +// file: rpctransact.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb"; +import * as exec_pb from "./exec_pb"; +import * as payload_pb from "./payload_pb"; +import * as txs_pb from "./txs_pb"; + +export class CallCodeParam extends jspb.Message { + getFromaddress(): Uint8Array | string; + getFromaddress_asU8(): Uint8Array; + getFromaddress_asB64(): string; + setFromaddress(value: Uint8Array | string): CallCodeParam; + + getCode(): Uint8Array | string; + getCode_asU8(): Uint8Array; + getCode_asB64(): string; + setCode(value: Uint8Array | string): CallCodeParam; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): CallCodeParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CallCodeParam.AsObject; + static toObject(includeInstance: boolean, msg: CallCodeParam): CallCodeParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CallCodeParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CallCodeParam; + static deserializeBinaryFromReader(message: CallCodeParam, reader: jspb.BinaryReader): CallCodeParam; +} + +export namespace CallCodeParam { + export type AsObject = { + fromaddress: Uint8Array | string, + code: Uint8Array | string, + data: Uint8Array | string, + } +} + +export class TxEnvelope extends jspb.Message { + + hasEnvelope(): boolean; + clearEnvelope(): void; + getEnvelope(): txs_pb.Envelope | undefined; + setEnvelope(value?: txs_pb.Envelope): TxEnvelope; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxEnvelope.AsObject; + static toObject(includeInstance: boolean, msg: TxEnvelope): TxEnvelope.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxEnvelope, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxEnvelope; + static deserializeBinaryFromReader(message: TxEnvelope, reader: jspb.BinaryReader): TxEnvelope; +} + +export namespace TxEnvelope { + export type AsObject = { + envelope?: txs_pb.Envelope.AsObject, + } +} + +export class TxEnvelopeParam extends jspb.Message { + + hasEnvelope(): boolean; + clearEnvelope(): void; + getEnvelope(): txs_pb.Envelope | undefined; + setEnvelope(value?: txs_pb.Envelope): TxEnvelopeParam; + + + hasPayload(): boolean; + clearPayload(): void; + getPayload(): payload_pb.Any | undefined; + setPayload(value?: payload_pb.Any): TxEnvelopeParam; + + + hasTimeout(): boolean; + clearTimeout(): void; + getTimeout(): google_protobuf_duration_pb.Duration | undefined; + setTimeout(value?: google_protobuf_duration_pb.Duration): TxEnvelopeParam; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxEnvelopeParam.AsObject; + static toObject(includeInstance: boolean, msg: TxEnvelopeParam): TxEnvelopeParam.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxEnvelopeParam, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxEnvelopeParam; + static deserializeBinaryFromReader(message: TxEnvelopeParam, reader: jspb.BinaryReader): TxEnvelopeParam; +} + +export namespace TxEnvelopeParam { + export type AsObject = { + envelope?: txs_pb.Envelope.AsObject, + payload?: payload_pb.Any.AsObject, + timeout?: google_protobuf_duration_pb.Duration.AsObject, + } +} diff --git a/js/proto/rpctransact_pb.js b/js/proto/rpctransact_pb.js new file mode 100644 index 000000000..203888c09 --- /dev/null +++ b/js/proto/rpctransact_pb.js @@ -0,0 +1,759 @@ +// source: rpctransact.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js'); +goog.object.extend(proto, google_protobuf_duration_pb); +var exec_pb = require('./exec_pb.js'); +goog.object.extend(proto, exec_pb); +var payload_pb = require('./payload_pb.js'); +goog.object.extend(proto, payload_pb); +var txs_pb = require('./txs_pb.js'); +goog.object.extend(proto, txs_pb); +goog.exportSymbol('proto.rpctransact.CallCodeParam', null, global); +goog.exportSymbol('proto.rpctransact.TxEnvelope', null, global); +goog.exportSymbol('proto.rpctransact.TxEnvelopeParam', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpctransact.CallCodeParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpctransact.CallCodeParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpctransact.CallCodeParam.displayName = 'proto.rpctransact.CallCodeParam'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpctransact.TxEnvelope = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpctransact.TxEnvelope, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpctransact.TxEnvelope.displayName = 'proto.rpctransact.TxEnvelope'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.rpctransact.TxEnvelopeParam = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.rpctransact.TxEnvelopeParam, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.rpctransact.TxEnvelopeParam.displayName = 'proto.rpctransact.TxEnvelopeParam'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpctransact.CallCodeParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpctransact.CallCodeParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpctransact.CallCodeParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpctransact.CallCodeParam.toObject = function(includeInstance, msg) { + var f, obj = { + fromaddress: msg.getFromaddress_asB64(), + code: msg.getCode_asB64(), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpctransact.CallCodeParam} + */ +proto.rpctransact.CallCodeParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpctransact.CallCodeParam; + return proto.rpctransact.CallCodeParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpctransact.CallCodeParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpctransact.CallCodeParam} + */ +proto.rpctransact.CallCodeParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setFromaddress(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCode(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpctransact.CallCodeParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpctransact.CallCodeParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpctransact.CallCodeParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpctransact.CallCodeParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFromaddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getCode_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional bytes FromAddress = 1; + * @return {!(string|Uint8Array)} + */ +proto.rpctransact.CallCodeParam.prototype.getFromaddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes FromAddress = 1; + * This is a type-conversion wrapper around `getFromaddress()` + * @return {string} + */ +proto.rpctransact.CallCodeParam.prototype.getFromaddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getFromaddress())); +}; + + +/** + * optional bytes FromAddress = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getFromaddress()` + * @return {!Uint8Array} + */ +proto.rpctransact.CallCodeParam.prototype.getFromaddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getFromaddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpctransact.CallCodeParam} returns this + */ +proto.rpctransact.CallCodeParam.prototype.setFromaddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes Code = 2; + * @return {!(string|Uint8Array)} + */ +proto.rpctransact.CallCodeParam.prototype.getCode = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Code = 2; + * This is a type-conversion wrapper around `getCode()` + * @return {string} + */ +proto.rpctransact.CallCodeParam.prototype.getCode_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCode())); +}; + + +/** + * optional bytes Code = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCode()` + * @return {!Uint8Array} + */ +proto.rpctransact.CallCodeParam.prototype.getCode_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCode())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpctransact.CallCodeParam} returns this + */ +proto.rpctransact.CallCodeParam.prototype.setCode = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes Data = 3; + * @return {!(string|Uint8Array)} + */ +proto.rpctransact.CallCodeParam.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes Data = 3; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.rpctransact.CallCodeParam.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes Data = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.rpctransact.CallCodeParam.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.rpctransact.CallCodeParam} returns this + */ +proto.rpctransact.CallCodeParam.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpctransact.TxEnvelope.prototype.toObject = function(opt_includeInstance) { + return proto.rpctransact.TxEnvelope.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpctransact.TxEnvelope} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpctransact.TxEnvelope.toObject = function(includeInstance, msg) { + var f, obj = { + envelope: (f = msg.getEnvelope()) && txs_pb.Envelope.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpctransact.TxEnvelope} + */ +proto.rpctransact.TxEnvelope.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpctransact.TxEnvelope; + return proto.rpctransact.TxEnvelope.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpctransact.TxEnvelope} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpctransact.TxEnvelope} + */ +proto.rpctransact.TxEnvelope.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new txs_pb.Envelope; + reader.readMessage(value,txs_pb.Envelope.deserializeBinaryFromReader); + msg.setEnvelope(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpctransact.TxEnvelope.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpctransact.TxEnvelope.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpctransact.TxEnvelope} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpctransact.TxEnvelope.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEnvelope(); + if (f != null) { + writer.writeMessage( + 1, + f, + txs_pb.Envelope.serializeBinaryToWriter + ); + } +}; + + +/** + * optional txs.Envelope Envelope = 1; + * @return {?proto.txs.Envelope} + */ +proto.rpctransact.TxEnvelope.prototype.getEnvelope = function() { + return /** @type{?proto.txs.Envelope} */ ( + jspb.Message.getWrapperField(this, txs_pb.Envelope, 1)); +}; + + +/** + * @param {?proto.txs.Envelope|undefined} value + * @return {!proto.rpctransact.TxEnvelope} returns this +*/ +proto.rpctransact.TxEnvelope.prototype.setEnvelope = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpctransact.TxEnvelope} returns this + */ +proto.rpctransact.TxEnvelope.prototype.clearEnvelope = function() { + return this.setEnvelope(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpctransact.TxEnvelope.prototype.hasEnvelope = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.rpctransact.TxEnvelopeParam.prototype.toObject = function(opt_includeInstance) { + return proto.rpctransact.TxEnvelopeParam.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.rpctransact.TxEnvelopeParam} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpctransact.TxEnvelopeParam.toObject = function(includeInstance, msg) { + var f, obj = { + envelope: (f = msg.getEnvelope()) && txs_pb.Envelope.toObject(includeInstance, f), + payload: (f = msg.getPayload()) && payload_pb.Any.toObject(includeInstance, f), + timeout: (f = msg.getTimeout()) && google_protobuf_duration_pb.Duration.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.rpctransact.TxEnvelopeParam} + */ +proto.rpctransact.TxEnvelopeParam.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.rpctransact.TxEnvelopeParam; + return proto.rpctransact.TxEnvelopeParam.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.rpctransact.TxEnvelopeParam} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.rpctransact.TxEnvelopeParam} + */ +proto.rpctransact.TxEnvelopeParam.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new txs_pb.Envelope; + reader.readMessage(value,txs_pb.Envelope.deserializeBinaryFromReader); + msg.setEnvelope(value); + break; + case 2: + var value = new payload_pb.Any; + reader.readMessage(value,payload_pb.Any.deserializeBinaryFromReader); + msg.setPayload(value); + break; + case 3: + var value = new google_protobuf_duration_pb.Duration; + reader.readMessage(value,google_protobuf_duration_pb.Duration.deserializeBinaryFromReader); + msg.setTimeout(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.rpctransact.TxEnvelopeParam.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.rpctransact.TxEnvelopeParam.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.rpctransact.TxEnvelopeParam} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.rpctransact.TxEnvelopeParam.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEnvelope(); + if (f != null) { + writer.writeMessage( + 1, + f, + txs_pb.Envelope.serializeBinaryToWriter + ); + } + f = message.getPayload(); + if (f != null) { + writer.writeMessage( + 2, + f, + payload_pb.Any.serializeBinaryToWriter + ); + } + f = message.getTimeout(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_duration_pb.Duration.serializeBinaryToWriter + ); + } +}; + + +/** + * optional txs.Envelope Envelope = 1; + * @return {?proto.txs.Envelope} + */ +proto.rpctransact.TxEnvelopeParam.prototype.getEnvelope = function() { + return /** @type{?proto.txs.Envelope} */ ( + jspb.Message.getWrapperField(this, txs_pb.Envelope, 1)); +}; + + +/** + * @param {?proto.txs.Envelope|undefined} value + * @return {!proto.rpctransact.TxEnvelopeParam} returns this +*/ +proto.rpctransact.TxEnvelopeParam.prototype.setEnvelope = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpctransact.TxEnvelopeParam} returns this + */ +proto.rpctransact.TxEnvelopeParam.prototype.clearEnvelope = function() { + return this.setEnvelope(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpctransact.TxEnvelopeParam.prototype.hasEnvelope = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional payload.Any Payload = 2; + * @return {?proto.payload.Any} + */ +proto.rpctransact.TxEnvelopeParam.prototype.getPayload = function() { + return /** @type{?proto.payload.Any} */ ( + jspb.Message.getWrapperField(this, payload_pb.Any, 2)); +}; + + +/** + * @param {?proto.payload.Any|undefined} value + * @return {!proto.rpctransact.TxEnvelopeParam} returns this +*/ +proto.rpctransact.TxEnvelopeParam.prototype.setPayload = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpctransact.TxEnvelopeParam} returns this + */ +proto.rpctransact.TxEnvelopeParam.prototype.clearPayload = function() { + return this.setPayload(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpctransact.TxEnvelopeParam.prototype.hasPayload = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.Duration Timeout = 3; + * @return {?proto.google.protobuf.Duration} + */ +proto.rpctransact.TxEnvelopeParam.prototype.getTimeout = function() { + return /** @type{?proto.google.protobuf.Duration} */ ( + jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 3)); +}; + + +/** + * @param {?proto.google.protobuf.Duration|undefined} value + * @return {!proto.rpctransact.TxEnvelopeParam} returns this +*/ +proto.rpctransact.TxEnvelopeParam.prototype.setTimeout = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.rpctransact.TxEnvelopeParam} returns this + */ +proto.rpctransact.TxEnvelopeParam.prototype.clearTimeout = function() { + return this.setTimeout(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.rpctransact.TxEnvelopeParam.prototype.hasTimeout = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +goog.object.extend(exports, proto.rpctransact); diff --git a/js/proto/spec_grpc_pb.js b/js/proto/spec_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/spec_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/spec_pb.d.ts b/js/proto/spec_pb.d.ts new file mode 100644 index 000000000..037da85cf --- /dev/null +++ b/js/proto/spec_pb.d.ts @@ -0,0 +1,68 @@ +// package: spec +// file: spec.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as crypto_pb from "./crypto_pb"; +import * as balance_pb from "./balance_pb"; + +export class TemplateAccount extends jspb.Message { + getName(): string; + setName(value: string): TemplateAccount; + + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): TemplateAccount; + + + hasPublickey(): boolean; + clearPublickey(): void; + getPublickey(): crypto_pb.PublicKey | undefined; + setPublickey(value?: crypto_pb.PublicKey): TemplateAccount; + + clearAmountsList(): void; + getAmountsList(): Array; + setAmountsList(value: Array): TemplateAccount; + addAmounts(value?: balance_pb.Balance, index?: number): balance_pb.Balance; + + clearPermissionsList(): void; + getPermissionsList(): Array; + setPermissionsList(value: Array): TemplateAccount; + addPermissions(value: string, index?: number): string; + + clearRolesList(): void; + getRolesList(): Array; + setRolesList(value: Array): TemplateAccount; + addRoles(value: string, index?: number): string; + + getCode(): Uint8Array | string; + getCode_asU8(): Uint8Array; + getCode_asB64(): string; + setCode(value: Uint8Array | string): TemplateAccount; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TemplateAccount.AsObject; + static toObject(includeInstance: boolean, msg: TemplateAccount): TemplateAccount.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TemplateAccount, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TemplateAccount; + static deserializeBinaryFromReader(message: TemplateAccount, reader: jspb.BinaryReader): TemplateAccount; +} + +export namespace TemplateAccount { + export type AsObject = { + name: string, + address: Uint8Array | string, + publickey?: crypto_pb.PublicKey.AsObject, + amountsList: Array, + permissionsList: Array, + rolesList: Array, + code: Uint8Array | string, + } +} diff --git a/js/proto/spec_pb.js b/js/proto/spec_pb.js new file mode 100644 index 000000000..4ea1ad43b --- /dev/null +++ b/js/proto/spec_pb.js @@ -0,0 +1,492 @@ +// source: spec.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var crypto_pb = require('./crypto_pb.js'); +goog.object.extend(proto, crypto_pb); +var balance_pb = require('./balance_pb.js'); +goog.object.extend(proto, balance_pb); +goog.exportSymbol('proto.spec.TemplateAccount', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spec.TemplateAccount = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.spec.TemplateAccount.repeatedFields_, null); +}; +goog.inherits(proto.spec.TemplateAccount, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spec.TemplateAccount.displayName = 'proto.spec.TemplateAccount'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.spec.TemplateAccount.repeatedFields_ = [4,5,6]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spec.TemplateAccount.prototype.toObject = function(opt_includeInstance) { + return proto.spec.TemplateAccount.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spec.TemplateAccount} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spec.TemplateAccount.toObject = function(includeInstance, msg) { + var f, obj = { + name: jspb.Message.getFieldWithDefault(msg, 1, ""), + address: msg.getAddress_asB64(), + publickey: (f = msg.getPublickey()) && crypto_pb.PublicKey.toObject(includeInstance, f), + amountsList: jspb.Message.toObjectList(msg.getAmountsList(), + balance_pb.Balance.toObject, includeInstance), + permissionsList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f, + rolesList: (f = jspb.Message.getRepeatedField(msg, 6)) == null ? undefined : f, + code: msg.getCode_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spec.TemplateAccount} + */ +proto.spec.TemplateAccount.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spec.TemplateAccount; + return proto.spec.TemplateAccount.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spec.TemplateAccount} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spec.TemplateAccount} + */ +proto.spec.TemplateAccount.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 3: + var value = new crypto_pb.PublicKey; + reader.readMessage(value,crypto_pb.PublicKey.deserializeBinaryFromReader); + msg.setPublickey(value); + break; + case 4: + var value = new balance_pb.Balance; + reader.readMessage(value,balance_pb.Balance.deserializeBinaryFromReader); + msg.addAmounts(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.addPermissions(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.addRoles(value); + break; + case 7: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCode(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spec.TemplateAccount.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spec.TemplateAccount.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spec.TemplateAccount} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spec.TemplateAccount.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getPublickey(); + if (f != null) { + writer.writeMessage( + 3, + f, + crypto_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getAmountsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + balance_pb.Balance.serializeBinaryToWriter + ); + } + f = message.getPermissionsList(); + if (f.length > 0) { + writer.writeRepeatedString( + 5, + f + ); + } + f = message.getRolesList(); + if (f.length > 0) { + writer.writeRepeatedString( + 6, + f + ); + } + f = message.getCode_asU8(); + if (f.length > 0) { + writer.writeBytes( + 7, + f + ); + } +}; + + +/** + * optional string Name = 1; + * @return {string} + */ +proto.spec.TemplateAccount.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bytes Address = 2; + * @return {!(string|Uint8Array)} + */ +proto.spec.TemplateAccount.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Address = 2; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.spec.TemplateAccount.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.spec.TemplateAccount.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional crypto.PublicKey PublicKey = 3; + * @return {?proto.crypto.PublicKey} + */ +proto.spec.TemplateAccount.prototype.getPublickey = function() { + return /** @type{?proto.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, crypto_pb.PublicKey, 3)); +}; + + +/** + * @param {?proto.crypto.PublicKey|undefined} value + * @return {!proto.spec.TemplateAccount} returns this +*/ +proto.spec.TemplateAccount.prototype.setPublickey = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.clearPublickey = function() { + return this.setPublickey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spec.TemplateAccount.prototype.hasPublickey = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated balance.Balance Amounts = 4; + * @return {!Array} + */ +proto.spec.TemplateAccount.prototype.getAmountsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, balance_pb.Balance, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.spec.TemplateAccount} returns this +*/ +proto.spec.TemplateAccount.prototype.setAmountsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.balance.Balance=} opt_value + * @param {number=} opt_index + * @return {!proto.balance.Balance} + */ +proto.spec.TemplateAccount.prototype.addAmounts = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.balance.Balance, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.clearAmountsList = function() { + return this.setAmountsList([]); +}; + + +/** + * repeated string Permissions = 5; + * @return {!Array} + */ +proto.spec.TemplateAccount.prototype.getPermissionsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.setPermissionsList = function(value) { + return jspb.Message.setField(this, 5, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.addPermissions = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.clearPermissionsList = function() { + return this.setPermissionsList([]); +}; + + +/** + * repeated string Roles = 6; + * @return {!Array} + */ +proto.spec.TemplateAccount.prototype.getRolesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 6)); +}; + + +/** + * @param {!Array} value + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.setRolesList = function(value) { + return jspb.Message.setField(this, 6, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.addRoles = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 6, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.clearRolesList = function() { + return this.setRolesList([]); +}; + + +/** + * optional bytes Code = 7; + * @return {!(string|Uint8Array)} + */ +proto.spec.TemplateAccount.prototype.getCode = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * optional bytes Code = 7; + * This is a type-conversion wrapper around `getCode()` + * @return {string} + */ +proto.spec.TemplateAccount.prototype.getCode_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCode())); +}; + + +/** + * optional bytes Code = 7; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCode()` + * @return {!Uint8Array} + */ +proto.spec.TemplateAccount.prototype.getCode_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCode())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.spec.TemplateAccount} returns this + */ +proto.spec.TemplateAccount.prototype.setCode = function(value) { + return jspb.Message.setProto3BytesField(this, 7, value); +}; + + +goog.object.extend(exports, proto.spec); diff --git a/js/proto/storage_grpc_pb.js b/js/proto/storage_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/storage_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/storage_pb.d.ts b/js/proto/storage_pb.d.ts new file mode 100644 index 000000000..a924f26b3 --- /dev/null +++ b/js/proto/storage_pb.d.ts @@ -0,0 +1,35 @@ +// package: storage +// file: storage.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class CommitID extends jspb.Message { + getVersion(): number; + setVersion(value: number): CommitID; + + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): CommitID; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CommitID.AsObject; + static toObject(includeInstance: boolean, msg: CommitID): CommitID.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CommitID, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CommitID; + static deserializeBinaryFromReader(message: CommitID, reader: jspb.BinaryReader): CommitID; +} + +export namespace CommitID { + export type AsObject = { + version: number, + hash: Uint8Array | string, + } +} diff --git a/js/proto/storage_pb.js b/js/proto/storage_pb.js new file mode 100644 index 000000000..1995cceca --- /dev/null +++ b/js/proto/storage_pb.js @@ -0,0 +1,225 @@ +// source: storage.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.storage.CommitID', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.storage.CommitID = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.storage.CommitID, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.storage.CommitID.displayName = 'proto.storage.CommitID'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.storage.CommitID.prototype.toObject = function(opt_includeInstance) { + return proto.storage.CommitID.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.storage.CommitID} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.storage.CommitID.toObject = function(includeInstance, msg) { + var f, obj = { + version: jspb.Message.getFieldWithDefault(msg, 1, 0), + hash: msg.getHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.storage.CommitID} + */ +proto.storage.CommitID.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.storage.CommitID; + return proto.storage.CommitID.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.storage.CommitID} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.storage.CommitID} + */ +proto.storage.CommitID.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setVersion(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.storage.CommitID.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.storage.CommitID.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.storage.CommitID} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.storage.CommitID.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVersion(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional int64 Version = 1; + * @return {number} + */ +proto.storage.CommitID.prototype.getVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.storage.CommitID} returns this + */ +proto.storage.CommitID.prototype.setVersion = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes Hash = 2; + * @return {!(string|Uint8Array)} + */ +proto.storage.CommitID.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Hash = 2; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.storage.CommitID.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes Hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.storage.CommitID.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.storage.CommitID} returns this + */ +proto.storage.CommitID.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +goog.object.extend(exports, proto.storage); diff --git a/js/proto/tendermint/abci/types_grpc_pb.d.ts b/js/proto/tendermint/abci/types_grpc_pb.d.ts new file mode 100644 index 000000000..5859074ef --- /dev/null +++ b/js/proto/tendermint/abci/types_grpc_pb.d.ts @@ -0,0 +1,286 @@ +// package: tendermint.abci +// file: tendermint/abci/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; +import * as tendermint_abci_types_pb from "../../tendermint/abci/types_pb"; +import * as tendermint_crypto_proof_pb from "../../tendermint/crypto/proof_pb"; +import * as tendermint_types_types_pb from "../../tendermint/types/types_pb"; +import * as tendermint_crypto_keys_pb from "../../tendermint/crypto/keys_pb"; +import * as tendermint_types_params_pb from "../../tendermint/types/params_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; + +interface IABCIApplicationService extends grpc.ServiceDefinition { + echo: IABCIApplicationService_IEcho; + flush: IABCIApplicationService_IFlush; + info: IABCIApplicationService_IInfo; + setOption: IABCIApplicationService_ISetOption; + deliverTx: IABCIApplicationService_IDeliverTx; + checkTx: IABCIApplicationService_ICheckTx; + query: IABCIApplicationService_IQuery; + commit: IABCIApplicationService_ICommit; + initChain: IABCIApplicationService_IInitChain; + beginBlock: IABCIApplicationService_IBeginBlock; + endBlock: IABCIApplicationService_IEndBlock; + listSnapshots: IABCIApplicationService_IListSnapshots; + offerSnapshot: IABCIApplicationService_IOfferSnapshot; + loadSnapshotChunk: IABCIApplicationService_ILoadSnapshotChunk; + applySnapshotChunk: IABCIApplicationService_IApplySnapshotChunk; +} + +interface IABCIApplicationService_IEcho extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/Echo"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IFlush extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/Flush"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IInfo extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/Info"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_ISetOption extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/SetOption"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IDeliverTx extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/DeliverTx"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_ICheckTx extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/CheckTx"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IQuery extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/Query"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_ICommit extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/Commit"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IInitChain extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/InitChain"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IBeginBlock extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/BeginBlock"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IEndBlock extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/EndBlock"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IListSnapshots extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/ListSnapshots"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IOfferSnapshot extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/OfferSnapshot"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_ILoadSnapshotChunk extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/LoadSnapshotChunk"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IABCIApplicationService_IApplySnapshotChunk extends grpc.MethodDefinition { + path: "/tendermint.abci.ABCIApplication/ApplySnapshotChunk"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const ABCIApplicationService: IABCIApplicationService; + +export interface IABCIApplicationServer extends grpc.UntypedServiceImplementation { + echo: grpc.handleUnaryCall; + flush: grpc.handleUnaryCall; + info: grpc.handleUnaryCall; + setOption: grpc.handleUnaryCall; + deliverTx: grpc.handleUnaryCall; + checkTx: grpc.handleUnaryCall; + query: grpc.handleUnaryCall; + commit: grpc.handleUnaryCall; + initChain: grpc.handleUnaryCall; + beginBlock: grpc.handleUnaryCall; + endBlock: grpc.handleUnaryCall; + listSnapshots: grpc.handleUnaryCall; + offerSnapshot: grpc.handleUnaryCall; + loadSnapshotChunk: grpc.handleUnaryCall; + applySnapshotChunk: grpc.handleUnaryCall; +} + +export interface IABCIApplicationClient { + echo(request: tendermint_abci_types_pb.RequestEcho, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEcho) => void): grpc.ClientUnaryCall; + echo(request: tendermint_abci_types_pb.RequestEcho, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEcho) => void): grpc.ClientUnaryCall; + echo(request: tendermint_abci_types_pb.RequestEcho, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEcho) => void): grpc.ClientUnaryCall; + flush(request: tendermint_abci_types_pb.RequestFlush, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseFlush) => void): grpc.ClientUnaryCall; + flush(request: tendermint_abci_types_pb.RequestFlush, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseFlush) => void): grpc.ClientUnaryCall; + flush(request: tendermint_abci_types_pb.RequestFlush, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseFlush) => void): grpc.ClientUnaryCall; + info(request: tendermint_abci_types_pb.RequestInfo, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInfo) => void): grpc.ClientUnaryCall; + info(request: tendermint_abci_types_pb.RequestInfo, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInfo) => void): grpc.ClientUnaryCall; + info(request: tendermint_abci_types_pb.RequestInfo, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInfo) => void): grpc.ClientUnaryCall; + setOption(request: tendermint_abci_types_pb.RequestSetOption, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseSetOption) => void): grpc.ClientUnaryCall; + setOption(request: tendermint_abci_types_pb.RequestSetOption, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseSetOption) => void): grpc.ClientUnaryCall; + setOption(request: tendermint_abci_types_pb.RequestSetOption, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseSetOption) => void): grpc.ClientUnaryCall; + deliverTx(request: tendermint_abci_types_pb.RequestDeliverTx, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseDeliverTx) => void): grpc.ClientUnaryCall; + deliverTx(request: tendermint_abci_types_pb.RequestDeliverTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseDeliverTx) => void): grpc.ClientUnaryCall; + deliverTx(request: tendermint_abci_types_pb.RequestDeliverTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseDeliverTx) => void): grpc.ClientUnaryCall; + checkTx(request: tendermint_abci_types_pb.RequestCheckTx, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCheckTx) => void): grpc.ClientUnaryCall; + checkTx(request: tendermint_abci_types_pb.RequestCheckTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCheckTx) => void): grpc.ClientUnaryCall; + checkTx(request: tendermint_abci_types_pb.RequestCheckTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCheckTx) => void): grpc.ClientUnaryCall; + query(request: tendermint_abci_types_pb.RequestQuery, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseQuery) => void): grpc.ClientUnaryCall; + query(request: tendermint_abci_types_pb.RequestQuery, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseQuery) => void): grpc.ClientUnaryCall; + query(request: tendermint_abci_types_pb.RequestQuery, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseQuery) => void): grpc.ClientUnaryCall; + commit(request: tendermint_abci_types_pb.RequestCommit, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCommit) => void): grpc.ClientUnaryCall; + commit(request: tendermint_abci_types_pb.RequestCommit, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCommit) => void): grpc.ClientUnaryCall; + commit(request: tendermint_abci_types_pb.RequestCommit, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCommit) => void): grpc.ClientUnaryCall; + initChain(request: tendermint_abci_types_pb.RequestInitChain, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInitChain) => void): grpc.ClientUnaryCall; + initChain(request: tendermint_abci_types_pb.RequestInitChain, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInitChain) => void): grpc.ClientUnaryCall; + initChain(request: tendermint_abci_types_pb.RequestInitChain, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInitChain) => void): grpc.ClientUnaryCall; + beginBlock(request: tendermint_abci_types_pb.RequestBeginBlock, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseBeginBlock) => void): grpc.ClientUnaryCall; + beginBlock(request: tendermint_abci_types_pb.RequestBeginBlock, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseBeginBlock) => void): grpc.ClientUnaryCall; + beginBlock(request: tendermint_abci_types_pb.RequestBeginBlock, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseBeginBlock) => void): grpc.ClientUnaryCall; + endBlock(request: tendermint_abci_types_pb.RequestEndBlock, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEndBlock) => void): grpc.ClientUnaryCall; + endBlock(request: tendermint_abci_types_pb.RequestEndBlock, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEndBlock) => void): grpc.ClientUnaryCall; + endBlock(request: tendermint_abci_types_pb.RequestEndBlock, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEndBlock) => void): grpc.ClientUnaryCall; + listSnapshots(request: tendermint_abci_types_pb.RequestListSnapshots, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseListSnapshots) => void): grpc.ClientUnaryCall; + listSnapshots(request: tendermint_abci_types_pb.RequestListSnapshots, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseListSnapshots) => void): grpc.ClientUnaryCall; + listSnapshots(request: tendermint_abci_types_pb.RequestListSnapshots, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseListSnapshots) => void): grpc.ClientUnaryCall; + offerSnapshot(request: tendermint_abci_types_pb.RequestOfferSnapshot, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseOfferSnapshot) => void): grpc.ClientUnaryCall; + offerSnapshot(request: tendermint_abci_types_pb.RequestOfferSnapshot, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseOfferSnapshot) => void): grpc.ClientUnaryCall; + offerSnapshot(request: tendermint_abci_types_pb.RequestOfferSnapshot, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseOfferSnapshot) => void): grpc.ClientUnaryCall; + loadSnapshotChunk(request: tendermint_abci_types_pb.RequestLoadSnapshotChunk, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseLoadSnapshotChunk) => void): grpc.ClientUnaryCall; + loadSnapshotChunk(request: tendermint_abci_types_pb.RequestLoadSnapshotChunk, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseLoadSnapshotChunk) => void): grpc.ClientUnaryCall; + loadSnapshotChunk(request: tendermint_abci_types_pb.RequestLoadSnapshotChunk, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseLoadSnapshotChunk) => void): grpc.ClientUnaryCall; + applySnapshotChunk(request: tendermint_abci_types_pb.RequestApplySnapshotChunk, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseApplySnapshotChunk) => void): grpc.ClientUnaryCall; + applySnapshotChunk(request: tendermint_abci_types_pb.RequestApplySnapshotChunk, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseApplySnapshotChunk) => void): grpc.ClientUnaryCall; + applySnapshotChunk(request: tendermint_abci_types_pb.RequestApplySnapshotChunk, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseApplySnapshotChunk) => void): grpc.ClientUnaryCall; +} + +export class ABCIApplicationClient extends grpc.Client implements IABCIApplicationClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public echo(request: tendermint_abci_types_pb.RequestEcho, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEcho) => void): grpc.ClientUnaryCall; + public echo(request: tendermint_abci_types_pb.RequestEcho, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEcho) => void): grpc.ClientUnaryCall; + public echo(request: tendermint_abci_types_pb.RequestEcho, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEcho) => void): grpc.ClientUnaryCall; + public flush(request: tendermint_abci_types_pb.RequestFlush, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseFlush) => void): grpc.ClientUnaryCall; + public flush(request: tendermint_abci_types_pb.RequestFlush, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseFlush) => void): grpc.ClientUnaryCall; + public flush(request: tendermint_abci_types_pb.RequestFlush, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseFlush) => void): grpc.ClientUnaryCall; + public info(request: tendermint_abci_types_pb.RequestInfo, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInfo) => void): grpc.ClientUnaryCall; + public info(request: tendermint_abci_types_pb.RequestInfo, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInfo) => void): grpc.ClientUnaryCall; + public info(request: tendermint_abci_types_pb.RequestInfo, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInfo) => void): grpc.ClientUnaryCall; + public setOption(request: tendermint_abci_types_pb.RequestSetOption, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseSetOption) => void): grpc.ClientUnaryCall; + public setOption(request: tendermint_abci_types_pb.RequestSetOption, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseSetOption) => void): grpc.ClientUnaryCall; + public setOption(request: tendermint_abci_types_pb.RequestSetOption, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseSetOption) => void): grpc.ClientUnaryCall; + public deliverTx(request: tendermint_abci_types_pb.RequestDeliverTx, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseDeliverTx) => void): grpc.ClientUnaryCall; + public deliverTx(request: tendermint_abci_types_pb.RequestDeliverTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseDeliverTx) => void): grpc.ClientUnaryCall; + public deliverTx(request: tendermint_abci_types_pb.RequestDeliverTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseDeliverTx) => void): grpc.ClientUnaryCall; + public checkTx(request: tendermint_abci_types_pb.RequestCheckTx, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCheckTx) => void): grpc.ClientUnaryCall; + public checkTx(request: tendermint_abci_types_pb.RequestCheckTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCheckTx) => void): grpc.ClientUnaryCall; + public checkTx(request: tendermint_abci_types_pb.RequestCheckTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCheckTx) => void): grpc.ClientUnaryCall; + public query(request: tendermint_abci_types_pb.RequestQuery, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseQuery) => void): grpc.ClientUnaryCall; + public query(request: tendermint_abci_types_pb.RequestQuery, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseQuery) => void): grpc.ClientUnaryCall; + public query(request: tendermint_abci_types_pb.RequestQuery, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseQuery) => void): grpc.ClientUnaryCall; + public commit(request: tendermint_abci_types_pb.RequestCommit, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCommit) => void): grpc.ClientUnaryCall; + public commit(request: tendermint_abci_types_pb.RequestCommit, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCommit) => void): grpc.ClientUnaryCall; + public commit(request: tendermint_abci_types_pb.RequestCommit, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseCommit) => void): grpc.ClientUnaryCall; + public initChain(request: tendermint_abci_types_pb.RequestInitChain, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInitChain) => void): grpc.ClientUnaryCall; + public initChain(request: tendermint_abci_types_pb.RequestInitChain, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInitChain) => void): grpc.ClientUnaryCall; + public initChain(request: tendermint_abci_types_pb.RequestInitChain, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseInitChain) => void): grpc.ClientUnaryCall; + public beginBlock(request: tendermint_abci_types_pb.RequestBeginBlock, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseBeginBlock) => void): grpc.ClientUnaryCall; + public beginBlock(request: tendermint_abci_types_pb.RequestBeginBlock, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseBeginBlock) => void): grpc.ClientUnaryCall; + public beginBlock(request: tendermint_abci_types_pb.RequestBeginBlock, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseBeginBlock) => void): grpc.ClientUnaryCall; + public endBlock(request: tendermint_abci_types_pb.RequestEndBlock, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEndBlock) => void): grpc.ClientUnaryCall; + public endBlock(request: tendermint_abci_types_pb.RequestEndBlock, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEndBlock) => void): grpc.ClientUnaryCall; + public endBlock(request: tendermint_abci_types_pb.RequestEndBlock, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseEndBlock) => void): grpc.ClientUnaryCall; + public listSnapshots(request: tendermint_abci_types_pb.RequestListSnapshots, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseListSnapshots) => void): grpc.ClientUnaryCall; + public listSnapshots(request: tendermint_abci_types_pb.RequestListSnapshots, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseListSnapshots) => void): grpc.ClientUnaryCall; + public listSnapshots(request: tendermint_abci_types_pb.RequestListSnapshots, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseListSnapshots) => void): grpc.ClientUnaryCall; + public offerSnapshot(request: tendermint_abci_types_pb.RequestOfferSnapshot, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseOfferSnapshot) => void): grpc.ClientUnaryCall; + public offerSnapshot(request: tendermint_abci_types_pb.RequestOfferSnapshot, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseOfferSnapshot) => void): grpc.ClientUnaryCall; + public offerSnapshot(request: tendermint_abci_types_pb.RequestOfferSnapshot, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseOfferSnapshot) => void): grpc.ClientUnaryCall; + public loadSnapshotChunk(request: tendermint_abci_types_pb.RequestLoadSnapshotChunk, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseLoadSnapshotChunk) => void): grpc.ClientUnaryCall; + public loadSnapshotChunk(request: tendermint_abci_types_pb.RequestLoadSnapshotChunk, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseLoadSnapshotChunk) => void): grpc.ClientUnaryCall; + public loadSnapshotChunk(request: tendermint_abci_types_pb.RequestLoadSnapshotChunk, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseLoadSnapshotChunk) => void): grpc.ClientUnaryCall; + public applySnapshotChunk(request: tendermint_abci_types_pb.RequestApplySnapshotChunk, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseApplySnapshotChunk) => void): grpc.ClientUnaryCall; + public applySnapshotChunk(request: tendermint_abci_types_pb.RequestApplySnapshotChunk, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseApplySnapshotChunk) => void): grpc.ClientUnaryCall; + public applySnapshotChunk(request: tendermint_abci_types_pb.RequestApplySnapshotChunk, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_abci_types_pb.ResponseApplySnapshotChunk) => void): grpc.ClientUnaryCall; +} diff --git a/js/proto/tendermint/abci/types_grpc_pb.js b/js/proto/tendermint/abci/types_grpc_pb.js new file mode 100644 index 000000000..ce0071733 --- /dev/null +++ b/js/proto/tendermint/abci/types_grpc_pb.js @@ -0,0 +1,513 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var tendermint_abci_types_pb = require('../../tendermint/abci/types_pb.js'); +var tendermint_crypto_proof_pb = require('../../tendermint/crypto/proof_pb.js'); +var tendermint_types_types_pb = require('../../tendermint/types/types_pb.js'); +var tendermint_crypto_keys_pb = require('../../tendermint/crypto/keys_pb.js'); +var tendermint_types_params_pb = require('../../tendermint/types/params_pb.js'); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); + +function serialize_tendermint_abci_RequestApplySnapshotChunk(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestApplySnapshotChunk)) { + throw new Error('Expected argument of type tendermint.abci.RequestApplySnapshotChunk'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestApplySnapshotChunk(buffer_arg) { + return tendermint_abci_types_pb.RequestApplySnapshotChunk.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestBeginBlock(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestBeginBlock)) { + throw new Error('Expected argument of type tendermint.abci.RequestBeginBlock'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestBeginBlock(buffer_arg) { + return tendermint_abci_types_pb.RequestBeginBlock.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestCheckTx(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestCheckTx)) { + throw new Error('Expected argument of type tendermint.abci.RequestCheckTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestCheckTx(buffer_arg) { + return tendermint_abci_types_pb.RequestCheckTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestCommit(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestCommit)) { + throw new Error('Expected argument of type tendermint.abci.RequestCommit'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestCommit(buffer_arg) { + return tendermint_abci_types_pb.RequestCommit.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestDeliverTx(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestDeliverTx)) { + throw new Error('Expected argument of type tendermint.abci.RequestDeliverTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestDeliverTx(buffer_arg) { + return tendermint_abci_types_pb.RequestDeliverTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestEcho(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestEcho)) { + throw new Error('Expected argument of type tendermint.abci.RequestEcho'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestEcho(buffer_arg) { + return tendermint_abci_types_pb.RequestEcho.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestEndBlock(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestEndBlock)) { + throw new Error('Expected argument of type tendermint.abci.RequestEndBlock'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestEndBlock(buffer_arg) { + return tendermint_abci_types_pb.RequestEndBlock.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestFlush(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestFlush)) { + throw new Error('Expected argument of type tendermint.abci.RequestFlush'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestFlush(buffer_arg) { + return tendermint_abci_types_pb.RequestFlush.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestInfo(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestInfo)) { + throw new Error('Expected argument of type tendermint.abci.RequestInfo'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestInfo(buffer_arg) { + return tendermint_abci_types_pb.RequestInfo.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestInitChain(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestInitChain)) { + throw new Error('Expected argument of type tendermint.abci.RequestInitChain'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestInitChain(buffer_arg) { + return tendermint_abci_types_pb.RequestInitChain.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestListSnapshots(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestListSnapshots)) { + throw new Error('Expected argument of type tendermint.abci.RequestListSnapshots'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestListSnapshots(buffer_arg) { + return tendermint_abci_types_pb.RequestListSnapshots.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestLoadSnapshotChunk(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestLoadSnapshotChunk)) { + throw new Error('Expected argument of type tendermint.abci.RequestLoadSnapshotChunk'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestLoadSnapshotChunk(buffer_arg) { + return tendermint_abci_types_pb.RequestLoadSnapshotChunk.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestOfferSnapshot(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestOfferSnapshot)) { + throw new Error('Expected argument of type tendermint.abci.RequestOfferSnapshot'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestOfferSnapshot(buffer_arg) { + return tendermint_abci_types_pb.RequestOfferSnapshot.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestQuery(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestQuery)) { + throw new Error('Expected argument of type tendermint.abci.RequestQuery'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestQuery(buffer_arg) { + return tendermint_abci_types_pb.RequestQuery.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_RequestSetOption(arg) { + if (!(arg instanceof tendermint_abci_types_pb.RequestSetOption)) { + throw new Error('Expected argument of type tendermint.abci.RequestSetOption'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_RequestSetOption(buffer_arg) { + return tendermint_abci_types_pb.RequestSetOption.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseApplySnapshotChunk(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseApplySnapshotChunk)) { + throw new Error('Expected argument of type tendermint.abci.ResponseApplySnapshotChunk'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseApplySnapshotChunk(buffer_arg) { + return tendermint_abci_types_pb.ResponseApplySnapshotChunk.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseBeginBlock(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseBeginBlock)) { + throw new Error('Expected argument of type tendermint.abci.ResponseBeginBlock'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseBeginBlock(buffer_arg) { + return tendermint_abci_types_pb.ResponseBeginBlock.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseCheckTx(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseCheckTx)) { + throw new Error('Expected argument of type tendermint.abci.ResponseCheckTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseCheckTx(buffer_arg) { + return tendermint_abci_types_pb.ResponseCheckTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseCommit(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseCommit)) { + throw new Error('Expected argument of type tendermint.abci.ResponseCommit'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseCommit(buffer_arg) { + return tendermint_abci_types_pb.ResponseCommit.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseDeliverTx(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseDeliverTx)) { + throw new Error('Expected argument of type tendermint.abci.ResponseDeliverTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseDeliverTx(buffer_arg) { + return tendermint_abci_types_pb.ResponseDeliverTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseEcho(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseEcho)) { + throw new Error('Expected argument of type tendermint.abci.ResponseEcho'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseEcho(buffer_arg) { + return tendermint_abci_types_pb.ResponseEcho.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseEndBlock(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseEndBlock)) { + throw new Error('Expected argument of type tendermint.abci.ResponseEndBlock'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseEndBlock(buffer_arg) { + return tendermint_abci_types_pb.ResponseEndBlock.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseFlush(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseFlush)) { + throw new Error('Expected argument of type tendermint.abci.ResponseFlush'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseFlush(buffer_arg) { + return tendermint_abci_types_pb.ResponseFlush.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseInfo(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseInfo)) { + throw new Error('Expected argument of type tendermint.abci.ResponseInfo'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseInfo(buffer_arg) { + return tendermint_abci_types_pb.ResponseInfo.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseInitChain(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseInitChain)) { + throw new Error('Expected argument of type tendermint.abci.ResponseInitChain'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseInitChain(buffer_arg) { + return tendermint_abci_types_pb.ResponseInitChain.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseListSnapshots(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseListSnapshots)) { + throw new Error('Expected argument of type tendermint.abci.ResponseListSnapshots'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseListSnapshots(buffer_arg) { + return tendermint_abci_types_pb.ResponseListSnapshots.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseLoadSnapshotChunk(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseLoadSnapshotChunk)) { + throw new Error('Expected argument of type tendermint.abci.ResponseLoadSnapshotChunk'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseLoadSnapshotChunk(buffer_arg) { + return tendermint_abci_types_pb.ResponseLoadSnapshotChunk.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseOfferSnapshot(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseOfferSnapshot)) { + throw new Error('Expected argument of type tendermint.abci.ResponseOfferSnapshot'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseOfferSnapshot(buffer_arg) { + return tendermint_abci_types_pb.ResponseOfferSnapshot.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseQuery(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseQuery)) { + throw new Error('Expected argument of type tendermint.abci.ResponseQuery'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseQuery(buffer_arg) { + return tendermint_abci_types_pb.ResponseQuery.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_abci_ResponseSetOption(arg) { + if (!(arg instanceof tendermint_abci_types_pb.ResponseSetOption)) { + throw new Error('Expected argument of type tendermint.abci.ResponseSetOption'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_abci_ResponseSetOption(buffer_arg) { + return tendermint_abci_types_pb.ResponseSetOption.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +// ---------------------------------------- +// Service Definition +// +var ABCIApplicationService = exports['tendermint.abci.ABCIApplication'] = { + echo: { + path: '/tendermint.abci.ABCIApplication/Echo', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestEcho, + responseType: tendermint_abci_types_pb.ResponseEcho, + requestSerialize: serialize_tendermint_abci_RequestEcho, + requestDeserialize: deserialize_tendermint_abci_RequestEcho, + responseSerialize: serialize_tendermint_abci_ResponseEcho, + responseDeserialize: deserialize_tendermint_abci_ResponseEcho, + }, + flush: { + path: '/tendermint.abci.ABCIApplication/Flush', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestFlush, + responseType: tendermint_abci_types_pb.ResponseFlush, + requestSerialize: serialize_tendermint_abci_RequestFlush, + requestDeserialize: deserialize_tendermint_abci_RequestFlush, + responseSerialize: serialize_tendermint_abci_ResponseFlush, + responseDeserialize: deserialize_tendermint_abci_ResponseFlush, + }, + info: { + path: '/tendermint.abci.ABCIApplication/Info', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestInfo, + responseType: tendermint_abci_types_pb.ResponseInfo, + requestSerialize: serialize_tendermint_abci_RequestInfo, + requestDeserialize: deserialize_tendermint_abci_RequestInfo, + responseSerialize: serialize_tendermint_abci_ResponseInfo, + responseDeserialize: deserialize_tendermint_abci_ResponseInfo, + }, + setOption: { + path: '/tendermint.abci.ABCIApplication/SetOption', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestSetOption, + responseType: tendermint_abci_types_pb.ResponseSetOption, + requestSerialize: serialize_tendermint_abci_RequestSetOption, + requestDeserialize: deserialize_tendermint_abci_RequestSetOption, + responseSerialize: serialize_tendermint_abci_ResponseSetOption, + responseDeserialize: deserialize_tendermint_abci_ResponseSetOption, + }, + deliverTx: { + path: '/tendermint.abci.ABCIApplication/DeliverTx', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestDeliverTx, + responseType: tendermint_abci_types_pb.ResponseDeliverTx, + requestSerialize: serialize_tendermint_abci_RequestDeliverTx, + requestDeserialize: deserialize_tendermint_abci_RequestDeliverTx, + responseSerialize: serialize_tendermint_abci_ResponseDeliverTx, + responseDeserialize: deserialize_tendermint_abci_ResponseDeliverTx, + }, + checkTx: { + path: '/tendermint.abci.ABCIApplication/CheckTx', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestCheckTx, + responseType: tendermint_abci_types_pb.ResponseCheckTx, + requestSerialize: serialize_tendermint_abci_RequestCheckTx, + requestDeserialize: deserialize_tendermint_abci_RequestCheckTx, + responseSerialize: serialize_tendermint_abci_ResponseCheckTx, + responseDeserialize: deserialize_tendermint_abci_ResponseCheckTx, + }, + query: { + path: '/tendermint.abci.ABCIApplication/Query', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestQuery, + responseType: tendermint_abci_types_pb.ResponseQuery, + requestSerialize: serialize_tendermint_abci_RequestQuery, + requestDeserialize: deserialize_tendermint_abci_RequestQuery, + responseSerialize: serialize_tendermint_abci_ResponseQuery, + responseDeserialize: deserialize_tendermint_abci_ResponseQuery, + }, + commit: { + path: '/tendermint.abci.ABCIApplication/Commit', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestCommit, + responseType: tendermint_abci_types_pb.ResponseCommit, + requestSerialize: serialize_tendermint_abci_RequestCommit, + requestDeserialize: deserialize_tendermint_abci_RequestCommit, + responseSerialize: serialize_tendermint_abci_ResponseCommit, + responseDeserialize: deserialize_tendermint_abci_ResponseCommit, + }, + initChain: { + path: '/tendermint.abci.ABCIApplication/InitChain', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestInitChain, + responseType: tendermint_abci_types_pb.ResponseInitChain, + requestSerialize: serialize_tendermint_abci_RequestInitChain, + requestDeserialize: deserialize_tendermint_abci_RequestInitChain, + responseSerialize: serialize_tendermint_abci_ResponseInitChain, + responseDeserialize: deserialize_tendermint_abci_ResponseInitChain, + }, + beginBlock: { + path: '/tendermint.abci.ABCIApplication/BeginBlock', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestBeginBlock, + responseType: tendermint_abci_types_pb.ResponseBeginBlock, + requestSerialize: serialize_tendermint_abci_RequestBeginBlock, + requestDeserialize: deserialize_tendermint_abci_RequestBeginBlock, + responseSerialize: serialize_tendermint_abci_ResponseBeginBlock, + responseDeserialize: deserialize_tendermint_abci_ResponseBeginBlock, + }, + endBlock: { + path: '/tendermint.abci.ABCIApplication/EndBlock', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestEndBlock, + responseType: tendermint_abci_types_pb.ResponseEndBlock, + requestSerialize: serialize_tendermint_abci_RequestEndBlock, + requestDeserialize: deserialize_tendermint_abci_RequestEndBlock, + responseSerialize: serialize_tendermint_abci_ResponseEndBlock, + responseDeserialize: deserialize_tendermint_abci_ResponseEndBlock, + }, + listSnapshots: { + path: '/tendermint.abci.ABCIApplication/ListSnapshots', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestListSnapshots, + responseType: tendermint_abci_types_pb.ResponseListSnapshots, + requestSerialize: serialize_tendermint_abci_RequestListSnapshots, + requestDeserialize: deserialize_tendermint_abci_RequestListSnapshots, + responseSerialize: serialize_tendermint_abci_ResponseListSnapshots, + responseDeserialize: deserialize_tendermint_abci_ResponseListSnapshots, + }, + offerSnapshot: { + path: '/tendermint.abci.ABCIApplication/OfferSnapshot', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestOfferSnapshot, + responseType: tendermint_abci_types_pb.ResponseOfferSnapshot, + requestSerialize: serialize_tendermint_abci_RequestOfferSnapshot, + requestDeserialize: deserialize_tendermint_abci_RequestOfferSnapshot, + responseSerialize: serialize_tendermint_abci_ResponseOfferSnapshot, + responseDeserialize: deserialize_tendermint_abci_ResponseOfferSnapshot, + }, + loadSnapshotChunk: { + path: '/tendermint.abci.ABCIApplication/LoadSnapshotChunk', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestLoadSnapshotChunk, + responseType: tendermint_abci_types_pb.ResponseLoadSnapshotChunk, + requestSerialize: serialize_tendermint_abci_RequestLoadSnapshotChunk, + requestDeserialize: deserialize_tendermint_abci_RequestLoadSnapshotChunk, + responseSerialize: serialize_tendermint_abci_ResponseLoadSnapshotChunk, + responseDeserialize: deserialize_tendermint_abci_ResponseLoadSnapshotChunk, + }, + applySnapshotChunk: { + path: '/tendermint.abci.ABCIApplication/ApplySnapshotChunk', + requestStream: false, + responseStream: false, + requestType: tendermint_abci_types_pb.RequestApplySnapshotChunk, + responseType: tendermint_abci_types_pb.ResponseApplySnapshotChunk, + requestSerialize: serialize_tendermint_abci_RequestApplySnapshotChunk, + requestDeserialize: deserialize_tendermint_abci_RequestApplySnapshotChunk, + responseSerialize: serialize_tendermint_abci_ResponseApplySnapshotChunk, + responseDeserialize: deserialize_tendermint_abci_ResponseApplySnapshotChunk, + }, +}; + diff --git a/js/proto/tendermint/abci/types_pb.d.ts b/js/proto/tendermint/abci/types_pb.d.ts new file mode 100644 index 000000000..d35c89a8a --- /dev/null +++ b/js/proto/tendermint/abci/types_pb.d.ts @@ -0,0 +1,1666 @@ +// package: tendermint.abci +// file: tendermint/abci/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as tendermint_crypto_proof_pb from "../../tendermint/crypto/proof_pb"; +import * as tendermint_types_types_pb from "../../tendermint/types/types_pb"; +import * as tendermint_crypto_keys_pb from "../../tendermint/crypto/keys_pb"; +import * as tendermint_types_params_pb from "../../tendermint/types/params_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; + +export class Request extends jspb.Message { + + hasEcho(): boolean; + clearEcho(): void; + getEcho(): RequestEcho | undefined; + setEcho(value?: RequestEcho): Request; + + + hasFlush(): boolean; + clearFlush(): void; + getFlush(): RequestFlush | undefined; + setFlush(value?: RequestFlush): Request; + + + hasInfo(): boolean; + clearInfo(): void; + getInfo(): RequestInfo | undefined; + setInfo(value?: RequestInfo): Request; + + + hasSetOption(): boolean; + clearSetOption(): void; + getSetOption(): RequestSetOption | undefined; + setSetOption(value?: RequestSetOption): Request; + + + hasInitChain(): boolean; + clearInitChain(): void; + getInitChain(): RequestInitChain | undefined; + setInitChain(value?: RequestInitChain): Request; + + + hasQuery(): boolean; + clearQuery(): void; + getQuery(): RequestQuery | undefined; + setQuery(value?: RequestQuery): Request; + + + hasBeginBlock(): boolean; + clearBeginBlock(): void; + getBeginBlock(): RequestBeginBlock | undefined; + setBeginBlock(value?: RequestBeginBlock): Request; + + + hasCheckTx(): boolean; + clearCheckTx(): void; + getCheckTx(): RequestCheckTx | undefined; + setCheckTx(value?: RequestCheckTx): Request; + + + hasDeliverTx(): boolean; + clearDeliverTx(): void; + getDeliverTx(): RequestDeliverTx | undefined; + setDeliverTx(value?: RequestDeliverTx): Request; + + + hasEndBlock(): boolean; + clearEndBlock(): void; + getEndBlock(): RequestEndBlock | undefined; + setEndBlock(value?: RequestEndBlock): Request; + + + hasCommit(): boolean; + clearCommit(): void; + getCommit(): RequestCommit | undefined; + setCommit(value?: RequestCommit): Request; + + + hasListSnapshots(): boolean; + clearListSnapshots(): void; + getListSnapshots(): RequestListSnapshots | undefined; + setListSnapshots(value?: RequestListSnapshots): Request; + + + hasOfferSnapshot(): boolean; + clearOfferSnapshot(): void; + getOfferSnapshot(): RequestOfferSnapshot | undefined; + setOfferSnapshot(value?: RequestOfferSnapshot): Request; + + + hasLoadSnapshotChunk(): boolean; + clearLoadSnapshotChunk(): void; + getLoadSnapshotChunk(): RequestLoadSnapshotChunk | undefined; + setLoadSnapshotChunk(value?: RequestLoadSnapshotChunk): Request; + + + hasApplySnapshotChunk(): boolean; + clearApplySnapshotChunk(): void; + getApplySnapshotChunk(): RequestApplySnapshotChunk | undefined; + setApplySnapshotChunk(value?: RequestApplySnapshotChunk): Request; + + + getValueCase(): Request.ValueCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Request.AsObject; + static toObject(includeInstance: boolean, msg: Request): Request.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Request, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Request; + static deserializeBinaryFromReader(message: Request, reader: jspb.BinaryReader): Request; +} + +export namespace Request { + export type AsObject = { + echo?: RequestEcho.AsObject, + flush?: RequestFlush.AsObject, + info?: RequestInfo.AsObject, + setOption?: RequestSetOption.AsObject, + initChain?: RequestInitChain.AsObject, + query?: RequestQuery.AsObject, + beginBlock?: RequestBeginBlock.AsObject, + checkTx?: RequestCheckTx.AsObject, + deliverTx?: RequestDeliverTx.AsObject, + endBlock?: RequestEndBlock.AsObject, + commit?: RequestCommit.AsObject, + listSnapshots?: RequestListSnapshots.AsObject, + offerSnapshot?: RequestOfferSnapshot.AsObject, + loadSnapshotChunk?: RequestLoadSnapshotChunk.AsObject, + applySnapshotChunk?: RequestApplySnapshotChunk.AsObject, + } + + export enum ValueCase { + VALUE_NOT_SET = 0, + + ECHO = 1, + + FLUSH = 2, + + INFO = 3, + + SET_OPTION = 4, + + INIT_CHAIN = 5, + + QUERY = 6, + + BEGIN_BLOCK = 7, + + CHECK_TX = 8, + + DELIVER_TX = 9, + + END_BLOCK = 10, + + COMMIT = 11, + + LIST_SNAPSHOTS = 12, + + OFFER_SNAPSHOT = 13, + + LOAD_SNAPSHOT_CHUNK = 14, + + APPLY_SNAPSHOT_CHUNK = 15, + + } + +} + +export class RequestEcho extends jspb.Message { + getMessage(): string; + setMessage(value: string): RequestEcho; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestEcho.AsObject; + static toObject(includeInstance: boolean, msg: RequestEcho): RequestEcho.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestEcho, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestEcho; + static deserializeBinaryFromReader(message: RequestEcho, reader: jspb.BinaryReader): RequestEcho; +} + +export namespace RequestEcho { + export type AsObject = { + message: string, + } +} + +export class RequestFlush extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestFlush.AsObject; + static toObject(includeInstance: boolean, msg: RequestFlush): RequestFlush.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestFlush, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestFlush; + static deserializeBinaryFromReader(message: RequestFlush, reader: jspb.BinaryReader): RequestFlush; +} + +export namespace RequestFlush { + export type AsObject = { + } +} + +export class RequestInfo extends jspb.Message { + getVersion(): string; + setVersion(value: string): RequestInfo; + + getBlockVersion(): number; + setBlockVersion(value: number): RequestInfo; + + getP2pVersion(): number; + setP2pVersion(value: number): RequestInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestInfo.AsObject; + static toObject(includeInstance: boolean, msg: RequestInfo): RequestInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestInfo; + static deserializeBinaryFromReader(message: RequestInfo, reader: jspb.BinaryReader): RequestInfo; +} + +export namespace RequestInfo { + export type AsObject = { + version: string, + blockVersion: number, + p2pVersion: number, + } +} + +export class RequestSetOption extends jspb.Message { + getKey(): string; + setKey(value: string): RequestSetOption; + + getValue(): string; + setValue(value: string): RequestSetOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestSetOption.AsObject; + static toObject(includeInstance: boolean, msg: RequestSetOption): RequestSetOption.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestSetOption, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestSetOption; + static deserializeBinaryFromReader(message: RequestSetOption, reader: jspb.BinaryReader): RequestSetOption; +} + +export namespace RequestSetOption { + export type AsObject = { + key: string, + value: string, + } +} + +export class RequestInitChain extends jspb.Message { + + hasTime(): boolean; + clearTime(): void; + getTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTime(value?: google_protobuf_timestamp_pb.Timestamp): RequestInitChain; + + getChainId(): string; + setChainId(value: string): RequestInitChain; + + + hasConsensusParams(): boolean; + clearConsensusParams(): void; + getConsensusParams(): ConsensusParams | undefined; + setConsensusParams(value?: ConsensusParams): RequestInitChain; + + clearValidatorsList(): void; + getValidatorsList(): Array; + setValidatorsList(value: Array): RequestInitChain; + addValidators(value?: ValidatorUpdate, index?: number): ValidatorUpdate; + + getAppStateBytes(): Uint8Array | string; + getAppStateBytes_asU8(): Uint8Array; + getAppStateBytes_asB64(): string; + setAppStateBytes(value: Uint8Array | string): RequestInitChain; + + getInitialHeight(): number; + setInitialHeight(value: number): RequestInitChain; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestInitChain.AsObject; + static toObject(includeInstance: boolean, msg: RequestInitChain): RequestInitChain.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestInitChain, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestInitChain; + static deserializeBinaryFromReader(message: RequestInitChain, reader: jspb.BinaryReader): RequestInitChain; +} + +export namespace RequestInitChain { + export type AsObject = { + time?: google_protobuf_timestamp_pb.Timestamp.AsObject, + chainId: string, + consensusParams?: ConsensusParams.AsObject, + validatorsList: Array, + appStateBytes: Uint8Array | string, + initialHeight: number, + } +} + +export class RequestQuery extends jspb.Message { + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): RequestQuery; + + getPath(): string; + setPath(value: string): RequestQuery; + + getHeight(): number; + setHeight(value: number): RequestQuery; + + getProve(): boolean; + setProve(value: boolean): RequestQuery; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestQuery.AsObject; + static toObject(includeInstance: boolean, msg: RequestQuery): RequestQuery.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestQuery, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestQuery; + static deserializeBinaryFromReader(message: RequestQuery, reader: jspb.BinaryReader): RequestQuery; +} + +export namespace RequestQuery { + export type AsObject = { + data: Uint8Array | string, + path: string, + height: number, + prove: boolean, + } +} + +export class RequestBeginBlock extends jspb.Message { + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): RequestBeginBlock; + + + hasHeader(): boolean; + clearHeader(): void; + getHeader(): tendermint_types_types_pb.Header | undefined; + setHeader(value?: tendermint_types_types_pb.Header): RequestBeginBlock; + + + hasLastCommitInfo(): boolean; + clearLastCommitInfo(): void; + getLastCommitInfo(): LastCommitInfo | undefined; + setLastCommitInfo(value?: LastCommitInfo): RequestBeginBlock; + + clearByzantineValidatorsList(): void; + getByzantineValidatorsList(): Array; + setByzantineValidatorsList(value: Array): RequestBeginBlock; + addByzantineValidators(value?: Evidence, index?: number): Evidence; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestBeginBlock.AsObject; + static toObject(includeInstance: boolean, msg: RequestBeginBlock): RequestBeginBlock.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestBeginBlock, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestBeginBlock; + static deserializeBinaryFromReader(message: RequestBeginBlock, reader: jspb.BinaryReader): RequestBeginBlock; +} + +export namespace RequestBeginBlock { + export type AsObject = { + hash: Uint8Array | string, + header?: tendermint_types_types_pb.Header.AsObject, + lastCommitInfo?: LastCommitInfo.AsObject, + byzantineValidatorsList: Array, + } +} + +export class RequestCheckTx extends jspb.Message { + getTx(): Uint8Array | string; + getTx_asU8(): Uint8Array; + getTx_asB64(): string; + setTx(value: Uint8Array | string): RequestCheckTx; + + getType(): CheckTxType; + setType(value: CheckTxType): RequestCheckTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestCheckTx.AsObject; + static toObject(includeInstance: boolean, msg: RequestCheckTx): RequestCheckTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestCheckTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestCheckTx; + static deserializeBinaryFromReader(message: RequestCheckTx, reader: jspb.BinaryReader): RequestCheckTx; +} + +export namespace RequestCheckTx { + export type AsObject = { + tx: Uint8Array | string, + type: CheckTxType, + } +} + +export class RequestDeliverTx extends jspb.Message { + getTx(): Uint8Array | string; + getTx_asU8(): Uint8Array; + getTx_asB64(): string; + setTx(value: Uint8Array | string): RequestDeliverTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestDeliverTx.AsObject; + static toObject(includeInstance: boolean, msg: RequestDeliverTx): RequestDeliverTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestDeliverTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestDeliverTx; + static deserializeBinaryFromReader(message: RequestDeliverTx, reader: jspb.BinaryReader): RequestDeliverTx; +} + +export namespace RequestDeliverTx { + export type AsObject = { + tx: Uint8Array | string, + } +} + +export class RequestEndBlock extends jspb.Message { + getHeight(): number; + setHeight(value: number): RequestEndBlock; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestEndBlock.AsObject; + static toObject(includeInstance: boolean, msg: RequestEndBlock): RequestEndBlock.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestEndBlock, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestEndBlock; + static deserializeBinaryFromReader(message: RequestEndBlock, reader: jspb.BinaryReader): RequestEndBlock; +} + +export namespace RequestEndBlock { + export type AsObject = { + height: number, + } +} + +export class RequestCommit extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestCommit.AsObject; + static toObject(includeInstance: boolean, msg: RequestCommit): RequestCommit.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestCommit, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestCommit; + static deserializeBinaryFromReader(message: RequestCommit, reader: jspb.BinaryReader): RequestCommit; +} + +export namespace RequestCommit { + export type AsObject = { + } +} + +export class RequestListSnapshots extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestListSnapshots.AsObject; + static toObject(includeInstance: boolean, msg: RequestListSnapshots): RequestListSnapshots.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestListSnapshots, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestListSnapshots; + static deserializeBinaryFromReader(message: RequestListSnapshots, reader: jspb.BinaryReader): RequestListSnapshots; +} + +export namespace RequestListSnapshots { + export type AsObject = { + } +} + +export class RequestOfferSnapshot extends jspb.Message { + + hasSnapshot(): boolean; + clearSnapshot(): void; + getSnapshot(): Snapshot | undefined; + setSnapshot(value?: Snapshot): RequestOfferSnapshot; + + getAppHash(): Uint8Array | string; + getAppHash_asU8(): Uint8Array; + getAppHash_asB64(): string; + setAppHash(value: Uint8Array | string): RequestOfferSnapshot; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestOfferSnapshot.AsObject; + static toObject(includeInstance: boolean, msg: RequestOfferSnapshot): RequestOfferSnapshot.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestOfferSnapshot, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestOfferSnapshot; + static deserializeBinaryFromReader(message: RequestOfferSnapshot, reader: jspb.BinaryReader): RequestOfferSnapshot; +} + +export namespace RequestOfferSnapshot { + export type AsObject = { + snapshot?: Snapshot.AsObject, + appHash: Uint8Array | string, + } +} + +export class RequestLoadSnapshotChunk extends jspb.Message { + getHeight(): number; + setHeight(value: number): RequestLoadSnapshotChunk; + + getFormat(): number; + setFormat(value: number): RequestLoadSnapshotChunk; + + getChunk(): number; + setChunk(value: number): RequestLoadSnapshotChunk; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestLoadSnapshotChunk.AsObject; + static toObject(includeInstance: boolean, msg: RequestLoadSnapshotChunk): RequestLoadSnapshotChunk.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestLoadSnapshotChunk, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestLoadSnapshotChunk; + static deserializeBinaryFromReader(message: RequestLoadSnapshotChunk, reader: jspb.BinaryReader): RequestLoadSnapshotChunk; +} + +export namespace RequestLoadSnapshotChunk { + export type AsObject = { + height: number, + format: number, + chunk: number, + } +} + +export class RequestApplySnapshotChunk extends jspb.Message { + getIndex(): number; + setIndex(value: number): RequestApplySnapshotChunk; + + getChunk(): Uint8Array | string; + getChunk_asU8(): Uint8Array; + getChunk_asB64(): string; + setChunk(value: Uint8Array | string): RequestApplySnapshotChunk; + + getSender(): string; + setSender(value: string): RequestApplySnapshotChunk; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestApplySnapshotChunk.AsObject; + static toObject(includeInstance: boolean, msg: RequestApplySnapshotChunk): RequestApplySnapshotChunk.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestApplySnapshotChunk, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestApplySnapshotChunk; + static deserializeBinaryFromReader(message: RequestApplySnapshotChunk, reader: jspb.BinaryReader): RequestApplySnapshotChunk; +} + +export namespace RequestApplySnapshotChunk { + export type AsObject = { + index: number, + chunk: Uint8Array | string, + sender: string, + } +} + +export class Response extends jspb.Message { + + hasException(): boolean; + clearException(): void; + getException(): ResponseException | undefined; + setException(value?: ResponseException): Response; + + + hasEcho(): boolean; + clearEcho(): void; + getEcho(): ResponseEcho | undefined; + setEcho(value?: ResponseEcho): Response; + + + hasFlush(): boolean; + clearFlush(): void; + getFlush(): ResponseFlush | undefined; + setFlush(value?: ResponseFlush): Response; + + + hasInfo(): boolean; + clearInfo(): void; + getInfo(): ResponseInfo | undefined; + setInfo(value?: ResponseInfo): Response; + + + hasSetOption(): boolean; + clearSetOption(): void; + getSetOption(): ResponseSetOption | undefined; + setSetOption(value?: ResponseSetOption): Response; + + + hasInitChain(): boolean; + clearInitChain(): void; + getInitChain(): ResponseInitChain | undefined; + setInitChain(value?: ResponseInitChain): Response; + + + hasQuery(): boolean; + clearQuery(): void; + getQuery(): ResponseQuery | undefined; + setQuery(value?: ResponseQuery): Response; + + + hasBeginBlock(): boolean; + clearBeginBlock(): void; + getBeginBlock(): ResponseBeginBlock | undefined; + setBeginBlock(value?: ResponseBeginBlock): Response; + + + hasCheckTx(): boolean; + clearCheckTx(): void; + getCheckTx(): ResponseCheckTx | undefined; + setCheckTx(value?: ResponseCheckTx): Response; + + + hasDeliverTx(): boolean; + clearDeliverTx(): void; + getDeliverTx(): ResponseDeliverTx | undefined; + setDeliverTx(value?: ResponseDeliverTx): Response; + + + hasEndBlock(): boolean; + clearEndBlock(): void; + getEndBlock(): ResponseEndBlock | undefined; + setEndBlock(value?: ResponseEndBlock): Response; + + + hasCommit(): boolean; + clearCommit(): void; + getCommit(): ResponseCommit | undefined; + setCommit(value?: ResponseCommit): Response; + + + hasListSnapshots(): boolean; + clearListSnapshots(): void; + getListSnapshots(): ResponseListSnapshots | undefined; + setListSnapshots(value?: ResponseListSnapshots): Response; + + + hasOfferSnapshot(): boolean; + clearOfferSnapshot(): void; + getOfferSnapshot(): ResponseOfferSnapshot | undefined; + setOfferSnapshot(value?: ResponseOfferSnapshot): Response; + + + hasLoadSnapshotChunk(): boolean; + clearLoadSnapshotChunk(): void; + getLoadSnapshotChunk(): ResponseLoadSnapshotChunk | undefined; + setLoadSnapshotChunk(value?: ResponseLoadSnapshotChunk): Response; + + + hasApplySnapshotChunk(): boolean; + clearApplySnapshotChunk(): void; + getApplySnapshotChunk(): ResponseApplySnapshotChunk | undefined; + setApplySnapshotChunk(value?: ResponseApplySnapshotChunk): Response; + + + getValueCase(): Response.ValueCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Response.AsObject; + static toObject(includeInstance: boolean, msg: Response): Response.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Response, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Response; + static deserializeBinaryFromReader(message: Response, reader: jspb.BinaryReader): Response; +} + +export namespace Response { + export type AsObject = { + exception?: ResponseException.AsObject, + echo?: ResponseEcho.AsObject, + flush?: ResponseFlush.AsObject, + info?: ResponseInfo.AsObject, + setOption?: ResponseSetOption.AsObject, + initChain?: ResponseInitChain.AsObject, + query?: ResponseQuery.AsObject, + beginBlock?: ResponseBeginBlock.AsObject, + checkTx?: ResponseCheckTx.AsObject, + deliverTx?: ResponseDeliverTx.AsObject, + endBlock?: ResponseEndBlock.AsObject, + commit?: ResponseCommit.AsObject, + listSnapshots?: ResponseListSnapshots.AsObject, + offerSnapshot?: ResponseOfferSnapshot.AsObject, + loadSnapshotChunk?: ResponseLoadSnapshotChunk.AsObject, + applySnapshotChunk?: ResponseApplySnapshotChunk.AsObject, + } + + export enum ValueCase { + VALUE_NOT_SET = 0, + + EXCEPTION = 1, + + ECHO = 2, + + FLUSH = 3, + + INFO = 4, + + SET_OPTION = 5, + + INIT_CHAIN = 6, + + QUERY = 7, + + BEGIN_BLOCK = 8, + + CHECK_TX = 9, + + DELIVER_TX = 10, + + END_BLOCK = 11, + + COMMIT = 12, + + LIST_SNAPSHOTS = 13, + + OFFER_SNAPSHOT = 14, + + LOAD_SNAPSHOT_CHUNK = 15, + + APPLY_SNAPSHOT_CHUNK = 16, + + } + +} + +export class ResponseException extends jspb.Message { + getError(): string; + setError(value: string): ResponseException; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseException.AsObject; + static toObject(includeInstance: boolean, msg: ResponseException): ResponseException.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseException, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseException; + static deserializeBinaryFromReader(message: ResponseException, reader: jspb.BinaryReader): ResponseException; +} + +export namespace ResponseException { + export type AsObject = { + error: string, + } +} + +export class ResponseEcho extends jspb.Message { + getMessage(): string; + setMessage(value: string): ResponseEcho; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseEcho.AsObject; + static toObject(includeInstance: boolean, msg: ResponseEcho): ResponseEcho.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseEcho, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseEcho; + static deserializeBinaryFromReader(message: ResponseEcho, reader: jspb.BinaryReader): ResponseEcho; +} + +export namespace ResponseEcho { + export type AsObject = { + message: string, + } +} + +export class ResponseFlush extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseFlush.AsObject; + static toObject(includeInstance: boolean, msg: ResponseFlush): ResponseFlush.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseFlush, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseFlush; + static deserializeBinaryFromReader(message: ResponseFlush, reader: jspb.BinaryReader): ResponseFlush; +} + +export namespace ResponseFlush { + export type AsObject = { + } +} + +export class ResponseInfo extends jspb.Message { + getData(): string; + setData(value: string): ResponseInfo; + + getVersion(): string; + setVersion(value: string): ResponseInfo; + + getAppVersion(): number; + setAppVersion(value: number): ResponseInfo; + + getLastBlockHeight(): number; + setLastBlockHeight(value: number): ResponseInfo; + + getLastBlockAppHash(): Uint8Array | string; + getLastBlockAppHash_asU8(): Uint8Array; + getLastBlockAppHash_asB64(): string; + setLastBlockAppHash(value: Uint8Array | string): ResponseInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseInfo.AsObject; + static toObject(includeInstance: boolean, msg: ResponseInfo): ResponseInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseInfo; + static deserializeBinaryFromReader(message: ResponseInfo, reader: jspb.BinaryReader): ResponseInfo; +} + +export namespace ResponseInfo { + export type AsObject = { + data: string, + version: string, + appVersion: number, + lastBlockHeight: number, + lastBlockAppHash: Uint8Array | string, + } +} + +export class ResponseSetOption extends jspb.Message { + getCode(): number; + setCode(value: number): ResponseSetOption; + + getLog(): string; + setLog(value: string): ResponseSetOption; + + getInfo(): string; + setInfo(value: string): ResponseSetOption; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseSetOption.AsObject; + static toObject(includeInstance: boolean, msg: ResponseSetOption): ResponseSetOption.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseSetOption, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseSetOption; + static deserializeBinaryFromReader(message: ResponseSetOption, reader: jspb.BinaryReader): ResponseSetOption; +} + +export namespace ResponseSetOption { + export type AsObject = { + code: number, + log: string, + info: string, + } +} + +export class ResponseInitChain extends jspb.Message { + + hasConsensusParams(): boolean; + clearConsensusParams(): void; + getConsensusParams(): ConsensusParams | undefined; + setConsensusParams(value?: ConsensusParams): ResponseInitChain; + + clearValidatorsList(): void; + getValidatorsList(): Array; + setValidatorsList(value: Array): ResponseInitChain; + addValidators(value?: ValidatorUpdate, index?: number): ValidatorUpdate; + + getAppHash(): Uint8Array | string; + getAppHash_asU8(): Uint8Array; + getAppHash_asB64(): string; + setAppHash(value: Uint8Array | string): ResponseInitChain; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseInitChain.AsObject; + static toObject(includeInstance: boolean, msg: ResponseInitChain): ResponseInitChain.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseInitChain, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseInitChain; + static deserializeBinaryFromReader(message: ResponseInitChain, reader: jspb.BinaryReader): ResponseInitChain; +} + +export namespace ResponseInitChain { + export type AsObject = { + consensusParams?: ConsensusParams.AsObject, + validatorsList: Array, + appHash: Uint8Array | string, + } +} + +export class ResponseQuery extends jspb.Message { + getCode(): number; + setCode(value: number): ResponseQuery; + + getLog(): string; + setLog(value: string): ResponseQuery; + + getInfo(): string; + setInfo(value: string): ResponseQuery; + + getIndex(): number; + setIndex(value: number): ResponseQuery; + + getKey(): Uint8Array | string; + getKey_asU8(): Uint8Array; + getKey_asB64(): string; + setKey(value: Uint8Array | string): ResponseQuery; + + getValue(): Uint8Array | string; + getValue_asU8(): Uint8Array; + getValue_asB64(): string; + setValue(value: Uint8Array | string): ResponseQuery; + + + hasProofOps(): boolean; + clearProofOps(): void; + getProofOps(): tendermint_crypto_proof_pb.ProofOps | undefined; + setProofOps(value?: tendermint_crypto_proof_pb.ProofOps): ResponseQuery; + + getHeight(): number; + setHeight(value: number): ResponseQuery; + + getCodespace(): string; + setCodespace(value: string): ResponseQuery; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseQuery.AsObject; + static toObject(includeInstance: boolean, msg: ResponseQuery): ResponseQuery.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseQuery, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseQuery; + static deserializeBinaryFromReader(message: ResponseQuery, reader: jspb.BinaryReader): ResponseQuery; +} + +export namespace ResponseQuery { + export type AsObject = { + code: number, + log: string, + info: string, + index: number, + key: Uint8Array | string, + value: Uint8Array | string, + proofOps?: tendermint_crypto_proof_pb.ProofOps.AsObject, + height: number, + codespace: string, + } +} + +export class ResponseBeginBlock extends jspb.Message { + clearEventsList(): void; + getEventsList(): Array; + setEventsList(value: Array): ResponseBeginBlock; + addEvents(value?: Event, index?: number): Event; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseBeginBlock.AsObject; + static toObject(includeInstance: boolean, msg: ResponseBeginBlock): ResponseBeginBlock.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseBeginBlock, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseBeginBlock; + static deserializeBinaryFromReader(message: ResponseBeginBlock, reader: jspb.BinaryReader): ResponseBeginBlock; +} + +export namespace ResponseBeginBlock { + export type AsObject = { + eventsList: Array, + } +} + +export class ResponseCheckTx extends jspb.Message { + getCode(): number; + setCode(value: number): ResponseCheckTx; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): ResponseCheckTx; + + getLog(): string; + setLog(value: string): ResponseCheckTx; + + getInfo(): string; + setInfo(value: string): ResponseCheckTx; + + getGasWanted(): number; + setGasWanted(value: number): ResponseCheckTx; + + getGasUsed(): number; + setGasUsed(value: number): ResponseCheckTx; + + clearEventsList(): void; + getEventsList(): Array; + setEventsList(value: Array): ResponseCheckTx; + addEvents(value?: Event, index?: number): Event; + + getCodespace(): string; + setCodespace(value: string): ResponseCheckTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseCheckTx.AsObject; + static toObject(includeInstance: boolean, msg: ResponseCheckTx): ResponseCheckTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseCheckTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseCheckTx; + static deserializeBinaryFromReader(message: ResponseCheckTx, reader: jspb.BinaryReader): ResponseCheckTx; +} + +export namespace ResponseCheckTx { + export type AsObject = { + code: number, + data: Uint8Array | string, + log: string, + info: string, + gasWanted: number, + gasUsed: number, + eventsList: Array, + codespace: string, + } +} + +export class ResponseDeliverTx extends jspb.Message { + getCode(): number; + setCode(value: number): ResponseDeliverTx; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): ResponseDeliverTx; + + getLog(): string; + setLog(value: string): ResponseDeliverTx; + + getInfo(): string; + setInfo(value: string): ResponseDeliverTx; + + getGasWanted(): number; + setGasWanted(value: number): ResponseDeliverTx; + + getGasUsed(): number; + setGasUsed(value: number): ResponseDeliverTx; + + clearEventsList(): void; + getEventsList(): Array; + setEventsList(value: Array): ResponseDeliverTx; + addEvents(value?: Event, index?: number): Event; + + getCodespace(): string; + setCodespace(value: string): ResponseDeliverTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseDeliverTx.AsObject; + static toObject(includeInstance: boolean, msg: ResponseDeliverTx): ResponseDeliverTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseDeliverTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseDeliverTx; + static deserializeBinaryFromReader(message: ResponseDeliverTx, reader: jspb.BinaryReader): ResponseDeliverTx; +} + +export namespace ResponseDeliverTx { + export type AsObject = { + code: number, + data: Uint8Array | string, + log: string, + info: string, + gasWanted: number, + gasUsed: number, + eventsList: Array, + codespace: string, + } +} + +export class ResponseEndBlock extends jspb.Message { + clearValidatorUpdatesList(): void; + getValidatorUpdatesList(): Array; + setValidatorUpdatesList(value: Array): ResponseEndBlock; + addValidatorUpdates(value?: ValidatorUpdate, index?: number): ValidatorUpdate; + + + hasConsensusParamUpdates(): boolean; + clearConsensusParamUpdates(): void; + getConsensusParamUpdates(): ConsensusParams | undefined; + setConsensusParamUpdates(value?: ConsensusParams): ResponseEndBlock; + + clearEventsList(): void; + getEventsList(): Array; + setEventsList(value: Array): ResponseEndBlock; + addEvents(value?: Event, index?: number): Event; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseEndBlock.AsObject; + static toObject(includeInstance: boolean, msg: ResponseEndBlock): ResponseEndBlock.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseEndBlock, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseEndBlock; + static deserializeBinaryFromReader(message: ResponseEndBlock, reader: jspb.BinaryReader): ResponseEndBlock; +} + +export namespace ResponseEndBlock { + export type AsObject = { + validatorUpdatesList: Array, + consensusParamUpdates?: ConsensusParams.AsObject, + eventsList: Array, + } +} + +export class ResponseCommit extends jspb.Message { + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): ResponseCommit; + + getRetainHeight(): number; + setRetainHeight(value: number): ResponseCommit; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseCommit.AsObject; + static toObject(includeInstance: boolean, msg: ResponseCommit): ResponseCommit.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseCommit, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseCommit; + static deserializeBinaryFromReader(message: ResponseCommit, reader: jspb.BinaryReader): ResponseCommit; +} + +export namespace ResponseCommit { + export type AsObject = { + data: Uint8Array | string, + retainHeight: number, + } +} + +export class ResponseListSnapshots extends jspb.Message { + clearSnapshotsList(): void; + getSnapshotsList(): Array; + setSnapshotsList(value: Array): ResponseListSnapshots; + addSnapshots(value?: Snapshot, index?: number): Snapshot; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseListSnapshots.AsObject; + static toObject(includeInstance: boolean, msg: ResponseListSnapshots): ResponseListSnapshots.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseListSnapshots, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseListSnapshots; + static deserializeBinaryFromReader(message: ResponseListSnapshots, reader: jspb.BinaryReader): ResponseListSnapshots; +} + +export namespace ResponseListSnapshots { + export type AsObject = { + snapshotsList: Array, + } +} + +export class ResponseOfferSnapshot extends jspb.Message { + getResult(): ResponseOfferSnapshot.Result; + setResult(value: ResponseOfferSnapshot.Result): ResponseOfferSnapshot; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseOfferSnapshot.AsObject; + static toObject(includeInstance: boolean, msg: ResponseOfferSnapshot): ResponseOfferSnapshot.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseOfferSnapshot, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseOfferSnapshot; + static deserializeBinaryFromReader(message: ResponseOfferSnapshot, reader: jspb.BinaryReader): ResponseOfferSnapshot; +} + +export namespace ResponseOfferSnapshot { + export type AsObject = { + result: ResponseOfferSnapshot.Result, + } + + export enum Result { + UNKNOWN = 0, + ACCEPT = 1, + ABORT = 2, + REJECT = 3, + REJECT_FORMAT = 4, + REJECT_SENDER = 5, + } + +} + +export class ResponseLoadSnapshotChunk extends jspb.Message { + getChunk(): Uint8Array | string; + getChunk_asU8(): Uint8Array; + getChunk_asB64(): string; + setChunk(value: Uint8Array | string): ResponseLoadSnapshotChunk; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseLoadSnapshotChunk.AsObject; + static toObject(includeInstance: boolean, msg: ResponseLoadSnapshotChunk): ResponseLoadSnapshotChunk.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseLoadSnapshotChunk, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseLoadSnapshotChunk; + static deserializeBinaryFromReader(message: ResponseLoadSnapshotChunk, reader: jspb.BinaryReader): ResponseLoadSnapshotChunk; +} + +export namespace ResponseLoadSnapshotChunk { + export type AsObject = { + chunk: Uint8Array | string, + } +} + +export class ResponseApplySnapshotChunk extends jspb.Message { + getResult(): ResponseApplySnapshotChunk.Result; + setResult(value: ResponseApplySnapshotChunk.Result): ResponseApplySnapshotChunk; + + clearRefetchChunksList(): void; + getRefetchChunksList(): Array; + setRefetchChunksList(value: Array): ResponseApplySnapshotChunk; + addRefetchChunks(value: number, index?: number): number; + + clearRejectSendersList(): void; + getRejectSendersList(): Array; + setRejectSendersList(value: Array): ResponseApplySnapshotChunk; + addRejectSenders(value: string, index?: number): string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseApplySnapshotChunk.AsObject; + static toObject(includeInstance: boolean, msg: ResponseApplySnapshotChunk): ResponseApplySnapshotChunk.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseApplySnapshotChunk, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseApplySnapshotChunk; + static deserializeBinaryFromReader(message: ResponseApplySnapshotChunk, reader: jspb.BinaryReader): ResponseApplySnapshotChunk; +} + +export namespace ResponseApplySnapshotChunk { + export type AsObject = { + result: ResponseApplySnapshotChunk.Result, + refetchChunksList: Array, + rejectSendersList: Array, + } + + export enum Result { + UNKNOWN = 0, + ACCEPT = 1, + ABORT = 2, + RETRY = 3, + RETRY_SNAPSHOT = 4, + REJECT_SNAPSHOT = 5, + } + +} + +export class ConsensusParams extends jspb.Message { + + hasBlock(): boolean; + clearBlock(): void; + getBlock(): BlockParams | undefined; + setBlock(value?: BlockParams): ConsensusParams; + + + hasEvidence(): boolean; + clearEvidence(): void; + getEvidence(): tendermint_types_params_pb.EvidenceParams | undefined; + setEvidence(value?: tendermint_types_params_pb.EvidenceParams): ConsensusParams; + + + hasValidator(): boolean; + clearValidator(): void; + getValidator(): tendermint_types_params_pb.ValidatorParams | undefined; + setValidator(value?: tendermint_types_params_pb.ValidatorParams): ConsensusParams; + + + hasVersion(): boolean; + clearVersion(): void; + getVersion(): tendermint_types_params_pb.VersionParams | undefined; + setVersion(value?: tendermint_types_params_pb.VersionParams): ConsensusParams; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ConsensusParams.AsObject; + static toObject(includeInstance: boolean, msg: ConsensusParams): ConsensusParams.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ConsensusParams, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ConsensusParams; + static deserializeBinaryFromReader(message: ConsensusParams, reader: jspb.BinaryReader): ConsensusParams; +} + +export namespace ConsensusParams { + export type AsObject = { + block?: BlockParams.AsObject, + evidence?: tendermint_types_params_pb.EvidenceParams.AsObject, + validator?: tendermint_types_params_pb.ValidatorParams.AsObject, + version?: tendermint_types_params_pb.VersionParams.AsObject, + } +} + +export class BlockParams extends jspb.Message { + getMaxBytes(): number; + setMaxBytes(value: number): BlockParams; + + getMaxGas(): number; + setMaxGas(value: number): BlockParams; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockParams.AsObject; + static toObject(includeInstance: boolean, msg: BlockParams): BlockParams.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockParams, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockParams; + static deserializeBinaryFromReader(message: BlockParams, reader: jspb.BinaryReader): BlockParams; +} + +export namespace BlockParams { + export type AsObject = { + maxBytes: number, + maxGas: number, + } +} + +export class LastCommitInfo extends jspb.Message { + getRound(): number; + setRound(value: number): LastCommitInfo; + + clearVotesList(): void; + getVotesList(): Array; + setVotesList(value: Array): LastCommitInfo; + addVotes(value?: VoteInfo, index?: number): VoteInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): LastCommitInfo.AsObject; + static toObject(includeInstance: boolean, msg: LastCommitInfo): LastCommitInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: LastCommitInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): LastCommitInfo; + static deserializeBinaryFromReader(message: LastCommitInfo, reader: jspb.BinaryReader): LastCommitInfo; +} + +export namespace LastCommitInfo { + export type AsObject = { + round: number, + votesList: Array, + } +} + +export class Event extends jspb.Message { + getType(): string; + setType(value: string): Event; + + clearAttributesList(): void; + getAttributesList(): Array; + setAttributesList(value: Array): Event; + addAttributes(value?: EventAttribute, index?: number): EventAttribute; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Event.AsObject; + static toObject(includeInstance: boolean, msg: Event): Event.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Event, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Event; + static deserializeBinaryFromReader(message: Event, reader: jspb.BinaryReader): Event; +} + +export namespace Event { + export type AsObject = { + type: string, + attributesList: Array, + } +} + +export class EventAttribute extends jspb.Message { + getKey(): Uint8Array | string; + getKey_asU8(): Uint8Array; + getKey_asB64(): string; + setKey(value: Uint8Array | string): EventAttribute; + + getValue(): Uint8Array | string; + getValue_asU8(): Uint8Array; + getValue_asB64(): string; + setValue(value: Uint8Array | string): EventAttribute; + + getIndex(): boolean; + setIndex(value: boolean): EventAttribute; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EventAttribute.AsObject; + static toObject(includeInstance: boolean, msg: EventAttribute): EventAttribute.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EventAttribute, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EventAttribute; + static deserializeBinaryFromReader(message: EventAttribute, reader: jspb.BinaryReader): EventAttribute; +} + +export namespace EventAttribute { + export type AsObject = { + key: Uint8Array | string, + value: Uint8Array | string, + index: boolean, + } +} + +export class TxResult extends jspb.Message { + getHeight(): number; + setHeight(value: number): TxResult; + + getIndex(): number; + setIndex(value: number): TxResult; + + getTx(): Uint8Array | string; + getTx_asU8(): Uint8Array; + getTx_asB64(): string; + setTx(value: Uint8Array | string): TxResult; + + + hasResult(): boolean; + clearResult(): void; + getResult(): ResponseDeliverTx | undefined; + setResult(value?: ResponseDeliverTx): TxResult; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxResult.AsObject; + static toObject(includeInstance: boolean, msg: TxResult): TxResult.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxResult, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxResult; + static deserializeBinaryFromReader(message: TxResult, reader: jspb.BinaryReader): TxResult; +} + +export namespace TxResult { + export type AsObject = { + height: number, + index: number, + tx: Uint8Array | string, + result?: ResponseDeliverTx.AsObject, + } +} + +export class Validator extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): Validator; + + getPower(): number; + setPower(value: number): Validator; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Validator.AsObject; + static toObject(includeInstance: boolean, msg: Validator): Validator.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Validator, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Validator; + static deserializeBinaryFromReader(message: Validator, reader: jspb.BinaryReader): Validator; +} + +export namespace Validator { + export type AsObject = { + address: Uint8Array | string, + power: number, + } +} + +export class ValidatorUpdate extends jspb.Message { + + hasPubKey(): boolean; + clearPubKey(): void; + getPubKey(): tendermint_crypto_keys_pb.PublicKey | undefined; + setPubKey(value?: tendermint_crypto_keys_pb.PublicKey): ValidatorUpdate; + + getPower(): number; + setPower(value: number): ValidatorUpdate; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ValidatorUpdate.AsObject; + static toObject(includeInstance: boolean, msg: ValidatorUpdate): ValidatorUpdate.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ValidatorUpdate, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ValidatorUpdate; + static deserializeBinaryFromReader(message: ValidatorUpdate, reader: jspb.BinaryReader): ValidatorUpdate; +} + +export namespace ValidatorUpdate { + export type AsObject = { + pubKey?: tendermint_crypto_keys_pb.PublicKey.AsObject, + power: number, + } +} + +export class VoteInfo extends jspb.Message { + + hasValidator(): boolean; + clearValidator(): void; + getValidator(): Validator | undefined; + setValidator(value?: Validator): VoteInfo; + + getSignedLastBlock(): boolean; + setSignedLastBlock(value: boolean): VoteInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): VoteInfo.AsObject; + static toObject(includeInstance: boolean, msg: VoteInfo): VoteInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: VoteInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): VoteInfo; + static deserializeBinaryFromReader(message: VoteInfo, reader: jspb.BinaryReader): VoteInfo; +} + +export namespace VoteInfo { + export type AsObject = { + validator?: Validator.AsObject, + signedLastBlock: boolean, + } +} + +export class Evidence extends jspb.Message { + getType(): EvidenceType; + setType(value: EvidenceType): Evidence; + + + hasValidator(): boolean; + clearValidator(): void; + getValidator(): Validator | undefined; + setValidator(value?: Validator): Evidence; + + getHeight(): number; + setHeight(value: number): Evidence; + + + hasTime(): boolean; + clearTime(): void; + getTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTime(value?: google_protobuf_timestamp_pb.Timestamp): Evidence; + + getTotalVotingPower(): number; + setTotalVotingPower(value: number): Evidence; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Evidence.AsObject; + static toObject(includeInstance: boolean, msg: Evidence): Evidence.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Evidence, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Evidence; + static deserializeBinaryFromReader(message: Evidence, reader: jspb.BinaryReader): Evidence; +} + +export namespace Evidence { + export type AsObject = { + type: EvidenceType, + validator?: Validator.AsObject, + height: number, + time?: google_protobuf_timestamp_pb.Timestamp.AsObject, + totalVotingPower: number, + } +} + +export class Snapshot extends jspb.Message { + getHeight(): number; + setHeight(value: number): Snapshot; + + getFormat(): number; + setFormat(value: number): Snapshot; + + getChunks(): number; + setChunks(value: number): Snapshot; + + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): Snapshot; + + getMetadata(): Uint8Array | string; + getMetadata_asU8(): Uint8Array; + getMetadata_asB64(): string; + setMetadata(value: Uint8Array | string): Snapshot; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Snapshot.AsObject; + static toObject(includeInstance: boolean, msg: Snapshot): Snapshot.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Snapshot, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Snapshot; + static deserializeBinaryFromReader(message: Snapshot, reader: jspb.BinaryReader): Snapshot; +} + +export namespace Snapshot { + export type AsObject = { + height: number, + format: number, + chunks: number, + hash: Uint8Array | string, + metadata: Uint8Array | string, + } +} + +export enum CheckTxType { + NEW = 0, + RECHECK = 1, +} + +export enum EvidenceType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, +} diff --git a/js/proto/tendermint/abci/types_pb.js b/js/proto/tendermint/abci/types_pb.js new file mode 100644 index 000000000..2a68a91f4 --- /dev/null +++ b/js/proto/tendermint/abci/types_pb.js @@ -0,0 +1,11789 @@ +// source: tendermint/abci/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var tendermint_crypto_proof_pb = require('../../tendermint/crypto/proof_pb.js'); +goog.object.extend(proto, tendermint_crypto_proof_pb); +var tendermint_types_types_pb = require('../../tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var tendermint_crypto_keys_pb = require('../../tendermint/crypto/keys_pb.js'); +goog.object.extend(proto, tendermint_crypto_keys_pb); +var tendermint_types_params_pb = require('../../tendermint/types/params_pb.js'); +goog.object.extend(proto, tendermint_types_params_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.tendermint.abci.BlockParams', null, global); +goog.exportSymbol('proto.tendermint.abci.CheckTxType', null, global); +goog.exportSymbol('proto.tendermint.abci.ConsensusParams', null, global); +goog.exportSymbol('proto.tendermint.abci.Event', null, global); +goog.exportSymbol('proto.tendermint.abci.EventAttribute', null, global); +goog.exportSymbol('proto.tendermint.abci.Evidence', null, global); +goog.exportSymbol('proto.tendermint.abci.EvidenceType', null, global); +goog.exportSymbol('proto.tendermint.abci.LastCommitInfo', null, global); +goog.exportSymbol('proto.tendermint.abci.Request', null, global); +goog.exportSymbol('proto.tendermint.abci.Request.ValueCase', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestApplySnapshotChunk', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestBeginBlock', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestCheckTx', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestCommit', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestDeliverTx', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestEcho', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestEndBlock', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestFlush', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestInfo', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestInitChain', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestListSnapshots', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestLoadSnapshotChunk', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestOfferSnapshot', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestQuery', null, global); +goog.exportSymbol('proto.tendermint.abci.RequestSetOption', null, global); +goog.exportSymbol('proto.tendermint.abci.Response', null, global); +goog.exportSymbol('proto.tendermint.abci.Response.ValueCase', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseApplySnapshotChunk', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseApplySnapshotChunk.Result', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseBeginBlock', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseCheckTx', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseCommit', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseDeliverTx', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseEcho', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseEndBlock', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseException', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseFlush', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseInfo', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseInitChain', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseListSnapshots', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseLoadSnapshotChunk', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseOfferSnapshot', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseOfferSnapshot.Result', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseQuery', null, global); +goog.exportSymbol('proto.tendermint.abci.ResponseSetOption', null, global); +goog.exportSymbol('proto.tendermint.abci.Snapshot', null, global); +goog.exportSymbol('proto.tendermint.abci.TxResult', null, global); +goog.exportSymbol('proto.tendermint.abci.Validator', null, global); +goog.exportSymbol('proto.tendermint.abci.ValidatorUpdate', null, global); +goog.exportSymbol('proto.tendermint.abci.VoteInfo', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.Request = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.abci.Request.oneofGroups_); +}; +goog.inherits(proto.tendermint.abci.Request, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.Request.displayName = 'proto.tendermint.abci.Request'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestEcho = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestEcho, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestEcho.displayName = 'proto.tendermint.abci.RequestEcho'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestFlush = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestFlush, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestFlush.displayName = 'proto.tendermint.abci.RequestFlush'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestInfo.displayName = 'proto.tendermint.abci.RequestInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestSetOption = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestSetOption, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestSetOption.displayName = 'proto.tendermint.abci.RequestSetOption'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestInitChain = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.RequestInitChain.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.RequestInitChain, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestInitChain.displayName = 'proto.tendermint.abci.RequestInitChain'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestQuery = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestQuery, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestQuery.displayName = 'proto.tendermint.abci.RequestQuery'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestBeginBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.RequestBeginBlock.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.RequestBeginBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestBeginBlock.displayName = 'proto.tendermint.abci.RequestBeginBlock'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestCheckTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestCheckTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestCheckTx.displayName = 'proto.tendermint.abci.RequestCheckTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestDeliverTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestDeliverTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestDeliverTx.displayName = 'proto.tendermint.abci.RequestDeliverTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestEndBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestEndBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestEndBlock.displayName = 'proto.tendermint.abci.RequestEndBlock'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestCommit = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestCommit, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestCommit.displayName = 'proto.tendermint.abci.RequestCommit'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestListSnapshots = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestListSnapshots, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestListSnapshots.displayName = 'proto.tendermint.abci.RequestListSnapshots'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestOfferSnapshot = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestOfferSnapshot, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestOfferSnapshot.displayName = 'proto.tendermint.abci.RequestOfferSnapshot'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestLoadSnapshotChunk = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestLoadSnapshotChunk, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestLoadSnapshotChunk.displayName = 'proto.tendermint.abci.RequestLoadSnapshotChunk'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.RequestApplySnapshotChunk = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.RequestApplySnapshotChunk, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.RequestApplySnapshotChunk.displayName = 'proto.tendermint.abci.RequestApplySnapshotChunk'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.Response = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.abci.Response.oneofGroups_); +}; +goog.inherits(proto.tendermint.abci.Response, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.Response.displayName = 'proto.tendermint.abci.Response'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseException = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseException, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseException.displayName = 'proto.tendermint.abci.ResponseException'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseEcho = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseEcho, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseEcho.displayName = 'proto.tendermint.abci.ResponseEcho'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseFlush = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseFlush, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseFlush.displayName = 'proto.tendermint.abci.ResponseFlush'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseInfo.displayName = 'proto.tendermint.abci.ResponseInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseSetOption = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseSetOption, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseSetOption.displayName = 'proto.tendermint.abci.ResponseSetOption'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseInitChain = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.ResponseInitChain.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.ResponseInitChain, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseInitChain.displayName = 'proto.tendermint.abci.ResponseInitChain'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseQuery = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseQuery, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseQuery.displayName = 'proto.tendermint.abci.ResponseQuery'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseBeginBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.ResponseBeginBlock.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.ResponseBeginBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseBeginBlock.displayName = 'proto.tendermint.abci.ResponseBeginBlock'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseCheckTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.ResponseCheckTx.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.ResponseCheckTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseCheckTx.displayName = 'proto.tendermint.abci.ResponseCheckTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseDeliverTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.ResponseDeliverTx.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.ResponseDeliverTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseDeliverTx.displayName = 'proto.tendermint.abci.ResponseDeliverTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseEndBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.ResponseEndBlock.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.ResponseEndBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseEndBlock.displayName = 'proto.tendermint.abci.ResponseEndBlock'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseCommit = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseCommit, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseCommit.displayName = 'proto.tendermint.abci.ResponseCommit'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseListSnapshots = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.ResponseListSnapshots.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.ResponseListSnapshots, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseListSnapshots.displayName = 'proto.tendermint.abci.ResponseListSnapshots'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseOfferSnapshot = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseOfferSnapshot, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseOfferSnapshot.displayName = 'proto.tendermint.abci.ResponseOfferSnapshot'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ResponseLoadSnapshotChunk, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseLoadSnapshotChunk.displayName = 'proto.tendermint.abci.ResponseLoadSnapshotChunk'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ResponseApplySnapshotChunk = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.ResponseApplySnapshotChunk.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.ResponseApplySnapshotChunk, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ResponseApplySnapshotChunk.displayName = 'proto.tendermint.abci.ResponseApplySnapshotChunk'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ConsensusParams = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ConsensusParams, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ConsensusParams.displayName = 'proto.tendermint.abci.ConsensusParams'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.BlockParams = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.BlockParams, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.BlockParams.displayName = 'proto.tendermint.abci.BlockParams'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.LastCommitInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.LastCommitInfo.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.LastCommitInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.LastCommitInfo.displayName = 'proto.tendermint.abci.LastCommitInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.Event = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.abci.Event.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.abci.Event, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.Event.displayName = 'proto.tendermint.abci.Event'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.EventAttribute = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.EventAttribute, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.EventAttribute.displayName = 'proto.tendermint.abci.EventAttribute'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.TxResult = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.TxResult, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.TxResult.displayName = 'proto.tendermint.abci.TxResult'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.Validator = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.Validator, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.Validator.displayName = 'proto.tendermint.abci.Validator'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.ValidatorUpdate = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.ValidatorUpdate, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.ValidatorUpdate.displayName = 'proto.tendermint.abci.ValidatorUpdate'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.VoteInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.VoteInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.VoteInfo.displayName = 'proto.tendermint.abci.VoteInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.Evidence = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.Evidence, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.Evidence.displayName = 'proto.tendermint.abci.Evidence'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.abci.Snapshot = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.abci.Snapshot, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.abci.Snapshot.displayName = 'proto.tendermint.abci.Snapshot'; +} + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.abci.Request.oneofGroups_ = [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]; + +/** + * @enum {number} + */ +proto.tendermint.abci.Request.ValueCase = { + VALUE_NOT_SET: 0, + ECHO: 1, + FLUSH: 2, + INFO: 3, + SET_OPTION: 4, + INIT_CHAIN: 5, + QUERY: 6, + BEGIN_BLOCK: 7, + CHECK_TX: 8, + DELIVER_TX: 9, + END_BLOCK: 10, + COMMIT: 11, + LIST_SNAPSHOTS: 12, + OFFER_SNAPSHOT: 13, + LOAD_SNAPSHOT_CHUNK: 14, + APPLY_SNAPSHOT_CHUNK: 15 +}; + +/** + * @return {proto.tendermint.abci.Request.ValueCase} + */ +proto.tendermint.abci.Request.prototype.getValueCase = function() { + return /** @type {proto.tendermint.abci.Request.ValueCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.abci.Request.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.Request.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.Request.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.Request} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Request.toObject = function(includeInstance, msg) { + var f, obj = { + echo: (f = msg.getEcho()) && proto.tendermint.abci.RequestEcho.toObject(includeInstance, f), + flush: (f = msg.getFlush()) && proto.tendermint.abci.RequestFlush.toObject(includeInstance, f), + info: (f = msg.getInfo()) && proto.tendermint.abci.RequestInfo.toObject(includeInstance, f), + setOption: (f = msg.getSetOption()) && proto.tendermint.abci.RequestSetOption.toObject(includeInstance, f), + initChain: (f = msg.getInitChain()) && proto.tendermint.abci.RequestInitChain.toObject(includeInstance, f), + query: (f = msg.getQuery()) && proto.tendermint.abci.RequestQuery.toObject(includeInstance, f), + beginBlock: (f = msg.getBeginBlock()) && proto.tendermint.abci.RequestBeginBlock.toObject(includeInstance, f), + checkTx: (f = msg.getCheckTx()) && proto.tendermint.abci.RequestCheckTx.toObject(includeInstance, f), + deliverTx: (f = msg.getDeliverTx()) && proto.tendermint.abci.RequestDeliverTx.toObject(includeInstance, f), + endBlock: (f = msg.getEndBlock()) && proto.tendermint.abci.RequestEndBlock.toObject(includeInstance, f), + commit: (f = msg.getCommit()) && proto.tendermint.abci.RequestCommit.toObject(includeInstance, f), + listSnapshots: (f = msg.getListSnapshots()) && proto.tendermint.abci.RequestListSnapshots.toObject(includeInstance, f), + offerSnapshot: (f = msg.getOfferSnapshot()) && proto.tendermint.abci.RequestOfferSnapshot.toObject(includeInstance, f), + loadSnapshotChunk: (f = msg.getLoadSnapshotChunk()) && proto.tendermint.abci.RequestLoadSnapshotChunk.toObject(includeInstance, f), + applySnapshotChunk: (f = msg.getApplySnapshotChunk()) && proto.tendermint.abci.RequestApplySnapshotChunk.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.Request} + */ +proto.tendermint.abci.Request.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.Request; + return proto.tendermint.abci.Request.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.Request} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.Request} + */ +proto.tendermint.abci.Request.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.RequestEcho; + reader.readMessage(value,proto.tendermint.abci.RequestEcho.deserializeBinaryFromReader); + msg.setEcho(value); + break; + case 2: + var value = new proto.tendermint.abci.RequestFlush; + reader.readMessage(value,proto.tendermint.abci.RequestFlush.deserializeBinaryFromReader); + msg.setFlush(value); + break; + case 3: + var value = new proto.tendermint.abci.RequestInfo; + reader.readMessage(value,proto.tendermint.abci.RequestInfo.deserializeBinaryFromReader); + msg.setInfo(value); + break; + case 4: + var value = new proto.tendermint.abci.RequestSetOption; + reader.readMessage(value,proto.tendermint.abci.RequestSetOption.deserializeBinaryFromReader); + msg.setSetOption(value); + break; + case 5: + var value = new proto.tendermint.abci.RequestInitChain; + reader.readMessage(value,proto.tendermint.abci.RequestInitChain.deserializeBinaryFromReader); + msg.setInitChain(value); + break; + case 6: + var value = new proto.tendermint.abci.RequestQuery; + reader.readMessage(value,proto.tendermint.abci.RequestQuery.deserializeBinaryFromReader); + msg.setQuery(value); + break; + case 7: + var value = new proto.tendermint.abci.RequestBeginBlock; + reader.readMessage(value,proto.tendermint.abci.RequestBeginBlock.deserializeBinaryFromReader); + msg.setBeginBlock(value); + break; + case 8: + var value = new proto.tendermint.abci.RequestCheckTx; + reader.readMessage(value,proto.tendermint.abci.RequestCheckTx.deserializeBinaryFromReader); + msg.setCheckTx(value); + break; + case 9: + var value = new proto.tendermint.abci.RequestDeliverTx; + reader.readMessage(value,proto.tendermint.abci.RequestDeliverTx.deserializeBinaryFromReader); + msg.setDeliverTx(value); + break; + case 10: + var value = new proto.tendermint.abci.RequestEndBlock; + reader.readMessage(value,proto.tendermint.abci.RequestEndBlock.deserializeBinaryFromReader); + msg.setEndBlock(value); + break; + case 11: + var value = new proto.tendermint.abci.RequestCommit; + reader.readMessage(value,proto.tendermint.abci.RequestCommit.deserializeBinaryFromReader); + msg.setCommit(value); + break; + case 12: + var value = new proto.tendermint.abci.RequestListSnapshots; + reader.readMessage(value,proto.tendermint.abci.RequestListSnapshots.deserializeBinaryFromReader); + msg.setListSnapshots(value); + break; + case 13: + var value = new proto.tendermint.abci.RequestOfferSnapshot; + reader.readMessage(value,proto.tendermint.abci.RequestOfferSnapshot.deserializeBinaryFromReader); + msg.setOfferSnapshot(value); + break; + case 14: + var value = new proto.tendermint.abci.RequestLoadSnapshotChunk; + reader.readMessage(value,proto.tendermint.abci.RequestLoadSnapshotChunk.deserializeBinaryFromReader); + msg.setLoadSnapshotChunk(value); + break; + case 15: + var value = new proto.tendermint.abci.RequestApplySnapshotChunk; + reader.readMessage(value,proto.tendermint.abci.RequestApplySnapshotChunk.deserializeBinaryFromReader); + msg.setApplySnapshotChunk(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.Request.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.Request.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.Request} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Request.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEcho(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.abci.RequestEcho.serializeBinaryToWriter + ); + } + f = message.getFlush(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.abci.RequestFlush.serializeBinaryToWriter + ); + } + f = message.getInfo(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.abci.RequestInfo.serializeBinaryToWriter + ); + } + f = message.getSetOption(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.abci.RequestSetOption.serializeBinaryToWriter + ); + } + f = message.getInitChain(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.tendermint.abci.RequestInitChain.serializeBinaryToWriter + ); + } + f = message.getQuery(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.tendermint.abci.RequestQuery.serializeBinaryToWriter + ); + } + f = message.getBeginBlock(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.tendermint.abci.RequestBeginBlock.serializeBinaryToWriter + ); + } + f = message.getCheckTx(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.tendermint.abci.RequestCheckTx.serializeBinaryToWriter + ); + } + f = message.getDeliverTx(); + if (f != null) { + writer.writeMessage( + 9, + f, + proto.tendermint.abci.RequestDeliverTx.serializeBinaryToWriter + ); + } + f = message.getEndBlock(); + if (f != null) { + writer.writeMessage( + 10, + f, + proto.tendermint.abci.RequestEndBlock.serializeBinaryToWriter + ); + } + f = message.getCommit(); + if (f != null) { + writer.writeMessage( + 11, + f, + proto.tendermint.abci.RequestCommit.serializeBinaryToWriter + ); + } + f = message.getListSnapshots(); + if (f != null) { + writer.writeMessage( + 12, + f, + proto.tendermint.abci.RequestListSnapshots.serializeBinaryToWriter + ); + } + f = message.getOfferSnapshot(); + if (f != null) { + writer.writeMessage( + 13, + f, + proto.tendermint.abci.RequestOfferSnapshot.serializeBinaryToWriter + ); + } + f = message.getLoadSnapshotChunk(); + if (f != null) { + writer.writeMessage( + 14, + f, + proto.tendermint.abci.RequestLoadSnapshotChunk.serializeBinaryToWriter + ); + } + f = message.getApplySnapshotChunk(); + if (f != null) { + writer.writeMessage( + 15, + f, + proto.tendermint.abci.RequestApplySnapshotChunk.serializeBinaryToWriter + ); + } +}; + + +/** + * optional RequestEcho echo = 1; + * @return {?proto.tendermint.abci.RequestEcho} + */ +proto.tendermint.abci.Request.prototype.getEcho = function() { + return /** @type{?proto.tendermint.abci.RequestEcho} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestEcho, 1)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestEcho|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setEcho = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearEcho = function() { + return this.setEcho(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasEcho = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional RequestFlush flush = 2; + * @return {?proto.tendermint.abci.RequestFlush} + */ +proto.tendermint.abci.Request.prototype.getFlush = function() { + return /** @type{?proto.tendermint.abci.RequestFlush} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestFlush, 2)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestFlush|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setFlush = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearFlush = function() { + return this.setFlush(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasFlush = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional RequestInfo info = 3; + * @return {?proto.tendermint.abci.RequestInfo} + */ +proto.tendermint.abci.Request.prototype.getInfo = function() { + return /** @type{?proto.tendermint.abci.RequestInfo} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestInfo, 3)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestInfo|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setInfo = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearInfo = function() { + return this.setInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasInfo = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional RequestSetOption set_option = 4; + * @return {?proto.tendermint.abci.RequestSetOption} + */ +proto.tendermint.abci.Request.prototype.getSetOption = function() { + return /** @type{?proto.tendermint.abci.RequestSetOption} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestSetOption, 4)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestSetOption|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setSetOption = function(value) { + return jspb.Message.setOneofWrapperField(this, 4, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearSetOption = function() { + return this.setSetOption(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasSetOption = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional RequestInitChain init_chain = 5; + * @return {?proto.tendermint.abci.RequestInitChain} + */ +proto.tendermint.abci.Request.prototype.getInitChain = function() { + return /** @type{?proto.tendermint.abci.RequestInitChain} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestInitChain, 5)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestInitChain|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setInitChain = function(value) { + return jspb.Message.setOneofWrapperField(this, 5, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearInitChain = function() { + return this.setInitChain(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasInitChain = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional RequestQuery query = 6; + * @return {?proto.tendermint.abci.RequestQuery} + */ +proto.tendermint.abci.Request.prototype.getQuery = function() { + return /** @type{?proto.tendermint.abci.RequestQuery} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestQuery, 6)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestQuery|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setQuery = function(value) { + return jspb.Message.setOneofWrapperField(this, 6, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearQuery = function() { + return this.setQuery(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasQuery = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional RequestBeginBlock begin_block = 7; + * @return {?proto.tendermint.abci.RequestBeginBlock} + */ +proto.tendermint.abci.Request.prototype.getBeginBlock = function() { + return /** @type{?proto.tendermint.abci.RequestBeginBlock} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestBeginBlock, 7)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestBeginBlock|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setBeginBlock = function(value) { + return jspb.Message.setOneofWrapperField(this, 7, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearBeginBlock = function() { + return this.setBeginBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasBeginBlock = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional RequestCheckTx check_tx = 8; + * @return {?proto.tendermint.abci.RequestCheckTx} + */ +proto.tendermint.abci.Request.prototype.getCheckTx = function() { + return /** @type{?proto.tendermint.abci.RequestCheckTx} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestCheckTx, 8)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestCheckTx|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setCheckTx = function(value) { + return jspb.Message.setOneofWrapperField(this, 8, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearCheckTx = function() { + return this.setCheckTx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasCheckTx = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional RequestDeliverTx deliver_tx = 9; + * @return {?proto.tendermint.abci.RequestDeliverTx} + */ +proto.tendermint.abci.Request.prototype.getDeliverTx = function() { + return /** @type{?proto.tendermint.abci.RequestDeliverTx} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestDeliverTx, 9)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestDeliverTx|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setDeliverTx = function(value) { + return jspb.Message.setOneofWrapperField(this, 9, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearDeliverTx = function() { + return this.setDeliverTx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasDeliverTx = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional RequestEndBlock end_block = 10; + * @return {?proto.tendermint.abci.RequestEndBlock} + */ +proto.tendermint.abci.Request.prototype.getEndBlock = function() { + return /** @type{?proto.tendermint.abci.RequestEndBlock} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestEndBlock, 10)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestEndBlock|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setEndBlock = function(value) { + return jspb.Message.setOneofWrapperField(this, 10, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearEndBlock = function() { + return this.setEndBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasEndBlock = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional RequestCommit commit = 11; + * @return {?proto.tendermint.abci.RequestCommit} + */ +proto.tendermint.abci.Request.prototype.getCommit = function() { + return /** @type{?proto.tendermint.abci.RequestCommit} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestCommit, 11)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestCommit|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setCommit = function(value) { + return jspb.Message.setOneofWrapperField(this, 11, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearCommit = function() { + return this.setCommit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasCommit = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * optional RequestListSnapshots list_snapshots = 12; + * @return {?proto.tendermint.abci.RequestListSnapshots} + */ +proto.tendermint.abci.Request.prototype.getListSnapshots = function() { + return /** @type{?proto.tendermint.abci.RequestListSnapshots} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestListSnapshots, 12)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestListSnapshots|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setListSnapshots = function(value) { + return jspb.Message.setOneofWrapperField(this, 12, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearListSnapshots = function() { + return this.setListSnapshots(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasListSnapshots = function() { + return jspb.Message.getField(this, 12) != null; +}; + + +/** + * optional RequestOfferSnapshot offer_snapshot = 13; + * @return {?proto.tendermint.abci.RequestOfferSnapshot} + */ +proto.tendermint.abci.Request.prototype.getOfferSnapshot = function() { + return /** @type{?proto.tendermint.abci.RequestOfferSnapshot} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestOfferSnapshot, 13)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestOfferSnapshot|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setOfferSnapshot = function(value) { + return jspb.Message.setOneofWrapperField(this, 13, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearOfferSnapshot = function() { + return this.setOfferSnapshot(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasOfferSnapshot = function() { + return jspb.Message.getField(this, 13) != null; +}; + + +/** + * optional RequestLoadSnapshotChunk load_snapshot_chunk = 14; + * @return {?proto.tendermint.abci.RequestLoadSnapshotChunk} + */ +proto.tendermint.abci.Request.prototype.getLoadSnapshotChunk = function() { + return /** @type{?proto.tendermint.abci.RequestLoadSnapshotChunk} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestLoadSnapshotChunk, 14)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestLoadSnapshotChunk|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setLoadSnapshotChunk = function(value) { + return jspb.Message.setOneofWrapperField(this, 14, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearLoadSnapshotChunk = function() { + return this.setLoadSnapshotChunk(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasLoadSnapshotChunk = function() { + return jspb.Message.getField(this, 14) != null; +}; + + +/** + * optional RequestApplySnapshotChunk apply_snapshot_chunk = 15; + * @return {?proto.tendermint.abci.RequestApplySnapshotChunk} + */ +proto.tendermint.abci.Request.prototype.getApplySnapshotChunk = function() { + return /** @type{?proto.tendermint.abci.RequestApplySnapshotChunk} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.RequestApplySnapshotChunk, 15)); +}; + + +/** + * @param {?proto.tendermint.abci.RequestApplySnapshotChunk|undefined} value + * @return {!proto.tendermint.abci.Request} returns this +*/ +proto.tendermint.abci.Request.prototype.setApplySnapshotChunk = function(value) { + return jspb.Message.setOneofWrapperField(this, 15, proto.tendermint.abci.Request.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Request} returns this + */ +proto.tendermint.abci.Request.prototype.clearApplySnapshotChunk = function() { + return this.setApplySnapshotChunk(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Request.prototype.hasApplySnapshotChunk = function() { + return jspb.Message.getField(this, 15) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestEcho.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestEcho.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestEcho} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestEcho.toObject = function(includeInstance, msg) { + var f, obj = { + message: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestEcho} + */ +proto.tendermint.abci.RequestEcho.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestEcho; + return proto.tendermint.abci.RequestEcho.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestEcho} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestEcho} + */ +proto.tendermint.abci.RequestEcho.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestEcho.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestEcho.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestEcho} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestEcho.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string message = 1; + * @return {string} + */ +proto.tendermint.abci.RequestEcho.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.RequestEcho} returns this + */ +proto.tendermint.abci.RequestEcho.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestFlush.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestFlush.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestFlush} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestFlush.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestFlush} + */ +proto.tendermint.abci.RequestFlush.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestFlush; + return proto.tendermint.abci.RequestFlush.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestFlush} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestFlush} + */ +proto.tendermint.abci.RequestFlush.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestFlush.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestFlush.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestFlush} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestFlush.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestInfo.toObject = function(includeInstance, msg) { + var f, obj = { + version: jspb.Message.getFieldWithDefault(msg, 1, ""), + blockVersion: jspb.Message.getFieldWithDefault(msg, 2, 0), + p2pVersion: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestInfo} + */ +proto.tendermint.abci.RequestInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestInfo; + return proto.tendermint.abci.RequestInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestInfo} + */ +proto.tendermint.abci.RequestInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setVersion(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setBlockVersion(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setP2pVersion(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVersion(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getBlockVersion(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getP2pVersion(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } +}; + + +/** + * optional string version = 1; + * @return {string} + */ +proto.tendermint.abci.RequestInfo.prototype.getVersion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.RequestInfo} returns this + */ +proto.tendermint.abci.RequestInfo.prototype.setVersion = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional uint64 block_version = 2; + * @return {number} + */ +proto.tendermint.abci.RequestInfo.prototype.getBlockVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestInfo} returns this + */ +proto.tendermint.abci.RequestInfo.prototype.setBlockVersion = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint64 p2p_version = 3; + * @return {number} + */ +proto.tendermint.abci.RequestInfo.prototype.getP2pVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestInfo} returns this + */ +proto.tendermint.abci.RequestInfo.prototype.setP2pVersion = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestSetOption.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestSetOption.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestSetOption} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestSetOption.toObject = function(includeInstance, msg) { + var f, obj = { + key: jspb.Message.getFieldWithDefault(msg, 1, ""), + value: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestSetOption} + */ +proto.tendermint.abci.RequestSetOption.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestSetOption; + return proto.tendermint.abci.RequestSetOption.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestSetOption} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestSetOption} + */ +proto.tendermint.abci.RequestSetOption.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setKey(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestSetOption.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestSetOption.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestSetOption} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestSetOption.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getValue(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string key = 1; + * @return {string} + */ +proto.tendermint.abci.RequestSetOption.prototype.getKey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.RequestSetOption} returns this + */ +proto.tendermint.abci.RequestSetOption.prototype.setKey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string value = 2; + * @return {string} + */ +proto.tendermint.abci.RequestSetOption.prototype.getValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.RequestSetOption} returns this + */ +proto.tendermint.abci.RequestSetOption.prototype.setValue = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.RequestInitChain.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestInitChain.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestInitChain.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestInitChain} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestInitChain.toObject = function(includeInstance, msg) { + var f, obj = { + time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + chainId: jspb.Message.getFieldWithDefault(msg, 2, ""), + consensusParams: (f = msg.getConsensusParams()) && proto.tendermint.abci.ConsensusParams.toObject(includeInstance, f), + validatorsList: jspb.Message.toObjectList(msg.getValidatorsList(), + proto.tendermint.abci.ValidatorUpdate.toObject, includeInstance), + appStateBytes: msg.getAppStateBytes_asB64(), + initialHeight: jspb.Message.getFieldWithDefault(msg, 6, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestInitChain} + */ +proto.tendermint.abci.RequestInitChain.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestInitChain; + return proto.tendermint.abci.RequestInitChain.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestInitChain} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestInitChain} + */ +proto.tendermint.abci.RequestInitChain.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTime(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + case 3: + var value = new proto.tendermint.abci.ConsensusParams; + reader.readMessage(value,proto.tendermint.abci.ConsensusParams.deserializeBinaryFromReader); + msg.setConsensusParams(value); + break; + case 4: + var value = new proto.tendermint.abci.ValidatorUpdate; + reader.readMessage(value,proto.tendermint.abci.ValidatorUpdate.deserializeBinaryFromReader); + msg.addValidators(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAppStateBytes(value); + break; + case 6: + var value = /** @type {number} */ (reader.readInt64()); + msg.setInitialHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestInitChain.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestInitChain.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestInitChain} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestInitChain.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTime(); + if (f != null) { + writer.writeMessage( + 1, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getConsensusParams(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.abci.ConsensusParams.serializeBinaryToWriter + ); + } + f = message.getValidatorsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.tendermint.abci.ValidatorUpdate.serializeBinaryToWriter + ); + } + f = message.getAppStateBytes_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getInitialHeight(); + if (f !== 0) { + writer.writeInt64( + 6, + f + ); + } +}; + + +/** + * optional google.protobuf.Timestamp time = 1; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.abci.RequestInitChain.prototype.getTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 1)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.abci.RequestInitChain} returns this +*/ +proto.tendermint.abci.RequestInitChain.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.RequestInitChain} returns this + */ +proto.tendermint.abci.RequestInitChain.prototype.clearTime = function() { + return this.setTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.RequestInitChain.prototype.hasTime = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string chain_id = 2; + * @return {string} + */ +proto.tendermint.abci.RequestInitChain.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.RequestInitChain} returns this + */ +proto.tendermint.abci.RequestInitChain.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional ConsensusParams consensus_params = 3; + * @return {?proto.tendermint.abci.ConsensusParams} + */ +proto.tendermint.abci.RequestInitChain.prototype.getConsensusParams = function() { + return /** @type{?proto.tendermint.abci.ConsensusParams} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ConsensusParams, 3)); +}; + + +/** + * @param {?proto.tendermint.abci.ConsensusParams|undefined} value + * @return {!proto.tendermint.abci.RequestInitChain} returns this +*/ +proto.tendermint.abci.RequestInitChain.prototype.setConsensusParams = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.RequestInitChain} returns this + */ +proto.tendermint.abci.RequestInitChain.prototype.clearConsensusParams = function() { + return this.setConsensusParams(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.RequestInitChain.prototype.hasConsensusParams = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated ValidatorUpdate validators = 4; + * @return {!Array} + */ +proto.tendermint.abci.RequestInitChain.prototype.getValidatorsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.ValidatorUpdate, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.RequestInitChain} returns this +*/ +proto.tendermint.abci.RequestInitChain.prototype.setValidatorsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.tendermint.abci.ValidatorUpdate=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.ValidatorUpdate} + */ +proto.tendermint.abci.RequestInitChain.prototype.addValidators = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.tendermint.abci.ValidatorUpdate, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.RequestInitChain} returns this + */ +proto.tendermint.abci.RequestInitChain.prototype.clearValidatorsList = function() { + return this.setValidatorsList([]); +}; + + +/** + * optional bytes app_state_bytes = 5; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.RequestInitChain.prototype.getAppStateBytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes app_state_bytes = 5; + * This is a type-conversion wrapper around `getAppStateBytes()` + * @return {string} + */ +proto.tendermint.abci.RequestInitChain.prototype.getAppStateBytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAppStateBytes())); +}; + + +/** + * optional bytes app_state_bytes = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAppStateBytes()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestInitChain.prototype.getAppStateBytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAppStateBytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.RequestInitChain} returns this + */ +proto.tendermint.abci.RequestInitChain.prototype.setAppStateBytes = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * optional int64 initial_height = 6; + * @return {number} + */ +proto.tendermint.abci.RequestInitChain.prototype.getInitialHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestInitChain} returns this + */ +proto.tendermint.abci.RequestInitChain.prototype.setInitialHeight = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestQuery.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestQuery.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestQuery} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestQuery.toObject = function(includeInstance, msg) { + var f, obj = { + data: msg.getData_asB64(), + path: jspb.Message.getFieldWithDefault(msg, 2, ""), + height: jspb.Message.getFieldWithDefault(msg, 3, 0), + prove: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestQuery} + */ +proto.tendermint.abci.RequestQuery.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestQuery; + return proto.tendermint.abci.RequestQuery.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestQuery} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestQuery} + */ +proto.tendermint.abci.RequestQuery.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setPath(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setProve(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestQuery.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestQuery.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestQuery} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestQuery.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPath(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } + f = message.getProve(); + if (f) { + writer.writeBool( + 4, + f + ); + } +}; + + +/** + * optional bytes data = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.RequestQuery.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes data = 1; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.tendermint.abci.RequestQuery.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestQuery.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.RequestQuery} returns this + */ +proto.tendermint.abci.RequestQuery.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string path = 2; + * @return {string} + */ +proto.tendermint.abci.RequestQuery.prototype.getPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.RequestQuery} returns this + */ +proto.tendermint.abci.RequestQuery.prototype.setPath = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional int64 height = 3; + * @return {number} + */ +proto.tendermint.abci.RequestQuery.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestQuery} returns this + */ +proto.tendermint.abci.RequestQuery.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional bool prove = 4; + * @return {boolean} + */ +proto.tendermint.abci.RequestQuery.prototype.getProve = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.tendermint.abci.RequestQuery} returns this + */ +proto.tendermint.abci.RequestQuery.prototype.setProve = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.RequestBeginBlock.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestBeginBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestBeginBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestBeginBlock.toObject = function(includeInstance, msg) { + var f, obj = { + hash: msg.getHash_asB64(), + header: (f = msg.getHeader()) && tendermint_types_types_pb.Header.toObject(includeInstance, f), + lastCommitInfo: (f = msg.getLastCommitInfo()) && proto.tendermint.abci.LastCommitInfo.toObject(includeInstance, f), + byzantineValidatorsList: jspb.Message.toObjectList(msg.getByzantineValidatorsList(), + proto.tendermint.abci.Evidence.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestBeginBlock} + */ +proto.tendermint.abci.RequestBeginBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestBeginBlock; + return proto.tendermint.abci.RequestBeginBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestBeginBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestBeginBlock} + */ +proto.tendermint.abci.RequestBeginBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 2: + var value = new tendermint_types_types_pb.Header; + reader.readMessage(value,tendermint_types_types_pb.Header.deserializeBinaryFromReader); + msg.setHeader(value); + break; + case 3: + var value = new proto.tendermint.abci.LastCommitInfo; + reader.readMessage(value,proto.tendermint.abci.LastCommitInfo.deserializeBinaryFromReader); + msg.setLastCommitInfo(value); + break; + case 4: + var value = new proto.tendermint.abci.Evidence; + reader.readMessage(value,proto.tendermint.abci.Evidence.deserializeBinaryFromReader); + msg.addByzantineValidators(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestBeginBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestBeginBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestBeginBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getHeader(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_types_types_pb.Header.serializeBinaryToWriter + ); + } + f = message.getLastCommitInfo(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.abci.LastCommitInfo.serializeBinaryToWriter + ); + } + f = message.getByzantineValidatorsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.tendermint.abci.Evidence.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes hash = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes hash = 1; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.RequestBeginBlock} returns this + */ +proto.tendermint.abci.RequestBeginBlock.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional tendermint.types.Header header = 2; + * @return {?proto.tendermint.types.Header} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.getHeader = function() { + return /** @type{?proto.tendermint.types.Header} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Header, 2)); +}; + + +/** + * @param {?proto.tendermint.types.Header|undefined} value + * @return {!proto.tendermint.abci.RequestBeginBlock} returns this +*/ +proto.tendermint.abci.RequestBeginBlock.prototype.setHeader = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.RequestBeginBlock} returns this + */ +proto.tendermint.abci.RequestBeginBlock.prototype.clearHeader = function() { + return this.setHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.hasHeader = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional LastCommitInfo last_commit_info = 3; + * @return {?proto.tendermint.abci.LastCommitInfo} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.getLastCommitInfo = function() { + return /** @type{?proto.tendermint.abci.LastCommitInfo} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.LastCommitInfo, 3)); +}; + + +/** + * @param {?proto.tendermint.abci.LastCommitInfo|undefined} value + * @return {!proto.tendermint.abci.RequestBeginBlock} returns this +*/ +proto.tendermint.abci.RequestBeginBlock.prototype.setLastCommitInfo = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.RequestBeginBlock} returns this + */ +proto.tendermint.abci.RequestBeginBlock.prototype.clearLastCommitInfo = function() { + return this.setLastCommitInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.hasLastCommitInfo = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated Evidence byzantine_validators = 4; + * @return {!Array} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.getByzantineValidatorsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.Evidence, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.RequestBeginBlock} returns this +*/ +proto.tendermint.abci.RequestBeginBlock.prototype.setByzantineValidatorsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.tendermint.abci.Evidence=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.Evidence} + */ +proto.tendermint.abci.RequestBeginBlock.prototype.addByzantineValidators = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.tendermint.abci.Evidence, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.RequestBeginBlock} returns this + */ +proto.tendermint.abci.RequestBeginBlock.prototype.clearByzantineValidatorsList = function() { + return this.setByzantineValidatorsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestCheckTx.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestCheckTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestCheckTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestCheckTx.toObject = function(includeInstance, msg) { + var f, obj = { + tx: msg.getTx_asB64(), + type: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestCheckTx} + */ +proto.tendermint.abci.RequestCheckTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestCheckTx; + return proto.tendermint.abci.RequestCheckTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestCheckTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestCheckTx} + */ +proto.tendermint.abci.RequestCheckTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTx(value); + break; + case 2: + var value = /** @type {!proto.tendermint.abci.CheckTxType} */ (reader.readEnum()); + msg.setType(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestCheckTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestCheckTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestCheckTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestCheckTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTx_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 2, + f + ); + } +}; + + +/** + * optional bytes tx = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.RequestCheckTx.prototype.getTx = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes tx = 1; + * This is a type-conversion wrapper around `getTx()` + * @return {string} + */ +proto.tendermint.abci.RequestCheckTx.prototype.getTx_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTx())); +}; + + +/** + * optional bytes tx = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTx()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestCheckTx.prototype.getTx_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTx())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.RequestCheckTx} returns this + */ +proto.tendermint.abci.RequestCheckTx.prototype.setTx = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional CheckTxType type = 2; + * @return {!proto.tendermint.abci.CheckTxType} + */ +proto.tendermint.abci.RequestCheckTx.prototype.getType = function() { + return /** @type {!proto.tendermint.abci.CheckTxType} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {!proto.tendermint.abci.CheckTxType} value + * @return {!proto.tendermint.abci.RequestCheckTx} returns this + */ +proto.tendermint.abci.RequestCheckTx.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestDeliverTx.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestDeliverTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestDeliverTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestDeliverTx.toObject = function(includeInstance, msg) { + var f, obj = { + tx: msg.getTx_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestDeliverTx} + */ +proto.tendermint.abci.RequestDeliverTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestDeliverTx; + return proto.tendermint.abci.RequestDeliverTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestDeliverTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestDeliverTx} + */ +proto.tendermint.abci.RequestDeliverTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTx(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestDeliverTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestDeliverTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestDeliverTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestDeliverTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTx_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes tx = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.RequestDeliverTx.prototype.getTx = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes tx = 1; + * This is a type-conversion wrapper around `getTx()` + * @return {string} + */ +proto.tendermint.abci.RequestDeliverTx.prototype.getTx_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTx())); +}; + + +/** + * optional bytes tx = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTx()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestDeliverTx.prototype.getTx_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTx())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.RequestDeliverTx} returns this + */ +proto.tendermint.abci.RequestDeliverTx.prototype.setTx = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestEndBlock.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestEndBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestEndBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestEndBlock.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestEndBlock} + */ +proto.tendermint.abci.RequestEndBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestEndBlock; + return proto.tendermint.abci.RequestEndBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestEndBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestEndBlock} + */ +proto.tendermint.abci.RequestEndBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestEndBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestEndBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestEndBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestEndBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.abci.RequestEndBlock.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestEndBlock} returns this + */ +proto.tendermint.abci.RequestEndBlock.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestCommit.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestCommit.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestCommit} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestCommit.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestCommit} + */ +proto.tendermint.abci.RequestCommit.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestCommit; + return proto.tendermint.abci.RequestCommit.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestCommit} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestCommit} + */ +proto.tendermint.abci.RequestCommit.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestCommit.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestCommit.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestCommit} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestCommit.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestListSnapshots.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestListSnapshots.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestListSnapshots} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestListSnapshots.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestListSnapshots} + */ +proto.tendermint.abci.RequestListSnapshots.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestListSnapshots; + return proto.tendermint.abci.RequestListSnapshots.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestListSnapshots} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestListSnapshots} + */ +proto.tendermint.abci.RequestListSnapshots.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestListSnapshots.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestListSnapshots.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestListSnapshots} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestListSnapshots.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestOfferSnapshot.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestOfferSnapshot} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestOfferSnapshot.toObject = function(includeInstance, msg) { + var f, obj = { + snapshot: (f = msg.getSnapshot()) && proto.tendermint.abci.Snapshot.toObject(includeInstance, f), + appHash: msg.getAppHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestOfferSnapshot} + */ +proto.tendermint.abci.RequestOfferSnapshot.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestOfferSnapshot; + return proto.tendermint.abci.RequestOfferSnapshot.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestOfferSnapshot} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestOfferSnapshot} + */ +proto.tendermint.abci.RequestOfferSnapshot.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.Snapshot; + reader.readMessage(value,proto.tendermint.abci.Snapshot.deserializeBinaryFromReader); + msg.setSnapshot(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAppHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestOfferSnapshot.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestOfferSnapshot} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestOfferSnapshot.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSnapshot(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.abci.Snapshot.serializeBinaryToWriter + ); + } + f = message.getAppHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional Snapshot snapshot = 1; + * @return {?proto.tendermint.abci.Snapshot} + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.getSnapshot = function() { + return /** @type{?proto.tendermint.abci.Snapshot} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.Snapshot, 1)); +}; + + +/** + * @param {?proto.tendermint.abci.Snapshot|undefined} value + * @return {!proto.tendermint.abci.RequestOfferSnapshot} returns this +*/ +proto.tendermint.abci.RequestOfferSnapshot.prototype.setSnapshot = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.RequestOfferSnapshot} returns this + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.clearSnapshot = function() { + return this.setSnapshot(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.hasSnapshot = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes app_hash = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.getAppHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes app_hash = 2; + * This is a type-conversion wrapper around `getAppHash()` + * @return {string} + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.getAppHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAppHash())); +}; + + +/** + * optional bytes app_hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAppHash()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.getAppHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAppHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.RequestOfferSnapshot} returns this + */ +proto.tendermint.abci.RequestOfferSnapshot.prototype.setAppHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestLoadSnapshotChunk.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestLoadSnapshotChunk} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + format: jspb.Message.getFieldWithDefault(msg, 2, 0), + chunk: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestLoadSnapshotChunk} + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestLoadSnapshotChunk; + return proto.tendermint.abci.RequestLoadSnapshotChunk.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestLoadSnapshotChunk} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestLoadSnapshotChunk} + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFormat(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setChunk(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestLoadSnapshotChunk.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestLoadSnapshotChunk} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getFormat(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getChunk(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestLoadSnapshotChunk} returns this + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 format = 2; + * @return {number} + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.prototype.getFormat = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestLoadSnapshotChunk} returns this + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.prototype.setFormat = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 chunk = 3; + * @return {number} + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.prototype.getChunk = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestLoadSnapshotChunk} returns this + */ +proto.tendermint.abci.RequestLoadSnapshotChunk.prototype.setChunk = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.RequestApplySnapshotChunk.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.RequestApplySnapshotChunk} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestApplySnapshotChunk.toObject = function(includeInstance, msg) { + var f, obj = { + index: jspb.Message.getFieldWithDefault(msg, 1, 0), + chunk: msg.getChunk_asB64(), + sender: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.RequestApplySnapshotChunk} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.RequestApplySnapshotChunk; + return proto.tendermint.abci.RequestApplySnapshotChunk.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.RequestApplySnapshotChunk} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.RequestApplySnapshotChunk} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setIndex(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setChunk(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setSender(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.RequestApplySnapshotChunk.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.RequestApplySnapshotChunk} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.RequestApplySnapshotChunk.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIndex(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getChunk_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getSender(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional uint32 index = 1; + * @return {number} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.RequestApplySnapshotChunk} returns this + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes chunk = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.getChunk = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes chunk = 2; + * This is a type-conversion wrapper around `getChunk()` + * @return {string} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.getChunk_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getChunk())); +}; + + +/** + * optional bytes chunk = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getChunk()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.getChunk_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getChunk())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.RequestApplySnapshotChunk} returns this + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.setChunk = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional string sender = 3; + * @return {string} + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.getSender = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.RequestApplySnapshotChunk} returns this + */ +proto.tendermint.abci.RequestApplySnapshotChunk.prototype.setSender = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.abci.Response.oneofGroups_ = [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]]; + +/** + * @enum {number} + */ +proto.tendermint.abci.Response.ValueCase = { + VALUE_NOT_SET: 0, + EXCEPTION: 1, + ECHO: 2, + FLUSH: 3, + INFO: 4, + SET_OPTION: 5, + INIT_CHAIN: 6, + QUERY: 7, + BEGIN_BLOCK: 8, + CHECK_TX: 9, + DELIVER_TX: 10, + END_BLOCK: 11, + COMMIT: 12, + LIST_SNAPSHOTS: 13, + OFFER_SNAPSHOT: 14, + LOAD_SNAPSHOT_CHUNK: 15, + APPLY_SNAPSHOT_CHUNK: 16 +}; + +/** + * @return {proto.tendermint.abci.Response.ValueCase} + */ +proto.tendermint.abci.Response.prototype.getValueCase = function() { + return /** @type {proto.tendermint.abci.Response.ValueCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.abci.Response.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.Response.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.Response.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.Response} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Response.toObject = function(includeInstance, msg) { + var f, obj = { + exception: (f = msg.getException()) && proto.tendermint.abci.ResponseException.toObject(includeInstance, f), + echo: (f = msg.getEcho()) && proto.tendermint.abci.ResponseEcho.toObject(includeInstance, f), + flush: (f = msg.getFlush()) && proto.tendermint.abci.ResponseFlush.toObject(includeInstance, f), + info: (f = msg.getInfo()) && proto.tendermint.abci.ResponseInfo.toObject(includeInstance, f), + setOption: (f = msg.getSetOption()) && proto.tendermint.abci.ResponseSetOption.toObject(includeInstance, f), + initChain: (f = msg.getInitChain()) && proto.tendermint.abci.ResponseInitChain.toObject(includeInstance, f), + query: (f = msg.getQuery()) && proto.tendermint.abci.ResponseQuery.toObject(includeInstance, f), + beginBlock: (f = msg.getBeginBlock()) && proto.tendermint.abci.ResponseBeginBlock.toObject(includeInstance, f), + checkTx: (f = msg.getCheckTx()) && proto.tendermint.abci.ResponseCheckTx.toObject(includeInstance, f), + deliverTx: (f = msg.getDeliverTx()) && proto.tendermint.abci.ResponseDeliverTx.toObject(includeInstance, f), + endBlock: (f = msg.getEndBlock()) && proto.tendermint.abci.ResponseEndBlock.toObject(includeInstance, f), + commit: (f = msg.getCommit()) && proto.tendermint.abci.ResponseCommit.toObject(includeInstance, f), + listSnapshots: (f = msg.getListSnapshots()) && proto.tendermint.abci.ResponseListSnapshots.toObject(includeInstance, f), + offerSnapshot: (f = msg.getOfferSnapshot()) && proto.tendermint.abci.ResponseOfferSnapshot.toObject(includeInstance, f), + loadSnapshotChunk: (f = msg.getLoadSnapshotChunk()) && proto.tendermint.abci.ResponseLoadSnapshotChunk.toObject(includeInstance, f), + applySnapshotChunk: (f = msg.getApplySnapshotChunk()) && proto.tendermint.abci.ResponseApplySnapshotChunk.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.Response} + */ +proto.tendermint.abci.Response.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.Response; + return proto.tendermint.abci.Response.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.Response} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.Response} + */ +proto.tendermint.abci.Response.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.ResponseException; + reader.readMessage(value,proto.tendermint.abci.ResponseException.deserializeBinaryFromReader); + msg.setException(value); + break; + case 2: + var value = new proto.tendermint.abci.ResponseEcho; + reader.readMessage(value,proto.tendermint.abci.ResponseEcho.deserializeBinaryFromReader); + msg.setEcho(value); + break; + case 3: + var value = new proto.tendermint.abci.ResponseFlush; + reader.readMessage(value,proto.tendermint.abci.ResponseFlush.deserializeBinaryFromReader); + msg.setFlush(value); + break; + case 4: + var value = new proto.tendermint.abci.ResponseInfo; + reader.readMessage(value,proto.tendermint.abci.ResponseInfo.deserializeBinaryFromReader); + msg.setInfo(value); + break; + case 5: + var value = new proto.tendermint.abci.ResponseSetOption; + reader.readMessage(value,proto.tendermint.abci.ResponseSetOption.deserializeBinaryFromReader); + msg.setSetOption(value); + break; + case 6: + var value = new proto.tendermint.abci.ResponseInitChain; + reader.readMessage(value,proto.tendermint.abci.ResponseInitChain.deserializeBinaryFromReader); + msg.setInitChain(value); + break; + case 7: + var value = new proto.tendermint.abci.ResponseQuery; + reader.readMessage(value,proto.tendermint.abci.ResponseQuery.deserializeBinaryFromReader); + msg.setQuery(value); + break; + case 8: + var value = new proto.tendermint.abci.ResponseBeginBlock; + reader.readMessage(value,proto.tendermint.abci.ResponseBeginBlock.deserializeBinaryFromReader); + msg.setBeginBlock(value); + break; + case 9: + var value = new proto.tendermint.abci.ResponseCheckTx; + reader.readMessage(value,proto.tendermint.abci.ResponseCheckTx.deserializeBinaryFromReader); + msg.setCheckTx(value); + break; + case 10: + var value = new proto.tendermint.abci.ResponseDeliverTx; + reader.readMessage(value,proto.tendermint.abci.ResponseDeliverTx.deserializeBinaryFromReader); + msg.setDeliverTx(value); + break; + case 11: + var value = new proto.tendermint.abci.ResponseEndBlock; + reader.readMessage(value,proto.tendermint.abci.ResponseEndBlock.deserializeBinaryFromReader); + msg.setEndBlock(value); + break; + case 12: + var value = new proto.tendermint.abci.ResponseCommit; + reader.readMessage(value,proto.tendermint.abci.ResponseCommit.deserializeBinaryFromReader); + msg.setCommit(value); + break; + case 13: + var value = new proto.tendermint.abci.ResponseListSnapshots; + reader.readMessage(value,proto.tendermint.abci.ResponseListSnapshots.deserializeBinaryFromReader); + msg.setListSnapshots(value); + break; + case 14: + var value = new proto.tendermint.abci.ResponseOfferSnapshot; + reader.readMessage(value,proto.tendermint.abci.ResponseOfferSnapshot.deserializeBinaryFromReader); + msg.setOfferSnapshot(value); + break; + case 15: + var value = new proto.tendermint.abci.ResponseLoadSnapshotChunk; + reader.readMessage(value,proto.tendermint.abci.ResponseLoadSnapshotChunk.deserializeBinaryFromReader); + msg.setLoadSnapshotChunk(value); + break; + case 16: + var value = new proto.tendermint.abci.ResponseApplySnapshotChunk; + reader.readMessage(value,proto.tendermint.abci.ResponseApplySnapshotChunk.deserializeBinaryFromReader); + msg.setApplySnapshotChunk(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.Response.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.Response.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.Response} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Response.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getException(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.abci.ResponseException.serializeBinaryToWriter + ); + } + f = message.getEcho(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.abci.ResponseEcho.serializeBinaryToWriter + ); + } + f = message.getFlush(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.abci.ResponseFlush.serializeBinaryToWriter + ); + } + f = message.getInfo(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.abci.ResponseInfo.serializeBinaryToWriter + ); + } + f = message.getSetOption(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.tendermint.abci.ResponseSetOption.serializeBinaryToWriter + ); + } + f = message.getInitChain(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.tendermint.abci.ResponseInitChain.serializeBinaryToWriter + ); + } + f = message.getQuery(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.tendermint.abci.ResponseQuery.serializeBinaryToWriter + ); + } + f = message.getBeginBlock(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.tendermint.abci.ResponseBeginBlock.serializeBinaryToWriter + ); + } + f = message.getCheckTx(); + if (f != null) { + writer.writeMessage( + 9, + f, + proto.tendermint.abci.ResponseCheckTx.serializeBinaryToWriter + ); + } + f = message.getDeliverTx(); + if (f != null) { + writer.writeMessage( + 10, + f, + proto.tendermint.abci.ResponseDeliverTx.serializeBinaryToWriter + ); + } + f = message.getEndBlock(); + if (f != null) { + writer.writeMessage( + 11, + f, + proto.tendermint.abci.ResponseEndBlock.serializeBinaryToWriter + ); + } + f = message.getCommit(); + if (f != null) { + writer.writeMessage( + 12, + f, + proto.tendermint.abci.ResponseCommit.serializeBinaryToWriter + ); + } + f = message.getListSnapshots(); + if (f != null) { + writer.writeMessage( + 13, + f, + proto.tendermint.abci.ResponseListSnapshots.serializeBinaryToWriter + ); + } + f = message.getOfferSnapshot(); + if (f != null) { + writer.writeMessage( + 14, + f, + proto.tendermint.abci.ResponseOfferSnapshot.serializeBinaryToWriter + ); + } + f = message.getLoadSnapshotChunk(); + if (f != null) { + writer.writeMessage( + 15, + f, + proto.tendermint.abci.ResponseLoadSnapshotChunk.serializeBinaryToWriter + ); + } + f = message.getApplySnapshotChunk(); + if (f != null) { + writer.writeMessage( + 16, + f, + proto.tendermint.abci.ResponseApplySnapshotChunk.serializeBinaryToWriter + ); + } +}; + + +/** + * optional ResponseException exception = 1; + * @return {?proto.tendermint.abci.ResponseException} + */ +proto.tendermint.abci.Response.prototype.getException = function() { + return /** @type{?proto.tendermint.abci.ResponseException} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseException, 1)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseException|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setException = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearException = function() { + return this.setException(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasException = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional ResponseEcho echo = 2; + * @return {?proto.tendermint.abci.ResponseEcho} + */ +proto.tendermint.abci.Response.prototype.getEcho = function() { + return /** @type{?proto.tendermint.abci.ResponseEcho} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseEcho, 2)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseEcho|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setEcho = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearEcho = function() { + return this.setEcho(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasEcho = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ResponseFlush flush = 3; + * @return {?proto.tendermint.abci.ResponseFlush} + */ +proto.tendermint.abci.Response.prototype.getFlush = function() { + return /** @type{?proto.tendermint.abci.ResponseFlush} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseFlush, 3)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseFlush|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setFlush = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearFlush = function() { + return this.setFlush(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasFlush = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional ResponseInfo info = 4; + * @return {?proto.tendermint.abci.ResponseInfo} + */ +proto.tendermint.abci.Response.prototype.getInfo = function() { + return /** @type{?proto.tendermint.abci.ResponseInfo} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseInfo, 4)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseInfo|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setInfo = function(value) { + return jspb.Message.setOneofWrapperField(this, 4, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearInfo = function() { + return this.setInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasInfo = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional ResponseSetOption set_option = 5; + * @return {?proto.tendermint.abci.ResponseSetOption} + */ +proto.tendermint.abci.Response.prototype.getSetOption = function() { + return /** @type{?proto.tendermint.abci.ResponseSetOption} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseSetOption, 5)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseSetOption|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setSetOption = function(value) { + return jspb.Message.setOneofWrapperField(this, 5, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearSetOption = function() { + return this.setSetOption(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasSetOption = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional ResponseInitChain init_chain = 6; + * @return {?proto.tendermint.abci.ResponseInitChain} + */ +proto.tendermint.abci.Response.prototype.getInitChain = function() { + return /** @type{?proto.tendermint.abci.ResponseInitChain} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseInitChain, 6)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseInitChain|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setInitChain = function(value) { + return jspb.Message.setOneofWrapperField(this, 6, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearInitChain = function() { + return this.setInitChain(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasInitChain = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional ResponseQuery query = 7; + * @return {?proto.tendermint.abci.ResponseQuery} + */ +proto.tendermint.abci.Response.prototype.getQuery = function() { + return /** @type{?proto.tendermint.abci.ResponseQuery} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseQuery, 7)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseQuery|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setQuery = function(value) { + return jspb.Message.setOneofWrapperField(this, 7, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearQuery = function() { + return this.setQuery(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasQuery = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional ResponseBeginBlock begin_block = 8; + * @return {?proto.tendermint.abci.ResponseBeginBlock} + */ +proto.tendermint.abci.Response.prototype.getBeginBlock = function() { + return /** @type{?proto.tendermint.abci.ResponseBeginBlock} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseBeginBlock, 8)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseBeginBlock|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setBeginBlock = function(value) { + return jspb.Message.setOneofWrapperField(this, 8, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearBeginBlock = function() { + return this.setBeginBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasBeginBlock = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional ResponseCheckTx check_tx = 9; + * @return {?proto.tendermint.abci.ResponseCheckTx} + */ +proto.tendermint.abci.Response.prototype.getCheckTx = function() { + return /** @type{?proto.tendermint.abci.ResponseCheckTx} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseCheckTx, 9)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseCheckTx|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setCheckTx = function(value) { + return jspb.Message.setOneofWrapperField(this, 9, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearCheckTx = function() { + return this.setCheckTx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasCheckTx = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional ResponseDeliverTx deliver_tx = 10; + * @return {?proto.tendermint.abci.ResponseDeliverTx} + */ +proto.tendermint.abci.Response.prototype.getDeliverTx = function() { + return /** @type{?proto.tendermint.abci.ResponseDeliverTx} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseDeliverTx, 10)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseDeliverTx|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setDeliverTx = function(value) { + return jspb.Message.setOneofWrapperField(this, 10, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearDeliverTx = function() { + return this.setDeliverTx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasDeliverTx = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional ResponseEndBlock end_block = 11; + * @return {?proto.tendermint.abci.ResponseEndBlock} + */ +proto.tendermint.abci.Response.prototype.getEndBlock = function() { + return /** @type{?proto.tendermint.abci.ResponseEndBlock} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseEndBlock, 11)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseEndBlock|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setEndBlock = function(value) { + return jspb.Message.setOneofWrapperField(this, 11, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearEndBlock = function() { + return this.setEndBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasEndBlock = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * optional ResponseCommit commit = 12; + * @return {?proto.tendermint.abci.ResponseCommit} + */ +proto.tendermint.abci.Response.prototype.getCommit = function() { + return /** @type{?proto.tendermint.abci.ResponseCommit} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseCommit, 12)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseCommit|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setCommit = function(value) { + return jspb.Message.setOneofWrapperField(this, 12, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearCommit = function() { + return this.setCommit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasCommit = function() { + return jspb.Message.getField(this, 12) != null; +}; + + +/** + * optional ResponseListSnapshots list_snapshots = 13; + * @return {?proto.tendermint.abci.ResponseListSnapshots} + */ +proto.tendermint.abci.Response.prototype.getListSnapshots = function() { + return /** @type{?proto.tendermint.abci.ResponseListSnapshots} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseListSnapshots, 13)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseListSnapshots|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setListSnapshots = function(value) { + return jspb.Message.setOneofWrapperField(this, 13, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearListSnapshots = function() { + return this.setListSnapshots(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasListSnapshots = function() { + return jspb.Message.getField(this, 13) != null; +}; + + +/** + * optional ResponseOfferSnapshot offer_snapshot = 14; + * @return {?proto.tendermint.abci.ResponseOfferSnapshot} + */ +proto.tendermint.abci.Response.prototype.getOfferSnapshot = function() { + return /** @type{?proto.tendermint.abci.ResponseOfferSnapshot} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseOfferSnapshot, 14)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseOfferSnapshot|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setOfferSnapshot = function(value) { + return jspb.Message.setOneofWrapperField(this, 14, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearOfferSnapshot = function() { + return this.setOfferSnapshot(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasOfferSnapshot = function() { + return jspb.Message.getField(this, 14) != null; +}; + + +/** + * optional ResponseLoadSnapshotChunk load_snapshot_chunk = 15; + * @return {?proto.tendermint.abci.ResponseLoadSnapshotChunk} + */ +proto.tendermint.abci.Response.prototype.getLoadSnapshotChunk = function() { + return /** @type{?proto.tendermint.abci.ResponseLoadSnapshotChunk} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseLoadSnapshotChunk, 15)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseLoadSnapshotChunk|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setLoadSnapshotChunk = function(value) { + return jspb.Message.setOneofWrapperField(this, 15, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearLoadSnapshotChunk = function() { + return this.setLoadSnapshotChunk(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasLoadSnapshotChunk = function() { + return jspb.Message.getField(this, 15) != null; +}; + + +/** + * optional ResponseApplySnapshotChunk apply_snapshot_chunk = 16; + * @return {?proto.tendermint.abci.ResponseApplySnapshotChunk} + */ +proto.tendermint.abci.Response.prototype.getApplySnapshotChunk = function() { + return /** @type{?proto.tendermint.abci.ResponseApplySnapshotChunk} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseApplySnapshotChunk, 16)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseApplySnapshotChunk|undefined} value + * @return {!proto.tendermint.abci.Response} returns this +*/ +proto.tendermint.abci.Response.prototype.setApplySnapshotChunk = function(value) { + return jspb.Message.setOneofWrapperField(this, 16, proto.tendermint.abci.Response.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Response} returns this + */ +proto.tendermint.abci.Response.prototype.clearApplySnapshotChunk = function() { + return this.setApplySnapshotChunk(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Response.prototype.hasApplySnapshotChunk = function() { + return jspb.Message.getField(this, 16) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseException.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseException.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseException} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseException.toObject = function(includeInstance, msg) { + var f, obj = { + error: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseException} + */ +proto.tendermint.abci.ResponseException.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseException; + return proto.tendermint.abci.ResponseException.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseException} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseException} + */ +proto.tendermint.abci.ResponseException.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setError(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseException.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseException.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseException} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseException.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getError(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string error = 1; + * @return {string} + */ +proto.tendermint.abci.ResponseException.prototype.getError = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseException} returns this + */ +proto.tendermint.abci.ResponseException.prototype.setError = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseEcho.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseEcho.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseEcho} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseEcho.toObject = function(includeInstance, msg) { + var f, obj = { + message: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseEcho} + */ +proto.tendermint.abci.ResponseEcho.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseEcho; + return proto.tendermint.abci.ResponseEcho.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseEcho} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseEcho} + */ +proto.tendermint.abci.ResponseEcho.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseEcho.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseEcho.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseEcho} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseEcho.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string message = 1; + * @return {string} + */ +proto.tendermint.abci.ResponseEcho.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseEcho} returns this + */ +proto.tendermint.abci.ResponseEcho.prototype.setMessage = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseFlush.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseFlush.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseFlush} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseFlush.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseFlush} + */ +proto.tendermint.abci.ResponseFlush.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseFlush; + return proto.tendermint.abci.ResponseFlush.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseFlush} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseFlush} + */ +proto.tendermint.abci.ResponseFlush.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseFlush.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseFlush.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseFlush} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseFlush.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseInfo.toObject = function(includeInstance, msg) { + var f, obj = { + data: jspb.Message.getFieldWithDefault(msg, 1, ""), + version: jspb.Message.getFieldWithDefault(msg, 2, ""), + appVersion: jspb.Message.getFieldWithDefault(msg, 3, 0), + lastBlockHeight: jspb.Message.getFieldWithDefault(msg, 4, 0), + lastBlockAppHash: msg.getLastBlockAppHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseInfo} + */ +proto.tendermint.abci.ResponseInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseInfo; + return proto.tendermint.abci.ResponseInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseInfo} + */ +proto.tendermint.abci.ResponseInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setData(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setVersion(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAppVersion(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setLastBlockHeight(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLastBlockAppHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getData(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getVersion(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getAppVersion(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } + f = message.getLastBlockHeight(); + if (f !== 0) { + writer.writeInt64( + 4, + f + ); + } + f = message.getLastBlockAppHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } +}; + + +/** + * optional string data = 1; + * @return {string} + */ +proto.tendermint.abci.ResponseInfo.prototype.getData = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseInfo} returns this + */ +proto.tendermint.abci.ResponseInfo.prototype.setData = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string version = 2; + * @return {string} + */ +proto.tendermint.abci.ResponseInfo.prototype.getVersion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseInfo} returns this + */ +proto.tendermint.abci.ResponseInfo.prototype.setVersion = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional uint64 app_version = 3; + * @return {number} + */ +proto.tendermint.abci.ResponseInfo.prototype.getAppVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseInfo} returns this + */ +proto.tendermint.abci.ResponseInfo.prototype.setAppVersion = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int64 last_block_height = 4; + * @return {number} + */ +proto.tendermint.abci.ResponseInfo.prototype.getLastBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseInfo} returns this + */ +proto.tendermint.abci.ResponseInfo.prototype.setLastBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional bytes last_block_app_hash = 5; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.ResponseInfo.prototype.getLastBlockAppHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes last_block_app_hash = 5; + * This is a type-conversion wrapper around `getLastBlockAppHash()` + * @return {string} + */ +proto.tendermint.abci.ResponseInfo.prototype.getLastBlockAppHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLastBlockAppHash())); +}; + + +/** + * optional bytes last_block_app_hash = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLastBlockAppHash()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseInfo.prototype.getLastBlockAppHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLastBlockAppHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.ResponseInfo} returns this + */ +proto.tendermint.abci.ResponseInfo.prototype.setLastBlockAppHash = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseSetOption.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseSetOption.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseSetOption} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseSetOption.toObject = function(includeInstance, msg) { + var f, obj = { + code: jspb.Message.getFieldWithDefault(msg, 1, 0), + log: jspb.Message.getFieldWithDefault(msg, 3, ""), + info: jspb.Message.getFieldWithDefault(msg, 4, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseSetOption} + */ +proto.tendermint.abci.ResponseSetOption.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseSetOption; + return proto.tendermint.abci.ResponseSetOption.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseSetOption} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseSetOption} + */ +proto.tendermint.abci.ResponseSetOption.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCode(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setLog(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setInfo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseSetOption.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseSetOption.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseSetOption} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseSetOption.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCode(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getLog(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getInfo(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * optional uint32 code = 1; + * @return {number} + */ +proto.tendermint.abci.ResponseSetOption.prototype.getCode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseSetOption} returns this + */ +proto.tendermint.abci.ResponseSetOption.prototype.setCode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string log = 3; + * @return {string} + */ +proto.tendermint.abci.ResponseSetOption.prototype.getLog = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseSetOption} returns this + */ +proto.tendermint.abci.ResponseSetOption.prototype.setLog = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string info = 4; + * @return {string} + */ +proto.tendermint.abci.ResponseSetOption.prototype.getInfo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseSetOption} returns this + */ +proto.tendermint.abci.ResponseSetOption.prototype.setInfo = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.ResponseInitChain.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseInitChain.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseInitChain.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseInitChain} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseInitChain.toObject = function(includeInstance, msg) { + var f, obj = { + consensusParams: (f = msg.getConsensusParams()) && proto.tendermint.abci.ConsensusParams.toObject(includeInstance, f), + validatorsList: jspb.Message.toObjectList(msg.getValidatorsList(), + proto.tendermint.abci.ValidatorUpdate.toObject, includeInstance), + appHash: msg.getAppHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseInitChain} + */ +proto.tendermint.abci.ResponseInitChain.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseInitChain; + return proto.tendermint.abci.ResponseInitChain.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseInitChain} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseInitChain} + */ +proto.tendermint.abci.ResponseInitChain.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.ConsensusParams; + reader.readMessage(value,proto.tendermint.abci.ConsensusParams.deserializeBinaryFromReader); + msg.setConsensusParams(value); + break; + case 2: + var value = new proto.tendermint.abci.ValidatorUpdate; + reader.readMessage(value,proto.tendermint.abci.ValidatorUpdate.deserializeBinaryFromReader); + msg.addValidators(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAppHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseInitChain.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseInitChain.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseInitChain} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseInitChain.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getConsensusParams(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.abci.ConsensusParams.serializeBinaryToWriter + ); + } + f = message.getValidatorsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.tendermint.abci.ValidatorUpdate.serializeBinaryToWriter + ); + } + f = message.getAppHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional ConsensusParams consensus_params = 1; + * @return {?proto.tendermint.abci.ConsensusParams} + */ +proto.tendermint.abci.ResponseInitChain.prototype.getConsensusParams = function() { + return /** @type{?proto.tendermint.abci.ConsensusParams} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ConsensusParams, 1)); +}; + + +/** + * @param {?proto.tendermint.abci.ConsensusParams|undefined} value + * @return {!proto.tendermint.abci.ResponseInitChain} returns this +*/ +proto.tendermint.abci.ResponseInitChain.prototype.setConsensusParams = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.ResponseInitChain} returns this + */ +proto.tendermint.abci.ResponseInitChain.prototype.clearConsensusParams = function() { + return this.setConsensusParams(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.ResponseInitChain.prototype.hasConsensusParams = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated ValidatorUpdate validators = 2; + * @return {!Array} + */ +proto.tendermint.abci.ResponseInitChain.prototype.getValidatorsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.ValidatorUpdate, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseInitChain} returns this +*/ +proto.tendermint.abci.ResponseInitChain.prototype.setValidatorsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.tendermint.abci.ValidatorUpdate=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.ValidatorUpdate} + */ +proto.tendermint.abci.ResponseInitChain.prototype.addValidators = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.tendermint.abci.ValidatorUpdate, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseInitChain} returns this + */ +proto.tendermint.abci.ResponseInitChain.prototype.clearValidatorsList = function() { + return this.setValidatorsList([]); +}; + + +/** + * optional bytes app_hash = 3; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.ResponseInitChain.prototype.getAppHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes app_hash = 3; + * This is a type-conversion wrapper around `getAppHash()` + * @return {string} + */ +proto.tendermint.abci.ResponseInitChain.prototype.getAppHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAppHash())); +}; + + +/** + * optional bytes app_hash = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAppHash()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseInitChain.prototype.getAppHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAppHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.ResponseInitChain} returns this + */ +proto.tendermint.abci.ResponseInitChain.prototype.setAppHash = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseQuery.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseQuery.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseQuery} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseQuery.toObject = function(includeInstance, msg) { + var f, obj = { + code: jspb.Message.getFieldWithDefault(msg, 1, 0), + log: jspb.Message.getFieldWithDefault(msg, 3, ""), + info: jspb.Message.getFieldWithDefault(msg, 4, ""), + index: jspb.Message.getFieldWithDefault(msg, 5, 0), + key: msg.getKey_asB64(), + value: msg.getValue_asB64(), + proofOps: (f = msg.getProofOps()) && tendermint_crypto_proof_pb.ProofOps.toObject(includeInstance, f), + height: jspb.Message.getFieldWithDefault(msg, 9, 0), + codespace: jspb.Message.getFieldWithDefault(msg, 10, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseQuery} + */ +proto.tendermint.abci.ResponseQuery.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseQuery; + return proto.tendermint.abci.ResponseQuery.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseQuery} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseQuery} + */ +proto.tendermint.abci.ResponseQuery.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCode(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setLog(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setInfo(value); + break; + case 5: + var value = /** @type {number} */ (reader.readInt64()); + msg.setIndex(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setKey(value); + break; + case 7: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValue(value); + break; + case 8: + var value = new tendermint_crypto_proof_pb.ProofOps; + reader.readMessage(value,tendermint_crypto_proof_pb.ProofOps.deserializeBinaryFromReader); + msg.setProofOps(value); + break; + case 9: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 10: + var value = /** @type {string} */ (reader.readString()); + msg.setCodespace(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseQuery.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseQuery.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseQuery} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseQuery.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCode(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getLog(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getInfo(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeInt64( + 5, + f + ); + } + f = message.getKey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 6, + f + ); + } + f = message.getValue_asU8(); + if (f.length > 0) { + writer.writeBytes( + 7, + f + ); + } + f = message.getProofOps(); + if (f != null) { + writer.writeMessage( + 8, + f, + tendermint_crypto_proof_pb.ProofOps.serializeBinaryToWriter + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 9, + f + ); + } + f = message.getCodespace(); + if (f.length > 0) { + writer.writeString( + 10, + f + ); + } +}; + + +/** + * optional uint32 code = 1; + * @return {number} + */ +proto.tendermint.abci.ResponseQuery.prototype.getCode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.setCode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string log = 3; + * @return {string} + */ +proto.tendermint.abci.ResponseQuery.prototype.getLog = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.setLog = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string info = 4; + * @return {string} + */ +proto.tendermint.abci.ResponseQuery.prototype.getInfo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.setInfo = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional int64 index = 5; + * @return {number} + */ +proto.tendermint.abci.ResponseQuery.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional bytes key = 6; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.ResponseQuery.prototype.getKey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes key = 6; + * This is a type-conversion wrapper around `getKey()` + * @return {string} + */ +proto.tendermint.abci.ResponseQuery.prototype.getKey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getKey())); +}; + + +/** + * optional bytes key = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKey()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseQuery.prototype.getKey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getKey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.setKey = function(value) { + return jspb.Message.setProto3BytesField(this, 6, value); +}; + + +/** + * optional bytes value = 7; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.ResponseQuery.prototype.getValue = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * optional bytes value = 7; + * This is a type-conversion wrapper around `getValue()` + * @return {string} + */ +proto.tendermint.abci.ResponseQuery.prototype.getValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValue())); +}; + + +/** + * optional bytes value = 7; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValue()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseQuery.prototype.getValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.setValue = function(value) { + return jspb.Message.setProto3BytesField(this, 7, value); +}; + + +/** + * optional tendermint.crypto.ProofOps proof_ops = 8; + * @return {?proto.tendermint.crypto.ProofOps} + */ +proto.tendermint.abci.ResponseQuery.prototype.getProofOps = function() { + return /** @type{?proto.tendermint.crypto.ProofOps} */ ( + jspb.Message.getWrapperField(this, tendermint_crypto_proof_pb.ProofOps, 8)); +}; + + +/** + * @param {?proto.tendermint.crypto.ProofOps|undefined} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this +*/ +proto.tendermint.abci.ResponseQuery.prototype.setProofOps = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.clearProofOps = function() { + return this.setProofOps(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.ResponseQuery.prototype.hasProofOps = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional int64 height = 9; + * @return {number} + */ +proto.tendermint.abci.ResponseQuery.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 9, value); +}; + + +/** + * optional string codespace = 10; + * @return {string} + */ +proto.tendermint.abci.ResponseQuery.prototype.getCodespace = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseQuery} returns this + */ +proto.tendermint.abci.ResponseQuery.prototype.setCodespace = function(value) { + return jspb.Message.setProto3StringField(this, 10, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.ResponseBeginBlock.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseBeginBlock.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseBeginBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseBeginBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseBeginBlock.toObject = function(includeInstance, msg) { + var f, obj = { + eventsList: jspb.Message.toObjectList(msg.getEventsList(), + proto.tendermint.abci.Event.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseBeginBlock} + */ +proto.tendermint.abci.ResponseBeginBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseBeginBlock; + return proto.tendermint.abci.ResponseBeginBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseBeginBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseBeginBlock} + */ +proto.tendermint.abci.ResponseBeginBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.Event; + reader.readMessage(value,proto.tendermint.abci.Event.deserializeBinaryFromReader); + msg.addEvents(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseBeginBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseBeginBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseBeginBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseBeginBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEventsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.tendermint.abci.Event.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated Event events = 1; + * @return {!Array} + */ +proto.tendermint.abci.ResponseBeginBlock.prototype.getEventsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.Event, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseBeginBlock} returns this +*/ +proto.tendermint.abci.ResponseBeginBlock.prototype.setEventsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.tendermint.abci.Event=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.Event} + */ +proto.tendermint.abci.ResponseBeginBlock.prototype.addEvents = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.tendermint.abci.Event, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseBeginBlock} returns this + */ +proto.tendermint.abci.ResponseBeginBlock.prototype.clearEventsList = function() { + return this.setEventsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.ResponseCheckTx.repeatedFields_ = [7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseCheckTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseCheckTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseCheckTx.toObject = function(includeInstance, msg) { + var f, obj = { + code: jspb.Message.getFieldWithDefault(msg, 1, 0), + data: msg.getData_asB64(), + log: jspb.Message.getFieldWithDefault(msg, 3, ""), + info: jspb.Message.getFieldWithDefault(msg, 4, ""), + gasWanted: jspb.Message.getFieldWithDefault(msg, 5, 0), + gasUsed: jspb.Message.getFieldWithDefault(msg, 6, 0), + eventsList: jspb.Message.toObjectList(msg.getEventsList(), + proto.tendermint.abci.Event.toObject, includeInstance), + codespace: jspb.Message.getFieldWithDefault(msg, 8, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseCheckTx} + */ +proto.tendermint.abci.ResponseCheckTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseCheckTx; + return proto.tendermint.abci.ResponseCheckTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseCheckTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseCheckTx} + */ +proto.tendermint.abci.ResponseCheckTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCode(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setLog(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setInfo(value); + break; + case 5: + var value = /** @type {number} */ (reader.readInt64()); + msg.setGasWanted(value); + break; + case 6: + var value = /** @type {number} */ (reader.readInt64()); + msg.setGasUsed(value); + break; + case 7: + var value = new proto.tendermint.abci.Event; + reader.readMessage(value,proto.tendermint.abci.Event.deserializeBinaryFromReader); + msg.addEvents(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setCodespace(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseCheckTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseCheckTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseCheckTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCode(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getLog(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getInfo(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getGasWanted(); + if (f !== 0) { + writer.writeInt64( + 5, + f + ); + } + f = message.getGasUsed(); + if (f !== 0) { + writer.writeInt64( + 6, + f + ); + } + f = message.getEventsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 7, + f, + proto.tendermint.abci.Event.serializeBinaryToWriter + ); + } + f = message.getCodespace(); + if (f.length > 0) { + writer.writeString( + 8, + f + ); + } +}; + + +/** + * optional uint32 code = 1; + * @return {number} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getCode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this + */ +proto.tendermint.abci.ResponseCheckTx.prototype.setCode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this + */ +proto.tendermint.abci.ResponseCheckTx.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional string log = 3; + * @return {string} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getLog = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this + */ +proto.tendermint.abci.ResponseCheckTx.prototype.setLog = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string info = 4; + * @return {string} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getInfo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this + */ +proto.tendermint.abci.ResponseCheckTx.prototype.setInfo = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional int64 gas_wanted = 5; + * @return {number} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getGasWanted = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this + */ +proto.tendermint.abci.ResponseCheckTx.prototype.setGasWanted = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional int64 gas_used = 6; + * @return {number} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getGasUsed = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this + */ +proto.tendermint.abci.ResponseCheckTx.prototype.setGasUsed = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + +/** + * repeated Event events = 7; + * @return {!Array} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getEventsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.Event, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this +*/ +proto.tendermint.abci.ResponseCheckTx.prototype.setEventsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 7, value); +}; + + +/** + * @param {!proto.tendermint.abci.Event=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.Event} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.addEvents = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.tendermint.abci.Event, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this + */ +proto.tendermint.abci.ResponseCheckTx.prototype.clearEventsList = function() { + return this.setEventsList([]); +}; + + +/** + * optional string codespace = 8; + * @return {string} + */ +proto.tendermint.abci.ResponseCheckTx.prototype.getCodespace = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseCheckTx} returns this + */ +proto.tendermint.abci.ResponseCheckTx.prototype.setCodespace = function(value) { + return jspb.Message.setProto3StringField(this, 8, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.ResponseDeliverTx.repeatedFields_ = [7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseDeliverTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseDeliverTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseDeliverTx.toObject = function(includeInstance, msg) { + var f, obj = { + code: jspb.Message.getFieldWithDefault(msg, 1, 0), + data: msg.getData_asB64(), + log: jspb.Message.getFieldWithDefault(msg, 3, ""), + info: jspb.Message.getFieldWithDefault(msg, 4, ""), + gasWanted: jspb.Message.getFieldWithDefault(msg, 5, 0), + gasUsed: jspb.Message.getFieldWithDefault(msg, 6, 0), + eventsList: jspb.Message.toObjectList(msg.getEventsList(), + proto.tendermint.abci.Event.toObject, includeInstance), + codespace: jspb.Message.getFieldWithDefault(msg, 8, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseDeliverTx} + */ +proto.tendermint.abci.ResponseDeliverTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseDeliverTx; + return proto.tendermint.abci.ResponseDeliverTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseDeliverTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseDeliverTx} + */ +proto.tendermint.abci.ResponseDeliverTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setCode(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setLog(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setInfo(value); + break; + case 5: + var value = /** @type {number} */ (reader.readInt64()); + msg.setGasWanted(value); + break; + case 6: + var value = /** @type {number} */ (reader.readInt64()); + msg.setGasUsed(value); + break; + case 7: + var value = new proto.tendermint.abci.Event; + reader.readMessage(value,proto.tendermint.abci.Event.deserializeBinaryFromReader); + msg.addEvents(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setCodespace(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseDeliverTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseDeliverTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseDeliverTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCode(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getLog(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getInfo(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getGasWanted(); + if (f !== 0) { + writer.writeInt64( + 5, + f + ); + } + f = message.getGasUsed(); + if (f !== 0) { + writer.writeInt64( + 6, + f + ); + } + f = message.getEventsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 7, + f, + proto.tendermint.abci.Event.serializeBinaryToWriter + ); + } + f = message.getCodespace(); + if (f.length > 0) { + writer.writeString( + 8, + f + ); + } +}; + + +/** + * optional uint32 code = 1; + * @return {number} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getCode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.setCode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional string log = 3; + * @return {string} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getLog = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.setLog = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string info = 4; + * @return {string} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getInfo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.setInfo = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional int64 gas_wanted = 5; + * @return {number} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getGasWanted = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.setGasWanted = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional int64 gas_used = 6; + * @return {number} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getGasUsed = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.setGasUsed = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + +/** + * repeated Event events = 7; + * @return {!Array} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getEventsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.Event, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this +*/ +proto.tendermint.abci.ResponseDeliverTx.prototype.setEventsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 7, value); +}; + + +/** + * @param {!proto.tendermint.abci.Event=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.Event} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.addEvents = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.tendermint.abci.Event, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.clearEventsList = function() { + return this.setEventsList([]); +}; + + +/** + * optional string codespace = 8; + * @return {string} + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.getCodespace = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.ResponseDeliverTx} returns this + */ +proto.tendermint.abci.ResponseDeliverTx.prototype.setCodespace = function(value) { + return jspb.Message.setProto3StringField(this, 8, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.ResponseEndBlock.repeatedFields_ = [1,3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseEndBlock.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseEndBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseEndBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseEndBlock.toObject = function(includeInstance, msg) { + var f, obj = { + validatorUpdatesList: jspb.Message.toObjectList(msg.getValidatorUpdatesList(), + proto.tendermint.abci.ValidatorUpdate.toObject, includeInstance), + consensusParamUpdates: (f = msg.getConsensusParamUpdates()) && proto.tendermint.abci.ConsensusParams.toObject(includeInstance, f), + eventsList: jspb.Message.toObjectList(msg.getEventsList(), + proto.tendermint.abci.Event.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseEndBlock} + */ +proto.tendermint.abci.ResponseEndBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseEndBlock; + return proto.tendermint.abci.ResponseEndBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseEndBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseEndBlock} + */ +proto.tendermint.abci.ResponseEndBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.ValidatorUpdate; + reader.readMessage(value,proto.tendermint.abci.ValidatorUpdate.deserializeBinaryFromReader); + msg.addValidatorUpdates(value); + break; + case 2: + var value = new proto.tendermint.abci.ConsensusParams; + reader.readMessage(value,proto.tendermint.abci.ConsensusParams.deserializeBinaryFromReader); + msg.setConsensusParamUpdates(value); + break; + case 3: + var value = new proto.tendermint.abci.Event; + reader.readMessage(value,proto.tendermint.abci.Event.deserializeBinaryFromReader); + msg.addEvents(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseEndBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseEndBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseEndBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseEndBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getValidatorUpdatesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.tendermint.abci.ValidatorUpdate.serializeBinaryToWriter + ); + } + f = message.getConsensusParamUpdates(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.abci.ConsensusParams.serializeBinaryToWriter + ); + } + f = message.getEventsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.tendermint.abci.Event.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated ValidatorUpdate validator_updates = 1; + * @return {!Array} + */ +proto.tendermint.abci.ResponseEndBlock.prototype.getValidatorUpdatesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.ValidatorUpdate, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseEndBlock} returns this +*/ +proto.tendermint.abci.ResponseEndBlock.prototype.setValidatorUpdatesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.tendermint.abci.ValidatorUpdate=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.ValidatorUpdate} + */ +proto.tendermint.abci.ResponseEndBlock.prototype.addValidatorUpdates = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.tendermint.abci.ValidatorUpdate, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseEndBlock} returns this + */ +proto.tendermint.abci.ResponseEndBlock.prototype.clearValidatorUpdatesList = function() { + return this.setValidatorUpdatesList([]); +}; + + +/** + * optional ConsensusParams consensus_param_updates = 2; + * @return {?proto.tendermint.abci.ConsensusParams} + */ +proto.tendermint.abci.ResponseEndBlock.prototype.getConsensusParamUpdates = function() { + return /** @type{?proto.tendermint.abci.ConsensusParams} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ConsensusParams, 2)); +}; + + +/** + * @param {?proto.tendermint.abci.ConsensusParams|undefined} value + * @return {!proto.tendermint.abci.ResponseEndBlock} returns this +*/ +proto.tendermint.abci.ResponseEndBlock.prototype.setConsensusParamUpdates = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.ResponseEndBlock} returns this + */ +proto.tendermint.abci.ResponseEndBlock.prototype.clearConsensusParamUpdates = function() { + return this.setConsensusParamUpdates(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.ResponseEndBlock.prototype.hasConsensusParamUpdates = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated Event events = 3; + * @return {!Array} + */ +proto.tendermint.abci.ResponseEndBlock.prototype.getEventsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.Event, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseEndBlock} returns this +*/ +proto.tendermint.abci.ResponseEndBlock.prototype.setEventsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.tendermint.abci.Event=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.Event} + */ +proto.tendermint.abci.ResponseEndBlock.prototype.addEvents = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.tendermint.abci.Event, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseEndBlock} returns this + */ +proto.tendermint.abci.ResponseEndBlock.prototype.clearEventsList = function() { + return this.setEventsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseCommit.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseCommit.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseCommit} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseCommit.toObject = function(includeInstance, msg) { + var f, obj = { + data: msg.getData_asB64(), + retainHeight: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseCommit} + */ +proto.tendermint.abci.ResponseCommit.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseCommit; + return proto.tendermint.abci.ResponseCommit.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseCommit} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseCommit} + */ +proto.tendermint.abci.ResponseCommit.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setRetainHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseCommit.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseCommit.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseCommit} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseCommit.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getRetainHeight(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } +}; + + +/** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.ResponseCommit.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.tendermint.abci.ResponseCommit.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseCommit.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.ResponseCommit} returns this + */ +proto.tendermint.abci.ResponseCommit.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional int64 retain_height = 3; + * @return {number} + */ +proto.tendermint.abci.ResponseCommit.prototype.getRetainHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ResponseCommit} returns this + */ +proto.tendermint.abci.ResponseCommit.prototype.setRetainHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.ResponseListSnapshots.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseListSnapshots.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseListSnapshots.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseListSnapshots} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseListSnapshots.toObject = function(includeInstance, msg) { + var f, obj = { + snapshotsList: jspb.Message.toObjectList(msg.getSnapshotsList(), + proto.tendermint.abci.Snapshot.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseListSnapshots} + */ +proto.tendermint.abci.ResponseListSnapshots.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseListSnapshots; + return proto.tendermint.abci.ResponseListSnapshots.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseListSnapshots} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseListSnapshots} + */ +proto.tendermint.abci.ResponseListSnapshots.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.Snapshot; + reader.readMessage(value,proto.tendermint.abci.Snapshot.deserializeBinaryFromReader); + msg.addSnapshots(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseListSnapshots.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseListSnapshots.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseListSnapshots} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseListSnapshots.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSnapshotsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.tendermint.abci.Snapshot.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated Snapshot snapshots = 1; + * @return {!Array} + */ +proto.tendermint.abci.ResponseListSnapshots.prototype.getSnapshotsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.Snapshot, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseListSnapshots} returns this +*/ +proto.tendermint.abci.ResponseListSnapshots.prototype.setSnapshotsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.tendermint.abci.Snapshot=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.Snapshot} + */ +proto.tendermint.abci.ResponseListSnapshots.prototype.addSnapshots = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.tendermint.abci.Snapshot, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseListSnapshots} returns this + */ +proto.tendermint.abci.ResponseListSnapshots.prototype.clearSnapshotsList = function() { + return this.setSnapshotsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseOfferSnapshot.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseOfferSnapshot.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseOfferSnapshot} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseOfferSnapshot.toObject = function(includeInstance, msg) { + var f, obj = { + result: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseOfferSnapshot} + */ +proto.tendermint.abci.ResponseOfferSnapshot.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseOfferSnapshot; + return proto.tendermint.abci.ResponseOfferSnapshot.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseOfferSnapshot} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseOfferSnapshot} + */ +proto.tendermint.abci.ResponseOfferSnapshot.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.tendermint.abci.ResponseOfferSnapshot.Result} */ (reader.readEnum()); + msg.setResult(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseOfferSnapshot.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseOfferSnapshot.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseOfferSnapshot} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseOfferSnapshot.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getResult(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.tendermint.abci.ResponseOfferSnapshot.Result = { + UNKNOWN: 0, + ACCEPT: 1, + ABORT: 2, + REJECT: 3, + REJECT_FORMAT: 4, + REJECT_SENDER: 5 +}; + +/** + * optional Result result = 1; + * @return {!proto.tendermint.abci.ResponseOfferSnapshot.Result} + */ +proto.tendermint.abci.ResponseOfferSnapshot.prototype.getResult = function() { + return /** @type {!proto.tendermint.abci.ResponseOfferSnapshot.Result} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.tendermint.abci.ResponseOfferSnapshot.Result} value + * @return {!proto.tendermint.abci.ResponseOfferSnapshot} returns this + */ +proto.tendermint.abci.ResponseOfferSnapshot.prototype.setResult = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseLoadSnapshotChunk.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseLoadSnapshotChunk} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.toObject = function(includeInstance, msg) { + var f, obj = { + chunk: msg.getChunk_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseLoadSnapshotChunk} + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseLoadSnapshotChunk; + return proto.tendermint.abci.ResponseLoadSnapshotChunk.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseLoadSnapshotChunk} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseLoadSnapshotChunk} + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setChunk(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseLoadSnapshotChunk.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseLoadSnapshotChunk} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getChunk_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes chunk = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.prototype.getChunk = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes chunk = 1; + * This is a type-conversion wrapper around `getChunk()` + * @return {string} + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.prototype.getChunk_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getChunk())); +}; + + +/** + * optional bytes chunk = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getChunk()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.prototype.getChunk_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getChunk())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.ResponseLoadSnapshotChunk} returns this + */ +proto.tendermint.abci.ResponseLoadSnapshotChunk.prototype.setChunk = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.repeatedFields_ = [2,3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ResponseApplySnapshotChunk.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ResponseApplySnapshotChunk} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.toObject = function(includeInstance, msg) { + var f, obj = { + result: jspb.Message.getFieldWithDefault(msg, 1, 0), + refetchChunksList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, + rejectSendersList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ResponseApplySnapshotChunk; + return proto.tendermint.abci.ResponseApplySnapshotChunk.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ResponseApplySnapshotChunk} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.tendermint.abci.ResponseApplySnapshotChunk.Result} */ (reader.readEnum()); + msg.setResult(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); + for (var i = 0; i < values.length; i++) { + msg.addRefetchChunks(values[i]); + } + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.addRejectSenders(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ResponseApplySnapshotChunk.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ResponseApplySnapshotChunk} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getResult(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getRefetchChunksList(); + if (f.length > 0) { + writer.writePackedUint32( + 2, + f + ); + } + f = message.getRejectSendersList(); + if (f.length > 0) { + writer.writeRepeatedString( + 3, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.Result = { + UNKNOWN: 0, + ACCEPT: 1, + ABORT: 2, + RETRY: 3, + RETRY_SNAPSHOT: 4, + REJECT_SNAPSHOT: 5 +}; + +/** + * optional Result result = 1; + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk.Result} + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.getResult = function() { + return /** @type {!proto.tendermint.abci.ResponseApplySnapshotChunk.Result} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.tendermint.abci.ResponseApplySnapshotChunk.Result} value + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} returns this + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.setResult = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * repeated uint32 refetch_chunks = 2; + * @return {!Array} + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.getRefetchChunksList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} returns this + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.setRefetchChunksList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} returns this + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.addRefetchChunks = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} returns this + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.clearRefetchChunksList = function() { + return this.setRefetchChunksList([]); +}; + + +/** + * repeated string reject_senders = 3; + * @return {!Array} + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.getRejectSendersList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} returns this + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.setRejectSendersList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} returns this + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.addRejectSenders = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.ResponseApplySnapshotChunk} returns this + */ +proto.tendermint.abci.ResponseApplySnapshotChunk.prototype.clearRejectSendersList = function() { + return this.setRejectSendersList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ConsensusParams.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ConsensusParams.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ConsensusParams} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ConsensusParams.toObject = function(includeInstance, msg) { + var f, obj = { + block: (f = msg.getBlock()) && proto.tendermint.abci.BlockParams.toObject(includeInstance, f), + evidence: (f = msg.getEvidence()) && tendermint_types_params_pb.EvidenceParams.toObject(includeInstance, f), + validator: (f = msg.getValidator()) && tendermint_types_params_pb.ValidatorParams.toObject(includeInstance, f), + version: (f = msg.getVersion()) && tendermint_types_params_pb.VersionParams.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ConsensusParams} + */ +proto.tendermint.abci.ConsensusParams.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ConsensusParams; + return proto.tendermint.abci.ConsensusParams.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ConsensusParams} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ConsensusParams} + */ +proto.tendermint.abci.ConsensusParams.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.BlockParams; + reader.readMessage(value,proto.tendermint.abci.BlockParams.deserializeBinaryFromReader); + msg.setBlock(value); + break; + case 2: + var value = new tendermint_types_params_pb.EvidenceParams; + reader.readMessage(value,tendermint_types_params_pb.EvidenceParams.deserializeBinaryFromReader); + msg.setEvidence(value); + break; + case 3: + var value = new tendermint_types_params_pb.ValidatorParams; + reader.readMessage(value,tendermint_types_params_pb.ValidatorParams.deserializeBinaryFromReader); + msg.setValidator(value); + break; + case 4: + var value = new tendermint_types_params_pb.VersionParams; + reader.readMessage(value,tendermint_types_params_pb.VersionParams.deserializeBinaryFromReader); + msg.setVersion(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ConsensusParams.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ConsensusParams.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ConsensusParams} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ConsensusParams.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.abci.BlockParams.serializeBinaryToWriter + ); + } + f = message.getEvidence(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_types_params_pb.EvidenceParams.serializeBinaryToWriter + ); + } + f = message.getValidator(); + if (f != null) { + writer.writeMessage( + 3, + f, + tendermint_types_params_pb.ValidatorParams.serializeBinaryToWriter + ); + } + f = message.getVersion(); + if (f != null) { + writer.writeMessage( + 4, + f, + tendermint_types_params_pb.VersionParams.serializeBinaryToWriter + ); + } +}; + + +/** + * optional BlockParams block = 1; + * @return {?proto.tendermint.abci.BlockParams} + */ +proto.tendermint.abci.ConsensusParams.prototype.getBlock = function() { + return /** @type{?proto.tendermint.abci.BlockParams} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.BlockParams, 1)); +}; + + +/** + * @param {?proto.tendermint.abci.BlockParams|undefined} value + * @return {!proto.tendermint.abci.ConsensusParams} returns this +*/ +proto.tendermint.abci.ConsensusParams.prototype.setBlock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.ConsensusParams} returns this + */ +proto.tendermint.abci.ConsensusParams.prototype.clearBlock = function() { + return this.setBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.ConsensusParams.prototype.hasBlock = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional tendermint.types.EvidenceParams evidence = 2; + * @return {?proto.tendermint.types.EvidenceParams} + */ +proto.tendermint.abci.ConsensusParams.prototype.getEvidence = function() { + return /** @type{?proto.tendermint.types.EvidenceParams} */ ( + jspb.Message.getWrapperField(this, tendermint_types_params_pb.EvidenceParams, 2)); +}; + + +/** + * @param {?proto.tendermint.types.EvidenceParams|undefined} value + * @return {!proto.tendermint.abci.ConsensusParams} returns this +*/ +proto.tendermint.abci.ConsensusParams.prototype.setEvidence = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.ConsensusParams} returns this + */ +proto.tendermint.abci.ConsensusParams.prototype.clearEvidence = function() { + return this.setEvidence(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.ConsensusParams.prototype.hasEvidence = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional tendermint.types.ValidatorParams validator = 3; + * @return {?proto.tendermint.types.ValidatorParams} + */ +proto.tendermint.abci.ConsensusParams.prototype.getValidator = function() { + return /** @type{?proto.tendermint.types.ValidatorParams} */ ( + jspb.Message.getWrapperField(this, tendermint_types_params_pb.ValidatorParams, 3)); +}; + + +/** + * @param {?proto.tendermint.types.ValidatorParams|undefined} value + * @return {!proto.tendermint.abci.ConsensusParams} returns this +*/ +proto.tendermint.abci.ConsensusParams.prototype.setValidator = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.ConsensusParams} returns this + */ +proto.tendermint.abci.ConsensusParams.prototype.clearValidator = function() { + return this.setValidator(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.ConsensusParams.prototype.hasValidator = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional tendermint.types.VersionParams version = 4; + * @return {?proto.tendermint.types.VersionParams} + */ +proto.tendermint.abci.ConsensusParams.prototype.getVersion = function() { + return /** @type{?proto.tendermint.types.VersionParams} */ ( + jspb.Message.getWrapperField(this, tendermint_types_params_pb.VersionParams, 4)); +}; + + +/** + * @param {?proto.tendermint.types.VersionParams|undefined} value + * @return {!proto.tendermint.abci.ConsensusParams} returns this +*/ +proto.tendermint.abci.ConsensusParams.prototype.setVersion = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.ConsensusParams} returns this + */ +proto.tendermint.abci.ConsensusParams.prototype.clearVersion = function() { + return this.setVersion(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.ConsensusParams.prototype.hasVersion = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.BlockParams.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.BlockParams.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.BlockParams} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.BlockParams.toObject = function(includeInstance, msg) { + var f, obj = { + maxBytes: jspb.Message.getFieldWithDefault(msg, 1, 0), + maxGas: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.BlockParams} + */ +proto.tendermint.abci.BlockParams.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.BlockParams; + return proto.tendermint.abci.BlockParams.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.BlockParams} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.BlockParams} + */ +proto.tendermint.abci.BlockParams.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMaxBytes(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMaxGas(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.BlockParams.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.BlockParams.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.BlockParams} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.BlockParams.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMaxBytes(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getMaxGas(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional int64 max_bytes = 1; + * @return {number} + */ +proto.tendermint.abci.BlockParams.prototype.getMaxBytes = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.BlockParams} returns this + */ +proto.tendermint.abci.BlockParams.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int64 max_gas = 2; + * @return {number} + */ +proto.tendermint.abci.BlockParams.prototype.getMaxGas = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.BlockParams} returns this + */ +proto.tendermint.abci.BlockParams.prototype.setMaxGas = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.LastCommitInfo.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.LastCommitInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.LastCommitInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.LastCommitInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.LastCommitInfo.toObject = function(includeInstance, msg) { + var f, obj = { + round: jspb.Message.getFieldWithDefault(msg, 1, 0), + votesList: jspb.Message.toObjectList(msg.getVotesList(), + proto.tendermint.abci.VoteInfo.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.LastCommitInfo} + */ +proto.tendermint.abci.LastCommitInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.LastCommitInfo; + return proto.tendermint.abci.LastCommitInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.LastCommitInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.LastCommitInfo} + */ +proto.tendermint.abci.LastCommitInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 2: + var value = new proto.tendermint.abci.VoteInfo; + reader.readMessage(value,proto.tendermint.abci.VoteInfo.deserializeBinaryFromReader); + msg.addVotes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.LastCommitInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.LastCommitInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.LastCommitInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.LastCommitInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } + f = message.getVotesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.tendermint.abci.VoteInfo.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int32 round = 1; + * @return {number} + */ +proto.tendermint.abci.LastCommitInfo.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.LastCommitInfo} returns this + */ +proto.tendermint.abci.LastCommitInfo.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * repeated VoteInfo votes = 2; + * @return {!Array} + */ +proto.tendermint.abci.LastCommitInfo.prototype.getVotesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.VoteInfo, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.LastCommitInfo} returns this +*/ +proto.tendermint.abci.LastCommitInfo.prototype.setVotesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.tendermint.abci.VoteInfo=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.VoteInfo} + */ +proto.tendermint.abci.LastCommitInfo.prototype.addVotes = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.tendermint.abci.VoteInfo, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.LastCommitInfo} returns this + */ +proto.tendermint.abci.LastCommitInfo.prototype.clearVotesList = function() { + return this.setVotesList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.abci.Event.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.Event.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.Event.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.Event} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Event.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, ""), + attributesList: jspb.Message.toObjectList(msg.getAttributesList(), + proto.tendermint.abci.EventAttribute.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.Event} + */ +proto.tendermint.abci.Event.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.Event; + return proto.tendermint.abci.Event.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.Event} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.Event} + */ +proto.tendermint.abci.Event.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setType(value); + break; + case 2: + var value = new proto.tendermint.abci.EventAttribute; + reader.readMessage(value,proto.tendermint.abci.EventAttribute.deserializeBinaryFromReader); + msg.addAttributes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.Event.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.Event.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.Event} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Event.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getAttributesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.tendermint.abci.EventAttribute.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string type = 1; + * @return {string} + */ +proto.tendermint.abci.Event.prototype.getType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.abci.Event} returns this + */ +proto.tendermint.abci.Event.prototype.setType = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * repeated EventAttribute attributes = 2; + * @return {!Array} + */ +proto.tendermint.abci.Event.prototype.getAttributesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.abci.EventAttribute, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.abci.Event} returns this +*/ +proto.tendermint.abci.Event.prototype.setAttributesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.tendermint.abci.EventAttribute=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.EventAttribute} + */ +proto.tendermint.abci.Event.prototype.addAttributes = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.tendermint.abci.EventAttribute, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.abci.Event} returns this + */ +proto.tendermint.abci.Event.prototype.clearAttributesList = function() { + return this.setAttributesList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.EventAttribute.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.EventAttribute.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.EventAttribute} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.EventAttribute.toObject = function(includeInstance, msg) { + var f, obj = { + key: msg.getKey_asB64(), + value: msg.getValue_asB64(), + index: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.EventAttribute} + */ +proto.tendermint.abci.EventAttribute.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.EventAttribute; + return proto.tendermint.abci.EventAttribute.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.EventAttribute} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.EventAttribute} + */ +proto.tendermint.abci.EventAttribute.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setKey(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValue(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIndex(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.EventAttribute.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.EventAttribute.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.EventAttribute} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.EventAttribute.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getValue_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getIndex(); + if (f) { + writer.writeBool( + 3, + f + ); + } +}; + + +/** + * optional bytes key = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.EventAttribute.prototype.getKey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes key = 1; + * This is a type-conversion wrapper around `getKey()` + * @return {string} + */ +proto.tendermint.abci.EventAttribute.prototype.getKey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getKey())); +}; + + +/** + * optional bytes key = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKey()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.EventAttribute.prototype.getKey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getKey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.EventAttribute} returns this + */ +proto.tendermint.abci.EventAttribute.prototype.setKey = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes value = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.EventAttribute.prototype.getValue = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes value = 2; + * This is a type-conversion wrapper around `getValue()` + * @return {string} + */ +proto.tendermint.abci.EventAttribute.prototype.getValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValue())); +}; + + +/** + * optional bytes value = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValue()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.EventAttribute.prototype.getValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.EventAttribute} returns this + */ +proto.tendermint.abci.EventAttribute.prototype.setValue = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bool index = 3; + * @return {boolean} + */ +proto.tendermint.abci.EventAttribute.prototype.getIndex = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.tendermint.abci.EventAttribute} returns this + */ +proto.tendermint.abci.EventAttribute.prototype.setIndex = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.TxResult.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.TxResult.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.TxResult} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.TxResult.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + index: jspb.Message.getFieldWithDefault(msg, 2, 0), + tx: msg.getTx_asB64(), + result: (f = msg.getResult()) && proto.tendermint.abci.ResponseDeliverTx.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.TxResult} + */ +proto.tendermint.abci.TxResult.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.TxResult; + return proto.tendermint.abci.TxResult.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.TxResult} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.TxResult} + */ +proto.tendermint.abci.TxResult.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setIndex(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTx(value); + break; + case 4: + var value = new proto.tendermint.abci.ResponseDeliverTx; + reader.readMessage(value,proto.tendermint.abci.ResponseDeliverTx.deserializeBinaryFromReader); + msg.setResult(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.TxResult.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.TxResult.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.TxResult} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.TxResult.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getTx_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getResult(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.abci.ResponseDeliverTx.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.abci.TxResult.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.TxResult} returns this + */ +proto.tendermint.abci.TxResult.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 index = 2; + * @return {number} + */ +proto.tendermint.abci.TxResult.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.TxResult} returns this + */ +proto.tendermint.abci.TxResult.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bytes tx = 3; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.TxResult.prototype.getTx = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes tx = 3; + * This is a type-conversion wrapper around `getTx()` + * @return {string} + */ +proto.tendermint.abci.TxResult.prototype.getTx_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTx())); +}; + + +/** + * optional bytes tx = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTx()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.TxResult.prototype.getTx_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTx())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.TxResult} returns this + */ +proto.tendermint.abci.TxResult.prototype.setTx = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional ResponseDeliverTx result = 4; + * @return {?proto.tendermint.abci.ResponseDeliverTx} + */ +proto.tendermint.abci.TxResult.prototype.getResult = function() { + return /** @type{?proto.tendermint.abci.ResponseDeliverTx} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.ResponseDeliverTx, 4)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseDeliverTx|undefined} value + * @return {!proto.tendermint.abci.TxResult} returns this +*/ +proto.tendermint.abci.TxResult.prototype.setResult = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.TxResult} returns this + */ +proto.tendermint.abci.TxResult.prototype.clearResult = function() { + return this.setResult(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.TxResult.prototype.hasResult = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.Validator.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.Validator.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.Validator} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Validator.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + power: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.Validator} + */ +proto.tendermint.abci.Validator.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.Validator; + return proto.tendermint.abci.Validator.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.Validator} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.Validator} + */ +proto.tendermint.abci.Validator.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setPower(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.Validator.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.Validator.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.Validator} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Validator.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPower(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } +}; + + +/** + * optional bytes address = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.Validator.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.tendermint.abci.Validator.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.Validator.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.Validator} returns this + */ +proto.tendermint.abci.Validator.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional int64 power = 3; + * @return {number} + */ +proto.tendermint.abci.Validator.prototype.getPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.Validator} returns this + */ +proto.tendermint.abci.Validator.prototype.setPower = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.ValidatorUpdate.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.ValidatorUpdate.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.ValidatorUpdate} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ValidatorUpdate.toObject = function(includeInstance, msg) { + var f, obj = { + pubKey: (f = msg.getPubKey()) && tendermint_crypto_keys_pb.PublicKey.toObject(includeInstance, f), + power: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.ValidatorUpdate} + */ +proto.tendermint.abci.ValidatorUpdate.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.ValidatorUpdate; + return proto.tendermint.abci.ValidatorUpdate.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.ValidatorUpdate} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.ValidatorUpdate} + */ +proto.tendermint.abci.ValidatorUpdate.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_crypto_keys_pb.PublicKey; + reader.readMessage(value,tendermint_crypto_keys_pb.PublicKey.deserializeBinaryFromReader); + msg.setPubKey(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setPower(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.ValidatorUpdate.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.ValidatorUpdate.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.ValidatorUpdate} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.ValidatorUpdate.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubKey(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_crypto_keys_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getPower(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional tendermint.crypto.PublicKey pub_key = 1; + * @return {?proto.tendermint.crypto.PublicKey} + */ +proto.tendermint.abci.ValidatorUpdate.prototype.getPubKey = function() { + return /** @type{?proto.tendermint.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, tendermint_crypto_keys_pb.PublicKey, 1)); +}; + + +/** + * @param {?proto.tendermint.crypto.PublicKey|undefined} value + * @return {!proto.tendermint.abci.ValidatorUpdate} returns this +*/ +proto.tendermint.abci.ValidatorUpdate.prototype.setPubKey = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.ValidatorUpdate} returns this + */ +proto.tendermint.abci.ValidatorUpdate.prototype.clearPubKey = function() { + return this.setPubKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.ValidatorUpdate.prototype.hasPubKey = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int64 power = 2; + * @return {number} + */ +proto.tendermint.abci.ValidatorUpdate.prototype.getPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.ValidatorUpdate} returns this + */ +proto.tendermint.abci.ValidatorUpdate.prototype.setPower = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.VoteInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.VoteInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.VoteInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.VoteInfo.toObject = function(includeInstance, msg) { + var f, obj = { + validator: (f = msg.getValidator()) && proto.tendermint.abci.Validator.toObject(includeInstance, f), + signedLastBlock: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.VoteInfo} + */ +proto.tendermint.abci.VoteInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.VoteInfo; + return proto.tendermint.abci.VoteInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.VoteInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.VoteInfo} + */ +proto.tendermint.abci.VoteInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.abci.Validator; + reader.readMessage(value,proto.tendermint.abci.Validator.deserializeBinaryFromReader); + msg.setValidator(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSignedLastBlock(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.VoteInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.VoteInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.VoteInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.VoteInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getValidator(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.abci.Validator.serializeBinaryToWriter + ); + } + f = message.getSignedLastBlock(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional Validator validator = 1; + * @return {?proto.tendermint.abci.Validator} + */ +proto.tendermint.abci.VoteInfo.prototype.getValidator = function() { + return /** @type{?proto.tendermint.abci.Validator} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.Validator, 1)); +}; + + +/** + * @param {?proto.tendermint.abci.Validator|undefined} value + * @return {!proto.tendermint.abci.VoteInfo} returns this +*/ +proto.tendermint.abci.VoteInfo.prototype.setValidator = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.VoteInfo} returns this + */ +proto.tendermint.abci.VoteInfo.prototype.clearValidator = function() { + return this.setValidator(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.VoteInfo.prototype.hasValidator = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool signed_last_block = 2; + * @return {boolean} + */ +proto.tendermint.abci.VoteInfo.prototype.getSignedLastBlock = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.tendermint.abci.VoteInfo} returns this + */ +proto.tendermint.abci.VoteInfo.prototype.setSignedLastBlock = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.Evidence.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.Evidence.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.Evidence} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Evidence.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + validator: (f = msg.getValidator()) && proto.tendermint.abci.Validator.toObject(includeInstance, f), + height: jspb.Message.getFieldWithDefault(msg, 3, 0), + time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + totalVotingPower: jspb.Message.getFieldWithDefault(msg, 5, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.Evidence} + */ +proto.tendermint.abci.Evidence.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.Evidence; + return proto.tendermint.abci.Evidence.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.Evidence} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.Evidence} + */ +proto.tendermint.abci.Evidence.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.tendermint.abci.EvidenceType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = new proto.tendermint.abci.Validator; + reader.readMessage(value,proto.tendermint.abci.Validator.deserializeBinaryFromReader); + msg.setValidator(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 4: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTime(value); + break; + case 5: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTotalVotingPower(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.Evidence.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.Evidence.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.Evidence} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Evidence.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getValidator(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.abci.Validator.serializeBinaryToWriter + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } + f = message.getTime(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getTotalVotingPower(); + if (f !== 0) { + writer.writeInt64( + 5, + f + ); + } +}; + + +/** + * optional EvidenceType type = 1; + * @return {!proto.tendermint.abci.EvidenceType} + */ +proto.tendermint.abci.Evidence.prototype.getType = function() { + return /** @type {!proto.tendermint.abci.EvidenceType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.tendermint.abci.EvidenceType} value + * @return {!proto.tendermint.abci.Evidence} returns this + */ +proto.tendermint.abci.Evidence.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional Validator validator = 2; + * @return {?proto.tendermint.abci.Validator} + */ +proto.tendermint.abci.Evidence.prototype.getValidator = function() { + return /** @type{?proto.tendermint.abci.Validator} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.abci.Validator, 2)); +}; + + +/** + * @param {?proto.tendermint.abci.Validator|undefined} value + * @return {!proto.tendermint.abci.Evidence} returns this +*/ +proto.tendermint.abci.Evidence.prototype.setValidator = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Evidence} returns this + */ +proto.tendermint.abci.Evidence.prototype.clearValidator = function() { + return this.setValidator(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Evidence.prototype.hasValidator = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int64 height = 3; + * @return {number} + */ +proto.tendermint.abci.Evidence.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.Evidence} returns this + */ +proto.tendermint.abci.Evidence.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional google.protobuf.Timestamp time = 4; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.abci.Evidence.prototype.getTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 4)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.abci.Evidence} returns this +*/ +proto.tendermint.abci.Evidence.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.abci.Evidence} returns this + */ +proto.tendermint.abci.Evidence.prototype.clearTime = function() { + return this.setTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.abci.Evidence.prototype.hasTime = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional int64 total_voting_power = 5; + * @return {number} + */ +proto.tendermint.abci.Evidence.prototype.getTotalVotingPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.Evidence} returns this + */ +proto.tendermint.abci.Evidence.prototype.setTotalVotingPower = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.abci.Snapshot.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.abci.Snapshot.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.abci.Snapshot} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Snapshot.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + format: jspb.Message.getFieldWithDefault(msg, 2, 0), + chunks: jspb.Message.getFieldWithDefault(msg, 3, 0), + hash: msg.getHash_asB64(), + metadata: msg.getMetadata_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.abci.Snapshot} + */ +proto.tendermint.abci.Snapshot.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.abci.Snapshot; + return proto.tendermint.abci.Snapshot.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.abci.Snapshot} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.abci.Snapshot} + */ +proto.tendermint.abci.Snapshot.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFormat(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setChunks(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.abci.Snapshot.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.abci.Snapshot.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.abci.Snapshot} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.abci.Snapshot.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getFormat(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getChunks(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getMetadata_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.tendermint.abci.Snapshot.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.Snapshot} returns this + */ +proto.tendermint.abci.Snapshot.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 format = 2; + * @return {number} + */ +proto.tendermint.abci.Snapshot.prototype.getFormat = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.Snapshot} returns this + */ +proto.tendermint.abci.Snapshot.prototype.setFormat = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 chunks = 3; + * @return {number} + */ +proto.tendermint.abci.Snapshot.prototype.getChunks = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.abci.Snapshot} returns this + */ +proto.tendermint.abci.Snapshot.prototype.setChunks = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional bytes hash = 4; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.Snapshot.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes hash = 4; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.tendermint.abci.Snapshot.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.Snapshot.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.Snapshot} returns this + */ +proto.tendermint.abci.Snapshot.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional bytes metadata = 5; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.abci.Snapshot.prototype.getMetadata = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes metadata = 5; + * This is a type-conversion wrapper around `getMetadata()` + * @return {string} + */ +proto.tendermint.abci.Snapshot.prototype.getMetadata_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMetadata())); +}; + + +/** + * optional bytes metadata = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMetadata()` + * @return {!Uint8Array} + */ +proto.tendermint.abci.Snapshot.prototype.getMetadata_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMetadata())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.abci.Snapshot} returns this + */ +proto.tendermint.abci.Snapshot.prototype.setMetadata = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * @enum {number} + */ +proto.tendermint.abci.CheckTxType = { + NEW: 0, + RECHECK: 1 +}; + +/** + * @enum {number} + */ +proto.tendermint.abci.EvidenceType = { + UNKNOWN: 0, + DUPLICATE_VOTE: 1, + LIGHT_CLIENT_ATTACK: 2 +}; + +goog.object.extend(exports, proto.tendermint.abci); diff --git a/js/proto/tendermint/blockchain/types_grpc_pb.js b/js/proto/tendermint/blockchain/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/blockchain/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/blockchain/types_pb.d.ts b/js/proto/tendermint/blockchain/types_pb.d.ts new file mode 100644 index 000000000..e2eece8b4 --- /dev/null +++ b/js/proto/tendermint/blockchain/types_pb.d.ts @@ -0,0 +1,186 @@ +// package: tendermint.blockchain +// file: tendermint/blockchain/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as tendermint_types_block_pb from "../../tendermint/types/block_pb"; + +export class BlockRequest extends jspb.Message { + getHeight(): number; + setHeight(value: number): BlockRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockRequest.AsObject; + static toObject(includeInstance: boolean, msg: BlockRequest): BlockRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockRequest; + static deserializeBinaryFromReader(message: BlockRequest, reader: jspb.BinaryReader): BlockRequest; +} + +export namespace BlockRequest { + export type AsObject = { + height: number, + } +} + +export class NoBlockResponse extends jspb.Message { + getHeight(): number; + setHeight(value: number): NoBlockResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NoBlockResponse.AsObject; + static toObject(includeInstance: boolean, msg: NoBlockResponse): NoBlockResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NoBlockResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NoBlockResponse; + static deserializeBinaryFromReader(message: NoBlockResponse, reader: jspb.BinaryReader): NoBlockResponse; +} + +export namespace NoBlockResponse { + export type AsObject = { + height: number, + } +} + +export class BlockResponse extends jspb.Message { + + hasBlock(): boolean; + clearBlock(): void; + getBlock(): tendermint_types_block_pb.Block | undefined; + setBlock(value?: tendermint_types_block_pb.Block): BlockResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockResponse.AsObject; + static toObject(includeInstance: boolean, msg: BlockResponse): BlockResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockResponse; + static deserializeBinaryFromReader(message: BlockResponse, reader: jspb.BinaryReader): BlockResponse; +} + +export namespace BlockResponse { + export type AsObject = { + block?: tendermint_types_block_pb.Block.AsObject, + } +} + +export class StatusRequest extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StatusRequest.AsObject; + static toObject(includeInstance: boolean, msg: StatusRequest): StatusRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StatusRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StatusRequest; + static deserializeBinaryFromReader(message: StatusRequest, reader: jspb.BinaryReader): StatusRequest; +} + +export namespace StatusRequest { + export type AsObject = { + } +} + +export class StatusResponse extends jspb.Message { + getHeight(): number; + setHeight(value: number): StatusResponse; + + getBase(): number; + setBase(value: number): StatusResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StatusResponse.AsObject; + static toObject(includeInstance: boolean, msg: StatusResponse): StatusResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StatusResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StatusResponse; + static deserializeBinaryFromReader(message: StatusResponse, reader: jspb.BinaryReader): StatusResponse; +} + +export namespace StatusResponse { + export type AsObject = { + height: number, + base: number, + } +} + +export class Message extends jspb.Message { + + hasBlockRequest(): boolean; + clearBlockRequest(): void; + getBlockRequest(): BlockRequest | undefined; + setBlockRequest(value?: BlockRequest): Message; + + + hasNoBlockResponse(): boolean; + clearNoBlockResponse(): void; + getNoBlockResponse(): NoBlockResponse | undefined; + setNoBlockResponse(value?: NoBlockResponse): Message; + + + hasBlockResponse(): boolean; + clearBlockResponse(): void; + getBlockResponse(): BlockResponse | undefined; + setBlockResponse(value?: BlockResponse): Message; + + + hasStatusRequest(): boolean; + clearStatusRequest(): void; + getStatusRequest(): StatusRequest | undefined; + setStatusRequest(value?: StatusRequest): Message; + + + hasStatusResponse(): boolean; + clearStatusResponse(): void; + getStatusResponse(): StatusResponse | undefined; + setStatusResponse(value?: StatusResponse): Message; + + + getSumCase(): Message.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Message.AsObject; + static toObject(includeInstance: boolean, msg: Message): Message.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Message, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Message; + static deserializeBinaryFromReader(message: Message, reader: jspb.BinaryReader): Message; +} + +export namespace Message { + export type AsObject = { + blockRequest?: BlockRequest.AsObject, + noBlockResponse?: NoBlockResponse.AsObject, + blockResponse?: BlockResponse.AsObject, + statusRequest?: StatusRequest.AsObject, + statusResponse?: StatusResponse.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + BLOCK_REQUEST = 1, + + NO_BLOCK_RESPONSE = 2, + + BLOCK_RESPONSE = 3, + + STATUS_REQUEST = 4, + + STATUS_RESPONSE = 5, + + } + +} diff --git a/js/proto/tendermint/blockchain/types_pb.js b/js/proto/tendermint/blockchain/types_pb.js new file mode 100644 index 000000000..7f0aecd69 --- /dev/null +++ b/js/proto/tendermint/blockchain/types_pb.js @@ -0,0 +1,1208 @@ +// source: tendermint/blockchain/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var tendermint_types_block_pb = require('../../tendermint/types/block_pb.js'); +goog.object.extend(proto, tendermint_types_block_pb); +goog.exportSymbol('proto.tendermint.blockchain.BlockRequest', null, global); +goog.exportSymbol('proto.tendermint.blockchain.BlockResponse', null, global); +goog.exportSymbol('proto.tendermint.blockchain.Message', null, global); +goog.exportSymbol('proto.tendermint.blockchain.Message.SumCase', null, global); +goog.exportSymbol('proto.tendermint.blockchain.NoBlockResponse', null, global); +goog.exportSymbol('proto.tendermint.blockchain.StatusRequest', null, global); +goog.exportSymbol('proto.tendermint.blockchain.StatusResponse', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.blockchain.BlockRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.blockchain.BlockRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.blockchain.BlockRequest.displayName = 'proto.tendermint.blockchain.BlockRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.blockchain.NoBlockResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.blockchain.NoBlockResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.blockchain.NoBlockResponse.displayName = 'proto.tendermint.blockchain.NoBlockResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.blockchain.BlockResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.blockchain.BlockResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.blockchain.BlockResponse.displayName = 'proto.tendermint.blockchain.BlockResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.blockchain.StatusRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.blockchain.StatusRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.blockchain.StatusRequest.displayName = 'proto.tendermint.blockchain.StatusRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.blockchain.StatusResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.blockchain.StatusResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.blockchain.StatusResponse.displayName = 'proto.tendermint.blockchain.StatusResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.blockchain.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.blockchain.Message.oneofGroups_); +}; +goog.inherits(proto.tendermint.blockchain.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.blockchain.Message.displayName = 'proto.tendermint.blockchain.Message'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.blockchain.BlockRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.blockchain.BlockRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.blockchain.BlockRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.BlockRequest.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.blockchain.BlockRequest} + */ +proto.tendermint.blockchain.BlockRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.blockchain.BlockRequest; + return proto.tendermint.blockchain.BlockRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.blockchain.BlockRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.blockchain.BlockRequest} + */ +proto.tendermint.blockchain.BlockRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.blockchain.BlockRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.blockchain.BlockRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.blockchain.BlockRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.BlockRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.blockchain.BlockRequest.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.blockchain.BlockRequest} returns this + */ +proto.tendermint.blockchain.BlockRequest.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.blockchain.NoBlockResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.blockchain.NoBlockResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.blockchain.NoBlockResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.NoBlockResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.blockchain.NoBlockResponse} + */ +proto.tendermint.blockchain.NoBlockResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.blockchain.NoBlockResponse; + return proto.tendermint.blockchain.NoBlockResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.blockchain.NoBlockResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.blockchain.NoBlockResponse} + */ +proto.tendermint.blockchain.NoBlockResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.blockchain.NoBlockResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.blockchain.NoBlockResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.blockchain.NoBlockResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.NoBlockResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.blockchain.NoBlockResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.blockchain.NoBlockResponse} returns this + */ +proto.tendermint.blockchain.NoBlockResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.blockchain.BlockResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.blockchain.BlockResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.blockchain.BlockResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.BlockResponse.toObject = function(includeInstance, msg) { + var f, obj = { + block: (f = msg.getBlock()) && tendermint_types_block_pb.Block.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.blockchain.BlockResponse} + */ +proto.tendermint.blockchain.BlockResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.blockchain.BlockResponse; + return proto.tendermint.blockchain.BlockResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.blockchain.BlockResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.blockchain.BlockResponse} + */ +proto.tendermint.blockchain.BlockResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_block_pb.Block; + reader.readMessage(value,tendermint_types_block_pb.Block.deserializeBinaryFromReader); + msg.setBlock(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.blockchain.BlockResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.blockchain.BlockResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.blockchain.BlockResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.BlockResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_block_pb.Block.serializeBinaryToWriter + ); + } +}; + + +/** + * optional tendermint.types.Block block = 1; + * @return {?proto.tendermint.types.Block} + */ +proto.tendermint.blockchain.BlockResponse.prototype.getBlock = function() { + return /** @type{?proto.tendermint.types.Block} */ ( + jspb.Message.getWrapperField(this, tendermint_types_block_pb.Block, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Block|undefined} value + * @return {!proto.tendermint.blockchain.BlockResponse} returns this +*/ +proto.tendermint.blockchain.BlockResponse.prototype.setBlock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.blockchain.BlockResponse} returns this + */ +proto.tendermint.blockchain.BlockResponse.prototype.clearBlock = function() { + return this.setBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.blockchain.BlockResponse.prototype.hasBlock = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.blockchain.StatusRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.blockchain.StatusRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.blockchain.StatusRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.StatusRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.blockchain.StatusRequest} + */ +proto.tendermint.blockchain.StatusRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.blockchain.StatusRequest; + return proto.tendermint.blockchain.StatusRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.blockchain.StatusRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.blockchain.StatusRequest} + */ +proto.tendermint.blockchain.StatusRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.blockchain.StatusRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.blockchain.StatusRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.blockchain.StatusRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.StatusRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.blockchain.StatusResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.blockchain.StatusResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.blockchain.StatusResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.StatusResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + base: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.blockchain.StatusResponse} + */ +proto.tendermint.blockchain.StatusResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.blockchain.StatusResponse; + return proto.tendermint.blockchain.StatusResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.blockchain.StatusResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.blockchain.StatusResponse} + */ +proto.tendermint.blockchain.StatusResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setBase(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.blockchain.StatusResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.blockchain.StatusResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.blockchain.StatusResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.StatusResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getBase(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.blockchain.StatusResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.blockchain.StatusResponse} returns this + */ +proto.tendermint.blockchain.StatusResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int64 base = 2; + * @return {number} + */ +proto.tendermint.blockchain.StatusResponse.prototype.getBase = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.blockchain.StatusResponse} returns this + */ +proto.tendermint.blockchain.StatusResponse.prototype.setBase = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.blockchain.Message.oneofGroups_ = [[1,2,3,4,5]]; + +/** + * @enum {number} + */ +proto.tendermint.blockchain.Message.SumCase = { + SUM_NOT_SET: 0, + BLOCK_REQUEST: 1, + NO_BLOCK_RESPONSE: 2, + BLOCK_RESPONSE: 3, + STATUS_REQUEST: 4, + STATUS_RESPONSE: 5 +}; + +/** + * @return {proto.tendermint.blockchain.Message.SumCase} + */ +proto.tendermint.blockchain.Message.prototype.getSumCase = function() { + return /** @type {proto.tendermint.blockchain.Message.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.blockchain.Message.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.blockchain.Message.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.blockchain.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.blockchain.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.Message.toObject = function(includeInstance, msg) { + var f, obj = { + blockRequest: (f = msg.getBlockRequest()) && proto.tendermint.blockchain.BlockRequest.toObject(includeInstance, f), + noBlockResponse: (f = msg.getNoBlockResponse()) && proto.tendermint.blockchain.NoBlockResponse.toObject(includeInstance, f), + blockResponse: (f = msg.getBlockResponse()) && proto.tendermint.blockchain.BlockResponse.toObject(includeInstance, f), + statusRequest: (f = msg.getStatusRequest()) && proto.tendermint.blockchain.StatusRequest.toObject(includeInstance, f), + statusResponse: (f = msg.getStatusResponse()) && proto.tendermint.blockchain.StatusResponse.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.blockchain.Message} + */ +proto.tendermint.blockchain.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.blockchain.Message; + return proto.tendermint.blockchain.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.blockchain.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.blockchain.Message} + */ +proto.tendermint.blockchain.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.blockchain.BlockRequest; + reader.readMessage(value,proto.tendermint.blockchain.BlockRequest.deserializeBinaryFromReader); + msg.setBlockRequest(value); + break; + case 2: + var value = new proto.tendermint.blockchain.NoBlockResponse; + reader.readMessage(value,proto.tendermint.blockchain.NoBlockResponse.deserializeBinaryFromReader); + msg.setNoBlockResponse(value); + break; + case 3: + var value = new proto.tendermint.blockchain.BlockResponse; + reader.readMessage(value,proto.tendermint.blockchain.BlockResponse.deserializeBinaryFromReader); + msg.setBlockResponse(value); + break; + case 4: + var value = new proto.tendermint.blockchain.StatusRequest; + reader.readMessage(value,proto.tendermint.blockchain.StatusRequest.deserializeBinaryFromReader); + msg.setStatusRequest(value); + break; + case 5: + var value = new proto.tendermint.blockchain.StatusResponse; + reader.readMessage(value,proto.tendermint.blockchain.StatusResponse.deserializeBinaryFromReader); + msg.setStatusResponse(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.blockchain.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.blockchain.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.blockchain.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.blockchain.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlockRequest(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.blockchain.BlockRequest.serializeBinaryToWriter + ); + } + f = message.getNoBlockResponse(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.blockchain.NoBlockResponse.serializeBinaryToWriter + ); + } + f = message.getBlockResponse(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.blockchain.BlockResponse.serializeBinaryToWriter + ); + } + f = message.getStatusRequest(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.blockchain.StatusRequest.serializeBinaryToWriter + ); + } + f = message.getStatusResponse(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.tendermint.blockchain.StatusResponse.serializeBinaryToWriter + ); + } +}; + + +/** + * optional BlockRequest block_request = 1; + * @return {?proto.tendermint.blockchain.BlockRequest} + */ +proto.tendermint.blockchain.Message.prototype.getBlockRequest = function() { + return /** @type{?proto.tendermint.blockchain.BlockRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.blockchain.BlockRequest, 1)); +}; + + +/** + * @param {?proto.tendermint.blockchain.BlockRequest|undefined} value + * @return {!proto.tendermint.blockchain.Message} returns this +*/ +proto.tendermint.blockchain.Message.prototype.setBlockRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.blockchain.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.blockchain.Message} returns this + */ +proto.tendermint.blockchain.Message.prototype.clearBlockRequest = function() { + return this.setBlockRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.blockchain.Message.prototype.hasBlockRequest = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional NoBlockResponse no_block_response = 2; + * @return {?proto.tendermint.blockchain.NoBlockResponse} + */ +proto.tendermint.blockchain.Message.prototype.getNoBlockResponse = function() { + return /** @type{?proto.tendermint.blockchain.NoBlockResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.blockchain.NoBlockResponse, 2)); +}; + + +/** + * @param {?proto.tendermint.blockchain.NoBlockResponse|undefined} value + * @return {!proto.tendermint.blockchain.Message} returns this +*/ +proto.tendermint.blockchain.Message.prototype.setNoBlockResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.blockchain.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.blockchain.Message} returns this + */ +proto.tendermint.blockchain.Message.prototype.clearNoBlockResponse = function() { + return this.setNoBlockResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.blockchain.Message.prototype.hasNoBlockResponse = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional BlockResponse block_response = 3; + * @return {?proto.tendermint.blockchain.BlockResponse} + */ +proto.tendermint.blockchain.Message.prototype.getBlockResponse = function() { + return /** @type{?proto.tendermint.blockchain.BlockResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.blockchain.BlockResponse, 3)); +}; + + +/** + * @param {?proto.tendermint.blockchain.BlockResponse|undefined} value + * @return {!proto.tendermint.blockchain.Message} returns this +*/ +proto.tendermint.blockchain.Message.prototype.setBlockResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.tendermint.blockchain.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.blockchain.Message} returns this + */ +proto.tendermint.blockchain.Message.prototype.clearBlockResponse = function() { + return this.setBlockResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.blockchain.Message.prototype.hasBlockResponse = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional StatusRequest status_request = 4; + * @return {?proto.tendermint.blockchain.StatusRequest} + */ +proto.tendermint.blockchain.Message.prototype.getStatusRequest = function() { + return /** @type{?proto.tendermint.blockchain.StatusRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.blockchain.StatusRequest, 4)); +}; + + +/** + * @param {?proto.tendermint.blockchain.StatusRequest|undefined} value + * @return {!proto.tendermint.blockchain.Message} returns this +*/ +proto.tendermint.blockchain.Message.prototype.setStatusRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 4, proto.tendermint.blockchain.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.blockchain.Message} returns this + */ +proto.tendermint.blockchain.Message.prototype.clearStatusRequest = function() { + return this.setStatusRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.blockchain.Message.prototype.hasStatusRequest = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional StatusResponse status_response = 5; + * @return {?proto.tendermint.blockchain.StatusResponse} + */ +proto.tendermint.blockchain.Message.prototype.getStatusResponse = function() { + return /** @type{?proto.tendermint.blockchain.StatusResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.blockchain.StatusResponse, 5)); +}; + + +/** + * @param {?proto.tendermint.blockchain.StatusResponse|undefined} value + * @return {!proto.tendermint.blockchain.Message} returns this +*/ +proto.tendermint.blockchain.Message.prototype.setStatusResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 5, proto.tendermint.blockchain.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.blockchain.Message} returns this + */ +proto.tendermint.blockchain.Message.prototype.clearStatusResponse = function() { + return this.setStatusResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.blockchain.Message.prototype.hasStatusResponse = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +goog.object.extend(exports, proto.tendermint.blockchain); diff --git a/js/proto/tendermint/consensus/types_grpc_pb.js b/js/proto/tendermint/consensus/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/consensus/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/consensus/types_pb.d.ts b/js/proto/tendermint/consensus/types_pb.d.ts new file mode 100644 index 000000000..fcadfc10b --- /dev/null +++ b/js/proto/tendermint/consensus/types_pb.d.ts @@ -0,0 +1,420 @@ +// package: tendermint.consensus +// file: tendermint/consensus/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as tendermint_types_types_pb from "../../tendermint/types/types_pb"; +import * as tendermint_libs_bits_types_pb from "../../tendermint/libs/bits/types_pb"; + +export class NewRoundStep extends jspb.Message { + getHeight(): number; + setHeight(value: number): NewRoundStep; + + getRound(): number; + setRound(value: number): NewRoundStep; + + getStep(): number; + setStep(value: number): NewRoundStep; + + getSecondsSinceStartTime(): number; + setSecondsSinceStartTime(value: number): NewRoundStep; + + getLastCommitRound(): number; + setLastCommitRound(value: number): NewRoundStep; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NewRoundStep.AsObject; + static toObject(includeInstance: boolean, msg: NewRoundStep): NewRoundStep.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NewRoundStep, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NewRoundStep; + static deserializeBinaryFromReader(message: NewRoundStep, reader: jspb.BinaryReader): NewRoundStep; +} + +export namespace NewRoundStep { + export type AsObject = { + height: number, + round: number, + step: number, + secondsSinceStartTime: number, + lastCommitRound: number, + } +} + +export class NewValidBlock extends jspb.Message { + getHeight(): number; + setHeight(value: number): NewValidBlock; + + getRound(): number; + setRound(value: number): NewValidBlock; + + + hasBlockPartSetHeader(): boolean; + clearBlockPartSetHeader(): void; + getBlockPartSetHeader(): tendermint_types_types_pb.PartSetHeader | undefined; + setBlockPartSetHeader(value?: tendermint_types_types_pb.PartSetHeader): NewValidBlock; + + + hasBlockParts(): boolean; + clearBlockParts(): void; + getBlockParts(): tendermint_libs_bits_types_pb.BitArray | undefined; + setBlockParts(value?: tendermint_libs_bits_types_pb.BitArray): NewValidBlock; + + getIsCommit(): boolean; + setIsCommit(value: boolean): NewValidBlock; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NewValidBlock.AsObject; + static toObject(includeInstance: boolean, msg: NewValidBlock): NewValidBlock.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NewValidBlock, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NewValidBlock; + static deserializeBinaryFromReader(message: NewValidBlock, reader: jspb.BinaryReader): NewValidBlock; +} + +export namespace NewValidBlock { + export type AsObject = { + height: number, + round: number, + blockPartSetHeader?: tendermint_types_types_pb.PartSetHeader.AsObject, + blockParts?: tendermint_libs_bits_types_pb.BitArray.AsObject, + isCommit: boolean, + } +} + +export class Proposal extends jspb.Message { + + hasProposal(): boolean; + clearProposal(): void; + getProposal(): tendermint_types_types_pb.Proposal | undefined; + setProposal(value?: tendermint_types_types_pb.Proposal): Proposal; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Proposal.AsObject; + static toObject(includeInstance: boolean, msg: Proposal): Proposal.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Proposal, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Proposal; + static deserializeBinaryFromReader(message: Proposal, reader: jspb.BinaryReader): Proposal; +} + +export namespace Proposal { + export type AsObject = { + proposal?: tendermint_types_types_pb.Proposal.AsObject, + } +} + +export class ProposalPOL extends jspb.Message { + getHeight(): number; + setHeight(value: number): ProposalPOL; + + getProposalPolRound(): number; + setProposalPolRound(value: number): ProposalPOL; + + + hasProposalPol(): boolean; + clearProposalPol(): void; + getProposalPol(): tendermint_libs_bits_types_pb.BitArray | undefined; + setProposalPol(value?: tendermint_libs_bits_types_pb.BitArray): ProposalPOL; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProposalPOL.AsObject; + static toObject(includeInstance: boolean, msg: ProposalPOL): ProposalPOL.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProposalPOL, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProposalPOL; + static deserializeBinaryFromReader(message: ProposalPOL, reader: jspb.BinaryReader): ProposalPOL; +} + +export namespace ProposalPOL { + export type AsObject = { + height: number, + proposalPolRound: number, + proposalPol?: tendermint_libs_bits_types_pb.BitArray.AsObject, + } +} + +export class BlockPart extends jspb.Message { + getHeight(): number; + setHeight(value: number): BlockPart; + + getRound(): number; + setRound(value: number): BlockPart; + + + hasPart(): boolean; + clearPart(): void; + getPart(): tendermint_types_types_pb.Part | undefined; + setPart(value?: tendermint_types_types_pb.Part): BlockPart; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockPart.AsObject; + static toObject(includeInstance: boolean, msg: BlockPart): BlockPart.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockPart, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockPart; + static deserializeBinaryFromReader(message: BlockPart, reader: jspb.BinaryReader): BlockPart; +} + +export namespace BlockPart { + export type AsObject = { + height: number, + round: number, + part?: tendermint_types_types_pb.Part.AsObject, + } +} + +export class Vote extends jspb.Message { + + hasVote(): boolean; + clearVote(): void; + getVote(): tendermint_types_types_pb.Vote | undefined; + setVote(value?: tendermint_types_types_pb.Vote): Vote; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Vote.AsObject; + static toObject(includeInstance: boolean, msg: Vote): Vote.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Vote, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Vote; + static deserializeBinaryFromReader(message: Vote, reader: jspb.BinaryReader): Vote; +} + +export namespace Vote { + export type AsObject = { + vote?: tendermint_types_types_pb.Vote.AsObject, + } +} + +export class HasVote extends jspb.Message { + getHeight(): number; + setHeight(value: number): HasVote; + + getRound(): number; + setRound(value: number): HasVote; + + getType(): tendermint_types_types_pb.SignedMsgType; + setType(value: tendermint_types_types_pb.SignedMsgType): HasVote; + + getIndex(): number; + setIndex(value: number): HasVote; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): HasVote.AsObject; + static toObject(includeInstance: boolean, msg: HasVote): HasVote.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: HasVote, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): HasVote; + static deserializeBinaryFromReader(message: HasVote, reader: jspb.BinaryReader): HasVote; +} + +export namespace HasVote { + export type AsObject = { + height: number, + round: number, + type: tendermint_types_types_pb.SignedMsgType, + index: number, + } +} + +export class VoteSetMaj23 extends jspb.Message { + getHeight(): number; + setHeight(value: number): VoteSetMaj23; + + getRound(): number; + setRound(value: number): VoteSetMaj23; + + getType(): tendermint_types_types_pb.SignedMsgType; + setType(value: tendermint_types_types_pb.SignedMsgType): VoteSetMaj23; + + + hasBlockId(): boolean; + clearBlockId(): void; + getBlockId(): tendermint_types_types_pb.BlockID | undefined; + setBlockId(value?: tendermint_types_types_pb.BlockID): VoteSetMaj23; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): VoteSetMaj23.AsObject; + static toObject(includeInstance: boolean, msg: VoteSetMaj23): VoteSetMaj23.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: VoteSetMaj23, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): VoteSetMaj23; + static deserializeBinaryFromReader(message: VoteSetMaj23, reader: jspb.BinaryReader): VoteSetMaj23; +} + +export namespace VoteSetMaj23 { + export type AsObject = { + height: number, + round: number, + type: tendermint_types_types_pb.SignedMsgType, + blockId?: tendermint_types_types_pb.BlockID.AsObject, + } +} + +export class VoteSetBits extends jspb.Message { + getHeight(): number; + setHeight(value: number): VoteSetBits; + + getRound(): number; + setRound(value: number): VoteSetBits; + + getType(): tendermint_types_types_pb.SignedMsgType; + setType(value: tendermint_types_types_pb.SignedMsgType): VoteSetBits; + + + hasBlockId(): boolean; + clearBlockId(): void; + getBlockId(): tendermint_types_types_pb.BlockID | undefined; + setBlockId(value?: tendermint_types_types_pb.BlockID): VoteSetBits; + + + hasVotes(): boolean; + clearVotes(): void; + getVotes(): tendermint_libs_bits_types_pb.BitArray | undefined; + setVotes(value?: tendermint_libs_bits_types_pb.BitArray): VoteSetBits; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): VoteSetBits.AsObject; + static toObject(includeInstance: boolean, msg: VoteSetBits): VoteSetBits.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: VoteSetBits, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): VoteSetBits; + static deserializeBinaryFromReader(message: VoteSetBits, reader: jspb.BinaryReader): VoteSetBits; +} + +export namespace VoteSetBits { + export type AsObject = { + height: number, + round: number, + type: tendermint_types_types_pb.SignedMsgType, + blockId?: tendermint_types_types_pb.BlockID.AsObject, + votes?: tendermint_libs_bits_types_pb.BitArray.AsObject, + } +} + +export class Message extends jspb.Message { + + hasNewRoundStep(): boolean; + clearNewRoundStep(): void; + getNewRoundStep(): NewRoundStep | undefined; + setNewRoundStep(value?: NewRoundStep): Message; + + + hasNewValidBlock(): boolean; + clearNewValidBlock(): void; + getNewValidBlock(): NewValidBlock | undefined; + setNewValidBlock(value?: NewValidBlock): Message; + + + hasProposal(): boolean; + clearProposal(): void; + getProposal(): Proposal | undefined; + setProposal(value?: Proposal): Message; + + + hasProposalPol(): boolean; + clearProposalPol(): void; + getProposalPol(): ProposalPOL | undefined; + setProposalPol(value?: ProposalPOL): Message; + + + hasBlockPart(): boolean; + clearBlockPart(): void; + getBlockPart(): BlockPart | undefined; + setBlockPart(value?: BlockPart): Message; + + + hasVote(): boolean; + clearVote(): void; + getVote(): Vote | undefined; + setVote(value?: Vote): Message; + + + hasHasVote(): boolean; + clearHasVote(): void; + getHasVote(): HasVote | undefined; + setHasVote(value?: HasVote): Message; + + + hasVoteSetMaj23(): boolean; + clearVoteSetMaj23(): void; + getVoteSetMaj23(): VoteSetMaj23 | undefined; + setVoteSetMaj23(value?: VoteSetMaj23): Message; + + + hasVoteSetBits(): boolean; + clearVoteSetBits(): void; + getVoteSetBits(): VoteSetBits | undefined; + setVoteSetBits(value?: VoteSetBits): Message; + + + getSumCase(): Message.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Message.AsObject; + static toObject(includeInstance: boolean, msg: Message): Message.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Message, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Message; + static deserializeBinaryFromReader(message: Message, reader: jspb.BinaryReader): Message; +} + +export namespace Message { + export type AsObject = { + newRoundStep?: NewRoundStep.AsObject, + newValidBlock?: NewValidBlock.AsObject, + proposal?: Proposal.AsObject, + proposalPol?: ProposalPOL.AsObject, + blockPart?: BlockPart.AsObject, + vote?: Vote.AsObject, + hasVote?: HasVote.AsObject, + voteSetMaj23?: VoteSetMaj23.AsObject, + voteSetBits?: VoteSetBits.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + NEW_ROUND_STEP = 1, + + NEW_VALID_BLOCK = 2, + + PROPOSAL = 3, + + PROPOSAL_POL = 4, + + BLOCK_PART = 5, + + VOTE = 6, + + HAS_VOTE = 7, + + VOTE_SET_MAJ23 = 8, + + VOTE_SET_BITS = 9, + + } + +} diff --git a/js/proto/tendermint/consensus/types_pb.js b/js/proto/tendermint/consensus/types_pb.js new file mode 100644 index 000000000..b0609fe4b --- /dev/null +++ b/js/proto/tendermint/consensus/types_pb.js @@ -0,0 +1,2855 @@ +// source: tendermint/consensus/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_types_types_pb = require('../../tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var tendermint_libs_bits_types_pb = require('../../tendermint/libs/bits/types_pb.js'); +goog.object.extend(proto, tendermint_libs_bits_types_pb); +goog.exportSymbol('proto.tendermint.consensus.BlockPart', null, global); +goog.exportSymbol('proto.tendermint.consensus.HasVote', null, global); +goog.exportSymbol('proto.tendermint.consensus.Message', null, global); +goog.exportSymbol('proto.tendermint.consensus.Message.SumCase', null, global); +goog.exportSymbol('proto.tendermint.consensus.NewRoundStep', null, global); +goog.exportSymbol('proto.tendermint.consensus.NewValidBlock', null, global); +goog.exportSymbol('proto.tendermint.consensus.Proposal', null, global); +goog.exportSymbol('proto.tendermint.consensus.ProposalPOL', null, global); +goog.exportSymbol('proto.tendermint.consensus.Vote', null, global); +goog.exportSymbol('proto.tendermint.consensus.VoteSetBits', null, global); +goog.exportSymbol('proto.tendermint.consensus.VoteSetMaj23', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.NewRoundStep = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.NewRoundStep, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.NewRoundStep.displayName = 'proto.tendermint.consensus.NewRoundStep'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.NewValidBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.NewValidBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.NewValidBlock.displayName = 'proto.tendermint.consensus.NewValidBlock'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.Proposal = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.Proposal, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.Proposal.displayName = 'proto.tendermint.consensus.Proposal'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.ProposalPOL = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.ProposalPOL, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.ProposalPOL.displayName = 'proto.tendermint.consensus.ProposalPOL'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.BlockPart = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.BlockPart, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.BlockPart.displayName = 'proto.tendermint.consensus.BlockPart'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.Vote = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.Vote, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.Vote.displayName = 'proto.tendermint.consensus.Vote'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.HasVote = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.HasVote, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.HasVote.displayName = 'proto.tendermint.consensus.HasVote'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.VoteSetMaj23 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.VoteSetMaj23, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.VoteSetMaj23.displayName = 'proto.tendermint.consensus.VoteSetMaj23'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.VoteSetBits = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.VoteSetBits, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.VoteSetBits.displayName = 'proto.tendermint.consensus.VoteSetBits'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.consensus.Message.oneofGroups_); +}; +goog.inherits(proto.tendermint.consensus.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.Message.displayName = 'proto.tendermint.consensus.Message'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.NewRoundStep.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.NewRoundStep.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.NewRoundStep} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.NewRoundStep.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + round: jspb.Message.getFieldWithDefault(msg, 2, 0), + step: jspb.Message.getFieldWithDefault(msg, 3, 0), + secondsSinceStartTime: jspb.Message.getFieldWithDefault(msg, 4, 0), + lastCommitRound: jspb.Message.getFieldWithDefault(msg, 5, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.NewRoundStep} + */ +proto.tendermint.consensus.NewRoundStep.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.NewRoundStep; + return proto.tendermint.consensus.NewRoundStep.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.NewRoundStep} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.NewRoundStep} + */ +proto.tendermint.consensus.NewRoundStep.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setStep(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setSecondsSinceStartTime(value); + break; + case 5: + var value = /** @type {number} */ (reader.readInt32()); + msg.setLastCommitRound(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.NewRoundStep.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.NewRoundStep.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.NewRoundStep} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.NewRoundStep.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getStep(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getSecondsSinceStartTime(); + if (f !== 0) { + writer.writeInt64( + 4, + f + ); + } + f = message.getLastCommitRound(); + if (f !== 0) { + writer.writeInt32( + 5, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.consensus.NewRoundStep.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.NewRoundStep} returns this + */ +proto.tendermint.consensus.NewRoundStep.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 round = 2; + * @return {number} + */ +proto.tendermint.consensus.NewRoundStep.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.NewRoundStep} returns this + */ +proto.tendermint.consensus.NewRoundStep.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 step = 3; + * @return {number} + */ +proto.tendermint.consensus.NewRoundStep.prototype.getStep = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.NewRoundStep} returns this + */ +proto.tendermint.consensus.NewRoundStep.prototype.setStep = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int64 seconds_since_start_time = 4; + * @return {number} + */ +proto.tendermint.consensus.NewRoundStep.prototype.getSecondsSinceStartTime = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.NewRoundStep} returns this + */ +proto.tendermint.consensus.NewRoundStep.prototype.setSecondsSinceStartTime = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional int32 last_commit_round = 5; + * @return {number} + */ +proto.tendermint.consensus.NewRoundStep.prototype.getLastCommitRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.NewRoundStep} returns this + */ +proto.tendermint.consensus.NewRoundStep.prototype.setLastCommitRound = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.NewValidBlock.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.NewValidBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.NewValidBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.NewValidBlock.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + round: jspb.Message.getFieldWithDefault(msg, 2, 0), + blockPartSetHeader: (f = msg.getBlockPartSetHeader()) && tendermint_types_types_pb.PartSetHeader.toObject(includeInstance, f), + blockParts: (f = msg.getBlockParts()) && tendermint_libs_bits_types_pb.BitArray.toObject(includeInstance, f), + isCommit: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.NewValidBlock} + */ +proto.tendermint.consensus.NewValidBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.NewValidBlock; + return proto.tendermint.consensus.NewValidBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.NewValidBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.NewValidBlock} + */ +proto.tendermint.consensus.NewValidBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 3: + var value = new tendermint_types_types_pb.PartSetHeader; + reader.readMessage(value,tendermint_types_types_pb.PartSetHeader.deserializeBinaryFromReader); + msg.setBlockPartSetHeader(value); + break; + case 4: + var value = new tendermint_libs_bits_types_pb.BitArray; + reader.readMessage(value,tendermint_libs_bits_types_pb.BitArray.deserializeBinaryFromReader); + msg.setBlockParts(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsCommit(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.NewValidBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.NewValidBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.NewValidBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.NewValidBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getBlockPartSetHeader(); + if (f != null) { + writer.writeMessage( + 3, + f, + tendermint_types_types_pb.PartSetHeader.serializeBinaryToWriter + ); + } + f = message.getBlockParts(); + if (f != null) { + writer.writeMessage( + 4, + f, + tendermint_libs_bits_types_pb.BitArray.serializeBinaryToWriter + ); + } + f = message.getIsCommit(); + if (f) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.consensus.NewValidBlock.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.NewValidBlock} returns this + */ +proto.tendermint.consensus.NewValidBlock.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 round = 2; + * @return {number} + */ +proto.tendermint.consensus.NewValidBlock.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.NewValidBlock} returns this + */ +proto.tendermint.consensus.NewValidBlock.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional tendermint.types.PartSetHeader block_part_set_header = 3; + * @return {?proto.tendermint.types.PartSetHeader} + */ +proto.tendermint.consensus.NewValidBlock.prototype.getBlockPartSetHeader = function() { + return /** @type{?proto.tendermint.types.PartSetHeader} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.PartSetHeader, 3)); +}; + + +/** + * @param {?proto.tendermint.types.PartSetHeader|undefined} value + * @return {!proto.tendermint.consensus.NewValidBlock} returns this +*/ +proto.tendermint.consensus.NewValidBlock.prototype.setBlockPartSetHeader = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.NewValidBlock} returns this + */ +proto.tendermint.consensus.NewValidBlock.prototype.clearBlockPartSetHeader = function() { + return this.setBlockPartSetHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.NewValidBlock.prototype.hasBlockPartSetHeader = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional tendermint.libs.bits.BitArray block_parts = 4; + * @return {?proto.tendermint.libs.bits.BitArray} + */ +proto.tendermint.consensus.NewValidBlock.prototype.getBlockParts = function() { + return /** @type{?proto.tendermint.libs.bits.BitArray} */ ( + jspb.Message.getWrapperField(this, tendermint_libs_bits_types_pb.BitArray, 4)); +}; + + +/** + * @param {?proto.tendermint.libs.bits.BitArray|undefined} value + * @return {!proto.tendermint.consensus.NewValidBlock} returns this +*/ +proto.tendermint.consensus.NewValidBlock.prototype.setBlockParts = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.NewValidBlock} returns this + */ +proto.tendermint.consensus.NewValidBlock.prototype.clearBlockParts = function() { + return this.setBlockParts(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.NewValidBlock.prototype.hasBlockParts = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional bool is_commit = 5; + * @return {boolean} + */ +proto.tendermint.consensus.NewValidBlock.prototype.getIsCommit = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.tendermint.consensus.NewValidBlock} returns this + */ +proto.tendermint.consensus.NewValidBlock.prototype.setIsCommit = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.Proposal.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.Proposal.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.Proposal} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.Proposal.toObject = function(includeInstance, msg) { + var f, obj = { + proposal: (f = msg.getProposal()) && tendermint_types_types_pb.Proposal.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.Proposal} + */ +proto.tendermint.consensus.Proposal.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.Proposal; + return proto.tendermint.consensus.Proposal.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.Proposal} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.Proposal} + */ +proto.tendermint.consensus.Proposal.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.Proposal; + reader.readMessage(value,tendermint_types_types_pb.Proposal.deserializeBinaryFromReader); + msg.setProposal(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.Proposal.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.Proposal.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.Proposal} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.Proposal.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProposal(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.Proposal.serializeBinaryToWriter + ); + } +}; + + +/** + * optional tendermint.types.Proposal proposal = 1; + * @return {?proto.tendermint.types.Proposal} + */ +proto.tendermint.consensus.Proposal.prototype.getProposal = function() { + return /** @type{?proto.tendermint.types.Proposal} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Proposal, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Proposal|undefined} value + * @return {!proto.tendermint.consensus.Proposal} returns this +*/ +proto.tendermint.consensus.Proposal.prototype.setProposal = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Proposal} returns this + */ +proto.tendermint.consensus.Proposal.prototype.clearProposal = function() { + return this.setProposal(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Proposal.prototype.hasProposal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.ProposalPOL.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.ProposalPOL.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.ProposalPOL} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.ProposalPOL.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + proposalPolRound: jspb.Message.getFieldWithDefault(msg, 2, 0), + proposalPol: (f = msg.getProposalPol()) && tendermint_libs_bits_types_pb.BitArray.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.ProposalPOL} + */ +proto.tendermint.consensus.ProposalPOL.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.ProposalPOL; + return proto.tendermint.consensus.ProposalPOL.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.ProposalPOL} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.ProposalPOL} + */ +proto.tendermint.consensus.ProposalPOL.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setProposalPolRound(value); + break; + case 3: + var value = new tendermint_libs_bits_types_pb.BitArray; + reader.readMessage(value,tendermint_libs_bits_types_pb.BitArray.deserializeBinaryFromReader); + msg.setProposalPol(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.ProposalPOL.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.ProposalPOL.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.ProposalPOL} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.ProposalPOL.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getProposalPolRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getProposalPol(); + if (f != null) { + writer.writeMessage( + 3, + f, + tendermint_libs_bits_types_pb.BitArray.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.consensus.ProposalPOL.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.ProposalPOL} returns this + */ +proto.tendermint.consensus.ProposalPOL.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 proposal_pol_round = 2; + * @return {number} + */ +proto.tendermint.consensus.ProposalPOL.prototype.getProposalPolRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.ProposalPOL} returns this + */ +proto.tendermint.consensus.ProposalPOL.prototype.setProposalPolRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional tendermint.libs.bits.BitArray proposal_pol = 3; + * @return {?proto.tendermint.libs.bits.BitArray} + */ +proto.tendermint.consensus.ProposalPOL.prototype.getProposalPol = function() { + return /** @type{?proto.tendermint.libs.bits.BitArray} */ ( + jspb.Message.getWrapperField(this, tendermint_libs_bits_types_pb.BitArray, 3)); +}; + + +/** + * @param {?proto.tendermint.libs.bits.BitArray|undefined} value + * @return {!proto.tendermint.consensus.ProposalPOL} returns this +*/ +proto.tendermint.consensus.ProposalPOL.prototype.setProposalPol = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.ProposalPOL} returns this + */ +proto.tendermint.consensus.ProposalPOL.prototype.clearProposalPol = function() { + return this.setProposalPol(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.ProposalPOL.prototype.hasProposalPol = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.BlockPart.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.BlockPart.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.BlockPart} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.BlockPart.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + round: jspb.Message.getFieldWithDefault(msg, 2, 0), + part: (f = msg.getPart()) && tendermint_types_types_pb.Part.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.BlockPart} + */ +proto.tendermint.consensus.BlockPart.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.BlockPart; + return proto.tendermint.consensus.BlockPart.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.BlockPart} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.BlockPart} + */ +proto.tendermint.consensus.BlockPart.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 3: + var value = new tendermint_types_types_pb.Part; + reader.readMessage(value,tendermint_types_types_pb.Part.deserializeBinaryFromReader); + msg.setPart(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.BlockPart.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.BlockPart.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.BlockPart} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.BlockPart.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getPart(); + if (f != null) { + writer.writeMessage( + 3, + f, + tendermint_types_types_pb.Part.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.consensus.BlockPart.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.BlockPart} returns this + */ +proto.tendermint.consensus.BlockPart.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 round = 2; + * @return {number} + */ +proto.tendermint.consensus.BlockPart.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.BlockPart} returns this + */ +proto.tendermint.consensus.BlockPart.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional tendermint.types.Part part = 3; + * @return {?proto.tendermint.types.Part} + */ +proto.tendermint.consensus.BlockPart.prototype.getPart = function() { + return /** @type{?proto.tendermint.types.Part} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Part, 3)); +}; + + +/** + * @param {?proto.tendermint.types.Part|undefined} value + * @return {!proto.tendermint.consensus.BlockPart} returns this +*/ +proto.tendermint.consensus.BlockPart.prototype.setPart = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.BlockPart} returns this + */ +proto.tendermint.consensus.BlockPart.prototype.clearPart = function() { + return this.setPart(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.BlockPart.prototype.hasPart = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.Vote.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.Vote.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.Vote} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.Vote.toObject = function(includeInstance, msg) { + var f, obj = { + vote: (f = msg.getVote()) && tendermint_types_types_pb.Vote.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.Vote} + */ +proto.tendermint.consensus.Vote.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.Vote; + return proto.tendermint.consensus.Vote.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.Vote} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.Vote} + */ +proto.tendermint.consensus.Vote.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.Vote; + reader.readMessage(value,tendermint_types_types_pb.Vote.deserializeBinaryFromReader); + msg.setVote(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.Vote.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.Vote.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.Vote} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.Vote.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVote(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.Vote.serializeBinaryToWriter + ); + } +}; + + +/** + * optional tendermint.types.Vote vote = 1; + * @return {?proto.tendermint.types.Vote} + */ +proto.tendermint.consensus.Vote.prototype.getVote = function() { + return /** @type{?proto.tendermint.types.Vote} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Vote, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Vote|undefined} value + * @return {!proto.tendermint.consensus.Vote} returns this +*/ +proto.tendermint.consensus.Vote.prototype.setVote = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Vote} returns this + */ +proto.tendermint.consensus.Vote.prototype.clearVote = function() { + return this.setVote(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Vote.prototype.hasVote = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.HasVote.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.HasVote.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.HasVote} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.HasVote.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + round: jspb.Message.getFieldWithDefault(msg, 2, 0), + type: jspb.Message.getFieldWithDefault(msg, 3, 0), + index: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.HasVote} + */ +proto.tendermint.consensus.HasVote.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.HasVote; + return proto.tendermint.consensus.HasVote.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.HasVote} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.HasVote} + */ +proto.tendermint.consensus.HasVote.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 3: + var value = /** @type {!proto.tendermint.types.SignedMsgType} */ (reader.readEnum()); + msg.setType(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt32()); + msg.setIndex(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.HasVote.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.HasVote.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.HasVote} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.HasVote.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeInt32( + 4, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.consensus.HasVote.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.HasVote} returns this + */ +proto.tendermint.consensus.HasVote.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 round = 2; + * @return {number} + */ +proto.tendermint.consensus.HasVote.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.HasVote} returns this + */ +proto.tendermint.consensus.HasVote.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional tendermint.types.SignedMsgType type = 3; + * @return {!proto.tendermint.types.SignedMsgType} + */ +proto.tendermint.consensus.HasVote.prototype.getType = function() { + return /** @type {!proto.tendermint.types.SignedMsgType} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {!proto.tendermint.types.SignedMsgType} value + * @return {!proto.tendermint.consensus.HasVote} returns this + */ +proto.tendermint.consensus.HasVote.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); +}; + + +/** + * optional int32 index = 4; + * @return {number} + */ +proto.tendermint.consensus.HasVote.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.HasVote} returns this + */ +proto.tendermint.consensus.HasVote.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.VoteSetMaj23.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.VoteSetMaj23} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.VoteSetMaj23.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + round: jspb.Message.getFieldWithDefault(msg, 2, 0), + type: jspb.Message.getFieldWithDefault(msg, 3, 0), + blockId: (f = msg.getBlockId()) && tendermint_types_types_pb.BlockID.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.VoteSetMaj23} + */ +proto.tendermint.consensus.VoteSetMaj23.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.VoteSetMaj23; + return proto.tendermint.consensus.VoteSetMaj23.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.VoteSetMaj23} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.VoteSetMaj23} + */ +proto.tendermint.consensus.VoteSetMaj23.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 3: + var value = /** @type {!proto.tendermint.types.SignedMsgType} */ (reader.readEnum()); + msg.setType(value); + break; + case 4: + var value = new tendermint_types_types_pb.BlockID; + reader.readMessage(value,tendermint_types_types_pb.BlockID.deserializeBinaryFromReader); + msg.setBlockId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.VoteSetMaj23.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.VoteSetMaj23} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.VoteSetMaj23.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } + f = message.getBlockId(); + if (f != null) { + writer.writeMessage( + 4, + f, + tendermint_types_types_pb.BlockID.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.VoteSetMaj23} returns this + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 round = 2; + * @return {number} + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.VoteSetMaj23} returns this + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional tendermint.types.SignedMsgType type = 3; + * @return {!proto.tendermint.types.SignedMsgType} + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.getType = function() { + return /** @type {!proto.tendermint.types.SignedMsgType} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {!proto.tendermint.types.SignedMsgType} value + * @return {!proto.tendermint.consensus.VoteSetMaj23} returns this + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); +}; + + +/** + * optional tendermint.types.BlockID block_id = 4; + * @return {?proto.tendermint.types.BlockID} + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.getBlockId = function() { + return /** @type{?proto.tendermint.types.BlockID} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.BlockID, 4)); +}; + + +/** + * @param {?proto.tendermint.types.BlockID|undefined} value + * @return {!proto.tendermint.consensus.VoteSetMaj23} returns this +*/ +proto.tendermint.consensus.VoteSetMaj23.prototype.setBlockId = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.VoteSetMaj23} returns this + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.clearBlockId = function() { + return this.setBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.VoteSetMaj23.prototype.hasBlockId = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.VoteSetBits.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.VoteSetBits.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.VoteSetBits} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.VoteSetBits.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + round: jspb.Message.getFieldWithDefault(msg, 2, 0), + type: jspb.Message.getFieldWithDefault(msg, 3, 0), + blockId: (f = msg.getBlockId()) && tendermint_types_types_pb.BlockID.toObject(includeInstance, f), + votes: (f = msg.getVotes()) && tendermint_libs_bits_types_pb.BitArray.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.VoteSetBits} + */ +proto.tendermint.consensus.VoteSetBits.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.VoteSetBits; + return proto.tendermint.consensus.VoteSetBits.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.VoteSetBits} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.VoteSetBits} + */ +proto.tendermint.consensus.VoteSetBits.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 3: + var value = /** @type {!proto.tendermint.types.SignedMsgType} */ (reader.readEnum()); + msg.setType(value); + break; + case 4: + var value = new tendermint_types_types_pb.BlockID; + reader.readMessage(value,tendermint_types_types_pb.BlockID.deserializeBinaryFromReader); + msg.setBlockId(value); + break; + case 5: + var value = new tendermint_libs_bits_types_pb.BitArray; + reader.readMessage(value,tendermint_libs_bits_types_pb.BitArray.deserializeBinaryFromReader); + msg.setVotes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.VoteSetBits.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.VoteSetBits.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.VoteSetBits} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.VoteSetBits.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } + f = message.getBlockId(); + if (f != null) { + writer.writeMessage( + 4, + f, + tendermint_types_types_pb.BlockID.serializeBinaryToWriter + ); + } + f = message.getVotes(); + if (f != null) { + writer.writeMessage( + 5, + f, + tendermint_libs_bits_types_pb.BitArray.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.consensus.VoteSetBits.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.VoteSetBits} returns this + */ +proto.tendermint.consensus.VoteSetBits.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 round = 2; + * @return {number} + */ +proto.tendermint.consensus.VoteSetBits.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.VoteSetBits} returns this + */ +proto.tendermint.consensus.VoteSetBits.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional tendermint.types.SignedMsgType type = 3; + * @return {!proto.tendermint.types.SignedMsgType} + */ +proto.tendermint.consensus.VoteSetBits.prototype.getType = function() { + return /** @type {!proto.tendermint.types.SignedMsgType} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {!proto.tendermint.types.SignedMsgType} value + * @return {!proto.tendermint.consensus.VoteSetBits} returns this + */ +proto.tendermint.consensus.VoteSetBits.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); +}; + + +/** + * optional tendermint.types.BlockID block_id = 4; + * @return {?proto.tendermint.types.BlockID} + */ +proto.tendermint.consensus.VoteSetBits.prototype.getBlockId = function() { + return /** @type{?proto.tendermint.types.BlockID} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.BlockID, 4)); +}; + + +/** + * @param {?proto.tendermint.types.BlockID|undefined} value + * @return {!proto.tendermint.consensus.VoteSetBits} returns this +*/ +proto.tendermint.consensus.VoteSetBits.prototype.setBlockId = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.VoteSetBits} returns this + */ +proto.tendermint.consensus.VoteSetBits.prototype.clearBlockId = function() { + return this.setBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.VoteSetBits.prototype.hasBlockId = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional tendermint.libs.bits.BitArray votes = 5; + * @return {?proto.tendermint.libs.bits.BitArray} + */ +proto.tendermint.consensus.VoteSetBits.prototype.getVotes = function() { + return /** @type{?proto.tendermint.libs.bits.BitArray} */ ( + jspb.Message.getWrapperField(this, tendermint_libs_bits_types_pb.BitArray, 5)); +}; + + +/** + * @param {?proto.tendermint.libs.bits.BitArray|undefined} value + * @return {!proto.tendermint.consensus.VoteSetBits} returns this +*/ +proto.tendermint.consensus.VoteSetBits.prototype.setVotes = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.VoteSetBits} returns this + */ +proto.tendermint.consensus.VoteSetBits.prototype.clearVotes = function() { + return this.setVotes(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.VoteSetBits.prototype.hasVotes = function() { + return jspb.Message.getField(this, 5) != null; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.consensus.Message.oneofGroups_ = [[1,2,3,4,5,6,7,8,9]]; + +/** + * @enum {number} + */ +proto.tendermint.consensus.Message.SumCase = { + SUM_NOT_SET: 0, + NEW_ROUND_STEP: 1, + NEW_VALID_BLOCK: 2, + PROPOSAL: 3, + PROPOSAL_POL: 4, + BLOCK_PART: 5, + VOTE: 6, + HAS_VOTE: 7, + VOTE_SET_MAJ23: 8, + VOTE_SET_BITS: 9 +}; + +/** + * @return {proto.tendermint.consensus.Message.SumCase} + */ +proto.tendermint.consensus.Message.prototype.getSumCase = function() { + return /** @type {proto.tendermint.consensus.Message.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.consensus.Message.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.Message.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.Message.toObject = function(includeInstance, msg) { + var f, obj = { + newRoundStep: (f = msg.getNewRoundStep()) && proto.tendermint.consensus.NewRoundStep.toObject(includeInstance, f), + newValidBlock: (f = msg.getNewValidBlock()) && proto.tendermint.consensus.NewValidBlock.toObject(includeInstance, f), + proposal: (f = msg.getProposal()) && proto.tendermint.consensus.Proposal.toObject(includeInstance, f), + proposalPol: (f = msg.getProposalPol()) && proto.tendermint.consensus.ProposalPOL.toObject(includeInstance, f), + blockPart: (f = msg.getBlockPart()) && proto.tendermint.consensus.BlockPart.toObject(includeInstance, f), + vote: (f = msg.getVote()) && proto.tendermint.consensus.Vote.toObject(includeInstance, f), + hasVote: (f = msg.getHasVote()) && proto.tendermint.consensus.HasVote.toObject(includeInstance, f), + voteSetMaj23: (f = msg.getVoteSetMaj23()) && proto.tendermint.consensus.VoteSetMaj23.toObject(includeInstance, f), + voteSetBits: (f = msg.getVoteSetBits()) && proto.tendermint.consensus.VoteSetBits.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.Message} + */ +proto.tendermint.consensus.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.Message; + return proto.tendermint.consensus.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.Message} + */ +proto.tendermint.consensus.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.consensus.NewRoundStep; + reader.readMessage(value,proto.tendermint.consensus.NewRoundStep.deserializeBinaryFromReader); + msg.setNewRoundStep(value); + break; + case 2: + var value = new proto.tendermint.consensus.NewValidBlock; + reader.readMessage(value,proto.tendermint.consensus.NewValidBlock.deserializeBinaryFromReader); + msg.setNewValidBlock(value); + break; + case 3: + var value = new proto.tendermint.consensus.Proposal; + reader.readMessage(value,proto.tendermint.consensus.Proposal.deserializeBinaryFromReader); + msg.setProposal(value); + break; + case 4: + var value = new proto.tendermint.consensus.ProposalPOL; + reader.readMessage(value,proto.tendermint.consensus.ProposalPOL.deserializeBinaryFromReader); + msg.setProposalPol(value); + break; + case 5: + var value = new proto.tendermint.consensus.BlockPart; + reader.readMessage(value,proto.tendermint.consensus.BlockPart.deserializeBinaryFromReader); + msg.setBlockPart(value); + break; + case 6: + var value = new proto.tendermint.consensus.Vote; + reader.readMessage(value,proto.tendermint.consensus.Vote.deserializeBinaryFromReader); + msg.setVote(value); + break; + case 7: + var value = new proto.tendermint.consensus.HasVote; + reader.readMessage(value,proto.tendermint.consensus.HasVote.deserializeBinaryFromReader); + msg.setHasVote(value); + break; + case 8: + var value = new proto.tendermint.consensus.VoteSetMaj23; + reader.readMessage(value,proto.tendermint.consensus.VoteSetMaj23.deserializeBinaryFromReader); + msg.setVoteSetMaj23(value); + break; + case 9: + var value = new proto.tendermint.consensus.VoteSetBits; + reader.readMessage(value,proto.tendermint.consensus.VoteSetBits.deserializeBinaryFromReader); + msg.setVoteSetBits(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNewRoundStep(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.consensus.NewRoundStep.serializeBinaryToWriter + ); + } + f = message.getNewValidBlock(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.consensus.NewValidBlock.serializeBinaryToWriter + ); + } + f = message.getProposal(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.consensus.Proposal.serializeBinaryToWriter + ); + } + f = message.getProposalPol(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.consensus.ProposalPOL.serializeBinaryToWriter + ); + } + f = message.getBlockPart(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.tendermint.consensus.BlockPart.serializeBinaryToWriter + ); + } + f = message.getVote(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.tendermint.consensus.Vote.serializeBinaryToWriter + ); + } + f = message.getHasVote(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.tendermint.consensus.HasVote.serializeBinaryToWriter + ); + } + f = message.getVoteSetMaj23(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.tendermint.consensus.VoteSetMaj23.serializeBinaryToWriter + ); + } + f = message.getVoteSetBits(); + if (f != null) { + writer.writeMessage( + 9, + f, + proto.tendermint.consensus.VoteSetBits.serializeBinaryToWriter + ); + } +}; + + +/** + * optional NewRoundStep new_round_step = 1; + * @return {?proto.tendermint.consensus.NewRoundStep} + */ +proto.tendermint.consensus.Message.prototype.getNewRoundStep = function() { + return /** @type{?proto.tendermint.consensus.NewRoundStep} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.NewRoundStep, 1)); +}; + + +/** + * @param {?proto.tendermint.consensus.NewRoundStep|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setNewRoundStep = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearNewRoundStep = function() { + return this.setNewRoundStep(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasNewRoundStep = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional NewValidBlock new_valid_block = 2; + * @return {?proto.tendermint.consensus.NewValidBlock} + */ +proto.tendermint.consensus.Message.prototype.getNewValidBlock = function() { + return /** @type{?proto.tendermint.consensus.NewValidBlock} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.NewValidBlock, 2)); +}; + + +/** + * @param {?proto.tendermint.consensus.NewValidBlock|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setNewValidBlock = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearNewValidBlock = function() { + return this.setNewValidBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasNewValidBlock = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional Proposal proposal = 3; + * @return {?proto.tendermint.consensus.Proposal} + */ +proto.tendermint.consensus.Message.prototype.getProposal = function() { + return /** @type{?proto.tendermint.consensus.Proposal} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.Proposal, 3)); +}; + + +/** + * @param {?proto.tendermint.consensus.Proposal|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setProposal = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearProposal = function() { + return this.setProposal(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasProposal = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional ProposalPOL proposal_pol = 4; + * @return {?proto.tendermint.consensus.ProposalPOL} + */ +proto.tendermint.consensus.Message.prototype.getProposalPol = function() { + return /** @type{?proto.tendermint.consensus.ProposalPOL} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.ProposalPOL, 4)); +}; + + +/** + * @param {?proto.tendermint.consensus.ProposalPOL|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setProposalPol = function(value) { + return jspb.Message.setOneofWrapperField(this, 4, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearProposalPol = function() { + return this.setProposalPol(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasProposalPol = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional BlockPart block_part = 5; + * @return {?proto.tendermint.consensus.BlockPart} + */ +proto.tendermint.consensus.Message.prototype.getBlockPart = function() { + return /** @type{?proto.tendermint.consensus.BlockPart} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.BlockPart, 5)); +}; + + +/** + * @param {?proto.tendermint.consensus.BlockPart|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setBlockPart = function(value) { + return jspb.Message.setOneofWrapperField(this, 5, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearBlockPart = function() { + return this.setBlockPart(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasBlockPart = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional Vote vote = 6; + * @return {?proto.tendermint.consensus.Vote} + */ +proto.tendermint.consensus.Message.prototype.getVote = function() { + return /** @type{?proto.tendermint.consensus.Vote} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.Vote, 6)); +}; + + +/** + * @param {?proto.tendermint.consensus.Vote|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setVote = function(value) { + return jspb.Message.setOneofWrapperField(this, 6, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearVote = function() { + return this.setVote(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasVote = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional HasVote has_vote = 7; + * @return {?proto.tendermint.consensus.HasVote} + */ +proto.tendermint.consensus.Message.prototype.getHasVote = function() { + return /** @type{?proto.tendermint.consensus.HasVote} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.HasVote, 7)); +}; + + +/** + * @param {?proto.tendermint.consensus.HasVote|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setHasVote = function(value) { + return jspb.Message.setOneofWrapperField(this, 7, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearHasVote = function() { + return this.setHasVote(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasHasVote = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional VoteSetMaj23 vote_set_maj23 = 8; + * @return {?proto.tendermint.consensus.VoteSetMaj23} + */ +proto.tendermint.consensus.Message.prototype.getVoteSetMaj23 = function() { + return /** @type{?proto.tendermint.consensus.VoteSetMaj23} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.VoteSetMaj23, 8)); +}; + + +/** + * @param {?proto.tendermint.consensus.VoteSetMaj23|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setVoteSetMaj23 = function(value) { + return jspb.Message.setOneofWrapperField(this, 8, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearVoteSetMaj23 = function() { + return this.setVoteSetMaj23(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasVoteSetMaj23 = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional VoteSetBits vote_set_bits = 9; + * @return {?proto.tendermint.consensus.VoteSetBits} + */ +proto.tendermint.consensus.Message.prototype.getVoteSetBits = function() { + return /** @type{?proto.tendermint.consensus.VoteSetBits} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.VoteSetBits, 9)); +}; + + +/** + * @param {?proto.tendermint.consensus.VoteSetBits|undefined} value + * @return {!proto.tendermint.consensus.Message} returns this +*/ +proto.tendermint.consensus.Message.prototype.setVoteSetBits = function(value) { + return jspb.Message.setOneofWrapperField(this, 9, proto.tendermint.consensus.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.Message} returns this + */ +proto.tendermint.consensus.Message.prototype.clearVoteSetBits = function() { + return this.setVoteSetBits(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.Message.prototype.hasVoteSetBits = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +goog.object.extend(exports, proto.tendermint.consensus); diff --git a/js/proto/tendermint/consensus/wal_grpc_pb.js b/js/proto/tendermint/consensus/wal_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/consensus/wal_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/consensus/wal_pb.d.ts b/js/proto/tendermint/consensus/wal_pb.d.ts new file mode 100644 index 000000000..ded1a8614 --- /dev/null +++ b/js/proto/tendermint/consensus/wal_pb.d.ts @@ -0,0 +1,189 @@ +// package: tendermint.consensus +// file: tendermint/consensus/wal.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as tendermint_consensus_types_pb from "../../tendermint/consensus/types_pb"; +import * as tendermint_types_events_pb from "../../tendermint/types/events_pb"; +import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; + +export class MsgInfo extends jspb.Message { + + hasMsg(): boolean; + clearMsg(): void; + getMsg(): tendermint_consensus_types_pb.Message | undefined; + setMsg(value?: tendermint_consensus_types_pb.Message): MsgInfo; + + getPeerId(): string; + setPeerId(value: string): MsgInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MsgInfo.AsObject; + static toObject(includeInstance: boolean, msg: MsgInfo): MsgInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MsgInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MsgInfo; + static deserializeBinaryFromReader(message: MsgInfo, reader: jspb.BinaryReader): MsgInfo; +} + +export namespace MsgInfo { + export type AsObject = { + msg?: tendermint_consensus_types_pb.Message.AsObject, + peerId: string, + } +} + +export class TimeoutInfo extends jspb.Message { + + hasDuration(): boolean; + clearDuration(): void; + getDuration(): google_protobuf_duration_pb.Duration | undefined; + setDuration(value?: google_protobuf_duration_pb.Duration): TimeoutInfo; + + getHeight(): number; + setHeight(value: number): TimeoutInfo; + + getRound(): number; + setRound(value: number): TimeoutInfo; + + getStep(): number; + setStep(value: number): TimeoutInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TimeoutInfo.AsObject; + static toObject(includeInstance: boolean, msg: TimeoutInfo): TimeoutInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TimeoutInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TimeoutInfo; + static deserializeBinaryFromReader(message: TimeoutInfo, reader: jspb.BinaryReader): TimeoutInfo; +} + +export namespace TimeoutInfo { + export type AsObject = { + duration?: google_protobuf_duration_pb.Duration.AsObject, + height: number, + round: number, + step: number, + } +} + +export class EndHeight extends jspb.Message { + getHeight(): number; + setHeight(value: number): EndHeight; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EndHeight.AsObject; + static toObject(includeInstance: boolean, msg: EndHeight): EndHeight.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EndHeight, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EndHeight; + static deserializeBinaryFromReader(message: EndHeight, reader: jspb.BinaryReader): EndHeight; +} + +export namespace EndHeight { + export type AsObject = { + height: number, + } +} + +export class WALMessage extends jspb.Message { + + hasEventDataRoundState(): boolean; + clearEventDataRoundState(): void; + getEventDataRoundState(): tendermint_types_events_pb.EventDataRoundState | undefined; + setEventDataRoundState(value?: tendermint_types_events_pb.EventDataRoundState): WALMessage; + + + hasMsgInfo(): boolean; + clearMsgInfo(): void; + getMsgInfo(): MsgInfo | undefined; + setMsgInfo(value?: MsgInfo): WALMessage; + + + hasTimeoutInfo(): boolean; + clearTimeoutInfo(): void; + getTimeoutInfo(): TimeoutInfo | undefined; + setTimeoutInfo(value?: TimeoutInfo): WALMessage; + + + hasEndHeight(): boolean; + clearEndHeight(): void; + getEndHeight(): EndHeight | undefined; + setEndHeight(value?: EndHeight): WALMessage; + + + getSumCase(): WALMessage.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WALMessage.AsObject; + static toObject(includeInstance: boolean, msg: WALMessage): WALMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: WALMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WALMessage; + static deserializeBinaryFromReader(message: WALMessage, reader: jspb.BinaryReader): WALMessage; +} + +export namespace WALMessage { + export type AsObject = { + eventDataRoundState?: tendermint_types_events_pb.EventDataRoundState.AsObject, + msgInfo?: MsgInfo.AsObject, + timeoutInfo?: TimeoutInfo.AsObject, + endHeight?: EndHeight.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + EVENT_DATA_ROUND_STATE = 1, + + MSG_INFO = 2, + + TIMEOUT_INFO = 3, + + END_HEIGHT = 4, + + } + +} + +export class TimedWALMessage extends jspb.Message { + + hasTime(): boolean; + clearTime(): void; + getTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTime(value?: google_protobuf_timestamp_pb.Timestamp): TimedWALMessage; + + + hasMsg(): boolean; + clearMsg(): void; + getMsg(): WALMessage | undefined; + setMsg(value?: WALMessage): TimedWALMessage; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TimedWALMessage.AsObject; + static toObject(includeInstance: boolean, msg: TimedWALMessage): TimedWALMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TimedWALMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TimedWALMessage; + static deserializeBinaryFromReader(message: TimedWALMessage, reader: jspb.BinaryReader): TimedWALMessage; +} + +export namespace TimedWALMessage { + export type AsObject = { + time?: google_protobuf_timestamp_pb.Timestamp.AsObject, + msg?: WALMessage.AsObject, + } +} diff --git a/js/proto/tendermint/consensus/wal_pb.js b/js/proto/tendermint/consensus/wal_pb.js new file mode 100644 index 000000000..2d09c3baf --- /dev/null +++ b/js/proto/tendermint/consensus/wal_pb.js @@ -0,0 +1,1224 @@ +// source: tendermint/consensus/wal.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_consensus_types_pb = require('../../tendermint/consensus/types_pb.js'); +goog.object.extend(proto, tendermint_consensus_types_pb); +var tendermint_types_events_pb = require('../../tendermint/types/events_pb.js'); +goog.object.extend(proto, tendermint_types_events_pb); +var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js'); +goog.object.extend(proto, google_protobuf_duration_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +goog.exportSymbol('proto.tendermint.consensus.EndHeight', null, global); +goog.exportSymbol('proto.tendermint.consensus.MsgInfo', null, global); +goog.exportSymbol('proto.tendermint.consensus.TimedWALMessage', null, global); +goog.exportSymbol('proto.tendermint.consensus.TimeoutInfo', null, global); +goog.exportSymbol('proto.tendermint.consensus.WALMessage', null, global); +goog.exportSymbol('proto.tendermint.consensus.WALMessage.SumCase', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.MsgInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.MsgInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.MsgInfo.displayName = 'proto.tendermint.consensus.MsgInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.TimeoutInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.TimeoutInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.TimeoutInfo.displayName = 'proto.tendermint.consensus.TimeoutInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.EndHeight = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.EndHeight, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.EndHeight.displayName = 'proto.tendermint.consensus.EndHeight'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.WALMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.consensus.WALMessage.oneofGroups_); +}; +goog.inherits(proto.tendermint.consensus.WALMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.WALMessage.displayName = 'proto.tendermint.consensus.WALMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.consensus.TimedWALMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.consensus.TimedWALMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.consensus.TimedWALMessage.displayName = 'proto.tendermint.consensus.TimedWALMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.MsgInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.MsgInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.MsgInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.MsgInfo.toObject = function(includeInstance, msg) { + var f, obj = { + msg: (f = msg.getMsg()) && tendermint_consensus_types_pb.Message.toObject(includeInstance, f), + peerId: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.MsgInfo} + */ +proto.tendermint.consensus.MsgInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.MsgInfo; + return proto.tendermint.consensus.MsgInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.MsgInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.MsgInfo} + */ +proto.tendermint.consensus.MsgInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_consensus_types_pb.Message; + reader.readMessage(value,tendermint_consensus_types_pb.Message.deserializeBinaryFromReader); + msg.setMsg(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setPeerId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.MsgInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.MsgInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.MsgInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.MsgInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMsg(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_consensus_types_pb.Message.serializeBinaryToWriter + ); + } + f = message.getPeerId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional Message msg = 1; + * @return {?proto.tendermint.consensus.Message} + */ +proto.tendermint.consensus.MsgInfo.prototype.getMsg = function() { + return /** @type{?proto.tendermint.consensus.Message} */ ( + jspb.Message.getWrapperField(this, tendermint_consensus_types_pb.Message, 1)); +}; + + +/** + * @param {?proto.tendermint.consensus.Message|undefined} value + * @return {!proto.tendermint.consensus.MsgInfo} returns this +*/ +proto.tendermint.consensus.MsgInfo.prototype.setMsg = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.MsgInfo} returns this + */ +proto.tendermint.consensus.MsgInfo.prototype.clearMsg = function() { + return this.setMsg(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.MsgInfo.prototype.hasMsg = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string peer_id = 2; + * @return {string} + */ +proto.tendermint.consensus.MsgInfo.prototype.getPeerId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.consensus.MsgInfo} returns this + */ +proto.tendermint.consensus.MsgInfo.prototype.setPeerId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.TimeoutInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.TimeoutInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.TimeoutInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.TimeoutInfo.toObject = function(includeInstance, msg) { + var f, obj = { + duration: (f = msg.getDuration()) && google_protobuf_duration_pb.Duration.toObject(includeInstance, f), + height: jspb.Message.getFieldWithDefault(msg, 2, 0), + round: jspb.Message.getFieldWithDefault(msg, 3, 0), + step: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.TimeoutInfo} + */ +proto.tendermint.consensus.TimeoutInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.TimeoutInfo; + return proto.tendermint.consensus.TimeoutInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.TimeoutInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.TimeoutInfo} + */ +proto.tendermint.consensus.TimeoutInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new google_protobuf_duration_pb.Duration; + reader.readMessage(value,google_protobuf_duration_pb.Duration.deserializeBinaryFromReader); + msg.setDuration(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 4: + var value = /** @type {number} */ (reader.readUint32()); + msg.setStep(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.TimeoutInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.TimeoutInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.TimeoutInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.TimeoutInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDuration(); + if (f != null) { + writer.writeMessage( + 1, + f, + google_protobuf_duration_pb.Duration.serializeBinaryToWriter + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 3, + f + ); + } + f = message.getStep(); + if (f !== 0) { + writer.writeUint32( + 4, + f + ); + } +}; + + +/** + * optional google.protobuf.Duration duration = 1; + * @return {?proto.google.protobuf.Duration} + */ +proto.tendermint.consensus.TimeoutInfo.prototype.getDuration = function() { + return /** @type{?proto.google.protobuf.Duration} */ ( + jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 1)); +}; + + +/** + * @param {?proto.google.protobuf.Duration|undefined} value + * @return {!proto.tendermint.consensus.TimeoutInfo} returns this +*/ +proto.tendermint.consensus.TimeoutInfo.prototype.setDuration = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.TimeoutInfo} returns this + */ +proto.tendermint.consensus.TimeoutInfo.prototype.clearDuration = function() { + return this.setDuration(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.TimeoutInfo.prototype.hasDuration = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int64 height = 2; + * @return {number} + */ +proto.tendermint.consensus.TimeoutInfo.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.TimeoutInfo} returns this + */ +proto.tendermint.consensus.TimeoutInfo.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional int32 round = 3; + * @return {number} + */ +proto.tendermint.consensus.TimeoutInfo.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.TimeoutInfo} returns this + */ +proto.tendermint.consensus.TimeoutInfo.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional uint32 step = 4; + * @return {number} + */ +proto.tendermint.consensus.TimeoutInfo.prototype.getStep = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.TimeoutInfo} returns this + */ +proto.tendermint.consensus.TimeoutInfo.prototype.setStep = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.EndHeight.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.EndHeight.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.EndHeight} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.EndHeight.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.EndHeight} + */ +proto.tendermint.consensus.EndHeight.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.EndHeight; + return proto.tendermint.consensus.EndHeight.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.EndHeight} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.EndHeight} + */ +proto.tendermint.consensus.EndHeight.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.EndHeight.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.EndHeight.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.EndHeight} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.EndHeight.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.consensus.EndHeight.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.consensus.EndHeight} returns this + */ +proto.tendermint.consensus.EndHeight.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.consensus.WALMessage.oneofGroups_ = [[1,2,3,4]]; + +/** + * @enum {number} + */ +proto.tendermint.consensus.WALMessage.SumCase = { + SUM_NOT_SET: 0, + EVENT_DATA_ROUND_STATE: 1, + MSG_INFO: 2, + TIMEOUT_INFO: 3, + END_HEIGHT: 4 +}; + +/** + * @return {proto.tendermint.consensus.WALMessage.SumCase} + */ +proto.tendermint.consensus.WALMessage.prototype.getSumCase = function() { + return /** @type {proto.tendermint.consensus.WALMessage.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.consensus.WALMessage.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.WALMessage.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.WALMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.WALMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.WALMessage.toObject = function(includeInstance, msg) { + var f, obj = { + eventDataRoundState: (f = msg.getEventDataRoundState()) && tendermint_types_events_pb.EventDataRoundState.toObject(includeInstance, f), + msgInfo: (f = msg.getMsgInfo()) && proto.tendermint.consensus.MsgInfo.toObject(includeInstance, f), + timeoutInfo: (f = msg.getTimeoutInfo()) && proto.tendermint.consensus.TimeoutInfo.toObject(includeInstance, f), + endHeight: (f = msg.getEndHeight()) && proto.tendermint.consensus.EndHeight.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.WALMessage} + */ +proto.tendermint.consensus.WALMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.WALMessage; + return proto.tendermint.consensus.WALMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.WALMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.WALMessage} + */ +proto.tendermint.consensus.WALMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_events_pb.EventDataRoundState; + reader.readMessage(value,tendermint_types_events_pb.EventDataRoundState.deserializeBinaryFromReader); + msg.setEventDataRoundState(value); + break; + case 2: + var value = new proto.tendermint.consensus.MsgInfo; + reader.readMessage(value,proto.tendermint.consensus.MsgInfo.deserializeBinaryFromReader); + msg.setMsgInfo(value); + break; + case 3: + var value = new proto.tendermint.consensus.TimeoutInfo; + reader.readMessage(value,proto.tendermint.consensus.TimeoutInfo.deserializeBinaryFromReader); + msg.setTimeoutInfo(value); + break; + case 4: + var value = new proto.tendermint.consensus.EndHeight; + reader.readMessage(value,proto.tendermint.consensus.EndHeight.deserializeBinaryFromReader); + msg.setEndHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.WALMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.WALMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.WALMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.WALMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEventDataRoundState(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_events_pb.EventDataRoundState.serializeBinaryToWriter + ); + } + f = message.getMsgInfo(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.consensus.MsgInfo.serializeBinaryToWriter + ); + } + f = message.getTimeoutInfo(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.consensus.TimeoutInfo.serializeBinaryToWriter + ); + } + f = message.getEndHeight(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.consensus.EndHeight.serializeBinaryToWriter + ); + } +}; + + +/** + * optional tendermint.types.EventDataRoundState event_data_round_state = 1; + * @return {?proto.tendermint.types.EventDataRoundState} + */ +proto.tendermint.consensus.WALMessage.prototype.getEventDataRoundState = function() { + return /** @type{?proto.tendermint.types.EventDataRoundState} */ ( + jspb.Message.getWrapperField(this, tendermint_types_events_pb.EventDataRoundState, 1)); +}; + + +/** + * @param {?proto.tendermint.types.EventDataRoundState|undefined} value + * @return {!proto.tendermint.consensus.WALMessage} returns this +*/ +proto.tendermint.consensus.WALMessage.prototype.setEventDataRoundState = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.consensus.WALMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.WALMessage} returns this + */ +proto.tendermint.consensus.WALMessage.prototype.clearEventDataRoundState = function() { + return this.setEventDataRoundState(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.WALMessage.prototype.hasEventDataRoundState = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional MsgInfo msg_info = 2; + * @return {?proto.tendermint.consensus.MsgInfo} + */ +proto.tendermint.consensus.WALMessage.prototype.getMsgInfo = function() { + return /** @type{?proto.tendermint.consensus.MsgInfo} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.MsgInfo, 2)); +}; + + +/** + * @param {?proto.tendermint.consensus.MsgInfo|undefined} value + * @return {!proto.tendermint.consensus.WALMessage} returns this +*/ +proto.tendermint.consensus.WALMessage.prototype.setMsgInfo = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.consensus.WALMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.WALMessage} returns this + */ +proto.tendermint.consensus.WALMessage.prototype.clearMsgInfo = function() { + return this.setMsgInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.WALMessage.prototype.hasMsgInfo = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional TimeoutInfo timeout_info = 3; + * @return {?proto.tendermint.consensus.TimeoutInfo} + */ +proto.tendermint.consensus.WALMessage.prototype.getTimeoutInfo = function() { + return /** @type{?proto.tendermint.consensus.TimeoutInfo} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.TimeoutInfo, 3)); +}; + + +/** + * @param {?proto.tendermint.consensus.TimeoutInfo|undefined} value + * @return {!proto.tendermint.consensus.WALMessage} returns this +*/ +proto.tendermint.consensus.WALMessage.prototype.setTimeoutInfo = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.tendermint.consensus.WALMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.WALMessage} returns this + */ +proto.tendermint.consensus.WALMessage.prototype.clearTimeoutInfo = function() { + return this.setTimeoutInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.WALMessage.prototype.hasTimeoutInfo = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional EndHeight end_height = 4; + * @return {?proto.tendermint.consensus.EndHeight} + */ +proto.tendermint.consensus.WALMessage.prototype.getEndHeight = function() { + return /** @type{?proto.tendermint.consensus.EndHeight} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.EndHeight, 4)); +}; + + +/** + * @param {?proto.tendermint.consensus.EndHeight|undefined} value + * @return {!proto.tendermint.consensus.WALMessage} returns this +*/ +proto.tendermint.consensus.WALMessage.prototype.setEndHeight = function(value) { + return jspb.Message.setOneofWrapperField(this, 4, proto.tendermint.consensus.WALMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.WALMessage} returns this + */ +proto.tendermint.consensus.WALMessage.prototype.clearEndHeight = function() { + return this.setEndHeight(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.WALMessage.prototype.hasEndHeight = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.consensus.TimedWALMessage.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.consensus.TimedWALMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.consensus.TimedWALMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.TimedWALMessage.toObject = function(includeInstance, msg) { + var f, obj = { + time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + msg: (f = msg.getMsg()) && proto.tendermint.consensus.WALMessage.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.consensus.TimedWALMessage} + */ +proto.tendermint.consensus.TimedWALMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.consensus.TimedWALMessage; + return proto.tendermint.consensus.TimedWALMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.consensus.TimedWALMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.consensus.TimedWALMessage} + */ +proto.tendermint.consensus.TimedWALMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTime(value); + break; + case 2: + var value = new proto.tendermint.consensus.WALMessage; + reader.readMessage(value,proto.tendermint.consensus.WALMessage.deserializeBinaryFromReader); + msg.setMsg(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.consensus.TimedWALMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.consensus.TimedWALMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.consensus.TimedWALMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.consensus.TimedWALMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTime(); + if (f != null) { + writer.writeMessage( + 1, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getMsg(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.consensus.WALMessage.serializeBinaryToWriter + ); + } +}; + + +/** + * optional google.protobuf.Timestamp time = 1; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.consensus.TimedWALMessage.prototype.getTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 1)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.consensus.TimedWALMessage} returns this +*/ +proto.tendermint.consensus.TimedWALMessage.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.TimedWALMessage} returns this + */ +proto.tendermint.consensus.TimedWALMessage.prototype.clearTime = function() { + return this.setTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.TimedWALMessage.prototype.hasTime = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional WALMessage msg = 2; + * @return {?proto.tendermint.consensus.WALMessage} + */ +proto.tendermint.consensus.TimedWALMessage.prototype.getMsg = function() { + return /** @type{?proto.tendermint.consensus.WALMessage} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.consensus.WALMessage, 2)); +}; + + +/** + * @param {?proto.tendermint.consensus.WALMessage|undefined} value + * @return {!proto.tendermint.consensus.TimedWALMessage} returns this +*/ +proto.tendermint.consensus.TimedWALMessage.prototype.setMsg = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.consensus.TimedWALMessage} returns this + */ +proto.tendermint.consensus.TimedWALMessage.prototype.clearMsg = function() { + return this.setMsg(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.consensus.TimedWALMessage.prototype.hasMsg = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +goog.object.extend(exports, proto.tendermint.consensus); diff --git a/js/proto/tendermint/crypto/keys_grpc_pb.js b/js/proto/tendermint/crypto/keys_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/crypto/keys_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/crypto/keys_pb.d.ts b/js/proto/tendermint/crypto/keys_pb.d.ts new file mode 100644 index 000000000..a4e9a2303 --- /dev/null +++ b/js/proto/tendermint/crypto/keys_pb.d.ts @@ -0,0 +1,55 @@ +// package: tendermint.crypto +// file: tendermint/crypto/keys.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; + +export class PublicKey extends jspb.Message { + + hasEd25519(): boolean; + clearEd25519(): void; + getEd25519(): Uint8Array | string; + getEd25519_asU8(): Uint8Array; + getEd25519_asB64(): string; + setEd25519(value: Uint8Array | string): PublicKey; + + + hasSecp256k1(): boolean; + clearSecp256k1(): void; + getSecp256k1(): Uint8Array | string; + getSecp256k1_asU8(): Uint8Array; + getSecp256k1_asB64(): string; + setSecp256k1(value: Uint8Array | string): PublicKey; + + + getSumCase(): PublicKey.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PublicKey.AsObject; + static toObject(includeInstance: boolean, msg: PublicKey): PublicKey.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PublicKey, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PublicKey; + static deserializeBinaryFromReader(message: PublicKey, reader: jspb.BinaryReader): PublicKey; +} + +export namespace PublicKey { + export type AsObject = { + ed25519: Uint8Array | string, + secp256k1: Uint8Array | string, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + ED25519 = 1, + + SECP256K1 = 2, + + } + +} diff --git a/js/proto/tendermint/crypto/keys_pb.js b/js/proto/tendermint/crypto/keys_pb.js new file mode 100644 index 000000000..89acbb08f --- /dev/null +++ b/js/proto/tendermint/crypto/keys_pb.js @@ -0,0 +1,312 @@ +// source: tendermint/crypto/keys.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.tendermint.crypto.PublicKey', null, global); +goog.exportSymbol('proto.tendermint.crypto.PublicKey.SumCase', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.crypto.PublicKey = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.crypto.PublicKey.oneofGroups_); +}; +goog.inherits(proto.tendermint.crypto.PublicKey, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.crypto.PublicKey.displayName = 'proto.tendermint.crypto.PublicKey'; +} + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.crypto.PublicKey.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.tendermint.crypto.PublicKey.SumCase = { + SUM_NOT_SET: 0, + ED25519: 1, + SECP256K1: 2 +}; + +/** + * @return {proto.tendermint.crypto.PublicKey.SumCase} + */ +proto.tendermint.crypto.PublicKey.prototype.getSumCase = function() { + return /** @type {proto.tendermint.crypto.PublicKey.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.crypto.PublicKey.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.crypto.PublicKey.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.crypto.PublicKey.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.crypto.PublicKey} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.PublicKey.toObject = function(includeInstance, msg) { + var f, obj = { + ed25519: msg.getEd25519_asB64(), + secp256k1: msg.getSecp256k1_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.crypto.PublicKey} + */ +proto.tendermint.crypto.PublicKey.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.crypto.PublicKey; + return proto.tendermint.crypto.PublicKey.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.crypto.PublicKey} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.crypto.PublicKey} + */ +proto.tendermint.crypto.PublicKey.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setEd25519(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSecp256k1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.crypto.PublicKey.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.crypto.PublicKey.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.crypto.PublicKey} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.PublicKey.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBytes( + 1, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional bytes ed25519 = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.crypto.PublicKey.prototype.getEd25519 = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes ed25519 = 1; + * This is a type-conversion wrapper around `getEd25519()` + * @return {string} + */ +proto.tendermint.crypto.PublicKey.prototype.getEd25519_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getEd25519())); +}; + + +/** + * optional bytes ed25519 = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getEd25519()` + * @return {!Uint8Array} + */ +proto.tendermint.crypto.PublicKey.prototype.getEd25519_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getEd25519())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.crypto.PublicKey} returns this + */ +proto.tendermint.crypto.PublicKey.prototype.setEd25519 = function(value) { + return jspb.Message.setOneofField(this, 1, proto.tendermint.crypto.PublicKey.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.tendermint.crypto.PublicKey} returns this + */ +proto.tendermint.crypto.PublicKey.prototype.clearEd25519 = function() { + return jspb.Message.setOneofField(this, 1, proto.tendermint.crypto.PublicKey.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.crypto.PublicKey.prototype.hasEd25519 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes secp256k1 = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.crypto.PublicKey.prototype.getSecp256k1 = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes secp256k1 = 2; + * This is a type-conversion wrapper around `getSecp256k1()` + * @return {string} + */ +proto.tendermint.crypto.PublicKey.prototype.getSecp256k1_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSecp256k1())); +}; + + +/** + * optional bytes secp256k1 = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSecp256k1()` + * @return {!Uint8Array} + */ +proto.tendermint.crypto.PublicKey.prototype.getSecp256k1_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSecp256k1())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.crypto.PublicKey} returns this + */ +proto.tendermint.crypto.PublicKey.prototype.setSecp256k1 = function(value) { + return jspb.Message.setOneofField(this, 2, proto.tendermint.crypto.PublicKey.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.tendermint.crypto.PublicKey} returns this + */ +proto.tendermint.crypto.PublicKey.prototype.clearSecp256k1 = function() { + return jspb.Message.setOneofField(this, 2, proto.tendermint.crypto.PublicKey.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.crypto.PublicKey.prototype.hasSecp256k1 = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +goog.object.extend(exports, proto.tendermint.crypto); diff --git a/js/proto/tendermint/crypto/proof_grpc_pb.js b/js/proto/tendermint/crypto/proof_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/crypto/proof_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/crypto/proof_pb.d.ts b/js/proto/tendermint/crypto/proof_pb.d.ts new file mode 100644 index 000000000..df2ddb53d --- /dev/null +++ b/js/proto/tendermint/crypto/proof_pb.d.ts @@ -0,0 +1,162 @@ +// package: tendermint.crypto +// file: tendermint/crypto/proof.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; + +export class Proof extends jspb.Message { + getTotal(): number; + setTotal(value: number): Proof; + + getIndex(): number; + setIndex(value: number): Proof; + + getLeafHash(): Uint8Array | string; + getLeafHash_asU8(): Uint8Array; + getLeafHash_asB64(): string; + setLeafHash(value: Uint8Array | string): Proof; + + clearAuntsList(): void; + getAuntsList(): Array; + getAuntsList_asU8(): Array; + getAuntsList_asB64(): Array; + setAuntsList(value: Array): Proof; + addAunts(value: Uint8Array | string, index?: number): Uint8Array | string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Proof.AsObject; + static toObject(includeInstance: boolean, msg: Proof): Proof.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Proof, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Proof; + static deserializeBinaryFromReader(message: Proof, reader: jspb.BinaryReader): Proof; +} + +export namespace Proof { + export type AsObject = { + total: number, + index: number, + leafHash: Uint8Array | string, + auntsList: Array, + } +} + +export class ValueOp extends jspb.Message { + getKey(): Uint8Array | string; + getKey_asU8(): Uint8Array; + getKey_asB64(): string; + setKey(value: Uint8Array | string): ValueOp; + + + hasProof(): boolean; + clearProof(): void; + getProof(): Proof | undefined; + setProof(value?: Proof): ValueOp; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ValueOp.AsObject; + static toObject(includeInstance: boolean, msg: ValueOp): ValueOp.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ValueOp, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ValueOp; + static deserializeBinaryFromReader(message: ValueOp, reader: jspb.BinaryReader): ValueOp; +} + +export namespace ValueOp { + export type AsObject = { + key: Uint8Array | string, + proof?: Proof.AsObject, + } +} + +export class DominoOp extends jspb.Message { + getKey(): string; + setKey(value: string): DominoOp; + + getInput(): string; + setInput(value: string): DominoOp; + + getOutput(): string; + setOutput(value: string): DominoOp; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DominoOp.AsObject; + static toObject(includeInstance: boolean, msg: DominoOp): DominoOp.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DominoOp, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DominoOp; + static deserializeBinaryFromReader(message: DominoOp, reader: jspb.BinaryReader): DominoOp; +} + +export namespace DominoOp { + export type AsObject = { + key: string, + input: string, + output: string, + } +} + +export class ProofOp extends jspb.Message { + getType(): string; + setType(value: string): ProofOp; + + getKey(): Uint8Array | string; + getKey_asU8(): Uint8Array; + getKey_asB64(): string; + setKey(value: Uint8Array | string): ProofOp; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): ProofOp; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProofOp.AsObject; + static toObject(includeInstance: boolean, msg: ProofOp): ProofOp.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProofOp, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProofOp; + static deserializeBinaryFromReader(message: ProofOp, reader: jspb.BinaryReader): ProofOp; +} + +export namespace ProofOp { + export type AsObject = { + type: string, + key: Uint8Array | string, + data: Uint8Array | string, + } +} + +export class ProofOps extends jspb.Message { + clearOpsList(): void; + getOpsList(): Array; + setOpsList(value: Array): ProofOps; + addOps(value?: ProofOp, index?: number): ProofOp; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProofOps.AsObject; + static toObject(includeInstance: boolean, msg: ProofOps): ProofOps.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProofOps, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProofOps; + static deserializeBinaryFromReader(message: ProofOps, reader: jspb.BinaryReader): ProofOps; +} + +export namespace ProofOps { + export type AsObject = { + opsList: Array, + } +} diff --git a/js/proto/tendermint/crypto/proof_pb.js b/js/proto/tendermint/crypto/proof_pb.js new file mode 100644 index 000000000..96338204a --- /dev/null +++ b/js/proto/tendermint/crypto/proof_pb.js @@ -0,0 +1,1216 @@ +// source: tendermint/crypto/proof.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.tendermint.crypto.DominoOp', null, global); +goog.exportSymbol('proto.tendermint.crypto.Proof', null, global); +goog.exportSymbol('proto.tendermint.crypto.ProofOp', null, global); +goog.exportSymbol('proto.tendermint.crypto.ProofOps', null, global); +goog.exportSymbol('proto.tendermint.crypto.ValueOp', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.crypto.Proof = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.crypto.Proof.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.crypto.Proof, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.crypto.Proof.displayName = 'proto.tendermint.crypto.Proof'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.crypto.ValueOp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.crypto.ValueOp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.crypto.ValueOp.displayName = 'proto.tendermint.crypto.ValueOp'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.crypto.DominoOp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.crypto.DominoOp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.crypto.DominoOp.displayName = 'proto.tendermint.crypto.DominoOp'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.crypto.ProofOp = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.crypto.ProofOp, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.crypto.ProofOp.displayName = 'proto.tendermint.crypto.ProofOp'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.crypto.ProofOps = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.crypto.ProofOps.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.crypto.ProofOps, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.crypto.ProofOps.displayName = 'proto.tendermint.crypto.ProofOps'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.crypto.Proof.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.crypto.Proof.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.crypto.Proof.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.crypto.Proof} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.Proof.toObject = function(includeInstance, msg) { + var f, obj = { + total: jspb.Message.getFieldWithDefault(msg, 1, 0), + index: jspb.Message.getFieldWithDefault(msg, 2, 0), + leafHash: msg.getLeafHash_asB64(), + auntsList: msg.getAuntsList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.crypto.Proof} + */ +proto.tendermint.crypto.Proof.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.crypto.Proof; + return proto.tendermint.crypto.Proof.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.crypto.Proof} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.crypto.Proof} + */ +proto.tendermint.crypto.Proof.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTotal(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setIndex(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLeafHash(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addAunts(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.crypto.Proof.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.crypto.Proof.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.crypto.Proof} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.Proof.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTotal(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getLeafHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getAuntsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 4, + f + ); + } +}; + + +/** + * optional int64 total = 1; + * @return {number} + */ +proto.tendermint.crypto.Proof.prototype.getTotal = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.crypto.Proof} returns this + */ +proto.tendermint.crypto.Proof.prototype.setTotal = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int64 index = 2; + * @return {number} + */ +proto.tendermint.crypto.Proof.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.crypto.Proof} returns this + */ +proto.tendermint.crypto.Proof.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bytes leaf_hash = 3; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.crypto.Proof.prototype.getLeafHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes leaf_hash = 3; + * This is a type-conversion wrapper around `getLeafHash()` + * @return {string} + */ +proto.tendermint.crypto.Proof.prototype.getLeafHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLeafHash())); +}; + + +/** + * optional bytes leaf_hash = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLeafHash()` + * @return {!Uint8Array} + */ +proto.tendermint.crypto.Proof.prototype.getLeafHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLeafHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.crypto.Proof} returns this + */ +proto.tendermint.crypto.Proof.prototype.setLeafHash = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * repeated bytes aunts = 4; + * @return {!(Array|Array)} + */ +proto.tendermint.crypto.Proof.prototype.getAuntsList = function() { + return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * repeated bytes aunts = 4; + * This is a type-conversion wrapper around `getAuntsList()` + * @return {!Array} + */ +proto.tendermint.crypto.Proof.prototype.getAuntsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getAuntsList())); +}; + + +/** + * repeated bytes aunts = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAuntsList()` + * @return {!Array} + */ +proto.tendermint.crypto.Proof.prototype.getAuntsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getAuntsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.tendermint.crypto.Proof} returns this + */ +proto.tendermint.crypto.Proof.prototype.setAuntsList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.tendermint.crypto.Proof} returns this + */ +proto.tendermint.crypto.Proof.prototype.addAunts = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.crypto.Proof} returns this + */ +proto.tendermint.crypto.Proof.prototype.clearAuntsList = function() { + return this.setAuntsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.crypto.ValueOp.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.crypto.ValueOp.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.crypto.ValueOp} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.ValueOp.toObject = function(includeInstance, msg) { + var f, obj = { + key: msg.getKey_asB64(), + proof: (f = msg.getProof()) && proto.tendermint.crypto.Proof.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.crypto.ValueOp} + */ +proto.tendermint.crypto.ValueOp.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.crypto.ValueOp; + return proto.tendermint.crypto.ValueOp.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.crypto.ValueOp} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.crypto.ValueOp} + */ +proto.tendermint.crypto.ValueOp.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setKey(value); + break; + case 2: + var value = new proto.tendermint.crypto.Proof; + reader.readMessage(value,proto.tendermint.crypto.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.crypto.ValueOp.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.crypto.ValueOp.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.crypto.ValueOp} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.ValueOp.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.crypto.Proof.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes key = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.crypto.ValueOp.prototype.getKey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes key = 1; + * This is a type-conversion wrapper around `getKey()` + * @return {string} + */ +proto.tendermint.crypto.ValueOp.prototype.getKey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getKey())); +}; + + +/** + * optional bytes key = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKey()` + * @return {!Uint8Array} + */ +proto.tendermint.crypto.ValueOp.prototype.getKey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getKey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.crypto.ValueOp} returns this + */ +proto.tendermint.crypto.ValueOp.prototype.setKey = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional Proof proof = 2; + * @return {?proto.tendermint.crypto.Proof} + */ +proto.tendermint.crypto.ValueOp.prototype.getProof = function() { + return /** @type{?proto.tendermint.crypto.Proof} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.crypto.Proof, 2)); +}; + + +/** + * @param {?proto.tendermint.crypto.Proof|undefined} value + * @return {!proto.tendermint.crypto.ValueOp} returns this +*/ +proto.tendermint.crypto.ValueOp.prototype.setProof = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.crypto.ValueOp} returns this + */ +proto.tendermint.crypto.ValueOp.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.crypto.ValueOp.prototype.hasProof = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.crypto.DominoOp.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.crypto.DominoOp.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.crypto.DominoOp} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.DominoOp.toObject = function(includeInstance, msg) { + var f, obj = { + key: jspb.Message.getFieldWithDefault(msg, 1, ""), + input: jspb.Message.getFieldWithDefault(msg, 2, ""), + output: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.crypto.DominoOp} + */ +proto.tendermint.crypto.DominoOp.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.crypto.DominoOp; + return proto.tendermint.crypto.DominoOp.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.crypto.DominoOp} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.crypto.DominoOp} + */ +proto.tendermint.crypto.DominoOp.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setKey(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setInput(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setOutput(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.crypto.DominoOp.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.crypto.DominoOp.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.crypto.DominoOp} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.DominoOp.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getKey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getInput(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getOutput(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string key = 1; + * @return {string} + */ +proto.tendermint.crypto.DominoOp.prototype.getKey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.crypto.DominoOp} returns this + */ +proto.tendermint.crypto.DominoOp.prototype.setKey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string input = 2; + * @return {string} + */ +proto.tendermint.crypto.DominoOp.prototype.getInput = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.crypto.DominoOp} returns this + */ +proto.tendermint.crypto.DominoOp.prototype.setInput = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string output = 3; + * @return {string} + */ +proto.tendermint.crypto.DominoOp.prototype.getOutput = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.crypto.DominoOp} returns this + */ +proto.tendermint.crypto.DominoOp.prototype.setOutput = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.crypto.ProofOp.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.crypto.ProofOp.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.crypto.ProofOp} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.ProofOp.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, ""), + key: msg.getKey_asB64(), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.crypto.ProofOp} + */ +proto.tendermint.crypto.ProofOp.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.crypto.ProofOp; + return proto.tendermint.crypto.ProofOp.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.crypto.ProofOp} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.crypto.ProofOp} + */ +proto.tendermint.crypto.ProofOp.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setType(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setKey(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.crypto.ProofOp.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.crypto.ProofOp.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.crypto.ProofOp} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.ProofOp.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getKey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional string type = 1; + * @return {string} + */ +proto.tendermint.crypto.ProofOp.prototype.getType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.crypto.ProofOp} returns this + */ +proto.tendermint.crypto.ProofOp.prototype.setType = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bytes key = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.crypto.ProofOp.prototype.getKey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes key = 2; + * This is a type-conversion wrapper around `getKey()` + * @return {string} + */ +proto.tendermint.crypto.ProofOp.prototype.getKey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getKey())); +}; + + +/** + * optional bytes key = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKey()` + * @return {!Uint8Array} + */ +proto.tendermint.crypto.ProofOp.prototype.getKey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getKey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.crypto.ProofOp} returns this + */ +proto.tendermint.crypto.ProofOp.prototype.setKey = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes data = 3; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.crypto.ProofOp.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes data = 3; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.tendermint.crypto.ProofOp.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.tendermint.crypto.ProofOp.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.crypto.ProofOp} returns this + */ +proto.tendermint.crypto.ProofOp.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.crypto.ProofOps.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.crypto.ProofOps.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.crypto.ProofOps.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.crypto.ProofOps} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.ProofOps.toObject = function(includeInstance, msg) { + var f, obj = { + opsList: jspb.Message.toObjectList(msg.getOpsList(), + proto.tendermint.crypto.ProofOp.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.crypto.ProofOps} + */ +proto.tendermint.crypto.ProofOps.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.crypto.ProofOps; + return proto.tendermint.crypto.ProofOps.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.crypto.ProofOps} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.crypto.ProofOps} + */ +proto.tendermint.crypto.ProofOps.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.crypto.ProofOp; + reader.readMessage(value,proto.tendermint.crypto.ProofOp.deserializeBinaryFromReader); + msg.addOps(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.crypto.ProofOps.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.crypto.ProofOps.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.crypto.ProofOps} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.crypto.ProofOps.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getOpsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.tendermint.crypto.ProofOp.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated ProofOp ops = 1; + * @return {!Array} + */ +proto.tendermint.crypto.ProofOps.prototype.getOpsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.crypto.ProofOp, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.crypto.ProofOps} returns this +*/ +proto.tendermint.crypto.ProofOps.prototype.setOpsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.tendermint.crypto.ProofOp=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.crypto.ProofOp} + */ +proto.tendermint.crypto.ProofOps.prototype.addOps = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.tendermint.crypto.ProofOp, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.crypto.ProofOps} returns this + */ +proto.tendermint.crypto.ProofOps.prototype.clearOpsList = function() { + return this.setOpsList([]); +}; + + +goog.object.extend(exports, proto.tendermint.crypto); diff --git a/js/proto/tendermint/libs/bits/types_grpc_pb.js b/js/proto/tendermint/libs/bits/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/libs/bits/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/libs/bits/types_pb.d.ts b/js/proto/tendermint/libs/bits/types_pb.d.ts new file mode 100644 index 000000000..e57ad32dd --- /dev/null +++ b/js/proto/tendermint/libs/bits/types_pb.d.ts @@ -0,0 +1,34 @@ +// package: tendermint.libs.bits +// file: tendermint/libs/bits/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class BitArray extends jspb.Message { + getBits(): number; + setBits(value: number): BitArray; + + clearElemsList(): void; + getElemsList(): Array; + setElemsList(value: Array): BitArray; + addElems(value: number, index?: number): number; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BitArray.AsObject; + static toObject(includeInstance: boolean, msg: BitArray): BitArray.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BitArray, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BitArray; + static deserializeBinaryFromReader(message: BitArray, reader: jspb.BinaryReader): BitArray; +} + +export namespace BitArray { + export type AsObject = { + bits: number, + elemsList: Array, + } +} diff --git a/js/proto/tendermint/libs/bits/types_pb.js b/js/proto/tendermint/libs/bits/types_pb.js new file mode 100644 index 000000000..057b898f2 --- /dev/null +++ b/js/proto/tendermint/libs/bits/types_pb.js @@ -0,0 +1,227 @@ +// source: tendermint/libs/bits/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.tendermint.libs.bits.BitArray', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.libs.bits.BitArray = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.libs.bits.BitArray.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.libs.bits.BitArray, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.libs.bits.BitArray.displayName = 'proto.tendermint.libs.bits.BitArray'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.libs.bits.BitArray.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.libs.bits.BitArray.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.libs.bits.BitArray.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.libs.bits.BitArray} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.libs.bits.BitArray.toObject = function(includeInstance, msg) { + var f, obj = { + bits: jspb.Message.getFieldWithDefault(msg, 1, 0), + elemsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.libs.bits.BitArray} + */ +proto.tendermint.libs.bits.BitArray.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.libs.bits.BitArray; + return proto.tendermint.libs.bits.BitArray.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.libs.bits.BitArray} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.libs.bits.BitArray} + */ +proto.tendermint.libs.bits.BitArray.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setBits(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64() : [reader.readUint64()]); + for (var i = 0; i < values.length; i++) { + msg.addElems(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.libs.bits.BitArray.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.libs.bits.BitArray.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.libs.bits.BitArray} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.libs.bits.BitArray.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBits(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getElemsList(); + if (f.length > 0) { + writer.writePackedUint64( + 2, + f + ); + } +}; + + +/** + * optional int64 bits = 1; + * @return {number} + */ +proto.tendermint.libs.bits.BitArray.prototype.getBits = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.libs.bits.BitArray} returns this + */ +proto.tendermint.libs.bits.BitArray.prototype.setBits = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * repeated uint64 elems = 2; + * @return {!Array} + */ +proto.tendermint.libs.bits.BitArray.prototype.getElemsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.libs.bits.BitArray} returns this + */ +proto.tendermint.libs.bits.BitArray.prototype.setElemsList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.tendermint.libs.bits.BitArray} returns this + */ +proto.tendermint.libs.bits.BitArray.prototype.addElems = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.libs.bits.BitArray} returns this + */ +proto.tendermint.libs.bits.BitArray.prototype.clearElemsList = function() { + return this.setElemsList([]); +}; + + +goog.object.extend(exports, proto.tendermint.libs.bits); diff --git a/js/proto/tendermint/mempool/types_grpc_pb.js b/js/proto/tendermint/mempool/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/mempool/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/mempool/types_pb.d.ts b/js/proto/tendermint/mempool/types_pb.d.ts new file mode 100644 index 000000000..5b74e5f80 --- /dev/null +++ b/js/proto/tendermint/mempool/types_pb.d.ts @@ -0,0 +1,66 @@ +// package: tendermint.mempool +// file: tendermint/mempool/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class Txs extends jspb.Message { + clearTxsList(): void; + getTxsList(): Array; + getTxsList_asU8(): Array; + getTxsList_asB64(): Array; + setTxsList(value: Array): Txs; + addTxs(value: Uint8Array | string, index?: number): Uint8Array | string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Txs.AsObject; + static toObject(includeInstance: boolean, msg: Txs): Txs.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Txs, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Txs; + static deserializeBinaryFromReader(message: Txs, reader: jspb.BinaryReader): Txs; +} + +export namespace Txs { + export type AsObject = { + txsList: Array, + } +} + +export class Message extends jspb.Message { + + hasTxs(): boolean; + clearTxs(): void; + getTxs(): Txs | undefined; + setTxs(value?: Txs): Message; + + + getSumCase(): Message.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Message.AsObject; + static toObject(includeInstance: boolean, msg: Message): Message.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Message, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Message; + static deserializeBinaryFromReader(message: Message, reader: jspb.BinaryReader): Message; +} + +export namespace Message { + export type AsObject = { + txs?: Txs.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + TXS = 1, + + } + +} diff --git a/js/proto/tendermint/mempool/types_pb.js b/js/proto/tendermint/mempool/types_pb.js new file mode 100644 index 000000000..ed9910508 --- /dev/null +++ b/js/proto/tendermint/mempool/types_pb.js @@ -0,0 +1,418 @@ +// source: tendermint/mempool/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.tendermint.mempool.Message', null, global); +goog.exportSymbol('proto.tendermint.mempool.Message.SumCase', null, global); +goog.exportSymbol('proto.tendermint.mempool.Txs', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.mempool.Txs = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.mempool.Txs.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.mempool.Txs, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.mempool.Txs.displayName = 'proto.tendermint.mempool.Txs'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.mempool.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.mempool.Message.oneofGroups_); +}; +goog.inherits(proto.tendermint.mempool.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.mempool.Message.displayName = 'proto.tendermint.mempool.Message'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.mempool.Txs.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.mempool.Txs.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.mempool.Txs.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.mempool.Txs} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.mempool.Txs.toObject = function(includeInstance, msg) { + var f, obj = { + txsList: msg.getTxsList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.mempool.Txs} + */ +proto.tendermint.mempool.Txs.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.mempool.Txs; + return proto.tendermint.mempool.Txs.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.mempool.Txs} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.mempool.Txs} + */ +proto.tendermint.mempool.Txs.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addTxs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.mempool.Txs.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.mempool.Txs.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.mempool.Txs} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.mempool.Txs.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } +}; + + +/** + * repeated bytes txs = 1; + * @return {!(Array|Array)} + */ +proto.tendermint.mempool.Txs.prototype.getTxsList = function() { + return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes txs = 1; + * This is a type-conversion wrapper around `getTxsList()` + * @return {!Array} + */ +proto.tendermint.mempool.Txs.prototype.getTxsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getTxsList())); +}; + + +/** + * repeated bytes txs = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTxsList()` + * @return {!Array} + */ +proto.tendermint.mempool.Txs.prototype.getTxsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getTxsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.tendermint.mempool.Txs} returns this + */ +proto.tendermint.mempool.Txs.prototype.setTxsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.tendermint.mempool.Txs} returns this + */ +proto.tendermint.mempool.Txs.prototype.addTxs = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.mempool.Txs} returns this + */ +proto.tendermint.mempool.Txs.prototype.clearTxsList = function() { + return this.setTxsList([]); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.mempool.Message.oneofGroups_ = [[1]]; + +/** + * @enum {number} + */ +proto.tendermint.mempool.Message.SumCase = { + SUM_NOT_SET: 0, + TXS: 1 +}; + +/** + * @return {proto.tendermint.mempool.Message.SumCase} + */ +proto.tendermint.mempool.Message.prototype.getSumCase = function() { + return /** @type {proto.tendermint.mempool.Message.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.mempool.Message.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.mempool.Message.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.mempool.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.mempool.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.mempool.Message.toObject = function(includeInstance, msg) { + var f, obj = { + txs: (f = msg.getTxs()) && proto.tendermint.mempool.Txs.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.mempool.Message} + */ +proto.tendermint.mempool.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.mempool.Message; + return proto.tendermint.mempool.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.mempool.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.mempool.Message} + */ +proto.tendermint.mempool.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.mempool.Txs; + reader.readMessage(value,proto.tendermint.mempool.Txs.deserializeBinaryFromReader); + msg.setTxs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.mempool.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.mempool.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.mempool.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.mempool.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxs(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.mempool.Txs.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Txs txs = 1; + * @return {?proto.tendermint.mempool.Txs} + */ +proto.tendermint.mempool.Message.prototype.getTxs = function() { + return /** @type{?proto.tendermint.mempool.Txs} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.mempool.Txs, 1)); +}; + + +/** + * @param {?proto.tendermint.mempool.Txs|undefined} value + * @return {!proto.tendermint.mempool.Message} returns this +*/ +proto.tendermint.mempool.Message.prototype.setTxs = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.mempool.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.mempool.Message} returns this + */ +proto.tendermint.mempool.Message.prototype.clearTxs = function() { + return this.setTxs(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.mempool.Message.prototype.hasTxs = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +goog.object.extend(exports, proto.tendermint.mempool); diff --git a/js/proto/tendermint/p2p/conn_grpc_pb.js b/js/proto/tendermint/p2p/conn_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/p2p/conn_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/p2p/conn_pb.d.ts b/js/proto/tendermint/p2p/conn_pb.d.ts new file mode 100644 index 000000000..439a212ed --- /dev/null +++ b/js/proto/tendermint/p2p/conn_pb.d.ts @@ -0,0 +1,156 @@ +// package: tendermint.p2p +// file: tendermint/p2p/conn.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as tendermint_crypto_keys_pb from "../../tendermint/crypto/keys_pb"; + +export class PacketPing extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PacketPing.AsObject; + static toObject(includeInstance: boolean, msg: PacketPing): PacketPing.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PacketPing, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PacketPing; + static deserializeBinaryFromReader(message: PacketPing, reader: jspb.BinaryReader): PacketPing; +} + +export namespace PacketPing { + export type AsObject = { + } +} + +export class PacketPong extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PacketPong.AsObject; + static toObject(includeInstance: boolean, msg: PacketPong): PacketPong.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PacketPong, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PacketPong; + static deserializeBinaryFromReader(message: PacketPong, reader: jspb.BinaryReader): PacketPong; +} + +export namespace PacketPong { + export type AsObject = { + } +} + +export class PacketMsg extends jspb.Message { + getChannelId(): number; + setChannelId(value: number): PacketMsg; + + getEof(): boolean; + setEof(value: boolean): PacketMsg; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): PacketMsg; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PacketMsg.AsObject; + static toObject(includeInstance: boolean, msg: PacketMsg): PacketMsg.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PacketMsg, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PacketMsg; + static deserializeBinaryFromReader(message: PacketMsg, reader: jspb.BinaryReader): PacketMsg; +} + +export namespace PacketMsg { + export type AsObject = { + channelId: number, + eof: boolean, + data: Uint8Array | string, + } +} + +export class Packet extends jspb.Message { + + hasPacketPing(): boolean; + clearPacketPing(): void; + getPacketPing(): PacketPing | undefined; + setPacketPing(value?: PacketPing): Packet; + + + hasPacketPong(): boolean; + clearPacketPong(): void; + getPacketPong(): PacketPong | undefined; + setPacketPong(value?: PacketPong): Packet; + + + hasPacketMsg(): boolean; + clearPacketMsg(): void; + getPacketMsg(): PacketMsg | undefined; + setPacketMsg(value?: PacketMsg): Packet; + + + getSumCase(): Packet.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Packet.AsObject; + static toObject(includeInstance: boolean, msg: Packet): Packet.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Packet, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Packet; + static deserializeBinaryFromReader(message: Packet, reader: jspb.BinaryReader): Packet; +} + +export namespace Packet { + export type AsObject = { + packetPing?: PacketPing.AsObject, + packetPong?: PacketPong.AsObject, + packetMsg?: PacketMsg.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + PACKET_PING = 1, + + PACKET_PONG = 2, + + PACKET_MSG = 3, + + } + +} + +export class AuthSigMessage extends jspb.Message { + + hasPubKey(): boolean; + clearPubKey(): void; + getPubKey(): tendermint_crypto_keys_pb.PublicKey | undefined; + setPubKey(value?: tendermint_crypto_keys_pb.PublicKey): AuthSigMessage; + + getSig(): Uint8Array | string; + getSig_asU8(): Uint8Array; + getSig_asB64(): string; + setSig(value: Uint8Array | string): AuthSigMessage; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): AuthSigMessage.AsObject; + static toObject(includeInstance: boolean, msg: AuthSigMessage): AuthSigMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: AuthSigMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AuthSigMessage; + static deserializeBinaryFromReader(message: AuthSigMessage, reader: jspb.BinaryReader): AuthSigMessage; +} + +export namespace AuthSigMessage { + export type AsObject = { + pubKey?: tendermint_crypto_keys_pb.PublicKey.AsObject, + sig: Uint8Array | string, + } +} diff --git a/js/proto/tendermint/p2p/conn_pb.js b/js/proto/tendermint/p2p/conn_pb.js new file mode 100644 index 000000000..16628c3cf --- /dev/null +++ b/js/proto/tendermint/p2p/conn_pb.js @@ -0,0 +1,1033 @@ +// source: tendermint/p2p/conn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_crypto_keys_pb = require('../../tendermint/crypto/keys_pb.js'); +goog.object.extend(proto, tendermint_crypto_keys_pb); +goog.exportSymbol('proto.tendermint.p2p.AuthSigMessage', null, global); +goog.exportSymbol('proto.tendermint.p2p.Packet', null, global); +goog.exportSymbol('proto.tendermint.p2p.Packet.SumCase', null, global); +goog.exportSymbol('proto.tendermint.p2p.PacketMsg', null, global); +goog.exportSymbol('proto.tendermint.p2p.PacketPing', null, global); +goog.exportSymbol('proto.tendermint.p2p.PacketPong', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.PacketPing = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.PacketPing, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.PacketPing.displayName = 'proto.tendermint.p2p.PacketPing'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.PacketPong = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.PacketPong, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.PacketPong.displayName = 'proto.tendermint.p2p.PacketPong'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.PacketMsg = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.PacketMsg, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.PacketMsg.displayName = 'proto.tendermint.p2p.PacketMsg'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.Packet = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.p2p.Packet.oneofGroups_); +}; +goog.inherits(proto.tendermint.p2p.Packet, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.Packet.displayName = 'proto.tendermint.p2p.Packet'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.AuthSigMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.AuthSigMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.AuthSigMessage.displayName = 'proto.tendermint.p2p.AuthSigMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.PacketPing.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.PacketPing.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.PacketPing} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PacketPing.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.PacketPing} + */ +proto.tendermint.p2p.PacketPing.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.PacketPing; + return proto.tendermint.p2p.PacketPing.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.PacketPing} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.PacketPing} + */ +proto.tendermint.p2p.PacketPing.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.PacketPing.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.PacketPing.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.PacketPing} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PacketPing.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.PacketPong.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.PacketPong.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.PacketPong} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PacketPong.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.PacketPong} + */ +proto.tendermint.p2p.PacketPong.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.PacketPong; + return proto.tendermint.p2p.PacketPong.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.PacketPong} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.PacketPong} + */ +proto.tendermint.p2p.PacketPong.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.PacketPong.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.PacketPong.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.PacketPong} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PacketPong.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.PacketMsg.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.PacketMsg.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.PacketMsg} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PacketMsg.toObject = function(includeInstance, msg) { + var f, obj = { + channelId: jspb.Message.getFieldWithDefault(msg, 1, 0), + eof: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.PacketMsg} + */ +proto.tendermint.p2p.PacketMsg.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.PacketMsg; + return proto.tendermint.p2p.PacketMsg.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.PacketMsg} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.PacketMsg} + */ +proto.tendermint.p2p.PacketMsg.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setChannelId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setEof(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.PacketMsg.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.PacketMsg.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.PacketMsg} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PacketMsg.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getChannelId(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } + f = message.getEof(); + if (f) { + writer.writeBool( + 2, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional int32 channel_id = 1; + * @return {number} + */ +proto.tendermint.p2p.PacketMsg.prototype.getChannelId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.p2p.PacketMsg} returns this + */ +proto.tendermint.p2p.PacketMsg.prototype.setChannelId = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bool eof = 2; + * @return {boolean} + */ +proto.tendermint.p2p.PacketMsg.prototype.getEof = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.tendermint.p2p.PacketMsg} returns this + */ +proto.tendermint.p2p.PacketMsg.prototype.setEof = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional bytes data = 3; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.p2p.PacketMsg.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes data = 3; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.tendermint.p2p.PacketMsg.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.tendermint.p2p.PacketMsg.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.p2p.PacketMsg} returns this + */ +proto.tendermint.p2p.PacketMsg.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.p2p.Packet.oneofGroups_ = [[1,2,3]]; + +/** + * @enum {number} + */ +proto.tendermint.p2p.Packet.SumCase = { + SUM_NOT_SET: 0, + PACKET_PING: 1, + PACKET_PONG: 2, + PACKET_MSG: 3 +}; + +/** + * @return {proto.tendermint.p2p.Packet.SumCase} + */ +proto.tendermint.p2p.Packet.prototype.getSumCase = function() { + return /** @type {proto.tendermint.p2p.Packet.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.p2p.Packet.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.Packet.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.Packet.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.Packet} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.Packet.toObject = function(includeInstance, msg) { + var f, obj = { + packetPing: (f = msg.getPacketPing()) && proto.tendermint.p2p.PacketPing.toObject(includeInstance, f), + packetPong: (f = msg.getPacketPong()) && proto.tendermint.p2p.PacketPong.toObject(includeInstance, f), + packetMsg: (f = msg.getPacketMsg()) && proto.tendermint.p2p.PacketMsg.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.Packet} + */ +proto.tendermint.p2p.Packet.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.Packet; + return proto.tendermint.p2p.Packet.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.Packet} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.Packet} + */ +proto.tendermint.p2p.Packet.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.p2p.PacketPing; + reader.readMessage(value,proto.tendermint.p2p.PacketPing.deserializeBinaryFromReader); + msg.setPacketPing(value); + break; + case 2: + var value = new proto.tendermint.p2p.PacketPong; + reader.readMessage(value,proto.tendermint.p2p.PacketPong.deserializeBinaryFromReader); + msg.setPacketPong(value); + break; + case 3: + var value = new proto.tendermint.p2p.PacketMsg; + reader.readMessage(value,proto.tendermint.p2p.PacketMsg.deserializeBinaryFromReader); + msg.setPacketMsg(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.Packet.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.Packet.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.Packet} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.Packet.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPacketPing(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.p2p.PacketPing.serializeBinaryToWriter + ); + } + f = message.getPacketPong(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.p2p.PacketPong.serializeBinaryToWriter + ); + } + f = message.getPacketMsg(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.p2p.PacketMsg.serializeBinaryToWriter + ); + } +}; + + +/** + * optional PacketPing packet_ping = 1; + * @return {?proto.tendermint.p2p.PacketPing} + */ +proto.tendermint.p2p.Packet.prototype.getPacketPing = function() { + return /** @type{?proto.tendermint.p2p.PacketPing} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.p2p.PacketPing, 1)); +}; + + +/** + * @param {?proto.tendermint.p2p.PacketPing|undefined} value + * @return {!proto.tendermint.p2p.Packet} returns this +*/ +proto.tendermint.p2p.Packet.prototype.setPacketPing = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.p2p.Packet.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.p2p.Packet} returns this + */ +proto.tendermint.p2p.Packet.prototype.clearPacketPing = function() { + return this.setPacketPing(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.p2p.Packet.prototype.hasPacketPing = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional PacketPong packet_pong = 2; + * @return {?proto.tendermint.p2p.PacketPong} + */ +proto.tendermint.p2p.Packet.prototype.getPacketPong = function() { + return /** @type{?proto.tendermint.p2p.PacketPong} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.p2p.PacketPong, 2)); +}; + + +/** + * @param {?proto.tendermint.p2p.PacketPong|undefined} value + * @return {!proto.tendermint.p2p.Packet} returns this +*/ +proto.tendermint.p2p.Packet.prototype.setPacketPong = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.p2p.Packet.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.p2p.Packet} returns this + */ +proto.tendermint.p2p.Packet.prototype.clearPacketPong = function() { + return this.setPacketPong(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.p2p.Packet.prototype.hasPacketPong = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional PacketMsg packet_msg = 3; + * @return {?proto.tendermint.p2p.PacketMsg} + */ +proto.tendermint.p2p.Packet.prototype.getPacketMsg = function() { + return /** @type{?proto.tendermint.p2p.PacketMsg} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.p2p.PacketMsg, 3)); +}; + + +/** + * @param {?proto.tendermint.p2p.PacketMsg|undefined} value + * @return {!proto.tendermint.p2p.Packet} returns this +*/ +proto.tendermint.p2p.Packet.prototype.setPacketMsg = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.tendermint.p2p.Packet.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.p2p.Packet} returns this + */ +proto.tendermint.p2p.Packet.prototype.clearPacketMsg = function() { + return this.setPacketMsg(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.p2p.Packet.prototype.hasPacketMsg = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.AuthSigMessage.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.AuthSigMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.AuthSigMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.AuthSigMessage.toObject = function(includeInstance, msg) { + var f, obj = { + pubKey: (f = msg.getPubKey()) && tendermint_crypto_keys_pb.PublicKey.toObject(includeInstance, f), + sig: msg.getSig_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.AuthSigMessage} + */ +proto.tendermint.p2p.AuthSigMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.AuthSigMessage; + return proto.tendermint.p2p.AuthSigMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.AuthSigMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.AuthSigMessage} + */ +proto.tendermint.p2p.AuthSigMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_crypto_keys_pb.PublicKey; + reader.readMessage(value,tendermint_crypto_keys_pb.PublicKey.deserializeBinaryFromReader); + msg.setPubKey(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSig(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.AuthSigMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.AuthSigMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.AuthSigMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.AuthSigMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubKey(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_crypto_keys_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getSig_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional tendermint.crypto.PublicKey pub_key = 1; + * @return {?proto.tendermint.crypto.PublicKey} + */ +proto.tendermint.p2p.AuthSigMessage.prototype.getPubKey = function() { + return /** @type{?proto.tendermint.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, tendermint_crypto_keys_pb.PublicKey, 1)); +}; + + +/** + * @param {?proto.tendermint.crypto.PublicKey|undefined} value + * @return {!proto.tendermint.p2p.AuthSigMessage} returns this +*/ +proto.tendermint.p2p.AuthSigMessage.prototype.setPubKey = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.p2p.AuthSigMessage} returns this + */ +proto.tendermint.p2p.AuthSigMessage.prototype.clearPubKey = function() { + return this.setPubKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.p2p.AuthSigMessage.prototype.hasPubKey = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes sig = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.p2p.AuthSigMessage.prototype.getSig = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes sig = 2; + * This is a type-conversion wrapper around `getSig()` + * @return {string} + */ +proto.tendermint.p2p.AuthSigMessage.prototype.getSig_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSig())); +}; + + +/** + * optional bytes sig = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSig()` + * @return {!Uint8Array} + */ +proto.tendermint.p2p.AuthSigMessage.prototype.getSig_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSig())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.p2p.AuthSigMessage} returns this + */ +proto.tendermint.p2p.AuthSigMessage.prototype.setSig = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +goog.object.extend(exports, proto.tendermint.p2p); diff --git a/js/proto/tendermint/p2p/pex_grpc_pb.js b/js/proto/tendermint/p2p/pex_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/p2p/pex_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/p2p/pex_pb.d.ts b/js/proto/tendermint/p2p/pex_pb.d.ts new file mode 100644 index 000000000..a9a6642a5 --- /dev/null +++ b/js/proto/tendermint/p2p/pex_pb.d.ts @@ -0,0 +1,92 @@ +// package: tendermint.p2p +// file: tendermint/p2p/pex.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as tendermint_p2p_types_pb from "../../tendermint/p2p/types_pb"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; + +export class PexRequest extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PexRequest.AsObject; + static toObject(includeInstance: boolean, msg: PexRequest): PexRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PexRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PexRequest; + static deserializeBinaryFromReader(message: PexRequest, reader: jspb.BinaryReader): PexRequest; +} + +export namespace PexRequest { + export type AsObject = { + } +} + +export class PexAddrs extends jspb.Message { + clearAddrsList(): void; + getAddrsList(): Array; + setAddrsList(value: Array): PexAddrs; + addAddrs(value?: tendermint_p2p_types_pb.NetAddress, index?: number): tendermint_p2p_types_pb.NetAddress; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PexAddrs.AsObject; + static toObject(includeInstance: boolean, msg: PexAddrs): PexAddrs.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PexAddrs, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PexAddrs; + static deserializeBinaryFromReader(message: PexAddrs, reader: jspb.BinaryReader): PexAddrs; +} + +export namespace PexAddrs { + export type AsObject = { + addrsList: Array, + } +} + +export class Message extends jspb.Message { + + hasPexRequest(): boolean; + clearPexRequest(): void; + getPexRequest(): PexRequest | undefined; + setPexRequest(value?: PexRequest): Message; + + + hasPexAddrs(): boolean; + clearPexAddrs(): void; + getPexAddrs(): PexAddrs | undefined; + setPexAddrs(value?: PexAddrs): Message; + + + getSumCase(): Message.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Message.AsObject; + static toObject(includeInstance: boolean, msg: Message): Message.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Message, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Message; + static deserializeBinaryFromReader(message: Message, reader: jspb.BinaryReader): Message; +} + +export namespace Message { + export type AsObject = { + pexRequest?: PexRequest.AsObject, + pexAddrs?: PexAddrs.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + PEX_REQUEST = 1, + + PEX_ADDRS = 2, + + } + +} diff --git a/js/proto/tendermint/p2p/pex_pb.js b/js/proto/tendermint/p2p/pex_pb.js new file mode 100644 index 000000000..9e0ce1ff9 --- /dev/null +++ b/js/proto/tendermint/p2p/pex_pb.js @@ -0,0 +1,577 @@ +// source: tendermint/p2p/pex.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var tendermint_p2p_types_pb = require('../../tendermint/p2p/types_pb.js'); +goog.object.extend(proto, tendermint_p2p_types_pb); +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.tendermint.p2p.Message', null, global); +goog.exportSymbol('proto.tendermint.p2p.Message.SumCase', null, global); +goog.exportSymbol('proto.tendermint.p2p.PexAddrs', null, global); +goog.exportSymbol('proto.tendermint.p2p.PexRequest', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.PexRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.PexRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.PexRequest.displayName = 'proto.tendermint.p2p.PexRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.PexAddrs = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.p2p.PexAddrs.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.p2p.PexAddrs, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.PexAddrs.displayName = 'proto.tendermint.p2p.PexAddrs'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.p2p.Message.oneofGroups_); +}; +goog.inherits(proto.tendermint.p2p.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.Message.displayName = 'proto.tendermint.p2p.Message'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.PexRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.PexRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.PexRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PexRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.PexRequest} + */ +proto.tendermint.p2p.PexRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.PexRequest; + return proto.tendermint.p2p.PexRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.PexRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.PexRequest} + */ +proto.tendermint.p2p.PexRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.PexRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.PexRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.PexRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PexRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.p2p.PexAddrs.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.PexAddrs.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.PexAddrs.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.PexAddrs} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PexAddrs.toObject = function(includeInstance, msg) { + var f, obj = { + addrsList: jspb.Message.toObjectList(msg.getAddrsList(), + tendermint_p2p_types_pb.NetAddress.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.PexAddrs} + */ +proto.tendermint.p2p.PexAddrs.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.PexAddrs; + return proto.tendermint.p2p.PexAddrs.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.PexAddrs} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.PexAddrs} + */ +proto.tendermint.p2p.PexAddrs.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_p2p_types_pb.NetAddress; + reader.readMessage(value,tendermint_p2p_types_pb.NetAddress.deserializeBinaryFromReader); + msg.addAddrs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.PexAddrs.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.PexAddrs.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.PexAddrs} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.PexAddrs.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddrsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + tendermint_p2p_types_pb.NetAddress.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated NetAddress addrs = 1; + * @return {!Array} + */ +proto.tendermint.p2p.PexAddrs.prototype.getAddrsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, tendermint_p2p_types_pb.NetAddress, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.p2p.PexAddrs} returns this +*/ +proto.tendermint.p2p.PexAddrs.prototype.setAddrsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.tendermint.p2p.NetAddress=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.p2p.NetAddress} + */ +proto.tendermint.p2p.PexAddrs.prototype.addAddrs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.tendermint.p2p.NetAddress, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.p2p.PexAddrs} returns this + */ +proto.tendermint.p2p.PexAddrs.prototype.clearAddrsList = function() { + return this.setAddrsList([]); +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.p2p.Message.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.tendermint.p2p.Message.SumCase = { + SUM_NOT_SET: 0, + PEX_REQUEST: 1, + PEX_ADDRS: 2 +}; + +/** + * @return {proto.tendermint.p2p.Message.SumCase} + */ +proto.tendermint.p2p.Message.prototype.getSumCase = function() { + return /** @type {proto.tendermint.p2p.Message.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.p2p.Message.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.Message.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.Message.toObject = function(includeInstance, msg) { + var f, obj = { + pexRequest: (f = msg.getPexRequest()) && proto.tendermint.p2p.PexRequest.toObject(includeInstance, f), + pexAddrs: (f = msg.getPexAddrs()) && proto.tendermint.p2p.PexAddrs.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.Message} + */ +proto.tendermint.p2p.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.Message; + return proto.tendermint.p2p.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.Message} + */ +proto.tendermint.p2p.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.p2p.PexRequest; + reader.readMessage(value,proto.tendermint.p2p.PexRequest.deserializeBinaryFromReader); + msg.setPexRequest(value); + break; + case 2: + var value = new proto.tendermint.p2p.PexAddrs; + reader.readMessage(value,proto.tendermint.p2p.PexAddrs.deserializeBinaryFromReader); + msg.setPexAddrs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPexRequest(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.p2p.PexRequest.serializeBinaryToWriter + ); + } + f = message.getPexAddrs(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.p2p.PexAddrs.serializeBinaryToWriter + ); + } +}; + + +/** + * optional PexRequest pex_request = 1; + * @return {?proto.tendermint.p2p.PexRequest} + */ +proto.tendermint.p2p.Message.prototype.getPexRequest = function() { + return /** @type{?proto.tendermint.p2p.PexRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.p2p.PexRequest, 1)); +}; + + +/** + * @param {?proto.tendermint.p2p.PexRequest|undefined} value + * @return {!proto.tendermint.p2p.Message} returns this +*/ +proto.tendermint.p2p.Message.prototype.setPexRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.p2p.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.p2p.Message} returns this + */ +proto.tendermint.p2p.Message.prototype.clearPexRequest = function() { + return this.setPexRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.p2p.Message.prototype.hasPexRequest = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional PexAddrs pex_addrs = 2; + * @return {?proto.tendermint.p2p.PexAddrs} + */ +proto.tendermint.p2p.Message.prototype.getPexAddrs = function() { + return /** @type{?proto.tendermint.p2p.PexAddrs} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.p2p.PexAddrs, 2)); +}; + + +/** + * @param {?proto.tendermint.p2p.PexAddrs|undefined} value + * @return {!proto.tendermint.p2p.Message} returns this +*/ +proto.tendermint.p2p.Message.prototype.setPexAddrs = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.p2p.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.p2p.Message} returns this + */ +proto.tendermint.p2p.Message.prototype.clearPexAddrs = function() { + return this.setPexAddrs(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.p2p.Message.prototype.hasPexAddrs = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +goog.object.extend(exports, proto.tendermint.p2p); diff --git a/js/proto/tendermint/p2p/types_grpc_pb.js b/js/proto/tendermint/p2p/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/p2p/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/p2p/types_pb.d.ts b/js/proto/tendermint/p2p/types_pb.d.ts new file mode 100644 index 000000000..e854a6f36 --- /dev/null +++ b/js/proto/tendermint/p2p/types_pb.d.ts @@ -0,0 +1,148 @@ +// package: tendermint.p2p +// file: tendermint/p2p/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; + +export class NetAddress extends jspb.Message { + getId(): string; + setId(value: string): NetAddress; + + getIp(): string; + setIp(value: string): NetAddress; + + getPort(): number; + setPort(value: number): NetAddress; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NetAddress.AsObject; + static toObject(includeInstance: boolean, msg: NetAddress): NetAddress.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NetAddress, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NetAddress; + static deserializeBinaryFromReader(message: NetAddress, reader: jspb.BinaryReader): NetAddress; +} + +export namespace NetAddress { + export type AsObject = { + id: string, + ip: string, + port: number, + } +} + +export class ProtocolVersion extends jspb.Message { + getP2p(): number; + setP2p(value: number): ProtocolVersion; + + getBlock(): number; + setBlock(value: number): ProtocolVersion; + + getApp(): number; + setApp(value: number): ProtocolVersion; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProtocolVersion.AsObject; + static toObject(includeInstance: boolean, msg: ProtocolVersion): ProtocolVersion.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProtocolVersion, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProtocolVersion; + static deserializeBinaryFromReader(message: ProtocolVersion, reader: jspb.BinaryReader): ProtocolVersion; +} + +export namespace ProtocolVersion { + export type AsObject = { + p2p: number, + block: number, + app: number, + } +} + +export class DefaultNodeInfo extends jspb.Message { + + hasProtocolVersion(): boolean; + clearProtocolVersion(): void; + getProtocolVersion(): ProtocolVersion | undefined; + setProtocolVersion(value?: ProtocolVersion): DefaultNodeInfo; + + getDefaultNodeId(): string; + setDefaultNodeId(value: string): DefaultNodeInfo; + + getListenAddr(): string; + setListenAddr(value: string): DefaultNodeInfo; + + getNetwork(): string; + setNetwork(value: string): DefaultNodeInfo; + + getVersion(): string; + setVersion(value: string): DefaultNodeInfo; + + getChannels(): Uint8Array | string; + getChannels_asU8(): Uint8Array; + getChannels_asB64(): string; + setChannels(value: Uint8Array | string): DefaultNodeInfo; + + getMoniker(): string; + setMoniker(value: string): DefaultNodeInfo; + + + hasOther(): boolean; + clearOther(): void; + getOther(): DefaultNodeInfoOther | undefined; + setOther(value?: DefaultNodeInfoOther): DefaultNodeInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DefaultNodeInfo.AsObject; + static toObject(includeInstance: boolean, msg: DefaultNodeInfo): DefaultNodeInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DefaultNodeInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DefaultNodeInfo; + static deserializeBinaryFromReader(message: DefaultNodeInfo, reader: jspb.BinaryReader): DefaultNodeInfo; +} + +export namespace DefaultNodeInfo { + export type AsObject = { + protocolVersion?: ProtocolVersion.AsObject, + defaultNodeId: string, + listenAddr: string, + network: string, + version: string, + channels: Uint8Array | string, + moniker: string, + other?: DefaultNodeInfoOther.AsObject, + } +} + +export class DefaultNodeInfoOther extends jspb.Message { + getTxIndex(): string; + setTxIndex(value: string): DefaultNodeInfoOther; + + getRpcAddress(): string; + setRpcAddress(value: string): DefaultNodeInfoOther; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DefaultNodeInfoOther.AsObject; + static toObject(includeInstance: boolean, msg: DefaultNodeInfoOther): DefaultNodeInfoOther.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DefaultNodeInfoOther, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DefaultNodeInfoOther; + static deserializeBinaryFromReader(message: DefaultNodeInfoOther, reader: jspb.BinaryReader): DefaultNodeInfoOther; +} + +export namespace DefaultNodeInfoOther { + export type AsObject = { + txIndex: string, + rpcAddress: string, + } +} diff --git a/js/proto/tendermint/p2p/types_pb.js b/js/proto/tendermint/p2p/types_pb.js new file mode 100644 index 000000000..00eeecc00 --- /dev/null +++ b/js/proto/tendermint/p2p/types_pb.js @@ -0,0 +1,1053 @@ +// source: tendermint/p2p/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.tendermint.p2p.DefaultNodeInfo', null, global); +goog.exportSymbol('proto.tendermint.p2p.DefaultNodeInfoOther', null, global); +goog.exportSymbol('proto.tendermint.p2p.NetAddress', null, global); +goog.exportSymbol('proto.tendermint.p2p.ProtocolVersion', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.NetAddress = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.NetAddress, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.NetAddress.displayName = 'proto.tendermint.p2p.NetAddress'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.ProtocolVersion = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.ProtocolVersion, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.ProtocolVersion.displayName = 'proto.tendermint.p2p.ProtocolVersion'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.DefaultNodeInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.DefaultNodeInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.DefaultNodeInfo.displayName = 'proto.tendermint.p2p.DefaultNodeInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.p2p.DefaultNodeInfoOther = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.p2p.DefaultNodeInfoOther, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.p2p.DefaultNodeInfoOther.displayName = 'proto.tendermint.p2p.DefaultNodeInfoOther'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.NetAddress.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.NetAddress.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.NetAddress} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.NetAddress.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + ip: jspb.Message.getFieldWithDefault(msg, 2, ""), + port: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.NetAddress} + */ +proto.tendermint.p2p.NetAddress.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.NetAddress; + return proto.tendermint.p2p.NetAddress.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.NetAddress} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.NetAddress} + */ +proto.tendermint.p2p.NetAddress.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setIp(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setPort(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.NetAddress.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.NetAddress.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.NetAddress} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.NetAddress.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getIp(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getPort(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.tendermint.p2p.NetAddress.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.NetAddress} returns this + */ +proto.tendermint.p2p.NetAddress.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string ip = 2; + * @return {string} + */ +proto.tendermint.p2p.NetAddress.prototype.getIp = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.NetAddress} returns this + */ +proto.tendermint.p2p.NetAddress.prototype.setIp = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional uint32 port = 3; + * @return {number} + */ +proto.tendermint.p2p.NetAddress.prototype.getPort = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.p2p.NetAddress} returns this + */ +proto.tendermint.p2p.NetAddress.prototype.setPort = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.ProtocolVersion.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.ProtocolVersion.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.ProtocolVersion} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.ProtocolVersion.toObject = function(includeInstance, msg) { + var f, obj = { + p2p: jspb.Message.getFieldWithDefault(msg, 1, 0), + block: jspb.Message.getFieldWithDefault(msg, 2, 0), + app: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.ProtocolVersion} + */ +proto.tendermint.p2p.ProtocolVersion.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.ProtocolVersion; + return proto.tendermint.p2p.ProtocolVersion.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.ProtocolVersion} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.ProtocolVersion} + */ +proto.tendermint.p2p.ProtocolVersion.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setP2p(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setBlock(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setApp(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.ProtocolVersion.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.ProtocolVersion.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.ProtocolVersion} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.ProtocolVersion.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getP2p(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getBlock(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getApp(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } +}; + + +/** + * optional uint64 p2p = 1; + * @return {number} + */ +proto.tendermint.p2p.ProtocolVersion.prototype.getP2p = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.p2p.ProtocolVersion} returns this + */ +proto.tendermint.p2p.ProtocolVersion.prototype.setP2p = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 block = 2; + * @return {number} + */ +proto.tendermint.p2p.ProtocolVersion.prototype.getBlock = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.p2p.ProtocolVersion} returns this + */ +proto.tendermint.p2p.ProtocolVersion.prototype.setBlock = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint64 app = 3; + * @return {number} + */ +proto.tendermint.p2p.ProtocolVersion.prototype.getApp = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.p2p.ProtocolVersion} returns this + */ +proto.tendermint.p2p.ProtocolVersion.prototype.setApp = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.DefaultNodeInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.DefaultNodeInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.DefaultNodeInfo.toObject = function(includeInstance, msg) { + var f, obj = { + protocolVersion: (f = msg.getProtocolVersion()) && proto.tendermint.p2p.ProtocolVersion.toObject(includeInstance, f), + defaultNodeId: jspb.Message.getFieldWithDefault(msg, 2, ""), + listenAddr: jspb.Message.getFieldWithDefault(msg, 3, ""), + network: jspb.Message.getFieldWithDefault(msg, 4, ""), + version: jspb.Message.getFieldWithDefault(msg, 5, ""), + channels: msg.getChannels_asB64(), + moniker: jspb.Message.getFieldWithDefault(msg, 7, ""), + other: (f = msg.getOther()) && proto.tendermint.p2p.DefaultNodeInfoOther.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.DefaultNodeInfo} + */ +proto.tendermint.p2p.DefaultNodeInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.DefaultNodeInfo; + return proto.tendermint.p2p.DefaultNodeInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.DefaultNodeInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.DefaultNodeInfo} + */ +proto.tendermint.p2p.DefaultNodeInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.p2p.ProtocolVersion; + reader.readMessage(value,proto.tendermint.p2p.ProtocolVersion.deserializeBinaryFromReader); + msg.setProtocolVersion(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDefaultNodeId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setListenAddr(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setNetwork(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setVersion(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setChannels(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setMoniker(value); + break; + case 8: + var value = new proto.tendermint.p2p.DefaultNodeInfoOther; + reader.readMessage(value,proto.tendermint.p2p.DefaultNodeInfoOther.deserializeBinaryFromReader); + msg.setOther(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.DefaultNodeInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.DefaultNodeInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.DefaultNodeInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProtocolVersion(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.p2p.ProtocolVersion.serializeBinaryToWriter + ); + } + f = message.getDefaultNodeId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getListenAddr(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getNetwork(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getVersion(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getChannels_asU8(); + if (f.length > 0) { + writer.writeBytes( + 6, + f + ); + } + f = message.getMoniker(); + if (f.length > 0) { + writer.writeString( + 7, + f + ); + } + f = message.getOther(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.tendermint.p2p.DefaultNodeInfoOther.serializeBinaryToWriter + ); + } +}; + + +/** + * optional ProtocolVersion protocol_version = 1; + * @return {?proto.tendermint.p2p.ProtocolVersion} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getProtocolVersion = function() { + return /** @type{?proto.tendermint.p2p.ProtocolVersion} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.p2p.ProtocolVersion, 1)); +}; + + +/** + * @param {?proto.tendermint.p2p.ProtocolVersion|undefined} value + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this +*/ +proto.tendermint.p2p.DefaultNodeInfo.prototype.setProtocolVersion = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.clearProtocolVersion = function() { + return this.setProtocolVersion(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.hasProtocolVersion = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string default_node_id = 2; + * @return {string} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getDefaultNodeId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.setDefaultNodeId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string listen_addr = 3; + * @return {string} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getListenAddr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.setListenAddr = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string network = 4; + * @return {string} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getNetwork = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.setNetwork = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string version = 5; + * @return {string} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getVersion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.setVersion = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional bytes channels = 6; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getChannels = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes channels = 6; + * This is a type-conversion wrapper around `getChannels()` + * @return {string} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getChannels_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getChannels())); +}; + + +/** + * optional bytes channels = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getChannels()` + * @return {!Uint8Array} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getChannels_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getChannels())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.setChannels = function(value) { + return jspb.Message.setProto3BytesField(this, 6, value); +}; + + +/** + * optional string moniker = 7; + * @return {string} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getMoniker = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.setMoniker = function(value) { + return jspb.Message.setProto3StringField(this, 7, value); +}; + + +/** + * optional DefaultNodeInfoOther other = 8; + * @return {?proto.tendermint.p2p.DefaultNodeInfoOther} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.getOther = function() { + return /** @type{?proto.tendermint.p2p.DefaultNodeInfoOther} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.p2p.DefaultNodeInfoOther, 8)); +}; + + +/** + * @param {?proto.tendermint.p2p.DefaultNodeInfoOther|undefined} value + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this +*/ +proto.tendermint.p2p.DefaultNodeInfo.prototype.setOther = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.p2p.DefaultNodeInfo} returns this + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.clearOther = function() { + return this.setOther(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.p2p.DefaultNodeInfo.prototype.hasOther = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.p2p.DefaultNodeInfoOther.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.p2p.DefaultNodeInfoOther.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.p2p.DefaultNodeInfoOther} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.DefaultNodeInfoOther.toObject = function(includeInstance, msg) { + var f, obj = { + txIndex: jspb.Message.getFieldWithDefault(msg, 1, ""), + rpcAddress: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.p2p.DefaultNodeInfoOther} + */ +proto.tendermint.p2p.DefaultNodeInfoOther.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.p2p.DefaultNodeInfoOther; + return proto.tendermint.p2p.DefaultNodeInfoOther.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.p2p.DefaultNodeInfoOther} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.p2p.DefaultNodeInfoOther} + */ +proto.tendermint.p2p.DefaultNodeInfoOther.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setTxIndex(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setRpcAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.p2p.DefaultNodeInfoOther.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.p2p.DefaultNodeInfoOther.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.p2p.DefaultNodeInfoOther} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.p2p.DefaultNodeInfoOther.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxIndex(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getRpcAddress(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string tx_index = 1; + * @return {string} + */ +proto.tendermint.p2p.DefaultNodeInfoOther.prototype.getTxIndex = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.DefaultNodeInfoOther} returns this + */ +proto.tendermint.p2p.DefaultNodeInfoOther.prototype.setTxIndex = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string rpc_address = 2; + * @return {string} + */ +proto.tendermint.p2p.DefaultNodeInfoOther.prototype.getRpcAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.p2p.DefaultNodeInfoOther} returns this + */ +proto.tendermint.p2p.DefaultNodeInfoOther.prototype.setRpcAddress = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +goog.object.extend(exports, proto.tendermint.p2p); diff --git a/js/proto/tendermint/privval/types_grpc_pb.js b/js/proto/tendermint/privval/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/privval/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/privval/types_pb.d.ts b/js/proto/tendermint/privval/types_pb.d.ts new file mode 100644 index 000000000..ff0f131e0 --- /dev/null +++ b/js/proto/tendermint/privval/types_pb.d.ts @@ -0,0 +1,345 @@ +// package: tendermint.privval +// file: tendermint/privval/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as tendermint_crypto_keys_pb from "../../tendermint/crypto/keys_pb"; +import * as tendermint_types_types_pb from "../../tendermint/types/types_pb"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; + +export class RemoteSignerError extends jspb.Message { + getCode(): number; + setCode(value: number): RemoteSignerError; + + getDescription(): string; + setDescription(value: string): RemoteSignerError; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RemoteSignerError.AsObject; + static toObject(includeInstance: boolean, msg: RemoteSignerError): RemoteSignerError.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RemoteSignerError, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RemoteSignerError; + static deserializeBinaryFromReader(message: RemoteSignerError, reader: jspb.BinaryReader): RemoteSignerError; +} + +export namespace RemoteSignerError { + export type AsObject = { + code: number, + description: string, + } +} + +export class PubKeyRequest extends jspb.Message { + getChainId(): string; + setChainId(value: string): PubKeyRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PubKeyRequest.AsObject; + static toObject(includeInstance: boolean, msg: PubKeyRequest): PubKeyRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PubKeyRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PubKeyRequest; + static deserializeBinaryFromReader(message: PubKeyRequest, reader: jspb.BinaryReader): PubKeyRequest; +} + +export namespace PubKeyRequest { + export type AsObject = { + chainId: string, + } +} + +export class PubKeyResponse extends jspb.Message { + + hasPubKey(): boolean; + clearPubKey(): void; + getPubKey(): tendermint_crypto_keys_pb.PublicKey | undefined; + setPubKey(value?: tendermint_crypto_keys_pb.PublicKey): PubKeyResponse; + + + hasError(): boolean; + clearError(): void; + getError(): RemoteSignerError | undefined; + setError(value?: RemoteSignerError): PubKeyResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PubKeyResponse.AsObject; + static toObject(includeInstance: boolean, msg: PubKeyResponse): PubKeyResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PubKeyResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PubKeyResponse; + static deserializeBinaryFromReader(message: PubKeyResponse, reader: jspb.BinaryReader): PubKeyResponse; +} + +export namespace PubKeyResponse { + export type AsObject = { + pubKey?: tendermint_crypto_keys_pb.PublicKey.AsObject, + error?: RemoteSignerError.AsObject, + } +} + +export class SignVoteRequest extends jspb.Message { + + hasVote(): boolean; + clearVote(): void; + getVote(): tendermint_types_types_pb.Vote | undefined; + setVote(value?: tendermint_types_types_pb.Vote): SignVoteRequest; + + getChainId(): string; + setChainId(value: string): SignVoteRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SignVoteRequest.AsObject; + static toObject(includeInstance: boolean, msg: SignVoteRequest): SignVoteRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SignVoteRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SignVoteRequest; + static deserializeBinaryFromReader(message: SignVoteRequest, reader: jspb.BinaryReader): SignVoteRequest; +} + +export namespace SignVoteRequest { + export type AsObject = { + vote?: tendermint_types_types_pb.Vote.AsObject, + chainId: string, + } +} + +export class SignedVoteResponse extends jspb.Message { + + hasVote(): boolean; + clearVote(): void; + getVote(): tendermint_types_types_pb.Vote | undefined; + setVote(value?: tendermint_types_types_pb.Vote): SignedVoteResponse; + + + hasError(): boolean; + clearError(): void; + getError(): RemoteSignerError | undefined; + setError(value?: RemoteSignerError): SignedVoteResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SignedVoteResponse.AsObject; + static toObject(includeInstance: boolean, msg: SignedVoteResponse): SignedVoteResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SignedVoteResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SignedVoteResponse; + static deserializeBinaryFromReader(message: SignedVoteResponse, reader: jspb.BinaryReader): SignedVoteResponse; +} + +export namespace SignedVoteResponse { + export type AsObject = { + vote?: tendermint_types_types_pb.Vote.AsObject, + error?: RemoteSignerError.AsObject, + } +} + +export class SignProposalRequest extends jspb.Message { + + hasProposal(): boolean; + clearProposal(): void; + getProposal(): tendermint_types_types_pb.Proposal | undefined; + setProposal(value?: tendermint_types_types_pb.Proposal): SignProposalRequest; + + getChainId(): string; + setChainId(value: string): SignProposalRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SignProposalRequest.AsObject; + static toObject(includeInstance: boolean, msg: SignProposalRequest): SignProposalRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SignProposalRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SignProposalRequest; + static deserializeBinaryFromReader(message: SignProposalRequest, reader: jspb.BinaryReader): SignProposalRequest; +} + +export namespace SignProposalRequest { + export type AsObject = { + proposal?: tendermint_types_types_pb.Proposal.AsObject, + chainId: string, + } +} + +export class SignedProposalResponse extends jspb.Message { + + hasProposal(): boolean; + clearProposal(): void; + getProposal(): tendermint_types_types_pb.Proposal | undefined; + setProposal(value?: tendermint_types_types_pb.Proposal): SignedProposalResponse; + + + hasError(): boolean; + clearError(): void; + getError(): RemoteSignerError | undefined; + setError(value?: RemoteSignerError): SignedProposalResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SignedProposalResponse.AsObject; + static toObject(includeInstance: boolean, msg: SignedProposalResponse): SignedProposalResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SignedProposalResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SignedProposalResponse; + static deserializeBinaryFromReader(message: SignedProposalResponse, reader: jspb.BinaryReader): SignedProposalResponse; +} + +export namespace SignedProposalResponse { + export type AsObject = { + proposal?: tendermint_types_types_pb.Proposal.AsObject, + error?: RemoteSignerError.AsObject, + } +} + +export class PingRequest extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PingRequest.AsObject; + static toObject(includeInstance: boolean, msg: PingRequest): PingRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PingRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PingRequest; + static deserializeBinaryFromReader(message: PingRequest, reader: jspb.BinaryReader): PingRequest; +} + +export namespace PingRequest { + export type AsObject = { + } +} + +export class PingResponse extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PingResponse.AsObject; + static toObject(includeInstance: boolean, msg: PingResponse): PingResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PingResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PingResponse; + static deserializeBinaryFromReader(message: PingResponse, reader: jspb.BinaryReader): PingResponse; +} + +export namespace PingResponse { + export type AsObject = { + } +} + +export class Message extends jspb.Message { + + hasPubKeyRequest(): boolean; + clearPubKeyRequest(): void; + getPubKeyRequest(): PubKeyRequest | undefined; + setPubKeyRequest(value?: PubKeyRequest): Message; + + + hasPubKeyResponse(): boolean; + clearPubKeyResponse(): void; + getPubKeyResponse(): PubKeyResponse | undefined; + setPubKeyResponse(value?: PubKeyResponse): Message; + + + hasSignVoteRequest(): boolean; + clearSignVoteRequest(): void; + getSignVoteRequest(): SignVoteRequest | undefined; + setSignVoteRequest(value?: SignVoteRequest): Message; + + + hasSignedVoteResponse(): boolean; + clearSignedVoteResponse(): void; + getSignedVoteResponse(): SignedVoteResponse | undefined; + setSignedVoteResponse(value?: SignedVoteResponse): Message; + + + hasSignProposalRequest(): boolean; + clearSignProposalRequest(): void; + getSignProposalRequest(): SignProposalRequest | undefined; + setSignProposalRequest(value?: SignProposalRequest): Message; + + + hasSignedProposalResponse(): boolean; + clearSignedProposalResponse(): void; + getSignedProposalResponse(): SignedProposalResponse | undefined; + setSignedProposalResponse(value?: SignedProposalResponse): Message; + + + hasPingRequest(): boolean; + clearPingRequest(): void; + getPingRequest(): PingRequest | undefined; + setPingRequest(value?: PingRequest): Message; + + + hasPingResponse(): boolean; + clearPingResponse(): void; + getPingResponse(): PingResponse | undefined; + setPingResponse(value?: PingResponse): Message; + + + getSumCase(): Message.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Message.AsObject; + static toObject(includeInstance: boolean, msg: Message): Message.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Message, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Message; + static deserializeBinaryFromReader(message: Message, reader: jspb.BinaryReader): Message; +} + +export namespace Message { + export type AsObject = { + pubKeyRequest?: PubKeyRequest.AsObject, + pubKeyResponse?: PubKeyResponse.AsObject, + signVoteRequest?: SignVoteRequest.AsObject, + signedVoteResponse?: SignedVoteResponse.AsObject, + signProposalRequest?: SignProposalRequest.AsObject, + signedProposalResponse?: SignedProposalResponse.AsObject, + pingRequest?: PingRequest.AsObject, + pingResponse?: PingResponse.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + PUB_KEY_REQUEST = 1, + + PUB_KEY_RESPONSE = 2, + + SIGN_VOTE_REQUEST = 3, + + SIGNED_VOTE_RESPONSE = 4, + + SIGN_PROPOSAL_REQUEST = 5, + + SIGNED_PROPOSAL_RESPONSE = 6, + + PING_REQUEST = 7, + + PING_RESPONSE = 8, + + } + +} + +export enum Errors { + ERRORS_UNKNOWN = 0, + ERRORS_UNEXPECTED_RESPONSE = 1, + ERRORS_NO_CONNECTION = 2, + ERRORS_CONNECTION_TIMEOUT = 3, + ERRORS_READ_TIMEOUT = 4, + ERRORS_WRITE_TIMEOUT = 5, +} diff --git a/js/proto/tendermint/privval/types_pb.js b/js/proto/tendermint/privval/types_pb.js new file mode 100644 index 000000000..388f57893 --- /dev/null +++ b/js/proto/tendermint/privval/types_pb.js @@ -0,0 +1,2257 @@ +// source: tendermint/privval/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var tendermint_crypto_keys_pb = require('../../tendermint/crypto/keys_pb.js'); +goog.object.extend(proto, tendermint_crypto_keys_pb); +var tendermint_types_types_pb = require('../../tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.tendermint.privval.Errors', null, global); +goog.exportSymbol('proto.tendermint.privval.Message', null, global); +goog.exportSymbol('proto.tendermint.privval.Message.SumCase', null, global); +goog.exportSymbol('proto.tendermint.privval.PingRequest', null, global); +goog.exportSymbol('proto.tendermint.privval.PingResponse', null, global); +goog.exportSymbol('proto.tendermint.privval.PubKeyRequest', null, global); +goog.exportSymbol('proto.tendermint.privval.PubKeyResponse', null, global); +goog.exportSymbol('proto.tendermint.privval.RemoteSignerError', null, global); +goog.exportSymbol('proto.tendermint.privval.SignProposalRequest', null, global); +goog.exportSymbol('proto.tendermint.privval.SignVoteRequest', null, global); +goog.exportSymbol('proto.tendermint.privval.SignedProposalResponse', null, global); +goog.exportSymbol('proto.tendermint.privval.SignedVoteResponse', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.RemoteSignerError = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.RemoteSignerError, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.RemoteSignerError.displayName = 'proto.tendermint.privval.RemoteSignerError'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.PubKeyRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.PubKeyRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.PubKeyRequest.displayName = 'proto.tendermint.privval.PubKeyRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.PubKeyResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.PubKeyResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.PubKeyResponse.displayName = 'proto.tendermint.privval.PubKeyResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.SignVoteRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.SignVoteRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.SignVoteRequest.displayName = 'proto.tendermint.privval.SignVoteRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.SignedVoteResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.SignedVoteResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.SignedVoteResponse.displayName = 'proto.tendermint.privval.SignedVoteResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.SignProposalRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.SignProposalRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.SignProposalRequest.displayName = 'proto.tendermint.privval.SignProposalRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.SignedProposalResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.SignedProposalResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.SignedProposalResponse.displayName = 'proto.tendermint.privval.SignedProposalResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.PingRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.PingRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.PingRequest.displayName = 'proto.tendermint.privval.PingRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.PingResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.privval.PingResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.PingResponse.displayName = 'proto.tendermint.privval.PingResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.privval.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.privval.Message.oneofGroups_); +}; +goog.inherits(proto.tendermint.privval.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.privval.Message.displayName = 'proto.tendermint.privval.Message'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.RemoteSignerError.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.RemoteSignerError.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.RemoteSignerError} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.RemoteSignerError.toObject = function(includeInstance, msg) { + var f, obj = { + code: jspb.Message.getFieldWithDefault(msg, 1, 0), + description: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.RemoteSignerError} + */ +proto.tendermint.privval.RemoteSignerError.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.RemoteSignerError; + return proto.tendermint.privval.RemoteSignerError.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.RemoteSignerError} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.RemoteSignerError} + */ +proto.tendermint.privval.RemoteSignerError.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCode(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDescription(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.RemoteSignerError.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.RemoteSignerError.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.RemoteSignerError} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.RemoteSignerError.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCode(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } + f = message.getDescription(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional int32 code = 1; + * @return {number} + */ +proto.tendermint.privval.RemoteSignerError.prototype.getCode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.privval.RemoteSignerError} returns this + */ +proto.tendermint.privval.RemoteSignerError.prototype.setCode = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string description = 2; + * @return {string} + */ +proto.tendermint.privval.RemoteSignerError.prototype.getDescription = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.privval.RemoteSignerError} returns this + */ +proto.tendermint.privval.RemoteSignerError.prototype.setDescription = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.PubKeyRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.PubKeyRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.PubKeyRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.PubKeyRequest.toObject = function(includeInstance, msg) { + var f, obj = { + chainId: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.PubKeyRequest} + */ +proto.tendermint.privval.PubKeyRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.PubKeyRequest; + return proto.tendermint.privval.PubKeyRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.PubKeyRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.PubKeyRequest} + */ +proto.tendermint.privval.PubKeyRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.PubKeyRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.PubKeyRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.PubKeyRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.PubKeyRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string chain_id = 1; + * @return {string} + */ +proto.tendermint.privval.PubKeyRequest.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.privval.PubKeyRequest} returns this + */ +proto.tendermint.privval.PubKeyRequest.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.PubKeyResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.PubKeyResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.PubKeyResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.PubKeyResponse.toObject = function(includeInstance, msg) { + var f, obj = { + pubKey: (f = msg.getPubKey()) && tendermint_crypto_keys_pb.PublicKey.toObject(includeInstance, f), + error: (f = msg.getError()) && proto.tendermint.privval.RemoteSignerError.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.PubKeyResponse} + */ +proto.tendermint.privval.PubKeyResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.PubKeyResponse; + return proto.tendermint.privval.PubKeyResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.PubKeyResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.PubKeyResponse} + */ +proto.tendermint.privval.PubKeyResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_crypto_keys_pb.PublicKey; + reader.readMessage(value,tendermint_crypto_keys_pb.PublicKey.deserializeBinaryFromReader); + msg.setPubKey(value); + break; + case 2: + var value = new proto.tendermint.privval.RemoteSignerError; + reader.readMessage(value,proto.tendermint.privval.RemoteSignerError.deserializeBinaryFromReader); + msg.setError(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.PubKeyResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.PubKeyResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.PubKeyResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.PubKeyResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubKey(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_crypto_keys_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getError(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.privval.RemoteSignerError.serializeBinaryToWriter + ); + } +}; + + +/** + * optional tendermint.crypto.PublicKey pub_key = 1; + * @return {?proto.tendermint.crypto.PublicKey} + */ +proto.tendermint.privval.PubKeyResponse.prototype.getPubKey = function() { + return /** @type{?proto.tendermint.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, tendermint_crypto_keys_pb.PublicKey, 1)); +}; + + +/** + * @param {?proto.tendermint.crypto.PublicKey|undefined} value + * @return {!proto.tendermint.privval.PubKeyResponse} returns this +*/ +proto.tendermint.privval.PubKeyResponse.prototype.setPubKey = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.PubKeyResponse} returns this + */ +proto.tendermint.privval.PubKeyResponse.prototype.clearPubKey = function() { + return this.setPubKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.PubKeyResponse.prototype.hasPubKey = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional RemoteSignerError error = 2; + * @return {?proto.tendermint.privval.RemoteSignerError} + */ +proto.tendermint.privval.PubKeyResponse.prototype.getError = function() { + return /** @type{?proto.tendermint.privval.RemoteSignerError} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.RemoteSignerError, 2)); +}; + + +/** + * @param {?proto.tendermint.privval.RemoteSignerError|undefined} value + * @return {!proto.tendermint.privval.PubKeyResponse} returns this +*/ +proto.tendermint.privval.PubKeyResponse.prototype.setError = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.PubKeyResponse} returns this + */ +proto.tendermint.privval.PubKeyResponse.prototype.clearError = function() { + return this.setError(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.PubKeyResponse.prototype.hasError = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.SignVoteRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.SignVoteRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.SignVoteRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.SignVoteRequest.toObject = function(includeInstance, msg) { + var f, obj = { + vote: (f = msg.getVote()) && tendermint_types_types_pb.Vote.toObject(includeInstance, f), + chainId: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.SignVoteRequest} + */ +proto.tendermint.privval.SignVoteRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.SignVoteRequest; + return proto.tendermint.privval.SignVoteRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.SignVoteRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.SignVoteRequest} + */ +proto.tendermint.privval.SignVoteRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.Vote; + reader.readMessage(value,tendermint_types_types_pb.Vote.deserializeBinaryFromReader); + msg.setVote(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.SignVoteRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.SignVoteRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.SignVoteRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.SignVoteRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVote(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.Vote.serializeBinaryToWriter + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional tendermint.types.Vote vote = 1; + * @return {?proto.tendermint.types.Vote} + */ +proto.tendermint.privval.SignVoteRequest.prototype.getVote = function() { + return /** @type{?proto.tendermint.types.Vote} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Vote, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Vote|undefined} value + * @return {!proto.tendermint.privval.SignVoteRequest} returns this +*/ +proto.tendermint.privval.SignVoteRequest.prototype.setVote = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.SignVoteRequest} returns this + */ +proto.tendermint.privval.SignVoteRequest.prototype.clearVote = function() { + return this.setVote(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.SignVoteRequest.prototype.hasVote = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string chain_id = 2; + * @return {string} + */ +proto.tendermint.privval.SignVoteRequest.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.privval.SignVoteRequest} returns this + */ +proto.tendermint.privval.SignVoteRequest.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.SignedVoteResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.SignedVoteResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.SignedVoteResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.SignedVoteResponse.toObject = function(includeInstance, msg) { + var f, obj = { + vote: (f = msg.getVote()) && tendermint_types_types_pb.Vote.toObject(includeInstance, f), + error: (f = msg.getError()) && proto.tendermint.privval.RemoteSignerError.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.SignedVoteResponse} + */ +proto.tendermint.privval.SignedVoteResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.SignedVoteResponse; + return proto.tendermint.privval.SignedVoteResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.SignedVoteResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.SignedVoteResponse} + */ +proto.tendermint.privval.SignedVoteResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.Vote; + reader.readMessage(value,tendermint_types_types_pb.Vote.deserializeBinaryFromReader); + msg.setVote(value); + break; + case 2: + var value = new proto.tendermint.privval.RemoteSignerError; + reader.readMessage(value,proto.tendermint.privval.RemoteSignerError.deserializeBinaryFromReader); + msg.setError(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.SignedVoteResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.SignedVoteResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.SignedVoteResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.SignedVoteResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVote(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.Vote.serializeBinaryToWriter + ); + } + f = message.getError(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.privval.RemoteSignerError.serializeBinaryToWriter + ); + } +}; + + +/** + * optional tendermint.types.Vote vote = 1; + * @return {?proto.tendermint.types.Vote} + */ +proto.tendermint.privval.SignedVoteResponse.prototype.getVote = function() { + return /** @type{?proto.tendermint.types.Vote} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Vote, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Vote|undefined} value + * @return {!proto.tendermint.privval.SignedVoteResponse} returns this +*/ +proto.tendermint.privval.SignedVoteResponse.prototype.setVote = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.SignedVoteResponse} returns this + */ +proto.tendermint.privval.SignedVoteResponse.prototype.clearVote = function() { + return this.setVote(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.SignedVoteResponse.prototype.hasVote = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional RemoteSignerError error = 2; + * @return {?proto.tendermint.privval.RemoteSignerError} + */ +proto.tendermint.privval.SignedVoteResponse.prototype.getError = function() { + return /** @type{?proto.tendermint.privval.RemoteSignerError} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.RemoteSignerError, 2)); +}; + + +/** + * @param {?proto.tendermint.privval.RemoteSignerError|undefined} value + * @return {!proto.tendermint.privval.SignedVoteResponse} returns this +*/ +proto.tendermint.privval.SignedVoteResponse.prototype.setError = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.SignedVoteResponse} returns this + */ +proto.tendermint.privval.SignedVoteResponse.prototype.clearError = function() { + return this.setError(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.SignedVoteResponse.prototype.hasError = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.SignProposalRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.SignProposalRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.SignProposalRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.SignProposalRequest.toObject = function(includeInstance, msg) { + var f, obj = { + proposal: (f = msg.getProposal()) && tendermint_types_types_pb.Proposal.toObject(includeInstance, f), + chainId: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.SignProposalRequest} + */ +proto.tendermint.privval.SignProposalRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.SignProposalRequest; + return proto.tendermint.privval.SignProposalRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.SignProposalRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.SignProposalRequest} + */ +proto.tendermint.privval.SignProposalRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.Proposal; + reader.readMessage(value,tendermint_types_types_pb.Proposal.deserializeBinaryFromReader); + msg.setProposal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.SignProposalRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.SignProposalRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.SignProposalRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.SignProposalRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProposal(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.Proposal.serializeBinaryToWriter + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional tendermint.types.Proposal proposal = 1; + * @return {?proto.tendermint.types.Proposal} + */ +proto.tendermint.privval.SignProposalRequest.prototype.getProposal = function() { + return /** @type{?proto.tendermint.types.Proposal} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Proposal, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Proposal|undefined} value + * @return {!proto.tendermint.privval.SignProposalRequest} returns this +*/ +proto.tendermint.privval.SignProposalRequest.prototype.setProposal = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.SignProposalRequest} returns this + */ +proto.tendermint.privval.SignProposalRequest.prototype.clearProposal = function() { + return this.setProposal(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.SignProposalRequest.prototype.hasProposal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string chain_id = 2; + * @return {string} + */ +proto.tendermint.privval.SignProposalRequest.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.privval.SignProposalRequest} returns this + */ +proto.tendermint.privval.SignProposalRequest.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.SignedProposalResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.SignedProposalResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.SignedProposalResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.SignedProposalResponse.toObject = function(includeInstance, msg) { + var f, obj = { + proposal: (f = msg.getProposal()) && tendermint_types_types_pb.Proposal.toObject(includeInstance, f), + error: (f = msg.getError()) && proto.tendermint.privval.RemoteSignerError.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.SignedProposalResponse} + */ +proto.tendermint.privval.SignedProposalResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.SignedProposalResponse; + return proto.tendermint.privval.SignedProposalResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.SignedProposalResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.SignedProposalResponse} + */ +proto.tendermint.privval.SignedProposalResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.Proposal; + reader.readMessage(value,tendermint_types_types_pb.Proposal.deserializeBinaryFromReader); + msg.setProposal(value); + break; + case 2: + var value = new proto.tendermint.privval.RemoteSignerError; + reader.readMessage(value,proto.tendermint.privval.RemoteSignerError.deserializeBinaryFromReader); + msg.setError(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.SignedProposalResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.SignedProposalResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.SignedProposalResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.SignedProposalResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProposal(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.Proposal.serializeBinaryToWriter + ); + } + f = message.getError(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.privval.RemoteSignerError.serializeBinaryToWriter + ); + } +}; + + +/** + * optional tendermint.types.Proposal proposal = 1; + * @return {?proto.tendermint.types.Proposal} + */ +proto.tendermint.privval.SignedProposalResponse.prototype.getProposal = function() { + return /** @type{?proto.tendermint.types.Proposal} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Proposal, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Proposal|undefined} value + * @return {!proto.tendermint.privval.SignedProposalResponse} returns this +*/ +proto.tendermint.privval.SignedProposalResponse.prototype.setProposal = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.SignedProposalResponse} returns this + */ +proto.tendermint.privval.SignedProposalResponse.prototype.clearProposal = function() { + return this.setProposal(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.SignedProposalResponse.prototype.hasProposal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional RemoteSignerError error = 2; + * @return {?proto.tendermint.privval.RemoteSignerError} + */ +proto.tendermint.privval.SignedProposalResponse.prototype.getError = function() { + return /** @type{?proto.tendermint.privval.RemoteSignerError} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.RemoteSignerError, 2)); +}; + + +/** + * @param {?proto.tendermint.privval.RemoteSignerError|undefined} value + * @return {!proto.tendermint.privval.SignedProposalResponse} returns this +*/ +proto.tendermint.privval.SignedProposalResponse.prototype.setError = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.SignedProposalResponse} returns this + */ +proto.tendermint.privval.SignedProposalResponse.prototype.clearError = function() { + return this.setError(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.SignedProposalResponse.prototype.hasError = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.PingRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.PingRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.PingRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.PingRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.PingRequest} + */ +proto.tendermint.privval.PingRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.PingRequest; + return proto.tendermint.privval.PingRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.PingRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.PingRequest} + */ +proto.tendermint.privval.PingRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.PingRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.PingRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.PingRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.PingRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.PingResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.PingResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.PingResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.PingResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.PingResponse} + */ +proto.tendermint.privval.PingResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.PingResponse; + return proto.tendermint.privval.PingResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.PingResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.PingResponse} + */ +proto.tendermint.privval.PingResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.PingResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.PingResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.PingResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.PingResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.privval.Message.oneofGroups_ = [[1,2,3,4,5,6,7,8]]; + +/** + * @enum {number} + */ +proto.tendermint.privval.Message.SumCase = { + SUM_NOT_SET: 0, + PUB_KEY_REQUEST: 1, + PUB_KEY_RESPONSE: 2, + SIGN_VOTE_REQUEST: 3, + SIGNED_VOTE_RESPONSE: 4, + SIGN_PROPOSAL_REQUEST: 5, + SIGNED_PROPOSAL_RESPONSE: 6, + PING_REQUEST: 7, + PING_RESPONSE: 8 +}; + +/** + * @return {proto.tendermint.privval.Message.SumCase} + */ +proto.tendermint.privval.Message.prototype.getSumCase = function() { + return /** @type {proto.tendermint.privval.Message.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.privval.Message.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.privval.Message.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.privval.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.privval.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.Message.toObject = function(includeInstance, msg) { + var f, obj = { + pubKeyRequest: (f = msg.getPubKeyRequest()) && proto.tendermint.privval.PubKeyRequest.toObject(includeInstance, f), + pubKeyResponse: (f = msg.getPubKeyResponse()) && proto.tendermint.privval.PubKeyResponse.toObject(includeInstance, f), + signVoteRequest: (f = msg.getSignVoteRequest()) && proto.tendermint.privval.SignVoteRequest.toObject(includeInstance, f), + signedVoteResponse: (f = msg.getSignedVoteResponse()) && proto.tendermint.privval.SignedVoteResponse.toObject(includeInstance, f), + signProposalRequest: (f = msg.getSignProposalRequest()) && proto.tendermint.privval.SignProposalRequest.toObject(includeInstance, f), + signedProposalResponse: (f = msg.getSignedProposalResponse()) && proto.tendermint.privval.SignedProposalResponse.toObject(includeInstance, f), + pingRequest: (f = msg.getPingRequest()) && proto.tendermint.privval.PingRequest.toObject(includeInstance, f), + pingResponse: (f = msg.getPingResponse()) && proto.tendermint.privval.PingResponse.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.privval.Message} + */ +proto.tendermint.privval.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.privval.Message; + return proto.tendermint.privval.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.privval.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.privval.Message} + */ +proto.tendermint.privval.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.privval.PubKeyRequest; + reader.readMessage(value,proto.tendermint.privval.PubKeyRequest.deserializeBinaryFromReader); + msg.setPubKeyRequest(value); + break; + case 2: + var value = new proto.tendermint.privval.PubKeyResponse; + reader.readMessage(value,proto.tendermint.privval.PubKeyResponse.deserializeBinaryFromReader); + msg.setPubKeyResponse(value); + break; + case 3: + var value = new proto.tendermint.privval.SignVoteRequest; + reader.readMessage(value,proto.tendermint.privval.SignVoteRequest.deserializeBinaryFromReader); + msg.setSignVoteRequest(value); + break; + case 4: + var value = new proto.tendermint.privval.SignedVoteResponse; + reader.readMessage(value,proto.tendermint.privval.SignedVoteResponse.deserializeBinaryFromReader); + msg.setSignedVoteResponse(value); + break; + case 5: + var value = new proto.tendermint.privval.SignProposalRequest; + reader.readMessage(value,proto.tendermint.privval.SignProposalRequest.deserializeBinaryFromReader); + msg.setSignProposalRequest(value); + break; + case 6: + var value = new proto.tendermint.privval.SignedProposalResponse; + reader.readMessage(value,proto.tendermint.privval.SignedProposalResponse.deserializeBinaryFromReader); + msg.setSignedProposalResponse(value); + break; + case 7: + var value = new proto.tendermint.privval.PingRequest; + reader.readMessage(value,proto.tendermint.privval.PingRequest.deserializeBinaryFromReader); + msg.setPingRequest(value); + break; + case 8: + var value = new proto.tendermint.privval.PingResponse; + reader.readMessage(value,proto.tendermint.privval.PingResponse.deserializeBinaryFromReader); + msg.setPingResponse(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.privval.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.privval.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.privval.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.privval.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubKeyRequest(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.privval.PubKeyRequest.serializeBinaryToWriter + ); + } + f = message.getPubKeyResponse(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.privval.PubKeyResponse.serializeBinaryToWriter + ); + } + f = message.getSignVoteRequest(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.privval.SignVoteRequest.serializeBinaryToWriter + ); + } + f = message.getSignedVoteResponse(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.privval.SignedVoteResponse.serializeBinaryToWriter + ); + } + f = message.getSignProposalRequest(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.tendermint.privval.SignProposalRequest.serializeBinaryToWriter + ); + } + f = message.getSignedProposalResponse(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.tendermint.privval.SignedProposalResponse.serializeBinaryToWriter + ); + } + f = message.getPingRequest(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.tendermint.privval.PingRequest.serializeBinaryToWriter + ); + } + f = message.getPingResponse(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.tendermint.privval.PingResponse.serializeBinaryToWriter + ); + } +}; + + +/** + * optional PubKeyRequest pub_key_request = 1; + * @return {?proto.tendermint.privval.PubKeyRequest} + */ +proto.tendermint.privval.Message.prototype.getPubKeyRequest = function() { + return /** @type{?proto.tendermint.privval.PubKeyRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.PubKeyRequest, 1)); +}; + + +/** + * @param {?proto.tendermint.privval.PubKeyRequest|undefined} value + * @return {!proto.tendermint.privval.Message} returns this +*/ +proto.tendermint.privval.Message.prototype.setPubKeyRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.privval.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.Message} returns this + */ +proto.tendermint.privval.Message.prototype.clearPubKeyRequest = function() { + return this.setPubKeyRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.Message.prototype.hasPubKeyRequest = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional PubKeyResponse pub_key_response = 2; + * @return {?proto.tendermint.privval.PubKeyResponse} + */ +proto.tendermint.privval.Message.prototype.getPubKeyResponse = function() { + return /** @type{?proto.tendermint.privval.PubKeyResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.PubKeyResponse, 2)); +}; + + +/** + * @param {?proto.tendermint.privval.PubKeyResponse|undefined} value + * @return {!proto.tendermint.privval.Message} returns this +*/ +proto.tendermint.privval.Message.prototype.setPubKeyResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.privval.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.Message} returns this + */ +proto.tendermint.privval.Message.prototype.clearPubKeyResponse = function() { + return this.setPubKeyResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.Message.prototype.hasPubKeyResponse = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional SignVoteRequest sign_vote_request = 3; + * @return {?proto.tendermint.privval.SignVoteRequest} + */ +proto.tendermint.privval.Message.prototype.getSignVoteRequest = function() { + return /** @type{?proto.tendermint.privval.SignVoteRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.SignVoteRequest, 3)); +}; + + +/** + * @param {?proto.tendermint.privval.SignVoteRequest|undefined} value + * @return {!proto.tendermint.privval.Message} returns this +*/ +proto.tendermint.privval.Message.prototype.setSignVoteRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.tendermint.privval.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.Message} returns this + */ +proto.tendermint.privval.Message.prototype.clearSignVoteRequest = function() { + return this.setSignVoteRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.Message.prototype.hasSignVoteRequest = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional SignedVoteResponse signed_vote_response = 4; + * @return {?proto.tendermint.privval.SignedVoteResponse} + */ +proto.tendermint.privval.Message.prototype.getSignedVoteResponse = function() { + return /** @type{?proto.tendermint.privval.SignedVoteResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.SignedVoteResponse, 4)); +}; + + +/** + * @param {?proto.tendermint.privval.SignedVoteResponse|undefined} value + * @return {!proto.tendermint.privval.Message} returns this +*/ +proto.tendermint.privval.Message.prototype.setSignedVoteResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 4, proto.tendermint.privval.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.Message} returns this + */ +proto.tendermint.privval.Message.prototype.clearSignedVoteResponse = function() { + return this.setSignedVoteResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.Message.prototype.hasSignedVoteResponse = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional SignProposalRequest sign_proposal_request = 5; + * @return {?proto.tendermint.privval.SignProposalRequest} + */ +proto.tendermint.privval.Message.prototype.getSignProposalRequest = function() { + return /** @type{?proto.tendermint.privval.SignProposalRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.SignProposalRequest, 5)); +}; + + +/** + * @param {?proto.tendermint.privval.SignProposalRequest|undefined} value + * @return {!proto.tendermint.privval.Message} returns this +*/ +proto.tendermint.privval.Message.prototype.setSignProposalRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 5, proto.tendermint.privval.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.Message} returns this + */ +proto.tendermint.privval.Message.prototype.clearSignProposalRequest = function() { + return this.setSignProposalRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.Message.prototype.hasSignProposalRequest = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional SignedProposalResponse signed_proposal_response = 6; + * @return {?proto.tendermint.privval.SignedProposalResponse} + */ +proto.tendermint.privval.Message.prototype.getSignedProposalResponse = function() { + return /** @type{?proto.tendermint.privval.SignedProposalResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.SignedProposalResponse, 6)); +}; + + +/** + * @param {?proto.tendermint.privval.SignedProposalResponse|undefined} value + * @return {!proto.tendermint.privval.Message} returns this +*/ +proto.tendermint.privval.Message.prototype.setSignedProposalResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 6, proto.tendermint.privval.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.Message} returns this + */ +proto.tendermint.privval.Message.prototype.clearSignedProposalResponse = function() { + return this.setSignedProposalResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.Message.prototype.hasSignedProposalResponse = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional PingRequest ping_request = 7; + * @return {?proto.tendermint.privval.PingRequest} + */ +proto.tendermint.privval.Message.prototype.getPingRequest = function() { + return /** @type{?proto.tendermint.privval.PingRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.PingRequest, 7)); +}; + + +/** + * @param {?proto.tendermint.privval.PingRequest|undefined} value + * @return {!proto.tendermint.privval.Message} returns this +*/ +proto.tendermint.privval.Message.prototype.setPingRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 7, proto.tendermint.privval.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.Message} returns this + */ +proto.tendermint.privval.Message.prototype.clearPingRequest = function() { + return this.setPingRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.Message.prototype.hasPingRequest = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional PingResponse ping_response = 8; + * @return {?proto.tendermint.privval.PingResponse} + */ +proto.tendermint.privval.Message.prototype.getPingResponse = function() { + return /** @type{?proto.tendermint.privval.PingResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.privval.PingResponse, 8)); +}; + + +/** + * @param {?proto.tendermint.privval.PingResponse|undefined} value + * @return {!proto.tendermint.privval.Message} returns this +*/ +proto.tendermint.privval.Message.prototype.setPingResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 8, proto.tendermint.privval.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.privval.Message} returns this + */ +proto.tendermint.privval.Message.prototype.clearPingResponse = function() { + return this.setPingResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.privval.Message.prototype.hasPingResponse = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * @enum {number} + */ +proto.tendermint.privval.Errors = { + ERRORS_UNKNOWN: 0, + ERRORS_UNEXPECTED_RESPONSE: 1, + ERRORS_NO_CONNECTION: 2, + ERRORS_CONNECTION_TIMEOUT: 3, + ERRORS_READ_TIMEOUT: 4, + ERRORS_WRITE_TIMEOUT: 5 +}; + +goog.object.extend(exports, proto.tendermint.privval); diff --git a/js/proto/tendermint/rpc/grpc/types_grpc_pb.d.ts b/js/proto/tendermint/rpc/grpc/types_grpc_pb.d.ts new file mode 100644 index 000000000..12d6ff430 --- /dev/null +++ b/js/proto/tendermint/rpc/grpc/types_grpc_pb.d.ts @@ -0,0 +1,60 @@ +// package: tendermint.rpc.grpc +// file: tendermint/rpc/grpc/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; +import * as tendermint_rpc_grpc_types_pb from "../../../tendermint/rpc/grpc/types_pb"; +import * as tendermint_abci_types_pb from "../../../tendermint/abci/types_pb"; + +interface IBroadcastAPIService extends grpc.ServiceDefinition { + ping: IBroadcastAPIService_IPing; + broadcastTx: IBroadcastAPIService_IBroadcastTx; +} + +interface IBroadcastAPIService_IPing extends grpc.MethodDefinition { + path: "/tendermint.rpc.grpc.BroadcastAPI/Ping"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IBroadcastAPIService_IBroadcastTx extends grpc.MethodDefinition { + path: "/tendermint.rpc.grpc.BroadcastAPI/BroadcastTx"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const BroadcastAPIService: IBroadcastAPIService; + +export interface IBroadcastAPIServer extends grpc.UntypedServiceImplementation { + ping: grpc.handleUnaryCall; + broadcastTx: grpc.handleUnaryCall; +} + +export interface IBroadcastAPIClient { + ping(request: tendermint_rpc_grpc_types_pb.RequestPing, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponsePing) => void): grpc.ClientUnaryCall; + ping(request: tendermint_rpc_grpc_types_pb.RequestPing, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponsePing) => void): grpc.ClientUnaryCall; + ping(request: tendermint_rpc_grpc_types_pb.RequestPing, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponsePing) => void): grpc.ClientUnaryCall; + broadcastTx(request: tendermint_rpc_grpc_types_pb.RequestBroadcastTx, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponseBroadcastTx) => void): grpc.ClientUnaryCall; + broadcastTx(request: tendermint_rpc_grpc_types_pb.RequestBroadcastTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponseBroadcastTx) => void): grpc.ClientUnaryCall; + broadcastTx(request: tendermint_rpc_grpc_types_pb.RequestBroadcastTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponseBroadcastTx) => void): grpc.ClientUnaryCall; +} + +export class BroadcastAPIClient extends grpc.Client implements IBroadcastAPIClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public ping(request: tendermint_rpc_grpc_types_pb.RequestPing, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponsePing) => void): grpc.ClientUnaryCall; + public ping(request: tendermint_rpc_grpc_types_pb.RequestPing, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponsePing) => void): grpc.ClientUnaryCall; + public ping(request: tendermint_rpc_grpc_types_pb.RequestPing, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponsePing) => void): grpc.ClientUnaryCall; + public broadcastTx(request: tendermint_rpc_grpc_types_pb.RequestBroadcastTx, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponseBroadcastTx) => void): grpc.ClientUnaryCall; + public broadcastTx(request: tendermint_rpc_grpc_types_pb.RequestBroadcastTx, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponseBroadcastTx) => void): grpc.ClientUnaryCall; + public broadcastTx(request: tendermint_rpc_grpc_types_pb.RequestBroadcastTx, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: tendermint_rpc_grpc_types_pb.ResponseBroadcastTx) => void): grpc.ClientUnaryCall; +} diff --git a/js/proto/tendermint/rpc/grpc/types_grpc_pb.js b/js/proto/tendermint/rpc/grpc/types_grpc_pb.js new file mode 100644 index 000000000..b3135236c --- /dev/null +++ b/js/proto/tendermint/rpc/grpc/types_grpc_pb.js @@ -0,0 +1,79 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var tendermint_rpc_grpc_types_pb = require('../../../tendermint/rpc/grpc/types_pb.js'); +var tendermint_abci_types_pb = require('../../../tendermint/abci/types_pb.js'); + +function serialize_tendermint_rpc_grpc_RequestBroadcastTx(arg) { + if (!(arg instanceof tendermint_rpc_grpc_types_pb.RequestBroadcastTx)) { + throw new Error('Expected argument of type tendermint.rpc.grpc.RequestBroadcastTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_rpc_grpc_RequestBroadcastTx(buffer_arg) { + return tendermint_rpc_grpc_types_pb.RequestBroadcastTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_rpc_grpc_RequestPing(arg) { + if (!(arg instanceof tendermint_rpc_grpc_types_pb.RequestPing)) { + throw new Error('Expected argument of type tendermint.rpc.grpc.RequestPing'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_rpc_grpc_RequestPing(buffer_arg) { + return tendermint_rpc_grpc_types_pb.RequestPing.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_rpc_grpc_ResponseBroadcastTx(arg) { + if (!(arg instanceof tendermint_rpc_grpc_types_pb.ResponseBroadcastTx)) { + throw new Error('Expected argument of type tendermint.rpc.grpc.ResponseBroadcastTx'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_rpc_grpc_ResponseBroadcastTx(buffer_arg) { + return tendermint_rpc_grpc_types_pb.ResponseBroadcastTx.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_tendermint_rpc_grpc_ResponsePing(arg) { + if (!(arg instanceof tendermint_rpc_grpc_types_pb.ResponsePing)) { + throw new Error('Expected argument of type tendermint.rpc.grpc.ResponsePing'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_tendermint_rpc_grpc_ResponsePing(buffer_arg) { + return tendermint_rpc_grpc_types_pb.ResponsePing.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +// ---------------------------------------- +// Service Definition +// +var BroadcastAPIService = exports['tendermint.rpc.grpc.BroadcastAPI'] = { + ping: { + path: '/tendermint.rpc.grpc.BroadcastAPI/Ping', + requestStream: false, + responseStream: false, + requestType: tendermint_rpc_grpc_types_pb.RequestPing, + responseType: tendermint_rpc_grpc_types_pb.ResponsePing, + requestSerialize: serialize_tendermint_rpc_grpc_RequestPing, + requestDeserialize: deserialize_tendermint_rpc_grpc_RequestPing, + responseSerialize: serialize_tendermint_rpc_grpc_ResponsePing, + responseDeserialize: deserialize_tendermint_rpc_grpc_ResponsePing, + }, + broadcastTx: { + path: '/tendermint.rpc.grpc.BroadcastAPI/BroadcastTx', + requestStream: false, + responseStream: false, + requestType: tendermint_rpc_grpc_types_pb.RequestBroadcastTx, + responseType: tendermint_rpc_grpc_types_pb.ResponseBroadcastTx, + requestSerialize: serialize_tendermint_rpc_grpc_RequestBroadcastTx, + requestDeserialize: deserialize_tendermint_rpc_grpc_RequestBroadcastTx, + responseSerialize: serialize_tendermint_rpc_grpc_ResponseBroadcastTx, + responseDeserialize: deserialize_tendermint_rpc_grpc_ResponseBroadcastTx, + }, +}; + diff --git a/js/proto/tendermint/rpc/grpc/types_pb.d.ts b/js/proto/tendermint/rpc/grpc/types_pb.d.ts new file mode 100644 index 000000000..afee84671 --- /dev/null +++ b/js/proto/tendermint/rpc/grpc/types_pb.d.ts @@ -0,0 +1,96 @@ +// package: tendermint.rpc.grpc +// file: tendermint/rpc/grpc/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as tendermint_abci_types_pb from "../../../tendermint/abci/types_pb"; + +export class RequestPing extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestPing.AsObject; + static toObject(includeInstance: boolean, msg: RequestPing): RequestPing.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestPing, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestPing; + static deserializeBinaryFromReader(message: RequestPing, reader: jspb.BinaryReader): RequestPing; +} + +export namespace RequestPing { + export type AsObject = { + } +} + +export class RequestBroadcastTx extends jspb.Message { + getTx(): Uint8Array | string; + getTx_asU8(): Uint8Array; + getTx_asB64(): string; + setTx(value: Uint8Array | string): RequestBroadcastTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RequestBroadcastTx.AsObject; + static toObject(includeInstance: boolean, msg: RequestBroadcastTx): RequestBroadcastTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RequestBroadcastTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RequestBroadcastTx; + static deserializeBinaryFromReader(message: RequestBroadcastTx, reader: jspb.BinaryReader): RequestBroadcastTx; +} + +export namespace RequestBroadcastTx { + export type AsObject = { + tx: Uint8Array | string, + } +} + +export class ResponsePing extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponsePing.AsObject; + static toObject(includeInstance: boolean, msg: ResponsePing): ResponsePing.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponsePing, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponsePing; + static deserializeBinaryFromReader(message: ResponsePing, reader: jspb.BinaryReader): ResponsePing; +} + +export namespace ResponsePing { + export type AsObject = { + } +} + +export class ResponseBroadcastTx extends jspb.Message { + + hasCheckTx(): boolean; + clearCheckTx(): void; + getCheckTx(): tendermint_abci_types_pb.ResponseCheckTx | undefined; + setCheckTx(value?: tendermint_abci_types_pb.ResponseCheckTx): ResponseBroadcastTx; + + + hasDeliverTx(): boolean; + clearDeliverTx(): void; + getDeliverTx(): tendermint_abci_types_pb.ResponseDeliverTx | undefined; + setDeliverTx(value?: tendermint_abci_types_pb.ResponseDeliverTx): ResponseBroadcastTx; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResponseBroadcastTx.AsObject; + static toObject(includeInstance: boolean, msg: ResponseBroadcastTx): ResponseBroadcastTx.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResponseBroadcastTx, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResponseBroadcastTx; + static deserializeBinaryFromReader(message: ResponseBroadcastTx, reader: jspb.BinaryReader): ResponseBroadcastTx; +} + +export namespace ResponseBroadcastTx { + export type AsObject = { + checkTx?: tendermint_abci_types_pb.ResponseCheckTx.AsObject, + deliverTx?: tendermint_abci_types_pb.ResponseDeliverTx.AsObject, + } +} diff --git a/js/proto/tendermint/rpc/grpc/types_pb.js b/js/proto/tendermint/rpc/grpc/types_pb.js new file mode 100644 index 000000000..62dcac82d --- /dev/null +++ b/js/proto/tendermint/rpc/grpc/types_pb.js @@ -0,0 +1,665 @@ +// source: tendermint/rpc/grpc/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var tendermint_abci_types_pb = require('../../../tendermint/abci/types_pb.js'); +goog.object.extend(proto, tendermint_abci_types_pb); +goog.exportSymbol('proto.tendermint.rpc.grpc.RequestBroadcastTx', null, global); +goog.exportSymbol('proto.tendermint.rpc.grpc.RequestPing', null, global); +goog.exportSymbol('proto.tendermint.rpc.grpc.ResponseBroadcastTx', null, global); +goog.exportSymbol('proto.tendermint.rpc.grpc.ResponsePing', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.rpc.grpc.RequestPing = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.rpc.grpc.RequestPing, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.rpc.grpc.RequestPing.displayName = 'proto.tendermint.rpc.grpc.RequestPing'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.rpc.grpc.RequestBroadcastTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.rpc.grpc.RequestBroadcastTx.displayName = 'proto.tendermint.rpc.grpc.RequestBroadcastTx'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.rpc.grpc.ResponsePing = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.rpc.grpc.ResponsePing, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.rpc.grpc.ResponsePing.displayName = 'proto.tendermint.rpc.grpc.ResponsePing'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.rpc.grpc.ResponseBroadcastTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.rpc.grpc.ResponseBroadcastTx.displayName = 'proto.tendermint.rpc.grpc.ResponseBroadcastTx'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.rpc.grpc.RequestPing.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.rpc.grpc.RequestPing.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.rpc.grpc.RequestPing} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.rpc.grpc.RequestPing.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.rpc.grpc.RequestPing} + */ +proto.tendermint.rpc.grpc.RequestPing.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.rpc.grpc.RequestPing; + return proto.tendermint.rpc.grpc.RequestPing.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.rpc.grpc.RequestPing} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.rpc.grpc.RequestPing} + */ +proto.tendermint.rpc.grpc.RequestPing.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.rpc.grpc.RequestPing.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.rpc.grpc.RequestPing.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.rpc.grpc.RequestPing} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.rpc.grpc.RequestPing.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.rpc.grpc.RequestBroadcastTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.rpc.grpc.RequestBroadcastTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.toObject = function(includeInstance, msg) { + var f, obj = { + tx: msg.getTx_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.rpc.grpc.RequestBroadcastTx} + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.rpc.grpc.RequestBroadcastTx; + return proto.tendermint.rpc.grpc.RequestBroadcastTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.rpc.grpc.RequestBroadcastTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.rpc.grpc.RequestBroadcastTx} + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTx(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.rpc.grpc.RequestBroadcastTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.rpc.grpc.RequestBroadcastTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTx_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes tx = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.prototype.getTx = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes tx = 1; + * This is a type-conversion wrapper around `getTx()` + * @return {string} + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.prototype.getTx_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTx())); +}; + + +/** + * optional bytes tx = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTx()` + * @return {!Uint8Array} + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.prototype.getTx_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTx())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.rpc.grpc.RequestBroadcastTx} returns this + */ +proto.tendermint.rpc.grpc.RequestBroadcastTx.prototype.setTx = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.rpc.grpc.ResponsePing.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.rpc.grpc.ResponsePing.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.rpc.grpc.ResponsePing} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.rpc.grpc.ResponsePing.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.rpc.grpc.ResponsePing} + */ +proto.tendermint.rpc.grpc.ResponsePing.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.rpc.grpc.ResponsePing; + return proto.tendermint.rpc.grpc.ResponsePing.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.rpc.grpc.ResponsePing} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.rpc.grpc.ResponsePing} + */ +proto.tendermint.rpc.grpc.ResponsePing.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.rpc.grpc.ResponsePing.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.rpc.grpc.ResponsePing.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.rpc.grpc.ResponsePing} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.rpc.grpc.ResponsePing.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.rpc.grpc.ResponseBroadcastTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.toObject = function(includeInstance, msg) { + var f, obj = { + checkTx: (f = msg.getCheckTx()) && tendermint_abci_types_pb.ResponseCheckTx.toObject(includeInstance, f), + deliverTx: (f = msg.getDeliverTx()) && tendermint_abci_types_pb.ResponseDeliverTx.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.rpc.grpc.ResponseBroadcastTx; + return proto.tendermint.rpc.grpc.ResponseBroadcastTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_abci_types_pb.ResponseCheckTx; + reader.readMessage(value,tendermint_abci_types_pb.ResponseCheckTx.deserializeBinaryFromReader); + msg.setCheckTx(value); + break; + case 2: + var value = new tendermint_abci_types_pb.ResponseDeliverTx; + reader.readMessage(value,tendermint_abci_types_pb.ResponseDeliverTx.deserializeBinaryFromReader); + msg.setDeliverTx(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.rpc.grpc.ResponseBroadcastTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCheckTx(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_abci_types_pb.ResponseCheckTx.serializeBinaryToWriter + ); + } + f = message.getDeliverTx(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_abci_types_pb.ResponseDeliverTx.serializeBinaryToWriter + ); + } +}; + + +/** + * optional tendermint.abci.ResponseCheckTx check_tx = 1; + * @return {?proto.tendermint.abci.ResponseCheckTx} + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.getCheckTx = function() { + return /** @type{?proto.tendermint.abci.ResponseCheckTx} */ ( + jspb.Message.getWrapperField(this, tendermint_abci_types_pb.ResponseCheckTx, 1)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseCheckTx|undefined} value + * @return {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} returns this +*/ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.setCheckTx = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} returns this + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.clearCheckTx = function() { + return this.setCheckTx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.hasCheckTx = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional tendermint.abci.ResponseDeliverTx deliver_tx = 2; + * @return {?proto.tendermint.abci.ResponseDeliverTx} + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.getDeliverTx = function() { + return /** @type{?proto.tendermint.abci.ResponseDeliverTx} */ ( + jspb.Message.getWrapperField(this, tendermint_abci_types_pb.ResponseDeliverTx, 2)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseDeliverTx|undefined} value + * @return {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} returns this +*/ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.setDeliverTx = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.rpc.grpc.ResponseBroadcastTx} returns this + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.clearDeliverTx = function() { + return this.setDeliverTx(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.rpc.grpc.ResponseBroadcastTx.prototype.hasDeliverTx = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +goog.object.extend(exports, proto.tendermint.rpc.grpc); diff --git a/js/proto/tendermint/state/types_grpc_pb.js b/js/proto/tendermint/state/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/state/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/state/types_pb.d.ts b/js/proto/tendermint/state/types_pb.d.ts new file mode 100644 index 000000000..2c3657c70 --- /dev/null +++ b/js/proto/tendermint/state/types_pb.d.ts @@ -0,0 +1,233 @@ +// package: tendermint.state +// file: tendermint/state/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as tendermint_abci_types_pb from "../../tendermint/abci/types_pb"; +import * as tendermint_types_types_pb from "../../tendermint/types/types_pb"; +import * as tendermint_types_validator_pb from "../../tendermint/types/validator_pb"; +import * as tendermint_types_params_pb from "../../tendermint/types/params_pb"; +import * as tendermint_version_types_pb from "../../tendermint/version/types_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; + +export class ABCIResponses extends jspb.Message { + clearDeliverTxsList(): void; + getDeliverTxsList(): Array; + setDeliverTxsList(value: Array): ABCIResponses; + addDeliverTxs(value?: tendermint_abci_types_pb.ResponseDeliverTx, index?: number): tendermint_abci_types_pb.ResponseDeliverTx; + + + hasEndBlock(): boolean; + clearEndBlock(): void; + getEndBlock(): tendermint_abci_types_pb.ResponseEndBlock | undefined; + setEndBlock(value?: tendermint_abci_types_pb.ResponseEndBlock): ABCIResponses; + + + hasBeginBlock(): boolean; + clearBeginBlock(): void; + getBeginBlock(): tendermint_abci_types_pb.ResponseBeginBlock | undefined; + setBeginBlock(value?: tendermint_abci_types_pb.ResponseBeginBlock): ABCIResponses; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ABCIResponses.AsObject; + static toObject(includeInstance: boolean, msg: ABCIResponses): ABCIResponses.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ABCIResponses, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ABCIResponses; + static deserializeBinaryFromReader(message: ABCIResponses, reader: jspb.BinaryReader): ABCIResponses; +} + +export namespace ABCIResponses { + export type AsObject = { + deliverTxsList: Array, + endBlock?: tendermint_abci_types_pb.ResponseEndBlock.AsObject, + beginBlock?: tendermint_abci_types_pb.ResponseBeginBlock.AsObject, + } +} + +export class ValidatorsInfo extends jspb.Message { + + hasValidatorSet(): boolean; + clearValidatorSet(): void; + getValidatorSet(): tendermint_types_validator_pb.ValidatorSet | undefined; + setValidatorSet(value?: tendermint_types_validator_pb.ValidatorSet): ValidatorsInfo; + + getLastHeightChanged(): number; + setLastHeightChanged(value: number): ValidatorsInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ValidatorsInfo.AsObject; + static toObject(includeInstance: boolean, msg: ValidatorsInfo): ValidatorsInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ValidatorsInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ValidatorsInfo; + static deserializeBinaryFromReader(message: ValidatorsInfo, reader: jspb.BinaryReader): ValidatorsInfo; +} + +export namespace ValidatorsInfo { + export type AsObject = { + validatorSet?: tendermint_types_validator_pb.ValidatorSet.AsObject, + lastHeightChanged: number, + } +} + +export class ConsensusParamsInfo extends jspb.Message { + + hasConsensusParams(): boolean; + clearConsensusParams(): void; + getConsensusParams(): tendermint_types_params_pb.ConsensusParams | undefined; + setConsensusParams(value?: tendermint_types_params_pb.ConsensusParams): ConsensusParamsInfo; + + getLastHeightChanged(): number; + setLastHeightChanged(value: number): ConsensusParamsInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ConsensusParamsInfo.AsObject; + static toObject(includeInstance: boolean, msg: ConsensusParamsInfo): ConsensusParamsInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ConsensusParamsInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ConsensusParamsInfo; + static deserializeBinaryFromReader(message: ConsensusParamsInfo, reader: jspb.BinaryReader): ConsensusParamsInfo; +} + +export namespace ConsensusParamsInfo { + export type AsObject = { + consensusParams?: tendermint_types_params_pb.ConsensusParams.AsObject, + lastHeightChanged: number, + } +} + +export class Version extends jspb.Message { + + hasConsensus(): boolean; + clearConsensus(): void; + getConsensus(): tendermint_version_types_pb.Consensus | undefined; + setConsensus(value?: tendermint_version_types_pb.Consensus): Version; + + getSoftware(): string; + setSoftware(value: string): Version; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Version.AsObject; + static toObject(includeInstance: boolean, msg: Version): Version.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Version, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Version; + static deserializeBinaryFromReader(message: Version, reader: jspb.BinaryReader): Version; +} + +export namespace Version { + export type AsObject = { + consensus?: tendermint_version_types_pb.Consensus.AsObject, + software: string, + } +} + +export class State extends jspb.Message { + + hasVersion(): boolean; + clearVersion(): void; + getVersion(): Version | undefined; + setVersion(value?: Version): State; + + getChainId(): string; + setChainId(value: string): State; + + getInitialHeight(): number; + setInitialHeight(value: number): State; + + getLastBlockHeight(): number; + setLastBlockHeight(value: number): State; + + + hasLastBlockId(): boolean; + clearLastBlockId(): void; + getLastBlockId(): tendermint_types_types_pb.BlockID | undefined; + setLastBlockId(value?: tendermint_types_types_pb.BlockID): State; + + + hasLastBlockTime(): boolean; + clearLastBlockTime(): void; + getLastBlockTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setLastBlockTime(value?: google_protobuf_timestamp_pb.Timestamp): State; + + + hasNextValidators(): boolean; + clearNextValidators(): void; + getNextValidators(): tendermint_types_validator_pb.ValidatorSet | undefined; + setNextValidators(value?: tendermint_types_validator_pb.ValidatorSet): State; + + + hasValidators(): boolean; + clearValidators(): void; + getValidators(): tendermint_types_validator_pb.ValidatorSet | undefined; + setValidators(value?: tendermint_types_validator_pb.ValidatorSet): State; + + + hasLastValidators(): boolean; + clearLastValidators(): void; + getLastValidators(): tendermint_types_validator_pb.ValidatorSet | undefined; + setLastValidators(value?: tendermint_types_validator_pb.ValidatorSet): State; + + getLastHeightValidatorsChanged(): number; + setLastHeightValidatorsChanged(value: number): State; + + + hasConsensusParams(): boolean; + clearConsensusParams(): void; + getConsensusParams(): tendermint_types_params_pb.ConsensusParams | undefined; + setConsensusParams(value?: tendermint_types_params_pb.ConsensusParams): State; + + getLastHeightConsensusParamsChanged(): number; + setLastHeightConsensusParamsChanged(value: number): State; + + getLastResultsHash(): Uint8Array | string; + getLastResultsHash_asU8(): Uint8Array; + getLastResultsHash_asB64(): string; + setLastResultsHash(value: Uint8Array | string): State; + + getAppHash(): Uint8Array | string; + getAppHash_asU8(): Uint8Array; + getAppHash_asB64(): string; + setAppHash(value: Uint8Array | string): State; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): State.AsObject; + static toObject(includeInstance: boolean, msg: State): State.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: State, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): State; + static deserializeBinaryFromReader(message: State, reader: jspb.BinaryReader): State; +} + +export namespace State { + export type AsObject = { + version?: Version.AsObject, + chainId: string, + initialHeight: number, + lastBlockHeight: number, + lastBlockId?: tendermint_types_types_pb.BlockID.AsObject, + lastBlockTime?: google_protobuf_timestamp_pb.Timestamp.AsObject, + nextValidators?: tendermint_types_validator_pb.ValidatorSet.AsObject, + validators?: tendermint_types_validator_pb.ValidatorSet.AsObject, + lastValidators?: tendermint_types_validator_pb.ValidatorSet.AsObject, + lastHeightValidatorsChanged: number, + consensusParams?: tendermint_types_params_pb.ConsensusParams.AsObject, + lastHeightConsensusParamsChanged: number, + lastResultsHash: Uint8Array | string, + appHash: Uint8Array | string, + } +} diff --git a/js/proto/tendermint/state/types_pb.js b/js/proto/tendermint/state/types_pb.js new file mode 100644 index 000000000..7868b2af4 --- /dev/null +++ b/js/proto/tendermint/state/types_pb.js @@ -0,0 +1,1661 @@ +// source: tendermint/state/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_abci_types_pb = require('../../tendermint/abci/types_pb.js'); +goog.object.extend(proto, tendermint_abci_types_pb); +var tendermint_types_types_pb = require('../../tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var tendermint_types_validator_pb = require('../../tendermint/types/validator_pb.js'); +goog.object.extend(proto, tendermint_types_validator_pb); +var tendermint_types_params_pb = require('../../tendermint/types/params_pb.js'); +goog.object.extend(proto, tendermint_types_params_pb); +var tendermint_version_types_pb = require('../../tendermint/version/types_pb.js'); +goog.object.extend(proto, tendermint_version_types_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +goog.exportSymbol('proto.tendermint.state.ABCIResponses', null, global); +goog.exportSymbol('proto.tendermint.state.ConsensusParamsInfo', null, global); +goog.exportSymbol('proto.tendermint.state.State', null, global); +goog.exportSymbol('proto.tendermint.state.ValidatorsInfo', null, global); +goog.exportSymbol('proto.tendermint.state.Version', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.state.ABCIResponses = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.state.ABCIResponses.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.state.ABCIResponses, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.state.ABCIResponses.displayName = 'proto.tendermint.state.ABCIResponses'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.state.ValidatorsInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.state.ValidatorsInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.state.ValidatorsInfo.displayName = 'proto.tendermint.state.ValidatorsInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.state.ConsensusParamsInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.state.ConsensusParamsInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.state.ConsensusParamsInfo.displayName = 'proto.tendermint.state.ConsensusParamsInfo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.state.Version = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.state.Version, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.state.Version.displayName = 'proto.tendermint.state.Version'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.state.State = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.state.State, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.state.State.displayName = 'proto.tendermint.state.State'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.state.ABCIResponses.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.state.ABCIResponses.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.state.ABCIResponses.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.state.ABCIResponses} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.ABCIResponses.toObject = function(includeInstance, msg) { + var f, obj = { + deliverTxsList: jspb.Message.toObjectList(msg.getDeliverTxsList(), + tendermint_abci_types_pb.ResponseDeliverTx.toObject, includeInstance), + endBlock: (f = msg.getEndBlock()) && tendermint_abci_types_pb.ResponseEndBlock.toObject(includeInstance, f), + beginBlock: (f = msg.getBeginBlock()) && tendermint_abci_types_pb.ResponseBeginBlock.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.state.ABCIResponses} + */ +proto.tendermint.state.ABCIResponses.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.state.ABCIResponses; + return proto.tendermint.state.ABCIResponses.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.state.ABCIResponses} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.state.ABCIResponses} + */ +proto.tendermint.state.ABCIResponses.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_abci_types_pb.ResponseDeliverTx; + reader.readMessage(value,tendermint_abci_types_pb.ResponseDeliverTx.deserializeBinaryFromReader); + msg.addDeliverTxs(value); + break; + case 2: + var value = new tendermint_abci_types_pb.ResponseEndBlock; + reader.readMessage(value,tendermint_abci_types_pb.ResponseEndBlock.deserializeBinaryFromReader); + msg.setEndBlock(value); + break; + case 3: + var value = new tendermint_abci_types_pb.ResponseBeginBlock; + reader.readMessage(value,tendermint_abci_types_pb.ResponseBeginBlock.deserializeBinaryFromReader); + msg.setBeginBlock(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.state.ABCIResponses.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.state.ABCIResponses.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.state.ABCIResponses} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.ABCIResponses.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDeliverTxsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + tendermint_abci_types_pb.ResponseDeliverTx.serializeBinaryToWriter + ); + } + f = message.getEndBlock(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_abci_types_pb.ResponseEndBlock.serializeBinaryToWriter + ); + } + f = message.getBeginBlock(); + if (f != null) { + writer.writeMessage( + 3, + f, + tendermint_abci_types_pb.ResponseBeginBlock.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated tendermint.abci.ResponseDeliverTx deliver_txs = 1; + * @return {!Array} + */ +proto.tendermint.state.ABCIResponses.prototype.getDeliverTxsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, tendermint_abci_types_pb.ResponseDeliverTx, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.state.ABCIResponses} returns this +*/ +proto.tendermint.state.ABCIResponses.prototype.setDeliverTxsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.tendermint.abci.ResponseDeliverTx=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.abci.ResponseDeliverTx} + */ +proto.tendermint.state.ABCIResponses.prototype.addDeliverTxs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.tendermint.abci.ResponseDeliverTx, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.state.ABCIResponses} returns this + */ +proto.tendermint.state.ABCIResponses.prototype.clearDeliverTxsList = function() { + return this.setDeliverTxsList([]); +}; + + +/** + * optional tendermint.abci.ResponseEndBlock end_block = 2; + * @return {?proto.tendermint.abci.ResponseEndBlock} + */ +proto.tendermint.state.ABCIResponses.prototype.getEndBlock = function() { + return /** @type{?proto.tendermint.abci.ResponseEndBlock} */ ( + jspb.Message.getWrapperField(this, tendermint_abci_types_pb.ResponseEndBlock, 2)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseEndBlock|undefined} value + * @return {!proto.tendermint.state.ABCIResponses} returns this +*/ +proto.tendermint.state.ABCIResponses.prototype.setEndBlock = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.ABCIResponses} returns this + */ +proto.tendermint.state.ABCIResponses.prototype.clearEndBlock = function() { + return this.setEndBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.ABCIResponses.prototype.hasEndBlock = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional tendermint.abci.ResponseBeginBlock begin_block = 3; + * @return {?proto.tendermint.abci.ResponseBeginBlock} + */ +proto.tendermint.state.ABCIResponses.prototype.getBeginBlock = function() { + return /** @type{?proto.tendermint.abci.ResponseBeginBlock} */ ( + jspb.Message.getWrapperField(this, tendermint_abci_types_pb.ResponseBeginBlock, 3)); +}; + + +/** + * @param {?proto.tendermint.abci.ResponseBeginBlock|undefined} value + * @return {!proto.tendermint.state.ABCIResponses} returns this +*/ +proto.tendermint.state.ABCIResponses.prototype.setBeginBlock = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.ABCIResponses} returns this + */ +proto.tendermint.state.ABCIResponses.prototype.clearBeginBlock = function() { + return this.setBeginBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.ABCIResponses.prototype.hasBeginBlock = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.state.ValidatorsInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.state.ValidatorsInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.state.ValidatorsInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.ValidatorsInfo.toObject = function(includeInstance, msg) { + var f, obj = { + validatorSet: (f = msg.getValidatorSet()) && tendermint_types_validator_pb.ValidatorSet.toObject(includeInstance, f), + lastHeightChanged: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.state.ValidatorsInfo} + */ +proto.tendermint.state.ValidatorsInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.state.ValidatorsInfo; + return proto.tendermint.state.ValidatorsInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.state.ValidatorsInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.state.ValidatorsInfo} + */ +proto.tendermint.state.ValidatorsInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_validator_pb.ValidatorSet; + reader.readMessage(value,tendermint_types_validator_pb.ValidatorSet.deserializeBinaryFromReader); + msg.setValidatorSet(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setLastHeightChanged(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.state.ValidatorsInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.state.ValidatorsInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.state.ValidatorsInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.ValidatorsInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getValidatorSet(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_validator_pb.ValidatorSet.serializeBinaryToWriter + ); + } + f = message.getLastHeightChanged(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional tendermint.types.ValidatorSet validator_set = 1; + * @return {?proto.tendermint.types.ValidatorSet} + */ +proto.tendermint.state.ValidatorsInfo.prototype.getValidatorSet = function() { + return /** @type{?proto.tendermint.types.ValidatorSet} */ ( + jspb.Message.getWrapperField(this, tendermint_types_validator_pb.ValidatorSet, 1)); +}; + + +/** + * @param {?proto.tendermint.types.ValidatorSet|undefined} value + * @return {!proto.tendermint.state.ValidatorsInfo} returns this +*/ +proto.tendermint.state.ValidatorsInfo.prototype.setValidatorSet = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.ValidatorsInfo} returns this + */ +proto.tendermint.state.ValidatorsInfo.prototype.clearValidatorSet = function() { + return this.setValidatorSet(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.ValidatorsInfo.prototype.hasValidatorSet = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int64 last_height_changed = 2; + * @return {number} + */ +proto.tendermint.state.ValidatorsInfo.prototype.getLastHeightChanged = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.state.ValidatorsInfo} returns this + */ +proto.tendermint.state.ValidatorsInfo.prototype.setLastHeightChanged = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.state.ConsensusParamsInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.state.ConsensusParamsInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.state.ConsensusParamsInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.ConsensusParamsInfo.toObject = function(includeInstance, msg) { + var f, obj = { + consensusParams: (f = msg.getConsensusParams()) && tendermint_types_params_pb.ConsensusParams.toObject(includeInstance, f), + lastHeightChanged: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.state.ConsensusParamsInfo} + */ +proto.tendermint.state.ConsensusParamsInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.state.ConsensusParamsInfo; + return proto.tendermint.state.ConsensusParamsInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.state.ConsensusParamsInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.state.ConsensusParamsInfo} + */ +proto.tendermint.state.ConsensusParamsInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_params_pb.ConsensusParams; + reader.readMessage(value,tendermint_types_params_pb.ConsensusParams.deserializeBinaryFromReader); + msg.setConsensusParams(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setLastHeightChanged(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.state.ConsensusParamsInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.state.ConsensusParamsInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.state.ConsensusParamsInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.ConsensusParamsInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getConsensusParams(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_params_pb.ConsensusParams.serializeBinaryToWriter + ); + } + f = message.getLastHeightChanged(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional tendermint.types.ConsensusParams consensus_params = 1; + * @return {?proto.tendermint.types.ConsensusParams} + */ +proto.tendermint.state.ConsensusParamsInfo.prototype.getConsensusParams = function() { + return /** @type{?proto.tendermint.types.ConsensusParams} */ ( + jspb.Message.getWrapperField(this, tendermint_types_params_pb.ConsensusParams, 1)); +}; + + +/** + * @param {?proto.tendermint.types.ConsensusParams|undefined} value + * @return {!proto.tendermint.state.ConsensusParamsInfo} returns this +*/ +proto.tendermint.state.ConsensusParamsInfo.prototype.setConsensusParams = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.ConsensusParamsInfo} returns this + */ +proto.tendermint.state.ConsensusParamsInfo.prototype.clearConsensusParams = function() { + return this.setConsensusParams(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.ConsensusParamsInfo.prototype.hasConsensusParams = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int64 last_height_changed = 2; + * @return {number} + */ +proto.tendermint.state.ConsensusParamsInfo.prototype.getLastHeightChanged = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.state.ConsensusParamsInfo} returns this + */ +proto.tendermint.state.ConsensusParamsInfo.prototype.setLastHeightChanged = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.state.Version.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.state.Version.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.state.Version} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.Version.toObject = function(includeInstance, msg) { + var f, obj = { + consensus: (f = msg.getConsensus()) && tendermint_version_types_pb.Consensus.toObject(includeInstance, f), + software: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.state.Version} + */ +proto.tendermint.state.Version.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.state.Version; + return proto.tendermint.state.Version.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.state.Version} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.state.Version} + */ +proto.tendermint.state.Version.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_version_types_pb.Consensus; + reader.readMessage(value,tendermint_version_types_pb.Consensus.deserializeBinaryFromReader); + msg.setConsensus(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setSoftware(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.state.Version.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.state.Version.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.state.Version} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.Version.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getConsensus(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_version_types_pb.Consensus.serializeBinaryToWriter + ); + } + f = message.getSoftware(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional tendermint.version.Consensus consensus = 1; + * @return {?proto.tendermint.version.Consensus} + */ +proto.tendermint.state.Version.prototype.getConsensus = function() { + return /** @type{?proto.tendermint.version.Consensus} */ ( + jspb.Message.getWrapperField(this, tendermint_version_types_pb.Consensus, 1)); +}; + + +/** + * @param {?proto.tendermint.version.Consensus|undefined} value + * @return {!proto.tendermint.state.Version} returns this +*/ +proto.tendermint.state.Version.prototype.setConsensus = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.Version} returns this + */ +proto.tendermint.state.Version.prototype.clearConsensus = function() { + return this.setConsensus(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.Version.prototype.hasConsensus = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string software = 2; + * @return {string} + */ +proto.tendermint.state.Version.prototype.getSoftware = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.state.Version} returns this + */ +proto.tendermint.state.Version.prototype.setSoftware = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.state.State.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.state.State.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.state.State} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.State.toObject = function(includeInstance, msg) { + var f, obj = { + version: (f = msg.getVersion()) && proto.tendermint.state.Version.toObject(includeInstance, f), + chainId: jspb.Message.getFieldWithDefault(msg, 2, ""), + initialHeight: jspb.Message.getFieldWithDefault(msg, 14, 0), + lastBlockHeight: jspb.Message.getFieldWithDefault(msg, 3, 0), + lastBlockId: (f = msg.getLastBlockId()) && tendermint_types_types_pb.BlockID.toObject(includeInstance, f), + lastBlockTime: (f = msg.getLastBlockTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + nextValidators: (f = msg.getNextValidators()) && tendermint_types_validator_pb.ValidatorSet.toObject(includeInstance, f), + validators: (f = msg.getValidators()) && tendermint_types_validator_pb.ValidatorSet.toObject(includeInstance, f), + lastValidators: (f = msg.getLastValidators()) && tendermint_types_validator_pb.ValidatorSet.toObject(includeInstance, f), + lastHeightValidatorsChanged: jspb.Message.getFieldWithDefault(msg, 9, 0), + consensusParams: (f = msg.getConsensusParams()) && tendermint_types_params_pb.ConsensusParams.toObject(includeInstance, f), + lastHeightConsensusParamsChanged: jspb.Message.getFieldWithDefault(msg, 11, 0), + lastResultsHash: msg.getLastResultsHash_asB64(), + appHash: msg.getAppHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.state.State} + */ +proto.tendermint.state.State.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.state.State; + return proto.tendermint.state.State.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.state.State} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.state.State} + */ +proto.tendermint.state.State.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.state.Version; + reader.readMessage(value,proto.tendermint.state.Version.deserializeBinaryFromReader); + msg.setVersion(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + case 14: + var value = /** @type {number} */ (reader.readInt64()); + msg.setInitialHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setLastBlockHeight(value); + break; + case 4: + var value = new tendermint_types_types_pb.BlockID; + reader.readMessage(value,tendermint_types_types_pb.BlockID.deserializeBinaryFromReader); + msg.setLastBlockId(value); + break; + case 5: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setLastBlockTime(value); + break; + case 6: + var value = new tendermint_types_validator_pb.ValidatorSet; + reader.readMessage(value,tendermint_types_validator_pb.ValidatorSet.deserializeBinaryFromReader); + msg.setNextValidators(value); + break; + case 7: + var value = new tendermint_types_validator_pb.ValidatorSet; + reader.readMessage(value,tendermint_types_validator_pb.ValidatorSet.deserializeBinaryFromReader); + msg.setValidators(value); + break; + case 8: + var value = new tendermint_types_validator_pb.ValidatorSet; + reader.readMessage(value,tendermint_types_validator_pb.ValidatorSet.deserializeBinaryFromReader); + msg.setLastValidators(value); + break; + case 9: + var value = /** @type {number} */ (reader.readInt64()); + msg.setLastHeightValidatorsChanged(value); + break; + case 10: + var value = new tendermint_types_params_pb.ConsensusParams; + reader.readMessage(value,tendermint_types_params_pb.ConsensusParams.deserializeBinaryFromReader); + msg.setConsensusParams(value); + break; + case 11: + var value = /** @type {number} */ (reader.readInt64()); + msg.setLastHeightConsensusParamsChanged(value); + break; + case 12: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLastResultsHash(value); + break; + case 13: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAppHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.state.State.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.state.State.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.state.State} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.state.State.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVersion(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.state.Version.serializeBinaryToWriter + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getInitialHeight(); + if (f !== 0) { + writer.writeInt64( + 14, + f + ); + } + f = message.getLastBlockHeight(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } + f = message.getLastBlockId(); + if (f != null) { + writer.writeMessage( + 4, + f, + tendermint_types_types_pb.BlockID.serializeBinaryToWriter + ); + } + f = message.getLastBlockTime(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getNextValidators(); + if (f != null) { + writer.writeMessage( + 6, + f, + tendermint_types_validator_pb.ValidatorSet.serializeBinaryToWriter + ); + } + f = message.getValidators(); + if (f != null) { + writer.writeMessage( + 7, + f, + tendermint_types_validator_pb.ValidatorSet.serializeBinaryToWriter + ); + } + f = message.getLastValidators(); + if (f != null) { + writer.writeMessage( + 8, + f, + tendermint_types_validator_pb.ValidatorSet.serializeBinaryToWriter + ); + } + f = message.getLastHeightValidatorsChanged(); + if (f !== 0) { + writer.writeInt64( + 9, + f + ); + } + f = message.getConsensusParams(); + if (f != null) { + writer.writeMessage( + 10, + f, + tendermint_types_params_pb.ConsensusParams.serializeBinaryToWriter + ); + } + f = message.getLastHeightConsensusParamsChanged(); + if (f !== 0) { + writer.writeInt64( + 11, + f + ); + } + f = message.getLastResultsHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 12, + f + ); + } + f = message.getAppHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 13, + f + ); + } +}; + + +/** + * optional Version version = 1; + * @return {?proto.tendermint.state.Version} + */ +proto.tendermint.state.State.prototype.getVersion = function() { + return /** @type{?proto.tendermint.state.Version} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.state.Version, 1)); +}; + + +/** + * @param {?proto.tendermint.state.Version|undefined} value + * @return {!proto.tendermint.state.State} returns this +*/ +proto.tendermint.state.State.prototype.setVersion = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.clearVersion = function() { + return this.setVersion(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.State.prototype.hasVersion = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string chain_id = 2; + * @return {string} + */ +proto.tendermint.state.State.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional int64 initial_height = 14; + * @return {number} + */ +proto.tendermint.state.State.prototype.getInitialHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 14, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.setInitialHeight = function(value) { + return jspb.Message.setProto3IntField(this, 14, value); +}; + + +/** + * optional int64 last_block_height = 3; + * @return {number} + */ +proto.tendermint.state.State.prototype.getLastBlockHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.setLastBlockHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional tendermint.types.BlockID last_block_id = 4; + * @return {?proto.tendermint.types.BlockID} + */ +proto.tendermint.state.State.prototype.getLastBlockId = function() { + return /** @type{?proto.tendermint.types.BlockID} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.BlockID, 4)); +}; + + +/** + * @param {?proto.tendermint.types.BlockID|undefined} value + * @return {!proto.tendermint.state.State} returns this +*/ +proto.tendermint.state.State.prototype.setLastBlockId = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.clearLastBlockId = function() { + return this.setLastBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.State.prototype.hasLastBlockId = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional google.protobuf.Timestamp last_block_time = 5; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.state.State.prototype.getLastBlockTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.state.State} returns this +*/ +proto.tendermint.state.State.prototype.setLastBlockTime = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.clearLastBlockTime = function() { + return this.setLastBlockTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.State.prototype.hasLastBlockTime = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional tendermint.types.ValidatorSet next_validators = 6; + * @return {?proto.tendermint.types.ValidatorSet} + */ +proto.tendermint.state.State.prototype.getNextValidators = function() { + return /** @type{?proto.tendermint.types.ValidatorSet} */ ( + jspb.Message.getWrapperField(this, tendermint_types_validator_pb.ValidatorSet, 6)); +}; + + +/** + * @param {?proto.tendermint.types.ValidatorSet|undefined} value + * @return {!proto.tendermint.state.State} returns this +*/ +proto.tendermint.state.State.prototype.setNextValidators = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.clearNextValidators = function() { + return this.setNextValidators(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.State.prototype.hasNextValidators = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional tendermint.types.ValidatorSet validators = 7; + * @return {?proto.tendermint.types.ValidatorSet} + */ +proto.tendermint.state.State.prototype.getValidators = function() { + return /** @type{?proto.tendermint.types.ValidatorSet} */ ( + jspb.Message.getWrapperField(this, tendermint_types_validator_pb.ValidatorSet, 7)); +}; + + +/** + * @param {?proto.tendermint.types.ValidatorSet|undefined} value + * @return {!proto.tendermint.state.State} returns this +*/ +proto.tendermint.state.State.prototype.setValidators = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.clearValidators = function() { + return this.setValidators(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.State.prototype.hasValidators = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional tendermint.types.ValidatorSet last_validators = 8; + * @return {?proto.tendermint.types.ValidatorSet} + */ +proto.tendermint.state.State.prototype.getLastValidators = function() { + return /** @type{?proto.tendermint.types.ValidatorSet} */ ( + jspb.Message.getWrapperField(this, tendermint_types_validator_pb.ValidatorSet, 8)); +}; + + +/** + * @param {?proto.tendermint.types.ValidatorSet|undefined} value + * @return {!proto.tendermint.state.State} returns this +*/ +proto.tendermint.state.State.prototype.setLastValidators = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.clearLastValidators = function() { + return this.setLastValidators(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.State.prototype.hasLastValidators = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional int64 last_height_validators_changed = 9; + * @return {number} + */ +proto.tendermint.state.State.prototype.getLastHeightValidatorsChanged = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.setLastHeightValidatorsChanged = function(value) { + return jspb.Message.setProto3IntField(this, 9, value); +}; + + +/** + * optional tendermint.types.ConsensusParams consensus_params = 10; + * @return {?proto.tendermint.types.ConsensusParams} + */ +proto.tendermint.state.State.prototype.getConsensusParams = function() { + return /** @type{?proto.tendermint.types.ConsensusParams} */ ( + jspb.Message.getWrapperField(this, tendermint_types_params_pb.ConsensusParams, 10)); +}; + + +/** + * @param {?proto.tendermint.types.ConsensusParams|undefined} value + * @return {!proto.tendermint.state.State} returns this +*/ +proto.tendermint.state.State.prototype.setConsensusParams = function(value) { + return jspb.Message.setWrapperField(this, 10, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.clearConsensusParams = function() { + return this.setConsensusParams(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.state.State.prototype.hasConsensusParams = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional int64 last_height_consensus_params_changed = 11; + * @return {number} + */ +proto.tendermint.state.State.prototype.getLastHeightConsensusParamsChanged = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.setLastHeightConsensusParamsChanged = function(value) { + return jspb.Message.setProto3IntField(this, 11, value); +}; + + +/** + * optional bytes last_results_hash = 12; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.state.State.prototype.getLastResultsHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +}; + + +/** + * optional bytes last_results_hash = 12; + * This is a type-conversion wrapper around `getLastResultsHash()` + * @return {string} + */ +proto.tendermint.state.State.prototype.getLastResultsHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLastResultsHash())); +}; + + +/** + * optional bytes last_results_hash = 12; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLastResultsHash()` + * @return {!Uint8Array} + */ +proto.tendermint.state.State.prototype.getLastResultsHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLastResultsHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.setLastResultsHash = function(value) { + return jspb.Message.setProto3BytesField(this, 12, value); +}; + + +/** + * optional bytes app_hash = 13; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.state.State.prototype.getAppHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 13, "")); +}; + + +/** + * optional bytes app_hash = 13; + * This is a type-conversion wrapper around `getAppHash()` + * @return {string} + */ +proto.tendermint.state.State.prototype.getAppHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAppHash())); +}; + + +/** + * optional bytes app_hash = 13; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAppHash()` + * @return {!Uint8Array} + */ +proto.tendermint.state.State.prototype.getAppHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAppHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.state.State} returns this + */ +proto.tendermint.state.State.prototype.setAppHash = function(value) { + return jspb.Message.setProto3BytesField(this, 13, value); +}; + + +goog.object.extend(exports, proto.tendermint.state); diff --git a/js/proto/tendermint/statesync/types_grpc_pb.js b/js/proto/tendermint/statesync/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/statesync/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/statesync/types_pb.d.ts b/js/proto/tendermint/statesync/types_pb.d.ts new file mode 100644 index 000000000..089fd9602 --- /dev/null +++ b/js/proto/tendermint/statesync/types_pb.d.ts @@ -0,0 +1,194 @@ +// package: tendermint.statesync +// file: tendermint/statesync/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class Message extends jspb.Message { + + hasSnapshotsRequest(): boolean; + clearSnapshotsRequest(): void; + getSnapshotsRequest(): SnapshotsRequest | undefined; + setSnapshotsRequest(value?: SnapshotsRequest): Message; + + + hasSnapshotsResponse(): boolean; + clearSnapshotsResponse(): void; + getSnapshotsResponse(): SnapshotsResponse | undefined; + setSnapshotsResponse(value?: SnapshotsResponse): Message; + + + hasChunkRequest(): boolean; + clearChunkRequest(): void; + getChunkRequest(): ChunkRequest | undefined; + setChunkRequest(value?: ChunkRequest): Message; + + + hasChunkResponse(): boolean; + clearChunkResponse(): void; + getChunkResponse(): ChunkResponse | undefined; + setChunkResponse(value?: ChunkResponse): Message; + + + getSumCase(): Message.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Message.AsObject; + static toObject(includeInstance: boolean, msg: Message): Message.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Message, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Message; + static deserializeBinaryFromReader(message: Message, reader: jspb.BinaryReader): Message; +} + +export namespace Message { + export type AsObject = { + snapshotsRequest?: SnapshotsRequest.AsObject, + snapshotsResponse?: SnapshotsResponse.AsObject, + chunkRequest?: ChunkRequest.AsObject, + chunkResponse?: ChunkResponse.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + SNAPSHOTS_REQUEST = 1, + + SNAPSHOTS_RESPONSE = 2, + + CHUNK_REQUEST = 3, + + CHUNK_RESPONSE = 4, + + } + +} + +export class SnapshotsRequest extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SnapshotsRequest.AsObject; + static toObject(includeInstance: boolean, msg: SnapshotsRequest): SnapshotsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SnapshotsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SnapshotsRequest; + static deserializeBinaryFromReader(message: SnapshotsRequest, reader: jspb.BinaryReader): SnapshotsRequest; +} + +export namespace SnapshotsRequest { + export type AsObject = { + } +} + +export class SnapshotsResponse extends jspb.Message { + getHeight(): number; + setHeight(value: number): SnapshotsResponse; + + getFormat(): number; + setFormat(value: number): SnapshotsResponse; + + getChunks(): number; + setChunks(value: number): SnapshotsResponse; + + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): SnapshotsResponse; + + getMetadata(): Uint8Array | string; + getMetadata_asU8(): Uint8Array; + getMetadata_asB64(): string; + setMetadata(value: Uint8Array | string): SnapshotsResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SnapshotsResponse.AsObject; + static toObject(includeInstance: boolean, msg: SnapshotsResponse): SnapshotsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SnapshotsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SnapshotsResponse; + static deserializeBinaryFromReader(message: SnapshotsResponse, reader: jspb.BinaryReader): SnapshotsResponse; +} + +export namespace SnapshotsResponse { + export type AsObject = { + height: number, + format: number, + chunks: number, + hash: Uint8Array | string, + metadata: Uint8Array | string, + } +} + +export class ChunkRequest extends jspb.Message { + getHeight(): number; + setHeight(value: number): ChunkRequest; + + getFormat(): number; + setFormat(value: number): ChunkRequest; + + getIndex(): number; + setIndex(value: number): ChunkRequest; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ChunkRequest.AsObject; + static toObject(includeInstance: boolean, msg: ChunkRequest): ChunkRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ChunkRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ChunkRequest; + static deserializeBinaryFromReader(message: ChunkRequest, reader: jspb.BinaryReader): ChunkRequest; +} + +export namespace ChunkRequest { + export type AsObject = { + height: number, + format: number, + index: number, + } +} + +export class ChunkResponse extends jspb.Message { + getHeight(): number; + setHeight(value: number): ChunkResponse; + + getFormat(): number; + setFormat(value: number): ChunkResponse; + + getIndex(): number; + setIndex(value: number): ChunkResponse; + + getChunk(): Uint8Array | string; + getChunk_asU8(): Uint8Array; + getChunk_asB64(): string; + setChunk(value: Uint8Array | string): ChunkResponse; + + getMissing(): boolean; + setMissing(value: boolean): ChunkResponse; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ChunkResponse.AsObject; + static toObject(includeInstance: boolean, msg: ChunkResponse): ChunkResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ChunkResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ChunkResponse; + static deserializeBinaryFromReader(message: ChunkResponse, reader: jspb.BinaryReader): ChunkResponse; +} + +export namespace ChunkResponse { + export type AsObject = { + height: number, + format: number, + index: number, + chunk: Uint8Array | string, + missing: boolean, + } +} diff --git a/js/proto/tendermint/statesync/types_pb.js b/js/proto/tendermint/statesync/types_pb.js new file mode 100644 index 000000000..10db6b29e --- /dev/null +++ b/js/proto/tendermint/statesync/types_pb.js @@ -0,0 +1,1323 @@ +// source: tendermint/statesync/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.tendermint.statesync.ChunkRequest', null, global); +goog.exportSymbol('proto.tendermint.statesync.ChunkResponse', null, global); +goog.exportSymbol('proto.tendermint.statesync.Message', null, global); +goog.exportSymbol('proto.tendermint.statesync.Message.SumCase', null, global); +goog.exportSymbol('proto.tendermint.statesync.SnapshotsRequest', null, global); +goog.exportSymbol('proto.tendermint.statesync.SnapshotsResponse', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.statesync.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.statesync.Message.oneofGroups_); +}; +goog.inherits(proto.tendermint.statesync.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.statesync.Message.displayName = 'proto.tendermint.statesync.Message'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.statesync.SnapshotsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.statesync.SnapshotsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.statesync.SnapshotsRequest.displayName = 'proto.tendermint.statesync.SnapshotsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.statesync.SnapshotsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.statesync.SnapshotsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.statesync.SnapshotsResponse.displayName = 'proto.tendermint.statesync.SnapshotsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.statesync.ChunkRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.statesync.ChunkRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.statesync.ChunkRequest.displayName = 'proto.tendermint.statesync.ChunkRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.statesync.ChunkResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.statesync.ChunkResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.statesync.ChunkResponse.displayName = 'proto.tendermint.statesync.ChunkResponse'; +} + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.statesync.Message.oneofGroups_ = [[1,2,3,4]]; + +/** + * @enum {number} + */ +proto.tendermint.statesync.Message.SumCase = { + SUM_NOT_SET: 0, + SNAPSHOTS_REQUEST: 1, + SNAPSHOTS_RESPONSE: 2, + CHUNK_REQUEST: 3, + CHUNK_RESPONSE: 4 +}; + +/** + * @return {proto.tendermint.statesync.Message.SumCase} + */ +proto.tendermint.statesync.Message.prototype.getSumCase = function() { + return /** @type {proto.tendermint.statesync.Message.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.statesync.Message.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.statesync.Message.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.statesync.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.statesync.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.Message.toObject = function(includeInstance, msg) { + var f, obj = { + snapshotsRequest: (f = msg.getSnapshotsRequest()) && proto.tendermint.statesync.SnapshotsRequest.toObject(includeInstance, f), + snapshotsResponse: (f = msg.getSnapshotsResponse()) && proto.tendermint.statesync.SnapshotsResponse.toObject(includeInstance, f), + chunkRequest: (f = msg.getChunkRequest()) && proto.tendermint.statesync.ChunkRequest.toObject(includeInstance, f), + chunkResponse: (f = msg.getChunkResponse()) && proto.tendermint.statesync.ChunkResponse.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.statesync.Message} + */ +proto.tendermint.statesync.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.statesync.Message; + return proto.tendermint.statesync.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.statesync.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.statesync.Message} + */ +proto.tendermint.statesync.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.statesync.SnapshotsRequest; + reader.readMessage(value,proto.tendermint.statesync.SnapshotsRequest.deserializeBinaryFromReader); + msg.setSnapshotsRequest(value); + break; + case 2: + var value = new proto.tendermint.statesync.SnapshotsResponse; + reader.readMessage(value,proto.tendermint.statesync.SnapshotsResponse.deserializeBinaryFromReader); + msg.setSnapshotsResponse(value); + break; + case 3: + var value = new proto.tendermint.statesync.ChunkRequest; + reader.readMessage(value,proto.tendermint.statesync.ChunkRequest.deserializeBinaryFromReader); + msg.setChunkRequest(value); + break; + case 4: + var value = new proto.tendermint.statesync.ChunkResponse; + reader.readMessage(value,proto.tendermint.statesync.ChunkResponse.deserializeBinaryFromReader); + msg.setChunkResponse(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.statesync.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.statesync.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.statesync.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSnapshotsRequest(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.statesync.SnapshotsRequest.serializeBinaryToWriter + ); + } + f = message.getSnapshotsResponse(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.statesync.SnapshotsResponse.serializeBinaryToWriter + ); + } + f = message.getChunkRequest(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.statesync.ChunkRequest.serializeBinaryToWriter + ); + } + f = message.getChunkResponse(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.statesync.ChunkResponse.serializeBinaryToWriter + ); + } +}; + + +/** + * optional SnapshotsRequest snapshots_request = 1; + * @return {?proto.tendermint.statesync.SnapshotsRequest} + */ +proto.tendermint.statesync.Message.prototype.getSnapshotsRequest = function() { + return /** @type{?proto.tendermint.statesync.SnapshotsRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.statesync.SnapshotsRequest, 1)); +}; + + +/** + * @param {?proto.tendermint.statesync.SnapshotsRequest|undefined} value + * @return {!proto.tendermint.statesync.Message} returns this +*/ +proto.tendermint.statesync.Message.prototype.setSnapshotsRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.statesync.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.statesync.Message} returns this + */ +proto.tendermint.statesync.Message.prototype.clearSnapshotsRequest = function() { + return this.setSnapshotsRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.statesync.Message.prototype.hasSnapshotsRequest = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional SnapshotsResponse snapshots_response = 2; + * @return {?proto.tendermint.statesync.SnapshotsResponse} + */ +proto.tendermint.statesync.Message.prototype.getSnapshotsResponse = function() { + return /** @type{?proto.tendermint.statesync.SnapshotsResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.statesync.SnapshotsResponse, 2)); +}; + + +/** + * @param {?proto.tendermint.statesync.SnapshotsResponse|undefined} value + * @return {!proto.tendermint.statesync.Message} returns this +*/ +proto.tendermint.statesync.Message.prototype.setSnapshotsResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.statesync.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.statesync.Message} returns this + */ +proto.tendermint.statesync.Message.prototype.clearSnapshotsResponse = function() { + return this.setSnapshotsResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.statesync.Message.prototype.hasSnapshotsResponse = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ChunkRequest chunk_request = 3; + * @return {?proto.tendermint.statesync.ChunkRequest} + */ +proto.tendermint.statesync.Message.prototype.getChunkRequest = function() { + return /** @type{?proto.tendermint.statesync.ChunkRequest} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.statesync.ChunkRequest, 3)); +}; + + +/** + * @param {?proto.tendermint.statesync.ChunkRequest|undefined} value + * @return {!proto.tendermint.statesync.Message} returns this +*/ +proto.tendermint.statesync.Message.prototype.setChunkRequest = function(value) { + return jspb.Message.setOneofWrapperField(this, 3, proto.tendermint.statesync.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.statesync.Message} returns this + */ +proto.tendermint.statesync.Message.prototype.clearChunkRequest = function() { + return this.setChunkRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.statesync.Message.prototype.hasChunkRequest = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional ChunkResponse chunk_response = 4; + * @return {?proto.tendermint.statesync.ChunkResponse} + */ +proto.tendermint.statesync.Message.prototype.getChunkResponse = function() { + return /** @type{?proto.tendermint.statesync.ChunkResponse} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.statesync.ChunkResponse, 4)); +}; + + +/** + * @param {?proto.tendermint.statesync.ChunkResponse|undefined} value + * @return {!proto.tendermint.statesync.Message} returns this +*/ +proto.tendermint.statesync.Message.prototype.setChunkResponse = function(value) { + return jspb.Message.setOneofWrapperField(this, 4, proto.tendermint.statesync.Message.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.statesync.Message} returns this + */ +proto.tendermint.statesync.Message.prototype.clearChunkResponse = function() { + return this.setChunkResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.statesync.Message.prototype.hasChunkResponse = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.statesync.SnapshotsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.statesync.SnapshotsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.statesync.SnapshotsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.SnapshotsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.statesync.SnapshotsRequest} + */ +proto.tendermint.statesync.SnapshotsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.statesync.SnapshotsRequest; + return proto.tendermint.statesync.SnapshotsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.statesync.SnapshotsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.statesync.SnapshotsRequest} + */ +proto.tendermint.statesync.SnapshotsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.statesync.SnapshotsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.statesync.SnapshotsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.statesync.SnapshotsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.SnapshotsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.statesync.SnapshotsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.statesync.SnapshotsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.SnapshotsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + format: jspb.Message.getFieldWithDefault(msg, 2, 0), + chunks: jspb.Message.getFieldWithDefault(msg, 3, 0), + hash: msg.getHash_asB64(), + metadata: msg.getMetadata_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.statesync.SnapshotsResponse} + */ +proto.tendermint.statesync.SnapshotsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.statesync.SnapshotsResponse; + return proto.tendermint.statesync.SnapshotsResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.statesync.SnapshotsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.statesync.SnapshotsResponse} + */ +proto.tendermint.statesync.SnapshotsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFormat(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setChunks(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMetadata(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.statesync.SnapshotsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.statesync.SnapshotsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.SnapshotsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getFormat(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getChunks(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getMetadata_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.SnapshotsResponse} returns this + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 format = 2; + * @return {number} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getFormat = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.SnapshotsResponse} returns this + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.setFormat = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 chunks = 3; + * @return {number} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getChunks = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.SnapshotsResponse} returns this + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.setChunks = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional bytes hash = 4; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes hash = 4; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.statesync.SnapshotsResponse} returns this + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional bytes metadata = 5; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getMetadata = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes metadata = 5; + * This is a type-conversion wrapper around `getMetadata()` + * @return {string} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getMetadata_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMetadata())); +}; + + +/** + * optional bytes metadata = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMetadata()` + * @return {!Uint8Array} + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.getMetadata_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMetadata())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.statesync.SnapshotsResponse} returns this + */ +proto.tendermint.statesync.SnapshotsResponse.prototype.setMetadata = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.statesync.ChunkRequest.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.statesync.ChunkRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.statesync.ChunkRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.ChunkRequest.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + format: jspb.Message.getFieldWithDefault(msg, 2, 0), + index: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.statesync.ChunkRequest} + */ +proto.tendermint.statesync.ChunkRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.statesync.ChunkRequest; + return proto.tendermint.statesync.ChunkRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.statesync.ChunkRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.statesync.ChunkRequest} + */ +proto.tendermint.statesync.ChunkRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFormat(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setIndex(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.statesync.ChunkRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.statesync.ChunkRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.statesync.ChunkRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.ChunkRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getFormat(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.tendermint.statesync.ChunkRequest.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.ChunkRequest} returns this + */ +proto.tendermint.statesync.ChunkRequest.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 format = 2; + * @return {number} + */ +proto.tendermint.statesync.ChunkRequest.prototype.getFormat = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.ChunkRequest} returns this + */ +proto.tendermint.statesync.ChunkRequest.prototype.setFormat = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 index = 3; + * @return {number} + */ +proto.tendermint.statesync.ChunkRequest.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.ChunkRequest} returns this + */ +proto.tendermint.statesync.ChunkRequest.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.statesync.ChunkResponse.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.statesync.ChunkResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.statesync.ChunkResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.ChunkResponse.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + format: jspb.Message.getFieldWithDefault(msg, 2, 0), + index: jspb.Message.getFieldWithDefault(msg, 3, 0), + chunk: msg.getChunk_asB64(), + missing: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.statesync.ChunkResponse} + */ +proto.tendermint.statesync.ChunkResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.statesync.ChunkResponse; + return proto.tendermint.statesync.ChunkResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.statesync.ChunkResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.statesync.ChunkResponse} + */ +proto.tendermint.statesync.ChunkResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFormat(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setIndex(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setChunk(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setMissing(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.statesync.ChunkResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.statesync.ChunkResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.statesync.ChunkResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.statesync.ChunkResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getFormat(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getChunk_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getMissing(); + if (f) { + writer.writeBool( + 5, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.tendermint.statesync.ChunkResponse.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.ChunkResponse} returns this + */ +proto.tendermint.statesync.ChunkResponse.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 format = 2; + * @return {number} + */ +proto.tendermint.statesync.ChunkResponse.prototype.getFormat = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.ChunkResponse} returns this + */ +proto.tendermint.statesync.ChunkResponse.prototype.setFormat = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional uint32 index = 3; + * @return {number} + */ +proto.tendermint.statesync.ChunkResponse.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.statesync.ChunkResponse} returns this + */ +proto.tendermint.statesync.ChunkResponse.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional bytes chunk = 4; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.statesync.ChunkResponse.prototype.getChunk = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes chunk = 4; + * This is a type-conversion wrapper around `getChunk()` + * @return {string} + */ +proto.tendermint.statesync.ChunkResponse.prototype.getChunk_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getChunk())); +}; + + +/** + * optional bytes chunk = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getChunk()` + * @return {!Uint8Array} + */ +proto.tendermint.statesync.ChunkResponse.prototype.getChunk_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getChunk())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.statesync.ChunkResponse} returns this + */ +proto.tendermint.statesync.ChunkResponse.prototype.setChunk = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional bool missing = 5; + * @return {boolean} + */ +proto.tendermint.statesync.ChunkResponse.prototype.getMissing = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.tendermint.statesync.ChunkResponse} returns this + */ +proto.tendermint.statesync.ChunkResponse.prototype.setMissing = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +goog.object.extend(exports, proto.tendermint.statesync); diff --git a/js/proto/tendermint/store/types_grpc_pb.js b/js/proto/tendermint/store/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/store/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/store/types_pb.d.ts b/js/proto/tendermint/store/types_pb.d.ts new file mode 100644 index 000000000..67e4e249a --- /dev/null +++ b/js/proto/tendermint/store/types_pb.d.ts @@ -0,0 +1,32 @@ +// package: tendermint.store +// file: tendermint/store/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class BlockStoreState extends jspb.Message { + getBase(): number; + setBase(value: number): BlockStoreState; + + getHeight(): number; + setHeight(value: number): BlockStoreState; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockStoreState.AsObject; + static toObject(includeInstance: boolean, msg: BlockStoreState): BlockStoreState.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockStoreState, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockStoreState; + static deserializeBinaryFromReader(message: BlockStoreState, reader: jspb.BinaryReader): BlockStoreState; +} + +export namespace BlockStoreState { + export type AsObject = { + base: number, + height: number, + } +} diff --git a/js/proto/tendermint/store/types_pb.js b/js/proto/tendermint/store/types_pb.js new file mode 100644 index 000000000..efc0dd653 --- /dev/null +++ b/js/proto/tendermint/store/types_pb.js @@ -0,0 +1,199 @@ +// source: tendermint/store/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.tendermint.store.BlockStoreState', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.store.BlockStoreState = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.store.BlockStoreState, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.store.BlockStoreState.displayName = 'proto.tendermint.store.BlockStoreState'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.store.BlockStoreState.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.store.BlockStoreState.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.store.BlockStoreState} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.store.BlockStoreState.toObject = function(includeInstance, msg) { + var f, obj = { + base: jspb.Message.getFieldWithDefault(msg, 1, 0), + height: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.store.BlockStoreState} + */ +proto.tendermint.store.BlockStoreState.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.store.BlockStoreState; + return proto.tendermint.store.BlockStoreState.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.store.BlockStoreState} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.store.BlockStoreState} + */ +proto.tendermint.store.BlockStoreState.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setBase(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.store.BlockStoreState.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.store.BlockStoreState.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.store.BlockStoreState} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.store.BlockStoreState.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBase(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional int64 base = 1; + * @return {number} + */ +proto.tendermint.store.BlockStoreState.prototype.getBase = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.store.BlockStoreState} returns this + */ +proto.tendermint.store.BlockStoreState.prototype.setBase = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int64 height = 2; + * @return {number} + */ +proto.tendermint.store.BlockStoreState.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.store.BlockStoreState} returns this + */ +proto.tendermint.store.BlockStoreState.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +goog.object.extend(exports, proto.tendermint.store); diff --git a/js/proto/tendermint/types/block_grpc_pb.js b/js/proto/tendermint/types/block_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/types/block_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/types/block_pb.d.ts b/js/proto/tendermint/types/block_pb.d.ts new file mode 100644 index 000000000..ceb01ae55 --- /dev/null +++ b/js/proto/tendermint/types/block_pb.d.ts @@ -0,0 +1,55 @@ +// package: tendermint.types +// file: tendermint/types/block.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as tendermint_types_types_pb from "../../tendermint/types/types_pb"; +import * as tendermint_types_evidence_pb from "../../tendermint/types/evidence_pb"; + +export class Block extends jspb.Message { + + hasHeader(): boolean; + clearHeader(): void; + getHeader(): tendermint_types_types_pb.Header | undefined; + setHeader(value?: tendermint_types_types_pb.Header): Block; + + + hasData(): boolean; + clearData(): void; + getData(): tendermint_types_types_pb.Data | undefined; + setData(value?: tendermint_types_types_pb.Data): Block; + + + hasEvidence(): boolean; + clearEvidence(): void; + getEvidence(): tendermint_types_evidence_pb.EvidenceList | undefined; + setEvidence(value?: tendermint_types_evidence_pb.EvidenceList): Block; + + + hasLastCommit(): boolean; + clearLastCommit(): void; + getLastCommit(): tendermint_types_types_pb.Commit | undefined; + setLastCommit(value?: tendermint_types_types_pb.Commit): Block; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Block.AsObject; + static toObject(includeInstance: boolean, msg: Block): Block.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Block, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Block; + static deserializeBinaryFromReader(message: Block, reader: jspb.BinaryReader): Block; +} + +export namespace Block { + export type AsObject = { + header?: tendermint_types_types_pb.Header.AsObject, + data?: tendermint_types_types_pb.Data.AsObject, + evidence?: tendermint_types_evidence_pb.EvidenceList.AsObject, + lastCommit?: tendermint_types_types_pb.Commit.AsObject, + } +} diff --git a/js/proto/tendermint/types/block_pb.js b/js/proto/tendermint/types/block_pb.js new file mode 100644 index 000000000..97f477eb7 --- /dev/null +++ b/js/proto/tendermint/types/block_pb.js @@ -0,0 +1,349 @@ +// source: tendermint/types/block.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_types_types_pb = require('../../tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var tendermint_types_evidence_pb = require('../../tendermint/types/evidence_pb.js'); +goog.object.extend(proto, tendermint_types_evidence_pb); +goog.exportSymbol('proto.tendermint.types.Block', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Block = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.Block, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Block.displayName = 'proto.tendermint.types.Block'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Block.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Block.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Block} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Block.toObject = function(includeInstance, msg) { + var f, obj = { + header: (f = msg.getHeader()) && tendermint_types_types_pb.Header.toObject(includeInstance, f), + data: (f = msg.getData()) && tendermint_types_types_pb.Data.toObject(includeInstance, f), + evidence: (f = msg.getEvidence()) && tendermint_types_evidence_pb.EvidenceList.toObject(includeInstance, f), + lastCommit: (f = msg.getLastCommit()) && tendermint_types_types_pb.Commit.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Block} + */ +proto.tendermint.types.Block.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Block; + return proto.tendermint.types.Block.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Block} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Block} + */ +proto.tendermint.types.Block.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.Header; + reader.readMessage(value,tendermint_types_types_pb.Header.deserializeBinaryFromReader); + msg.setHeader(value); + break; + case 2: + var value = new tendermint_types_types_pb.Data; + reader.readMessage(value,tendermint_types_types_pb.Data.deserializeBinaryFromReader); + msg.setData(value); + break; + case 3: + var value = new tendermint_types_evidence_pb.EvidenceList; + reader.readMessage(value,tendermint_types_evidence_pb.EvidenceList.deserializeBinaryFromReader); + msg.setEvidence(value); + break; + case 4: + var value = new tendermint_types_types_pb.Commit; + reader.readMessage(value,tendermint_types_types_pb.Commit.deserializeBinaryFromReader); + msg.setLastCommit(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Block.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Block.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Block} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Block.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeader(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.Header.serializeBinaryToWriter + ); + } + f = message.getData(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_types_types_pb.Data.serializeBinaryToWriter + ); + } + f = message.getEvidence(); + if (f != null) { + writer.writeMessage( + 3, + f, + tendermint_types_evidence_pb.EvidenceList.serializeBinaryToWriter + ); + } + f = message.getLastCommit(); + if (f != null) { + writer.writeMessage( + 4, + f, + tendermint_types_types_pb.Commit.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Header header = 1; + * @return {?proto.tendermint.types.Header} + */ +proto.tendermint.types.Block.prototype.getHeader = function() { + return /** @type{?proto.tendermint.types.Header} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Header, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Header|undefined} value + * @return {!proto.tendermint.types.Block} returns this +*/ +proto.tendermint.types.Block.prototype.setHeader = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Block} returns this + */ +proto.tendermint.types.Block.prototype.clearHeader = function() { + return this.setHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Block.prototype.hasHeader = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Data data = 2; + * @return {?proto.tendermint.types.Data} + */ +proto.tendermint.types.Block.prototype.getData = function() { + return /** @type{?proto.tendermint.types.Data} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Data, 2)); +}; + + +/** + * @param {?proto.tendermint.types.Data|undefined} value + * @return {!proto.tendermint.types.Block} returns this +*/ +proto.tendermint.types.Block.prototype.setData = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Block} returns this + */ +proto.tendermint.types.Block.prototype.clearData = function() { + return this.setData(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Block.prototype.hasData = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional EvidenceList evidence = 3; + * @return {?proto.tendermint.types.EvidenceList} + */ +proto.tendermint.types.Block.prototype.getEvidence = function() { + return /** @type{?proto.tendermint.types.EvidenceList} */ ( + jspb.Message.getWrapperField(this, tendermint_types_evidence_pb.EvidenceList, 3)); +}; + + +/** + * @param {?proto.tendermint.types.EvidenceList|undefined} value + * @return {!proto.tendermint.types.Block} returns this +*/ +proto.tendermint.types.Block.prototype.setEvidence = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Block} returns this + */ +proto.tendermint.types.Block.prototype.clearEvidence = function() { + return this.setEvidence(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Block.prototype.hasEvidence = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional Commit last_commit = 4; + * @return {?proto.tendermint.types.Commit} + */ +proto.tendermint.types.Block.prototype.getLastCommit = function() { + return /** @type{?proto.tendermint.types.Commit} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Commit, 4)); +}; + + +/** + * @param {?proto.tendermint.types.Commit|undefined} value + * @return {!proto.tendermint.types.Block} returns this +*/ +proto.tendermint.types.Block.prototype.setLastCommit = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Block} returns this + */ +proto.tendermint.types.Block.prototype.clearLastCommit = function() { + return this.setLastCommit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Block.prototype.hasLastCommit = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +goog.object.extend(exports, proto.tendermint.types); diff --git a/js/proto/tendermint/types/canonical_grpc_pb.js b/js/proto/tendermint/types/canonical_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/types/canonical_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/types/canonical_pb.d.ts b/js/proto/tendermint/types/canonical_pb.d.ts new file mode 100644 index 000000000..550878405 --- /dev/null +++ b/js/proto/tendermint/types/canonical_pb.d.ts @@ -0,0 +1,165 @@ +// package: tendermint.types +// file: tendermint/types/canonical.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as tendermint_types_types_pb from "../../tendermint/types/types_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; + +export class CanonicalBlockID extends jspb.Message { + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): CanonicalBlockID; + + + hasPartSetHeader(): boolean; + clearPartSetHeader(): void; + getPartSetHeader(): CanonicalPartSetHeader | undefined; + setPartSetHeader(value?: CanonicalPartSetHeader): CanonicalBlockID; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CanonicalBlockID.AsObject; + static toObject(includeInstance: boolean, msg: CanonicalBlockID): CanonicalBlockID.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CanonicalBlockID, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CanonicalBlockID; + static deserializeBinaryFromReader(message: CanonicalBlockID, reader: jspb.BinaryReader): CanonicalBlockID; +} + +export namespace CanonicalBlockID { + export type AsObject = { + hash: Uint8Array | string, + partSetHeader?: CanonicalPartSetHeader.AsObject, + } +} + +export class CanonicalPartSetHeader extends jspb.Message { + getTotal(): number; + setTotal(value: number): CanonicalPartSetHeader; + + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): CanonicalPartSetHeader; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CanonicalPartSetHeader.AsObject; + static toObject(includeInstance: boolean, msg: CanonicalPartSetHeader): CanonicalPartSetHeader.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CanonicalPartSetHeader, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CanonicalPartSetHeader; + static deserializeBinaryFromReader(message: CanonicalPartSetHeader, reader: jspb.BinaryReader): CanonicalPartSetHeader; +} + +export namespace CanonicalPartSetHeader { + export type AsObject = { + total: number, + hash: Uint8Array | string, + } +} + +export class CanonicalProposal extends jspb.Message { + getType(): tendermint_types_types_pb.SignedMsgType; + setType(value: tendermint_types_types_pb.SignedMsgType): CanonicalProposal; + + getHeight(): number; + setHeight(value: number): CanonicalProposal; + + getRound(): number; + setRound(value: number): CanonicalProposal; + + getPolRound(): number; + setPolRound(value: number): CanonicalProposal; + + + hasBlockId(): boolean; + clearBlockId(): void; + getBlockId(): CanonicalBlockID | undefined; + setBlockId(value?: CanonicalBlockID): CanonicalProposal; + + + hasTimestamp(): boolean; + clearTimestamp(): void; + getTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): CanonicalProposal; + + getChainId(): string; + setChainId(value: string): CanonicalProposal; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CanonicalProposal.AsObject; + static toObject(includeInstance: boolean, msg: CanonicalProposal): CanonicalProposal.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CanonicalProposal, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CanonicalProposal; + static deserializeBinaryFromReader(message: CanonicalProposal, reader: jspb.BinaryReader): CanonicalProposal; +} + +export namespace CanonicalProposal { + export type AsObject = { + type: tendermint_types_types_pb.SignedMsgType, + height: number, + round: number, + polRound: number, + blockId?: CanonicalBlockID.AsObject, + timestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + chainId: string, + } +} + +export class CanonicalVote extends jspb.Message { + getType(): tendermint_types_types_pb.SignedMsgType; + setType(value: tendermint_types_types_pb.SignedMsgType): CanonicalVote; + + getHeight(): number; + setHeight(value: number): CanonicalVote; + + getRound(): number; + setRound(value: number): CanonicalVote; + + + hasBlockId(): boolean; + clearBlockId(): void; + getBlockId(): CanonicalBlockID | undefined; + setBlockId(value?: CanonicalBlockID): CanonicalVote; + + + hasTimestamp(): boolean; + clearTimestamp(): void; + getTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): CanonicalVote; + + getChainId(): string; + setChainId(value: string): CanonicalVote; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CanonicalVote.AsObject; + static toObject(includeInstance: boolean, msg: CanonicalVote): CanonicalVote.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CanonicalVote, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CanonicalVote; + static deserializeBinaryFromReader(message: CanonicalVote, reader: jspb.BinaryReader): CanonicalVote; +} + +export namespace CanonicalVote { + export type AsObject = { + type: tendermint_types_types_pb.SignedMsgType, + height: number, + round: number, + blockId?: CanonicalBlockID.AsObject, + timestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + chainId: string, + } +} diff --git a/js/proto/tendermint/types/canonical_pb.js b/js/proto/tendermint/types/canonical_pb.js new file mode 100644 index 000000000..8d5d6a708 --- /dev/null +++ b/js/proto/tendermint/types/canonical_pb.js @@ -0,0 +1,1174 @@ +// source: tendermint/types/canonical.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_types_types_pb = require('../../tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +goog.exportSymbol('proto.tendermint.types.CanonicalBlockID', null, global); +goog.exportSymbol('proto.tendermint.types.CanonicalPartSetHeader', null, global); +goog.exportSymbol('proto.tendermint.types.CanonicalProposal', null, global); +goog.exportSymbol('proto.tendermint.types.CanonicalVote', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.CanonicalBlockID = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.CanonicalBlockID, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.CanonicalBlockID.displayName = 'proto.tendermint.types.CanonicalBlockID'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.CanonicalPartSetHeader = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.CanonicalPartSetHeader, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.CanonicalPartSetHeader.displayName = 'proto.tendermint.types.CanonicalPartSetHeader'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.CanonicalProposal = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.CanonicalProposal, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.CanonicalProposal.displayName = 'proto.tendermint.types.CanonicalProposal'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.CanonicalVote = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.CanonicalVote, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.CanonicalVote.displayName = 'proto.tendermint.types.CanonicalVote'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.CanonicalBlockID.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.CanonicalBlockID.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.CanonicalBlockID} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CanonicalBlockID.toObject = function(includeInstance, msg) { + var f, obj = { + hash: msg.getHash_asB64(), + partSetHeader: (f = msg.getPartSetHeader()) && proto.tendermint.types.CanonicalPartSetHeader.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.CanonicalBlockID} + */ +proto.tendermint.types.CanonicalBlockID.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.CanonicalBlockID; + return proto.tendermint.types.CanonicalBlockID.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.CanonicalBlockID} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.CanonicalBlockID} + */ +proto.tendermint.types.CanonicalBlockID.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 2: + var value = new proto.tendermint.types.CanonicalPartSetHeader; + reader.readMessage(value,proto.tendermint.types.CanonicalPartSetHeader.deserializeBinaryFromReader); + msg.setPartSetHeader(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.CanonicalBlockID.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.CanonicalBlockID.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.CanonicalBlockID} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CanonicalBlockID.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPartSetHeader(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.types.CanonicalPartSetHeader.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes hash = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.CanonicalBlockID.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes hash = 1; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.tendermint.types.CanonicalBlockID.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.CanonicalBlockID.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.CanonicalBlockID} returns this + */ +proto.tendermint.types.CanonicalBlockID.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional CanonicalPartSetHeader part_set_header = 2; + * @return {?proto.tendermint.types.CanonicalPartSetHeader} + */ +proto.tendermint.types.CanonicalBlockID.prototype.getPartSetHeader = function() { + return /** @type{?proto.tendermint.types.CanonicalPartSetHeader} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.CanonicalPartSetHeader, 2)); +}; + + +/** + * @param {?proto.tendermint.types.CanonicalPartSetHeader|undefined} value + * @return {!proto.tendermint.types.CanonicalBlockID} returns this +*/ +proto.tendermint.types.CanonicalBlockID.prototype.setPartSetHeader = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.CanonicalBlockID} returns this + */ +proto.tendermint.types.CanonicalBlockID.prototype.clearPartSetHeader = function() { + return this.setPartSetHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.CanonicalBlockID.prototype.hasPartSetHeader = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.CanonicalPartSetHeader.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.CanonicalPartSetHeader.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.CanonicalPartSetHeader} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CanonicalPartSetHeader.toObject = function(includeInstance, msg) { + var f, obj = { + total: jspb.Message.getFieldWithDefault(msg, 1, 0), + hash: msg.getHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.CanonicalPartSetHeader} + */ +proto.tendermint.types.CanonicalPartSetHeader.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.CanonicalPartSetHeader; + return proto.tendermint.types.CanonicalPartSetHeader.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.CanonicalPartSetHeader} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.CanonicalPartSetHeader} + */ +proto.tendermint.types.CanonicalPartSetHeader.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setTotal(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.CanonicalPartSetHeader.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.CanonicalPartSetHeader.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.CanonicalPartSetHeader} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CanonicalPartSetHeader.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTotal(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional uint32 total = 1; + * @return {number} + */ +proto.tendermint.types.CanonicalPartSetHeader.prototype.getTotal = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.CanonicalPartSetHeader} returns this + */ +proto.tendermint.types.CanonicalPartSetHeader.prototype.setTotal = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes hash = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.CanonicalPartSetHeader.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes hash = 2; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.tendermint.types.CanonicalPartSetHeader.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.CanonicalPartSetHeader.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.CanonicalPartSetHeader} returns this + */ +proto.tendermint.types.CanonicalPartSetHeader.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.CanonicalProposal.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.CanonicalProposal.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.CanonicalProposal} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CanonicalProposal.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + height: jspb.Message.getFieldWithDefault(msg, 2, 0), + round: jspb.Message.getFieldWithDefault(msg, 3, 0), + polRound: jspb.Message.getFieldWithDefault(msg, 4, 0), + blockId: (f = msg.getBlockId()) && proto.tendermint.types.CanonicalBlockID.toObject(includeInstance, f), + timestamp: (f = msg.getTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + chainId: jspb.Message.getFieldWithDefault(msg, 7, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.CanonicalProposal} + */ +proto.tendermint.types.CanonicalProposal.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.CanonicalProposal; + return proto.tendermint.types.CanonicalProposal.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.CanonicalProposal} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.CanonicalProposal} + */ +proto.tendermint.types.CanonicalProposal.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.tendermint.types.SignedMsgType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readSfixed64()); + msg.setHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readSfixed64()); + msg.setRound(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setPolRound(value); + break; + case 5: + var value = new proto.tendermint.types.CanonicalBlockID; + reader.readMessage(value,proto.tendermint.types.CanonicalBlockID.deserializeBinaryFromReader); + msg.setBlockId(value); + break; + case 6: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTimestamp(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.CanonicalProposal.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.CanonicalProposal.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.CanonicalProposal} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CanonicalProposal.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeSfixed64( + 2, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeSfixed64( + 3, + f + ); + } + f = message.getPolRound(); + if (f !== 0) { + writer.writeInt64( + 4, + f + ); + } + f = message.getBlockId(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.tendermint.types.CanonicalBlockID.serializeBinaryToWriter + ); + } + f = message.getTimestamp(); + if (f != null) { + writer.writeMessage( + 6, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 7, + f + ); + } +}; + + +/** + * optional SignedMsgType type = 1; + * @return {!proto.tendermint.types.SignedMsgType} + */ +proto.tendermint.types.CanonicalProposal.prototype.getType = function() { + return /** @type {!proto.tendermint.types.SignedMsgType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.tendermint.types.SignedMsgType} value + * @return {!proto.tendermint.types.CanonicalProposal} returns this + */ +proto.tendermint.types.CanonicalProposal.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional sfixed64 height = 2; + * @return {number} + */ +proto.tendermint.types.CanonicalProposal.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.CanonicalProposal} returns this + */ +proto.tendermint.types.CanonicalProposal.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional sfixed64 round = 3; + * @return {number} + */ +proto.tendermint.types.CanonicalProposal.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.CanonicalProposal} returns this + */ +proto.tendermint.types.CanonicalProposal.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int64 pol_round = 4; + * @return {number} + */ +proto.tendermint.types.CanonicalProposal.prototype.getPolRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.CanonicalProposal} returns this + */ +proto.tendermint.types.CanonicalProposal.prototype.setPolRound = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional CanonicalBlockID block_id = 5; + * @return {?proto.tendermint.types.CanonicalBlockID} + */ +proto.tendermint.types.CanonicalProposal.prototype.getBlockId = function() { + return /** @type{?proto.tendermint.types.CanonicalBlockID} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.CanonicalBlockID, 5)); +}; + + +/** + * @param {?proto.tendermint.types.CanonicalBlockID|undefined} value + * @return {!proto.tendermint.types.CanonicalProposal} returns this +*/ +proto.tendermint.types.CanonicalProposal.prototype.setBlockId = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.CanonicalProposal} returns this + */ +proto.tendermint.types.CanonicalProposal.prototype.clearBlockId = function() { + return this.setBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.CanonicalProposal.prototype.hasBlockId = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional google.protobuf.Timestamp timestamp = 6; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.types.CanonicalProposal.prototype.getTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 6)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.types.CanonicalProposal} returns this +*/ +proto.tendermint.types.CanonicalProposal.prototype.setTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.CanonicalProposal} returns this + */ +proto.tendermint.types.CanonicalProposal.prototype.clearTimestamp = function() { + return this.setTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.CanonicalProposal.prototype.hasTimestamp = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional string chain_id = 7; + * @return {string} + */ +proto.tendermint.types.CanonicalProposal.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.types.CanonicalProposal} returns this + */ +proto.tendermint.types.CanonicalProposal.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 7, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.CanonicalVote.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.CanonicalVote.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.CanonicalVote} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CanonicalVote.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + height: jspb.Message.getFieldWithDefault(msg, 2, 0), + round: jspb.Message.getFieldWithDefault(msg, 3, 0), + blockId: (f = msg.getBlockId()) && proto.tendermint.types.CanonicalBlockID.toObject(includeInstance, f), + timestamp: (f = msg.getTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + chainId: jspb.Message.getFieldWithDefault(msg, 6, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.CanonicalVote} + */ +proto.tendermint.types.CanonicalVote.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.CanonicalVote; + return proto.tendermint.types.CanonicalVote.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.CanonicalVote} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.CanonicalVote} + */ +proto.tendermint.types.CanonicalVote.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.tendermint.types.SignedMsgType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readSfixed64()); + msg.setHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readSfixed64()); + msg.setRound(value); + break; + case 4: + var value = new proto.tendermint.types.CanonicalBlockID; + reader.readMessage(value,proto.tendermint.types.CanonicalBlockID.deserializeBinaryFromReader); + msg.setBlockId(value); + break; + case 5: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTimestamp(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.CanonicalVote.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.CanonicalVote.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.CanonicalVote} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CanonicalVote.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeSfixed64( + 2, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeSfixed64( + 3, + f + ); + } + f = message.getBlockId(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.types.CanonicalBlockID.serializeBinaryToWriter + ); + } + f = message.getTimestamp(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } +}; + + +/** + * optional SignedMsgType type = 1; + * @return {!proto.tendermint.types.SignedMsgType} + */ +proto.tendermint.types.CanonicalVote.prototype.getType = function() { + return /** @type {!proto.tendermint.types.SignedMsgType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.tendermint.types.SignedMsgType} value + * @return {!proto.tendermint.types.CanonicalVote} returns this + */ +proto.tendermint.types.CanonicalVote.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional sfixed64 height = 2; + * @return {number} + */ +proto.tendermint.types.CanonicalVote.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.CanonicalVote} returns this + */ +proto.tendermint.types.CanonicalVote.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional sfixed64 round = 3; + * @return {number} + */ +proto.tendermint.types.CanonicalVote.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.CanonicalVote} returns this + */ +proto.tendermint.types.CanonicalVote.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional CanonicalBlockID block_id = 4; + * @return {?proto.tendermint.types.CanonicalBlockID} + */ +proto.tendermint.types.CanonicalVote.prototype.getBlockId = function() { + return /** @type{?proto.tendermint.types.CanonicalBlockID} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.CanonicalBlockID, 4)); +}; + + +/** + * @param {?proto.tendermint.types.CanonicalBlockID|undefined} value + * @return {!proto.tendermint.types.CanonicalVote} returns this +*/ +proto.tendermint.types.CanonicalVote.prototype.setBlockId = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.CanonicalVote} returns this + */ +proto.tendermint.types.CanonicalVote.prototype.clearBlockId = function() { + return this.setBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.CanonicalVote.prototype.hasBlockId = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional google.protobuf.Timestamp timestamp = 5; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.types.CanonicalVote.prototype.getTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.types.CanonicalVote} returns this +*/ +proto.tendermint.types.CanonicalVote.prototype.setTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.CanonicalVote} returns this + */ +proto.tendermint.types.CanonicalVote.prototype.clearTimestamp = function() { + return this.setTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.CanonicalVote.prototype.hasTimestamp = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional string chain_id = 6; + * @return {string} + */ +proto.tendermint.types.CanonicalVote.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.types.CanonicalVote} returns this + */ +proto.tendermint.types.CanonicalVote.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + +goog.object.extend(exports, proto.tendermint.types); diff --git a/js/proto/tendermint/types/events_grpc_pb.js b/js/proto/tendermint/types/events_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/types/events_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/types/events_pb.d.ts b/js/proto/tendermint/types/events_pb.d.ts new file mode 100644 index 000000000..cd516b0d5 --- /dev/null +++ b/js/proto/tendermint/types/events_pb.d.ts @@ -0,0 +1,36 @@ +// package: tendermint.types +// file: tendermint/types/events.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class EventDataRoundState extends jspb.Message { + getHeight(): number; + setHeight(value: number): EventDataRoundState; + + getRound(): number; + setRound(value: number): EventDataRoundState; + + getStep(): string; + setStep(value: string): EventDataRoundState; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EventDataRoundState.AsObject; + static toObject(includeInstance: boolean, msg: EventDataRoundState): EventDataRoundState.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EventDataRoundState, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EventDataRoundState; + static deserializeBinaryFromReader(message: EventDataRoundState, reader: jspb.BinaryReader): EventDataRoundState; +} + +export namespace EventDataRoundState { + export type AsObject = { + height: number, + round: number, + step: string, + } +} diff --git a/js/proto/tendermint/types/events_pb.js b/js/proto/tendermint/types/events_pb.js new file mode 100644 index 000000000..59bdd691f --- /dev/null +++ b/js/proto/tendermint/types/events_pb.js @@ -0,0 +1,229 @@ +// source: tendermint/types/events.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.tendermint.types.EventDataRoundState', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.EventDataRoundState = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.EventDataRoundState, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.EventDataRoundState.displayName = 'proto.tendermint.types.EventDataRoundState'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.EventDataRoundState.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.EventDataRoundState.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.EventDataRoundState} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.EventDataRoundState.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + round: jspb.Message.getFieldWithDefault(msg, 2, 0), + step: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.EventDataRoundState} + */ +proto.tendermint.types.EventDataRoundState.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.EventDataRoundState; + return proto.tendermint.types.EventDataRoundState.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.EventDataRoundState} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.EventDataRoundState} + */ +proto.tendermint.types.EventDataRoundState.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setStep(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.EventDataRoundState.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.EventDataRoundState.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.EventDataRoundState} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.EventDataRoundState.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getStep(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.types.EventDataRoundState.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.EventDataRoundState} returns this + */ +proto.tendermint.types.EventDataRoundState.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 round = 2; + * @return {number} + */ +proto.tendermint.types.EventDataRoundState.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.EventDataRoundState} returns this + */ +proto.tendermint.types.EventDataRoundState.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional string step = 3; + * @return {string} + */ +proto.tendermint.types.EventDataRoundState.prototype.getStep = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.types.EventDataRoundState} returns this + */ +proto.tendermint.types.EventDataRoundState.prototype.setStep = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +goog.object.extend(exports, proto.tendermint.types); diff --git a/js/proto/tendermint/types/evidence_grpc_pb.js b/js/proto/tendermint/types/evidence_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/types/evidence_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/types/evidence_pb.d.ts b/js/proto/tendermint/types/evidence_pb.d.ts new file mode 100644 index 000000000..2579a4603 --- /dev/null +++ b/js/proto/tendermint/types/evidence_pb.d.ts @@ -0,0 +1,168 @@ +// package: tendermint.types +// file: tendermint/types/evidence.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as tendermint_types_types_pb from "../../tendermint/types/types_pb"; +import * as tendermint_types_validator_pb from "../../tendermint/types/validator_pb"; + +export class Evidence extends jspb.Message { + + hasDuplicateVoteEvidence(): boolean; + clearDuplicateVoteEvidence(): void; + getDuplicateVoteEvidence(): DuplicateVoteEvidence | undefined; + setDuplicateVoteEvidence(value?: DuplicateVoteEvidence): Evidence; + + + hasLightClientAttackEvidence(): boolean; + clearLightClientAttackEvidence(): void; + getLightClientAttackEvidence(): LightClientAttackEvidence | undefined; + setLightClientAttackEvidence(value?: LightClientAttackEvidence): Evidence; + + + getSumCase(): Evidence.SumCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Evidence.AsObject; + static toObject(includeInstance: boolean, msg: Evidence): Evidence.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Evidence, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Evidence; + static deserializeBinaryFromReader(message: Evidence, reader: jspb.BinaryReader): Evidence; +} + +export namespace Evidence { + export type AsObject = { + duplicateVoteEvidence?: DuplicateVoteEvidence.AsObject, + lightClientAttackEvidence?: LightClientAttackEvidence.AsObject, + } + + export enum SumCase { + SUM_NOT_SET = 0, + + DUPLICATE_VOTE_EVIDENCE = 1, + + LIGHT_CLIENT_ATTACK_EVIDENCE = 2, + + } + +} + +export class DuplicateVoteEvidence extends jspb.Message { + + hasVoteA(): boolean; + clearVoteA(): void; + getVoteA(): tendermint_types_types_pb.Vote | undefined; + setVoteA(value?: tendermint_types_types_pb.Vote): DuplicateVoteEvidence; + + + hasVoteB(): boolean; + clearVoteB(): void; + getVoteB(): tendermint_types_types_pb.Vote | undefined; + setVoteB(value?: tendermint_types_types_pb.Vote): DuplicateVoteEvidence; + + getTotalVotingPower(): number; + setTotalVotingPower(value: number): DuplicateVoteEvidence; + + getValidatorPower(): number; + setValidatorPower(value: number): DuplicateVoteEvidence; + + + hasTimestamp(): boolean; + clearTimestamp(): void; + getTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): DuplicateVoteEvidence; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DuplicateVoteEvidence.AsObject; + static toObject(includeInstance: boolean, msg: DuplicateVoteEvidence): DuplicateVoteEvidence.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DuplicateVoteEvidence, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DuplicateVoteEvidence; + static deserializeBinaryFromReader(message: DuplicateVoteEvidence, reader: jspb.BinaryReader): DuplicateVoteEvidence; +} + +export namespace DuplicateVoteEvidence { + export type AsObject = { + voteA?: tendermint_types_types_pb.Vote.AsObject, + voteB?: tendermint_types_types_pb.Vote.AsObject, + totalVotingPower: number, + validatorPower: number, + timestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + } +} + +export class LightClientAttackEvidence extends jspb.Message { + + hasConflictingBlock(): boolean; + clearConflictingBlock(): void; + getConflictingBlock(): tendermint_types_types_pb.LightBlock | undefined; + setConflictingBlock(value?: tendermint_types_types_pb.LightBlock): LightClientAttackEvidence; + + getCommonHeight(): number; + setCommonHeight(value: number): LightClientAttackEvidence; + + clearByzantineValidatorsList(): void; + getByzantineValidatorsList(): Array; + setByzantineValidatorsList(value: Array): LightClientAttackEvidence; + addByzantineValidators(value?: tendermint_types_validator_pb.Validator, index?: number): tendermint_types_validator_pb.Validator; + + getTotalVotingPower(): number; + setTotalVotingPower(value: number): LightClientAttackEvidence; + + + hasTimestamp(): boolean; + clearTimestamp(): void; + getTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): LightClientAttackEvidence; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): LightClientAttackEvidence.AsObject; + static toObject(includeInstance: boolean, msg: LightClientAttackEvidence): LightClientAttackEvidence.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: LightClientAttackEvidence, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): LightClientAttackEvidence; + static deserializeBinaryFromReader(message: LightClientAttackEvidence, reader: jspb.BinaryReader): LightClientAttackEvidence; +} + +export namespace LightClientAttackEvidence { + export type AsObject = { + conflictingBlock?: tendermint_types_types_pb.LightBlock.AsObject, + commonHeight: number, + byzantineValidatorsList: Array, + totalVotingPower: number, + timestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + } +} + +export class EvidenceList extends jspb.Message { + clearEvidenceList(): void; + getEvidenceList(): Array; + setEvidenceList(value: Array): EvidenceList; + addEvidence(value?: Evidence, index?: number): Evidence; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EvidenceList.AsObject; + static toObject(includeInstance: boolean, msg: EvidenceList): EvidenceList.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EvidenceList, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EvidenceList; + static deserializeBinaryFromReader(message: EvidenceList, reader: jspb.BinaryReader): EvidenceList; +} + +export namespace EvidenceList { + export type AsObject = { + evidenceList: Array, + } +} diff --git a/js/proto/tendermint/types/evidence_pb.js b/js/proto/tendermint/types/evidence_pb.js new file mode 100644 index 000000000..8455dc943 --- /dev/null +++ b/js/proto/tendermint/types/evidence_pb.js @@ -0,0 +1,1137 @@ +// source: tendermint/types/evidence.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +var tendermint_types_types_pb = require('../../tendermint/types/types_pb.js'); +goog.object.extend(proto, tendermint_types_types_pb); +var tendermint_types_validator_pb = require('../../tendermint/types/validator_pb.js'); +goog.object.extend(proto, tendermint_types_validator_pb); +goog.exportSymbol('proto.tendermint.types.DuplicateVoteEvidence', null, global); +goog.exportSymbol('proto.tendermint.types.Evidence', null, global); +goog.exportSymbol('proto.tendermint.types.Evidence.SumCase', null, global); +goog.exportSymbol('proto.tendermint.types.EvidenceList', null, global); +goog.exportSymbol('proto.tendermint.types.LightClientAttackEvidence', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Evidence = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.tendermint.types.Evidence.oneofGroups_); +}; +goog.inherits(proto.tendermint.types.Evidence, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Evidence.displayName = 'proto.tendermint.types.Evidence'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.DuplicateVoteEvidence = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.DuplicateVoteEvidence, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.DuplicateVoteEvidence.displayName = 'proto.tendermint.types.DuplicateVoteEvidence'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.LightClientAttackEvidence = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.types.LightClientAttackEvidence.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.types.LightClientAttackEvidence, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.LightClientAttackEvidence.displayName = 'proto.tendermint.types.LightClientAttackEvidence'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.EvidenceList = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.types.EvidenceList.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.types.EvidenceList, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.EvidenceList.displayName = 'proto.tendermint.types.EvidenceList'; +} + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.tendermint.types.Evidence.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.tendermint.types.Evidence.SumCase = { + SUM_NOT_SET: 0, + DUPLICATE_VOTE_EVIDENCE: 1, + LIGHT_CLIENT_ATTACK_EVIDENCE: 2 +}; + +/** + * @return {proto.tendermint.types.Evidence.SumCase} + */ +proto.tendermint.types.Evidence.prototype.getSumCase = function() { + return /** @type {proto.tendermint.types.Evidence.SumCase} */(jspb.Message.computeOneofCase(this, proto.tendermint.types.Evidence.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Evidence.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Evidence.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Evidence} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Evidence.toObject = function(includeInstance, msg) { + var f, obj = { + duplicateVoteEvidence: (f = msg.getDuplicateVoteEvidence()) && proto.tendermint.types.DuplicateVoteEvidence.toObject(includeInstance, f), + lightClientAttackEvidence: (f = msg.getLightClientAttackEvidence()) && proto.tendermint.types.LightClientAttackEvidence.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Evidence} + */ +proto.tendermint.types.Evidence.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Evidence; + return proto.tendermint.types.Evidence.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Evidence} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Evidence} + */ +proto.tendermint.types.Evidence.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.types.DuplicateVoteEvidence; + reader.readMessage(value,proto.tendermint.types.DuplicateVoteEvidence.deserializeBinaryFromReader); + msg.setDuplicateVoteEvidence(value); + break; + case 2: + var value = new proto.tendermint.types.LightClientAttackEvidence; + reader.readMessage(value,proto.tendermint.types.LightClientAttackEvidence.deserializeBinaryFromReader); + msg.setLightClientAttackEvidence(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Evidence.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Evidence.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Evidence} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Evidence.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDuplicateVoteEvidence(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.types.DuplicateVoteEvidence.serializeBinaryToWriter + ); + } + f = message.getLightClientAttackEvidence(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.types.LightClientAttackEvidence.serializeBinaryToWriter + ); + } +}; + + +/** + * optional DuplicateVoteEvidence duplicate_vote_evidence = 1; + * @return {?proto.tendermint.types.DuplicateVoteEvidence} + */ +proto.tendermint.types.Evidence.prototype.getDuplicateVoteEvidence = function() { + return /** @type{?proto.tendermint.types.DuplicateVoteEvidence} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.DuplicateVoteEvidence, 1)); +}; + + +/** + * @param {?proto.tendermint.types.DuplicateVoteEvidence|undefined} value + * @return {!proto.tendermint.types.Evidence} returns this +*/ +proto.tendermint.types.Evidence.prototype.setDuplicateVoteEvidence = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.tendermint.types.Evidence.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Evidence} returns this + */ +proto.tendermint.types.Evidence.prototype.clearDuplicateVoteEvidence = function() { + return this.setDuplicateVoteEvidence(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Evidence.prototype.hasDuplicateVoteEvidence = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional LightClientAttackEvidence light_client_attack_evidence = 2; + * @return {?proto.tendermint.types.LightClientAttackEvidence} + */ +proto.tendermint.types.Evidence.prototype.getLightClientAttackEvidence = function() { + return /** @type{?proto.tendermint.types.LightClientAttackEvidence} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.LightClientAttackEvidence, 2)); +}; + + +/** + * @param {?proto.tendermint.types.LightClientAttackEvidence|undefined} value + * @return {!proto.tendermint.types.Evidence} returns this +*/ +proto.tendermint.types.Evidence.prototype.setLightClientAttackEvidence = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.tendermint.types.Evidence.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Evidence} returns this + */ +proto.tendermint.types.Evidence.prototype.clearLightClientAttackEvidence = function() { + return this.setLightClientAttackEvidence(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Evidence.prototype.hasLightClientAttackEvidence = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.DuplicateVoteEvidence.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.DuplicateVoteEvidence} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.DuplicateVoteEvidence.toObject = function(includeInstance, msg) { + var f, obj = { + voteA: (f = msg.getVoteA()) && tendermint_types_types_pb.Vote.toObject(includeInstance, f), + voteB: (f = msg.getVoteB()) && tendermint_types_types_pb.Vote.toObject(includeInstance, f), + totalVotingPower: jspb.Message.getFieldWithDefault(msg, 3, 0), + validatorPower: jspb.Message.getFieldWithDefault(msg, 4, 0), + timestamp: (f = msg.getTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.DuplicateVoteEvidence} + */ +proto.tendermint.types.DuplicateVoteEvidence.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.DuplicateVoteEvidence; + return proto.tendermint.types.DuplicateVoteEvidence.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.DuplicateVoteEvidence} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.DuplicateVoteEvidence} + */ +proto.tendermint.types.DuplicateVoteEvidence.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.Vote; + reader.readMessage(value,tendermint_types_types_pb.Vote.deserializeBinaryFromReader); + msg.setVoteA(value); + break; + case 2: + var value = new tendermint_types_types_pb.Vote; + reader.readMessage(value,tendermint_types_types_pb.Vote.deserializeBinaryFromReader); + msg.setVoteB(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTotalVotingPower(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setValidatorPower(value); + break; + case 5: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTimestamp(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.DuplicateVoteEvidence.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.DuplicateVoteEvidence} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.DuplicateVoteEvidence.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVoteA(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.Vote.serializeBinaryToWriter + ); + } + f = message.getVoteB(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_types_types_pb.Vote.serializeBinaryToWriter + ); + } + f = message.getTotalVotingPower(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } + f = message.getValidatorPower(); + if (f !== 0) { + writer.writeInt64( + 4, + f + ); + } + f = message.getTimestamp(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Vote vote_a = 1; + * @return {?proto.tendermint.types.Vote} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.getVoteA = function() { + return /** @type{?proto.tendermint.types.Vote} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Vote, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Vote|undefined} value + * @return {!proto.tendermint.types.DuplicateVoteEvidence} returns this +*/ +proto.tendermint.types.DuplicateVoteEvidence.prototype.setVoteA = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.DuplicateVoteEvidence} returns this + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.clearVoteA = function() { + return this.setVoteA(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.hasVoteA = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Vote vote_b = 2; + * @return {?proto.tendermint.types.Vote} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.getVoteB = function() { + return /** @type{?proto.tendermint.types.Vote} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.Vote, 2)); +}; + + +/** + * @param {?proto.tendermint.types.Vote|undefined} value + * @return {!proto.tendermint.types.DuplicateVoteEvidence} returns this +*/ +proto.tendermint.types.DuplicateVoteEvidence.prototype.setVoteB = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.DuplicateVoteEvidence} returns this + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.clearVoteB = function() { + return this.setVoteB(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.hasVoteB = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int64 total_voting_power = 3; + * @return {number} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.getTotalVotingPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.DuplicateVoteEvidence} returns this + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.setTotalVotingPower = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int64 validator_power = 4; + * @return {number} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.getValidatorPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.DuplicateVoteEvidence} returns this + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.setValidatorPower = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional google.protobuf.Timestamp timestamp = 5; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.getTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.types.DuplicateVoteEvidence} returns this +*/ +proto.tendermint.types.DuplicateVoteEvidence.prototype.setTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.DuplicateVoteEvidence} returns this + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.clearTimestamp = function() { + return this.setTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.DuplicateVoteEvidence.prototype.hasTimestamp = function() { + return jspb.Message.getField(this, 5) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.types.LightClientAttackEvidence.repeatedFields_ = [3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.LightClientAttackEvidence.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.LightClientAttackEvidence} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.LightClientAttackEvidence.toObject = function(includeInstance, msg) { + var f, obj = { + conflictingBlock: (f = msg.getConflictingBlock()) && tendermint_types_types_pb.LightBlock.toObject(includeInstance, f), + commonHeight: jspb.Message.getFieldWithDefault(msg, 2, 0), + byzantineValidatorsList: jspb.Message.toObjectList(msg.getByzantineValidatorsList(), + tendermint_types_validator_pb.Validator.toObject, includeInstance), + totalVotingPower: jspb.Message.getFieldWithDefault(msg, 4, 0), + timestamp: (f = msg.getTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.LightClientAttackEvidence} + */ +proto.tendermint.types.LightClientAttackEvidence.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.LightClientAttackEvidence; + return proto.tendermint.types.LightClientAttackEvidence.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.LightClientAttackEvidence} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.LightClientAttackEvidence} + */ +proto.tendermint.types.LightClientAttackEvidence.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_types_types_pb.LightBlock; + reader.readMessage(value,tendermint_types_types_pb.LightBlock.deserializeBinaryFromReader); + msg.setConflictingBlock(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setCommonHeight(value); + break; + case 3: + var value = new tendermint_types_validator_pb.Validator; + reader.readMessage(value,tendermint_types_validator_pb.Validator.deserializeBinaryFromReader); + msg.addByzantineValidators(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTotalVotingPower(value); + break; + case 5: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTimestamp(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.LightClientAttackEvidence.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.LightClientAttackEvidence} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.LightClientAttackEvidence.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getConflictingBlock(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_types_types_pb.LightBlock.serializeBinaryToWriter + ); + } + f = message.getCommonHeight(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getByzantineValidatorsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + tendermint_types_validator_pb.Validator.serializeBinaryToWriter + ); + } + f = message.getTotalVotingPower(); + if (f !== 0) { + writer.writeInt64( + 4, + f + ); + } + f = message.getTimestamp(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } +}; + + +/** + * optional LightBlock conflicting_block = 1; + * @return {?proto.tendermint.types.LightBlock} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.getConflictingBlock = function() { + return /** @type{?proto.tendermint.types.LightBlock} */ ( + jspb.Message.getWrapperField(this, tendermint_types_types_pb.LightBlock, 1)); +}; + + +/** + * @param {?proto.tendermint.types.LightBlock|undefined} value + * @return {!proto.tendermint.types.LightClientAttackEvidence} returns this +*/ +proto.tendermint.types.LightClientAttackEvidence.prototype.setConflictingBlock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.LightClientAttackEvidence} returns this + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.clearConflictingBlock = function() { + return this.setConflictingBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.hasConflictingBlock = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int64 common_height = 2; + * @return {number} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.getCommonHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.LightClientAttackEvidence} returns this + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.setCommonHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * repeated Validator byzantine_validators = 3; + * @return {!Array} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.getByzantineValidatorsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, tendermint_types_validator_pb.Validator, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.types.LightClientAttackEvidence} returns this +*/ +proto.tendermint.types.LightClientAttackEvidence.prototype.setByzantineValidatorsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.tendermint.types.Validator=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.types.Validator} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.addByzantineValidators = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.tendermint.types.Validator, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.types.LightClientAttackEvidence} returns this + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.clearByzantineValidatorsList = function() { + return this.setByzantineValidatorsList([]); +}; + + +/** + * optional int64 total_voting_power = 4; + * @return {number} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.getTotalVotingPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.LightClientAttackEvidence} returns this + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.setTotalVotingPower = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional google.protobuf.Timestamp timestamp = 5; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.getTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.types.LightClientAttackEvidence} returns this +*/ +proto.tendermint.types.LightClientAttackEvidence.prototype.setTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.LightClientAttackEvidence} returns this + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.clearTimestamp = function() { + return this.setTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.LightClientAttackEvidence.prototype.hasTimestamp = function() { + return jspb.Message.getField(this, 5) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.types.EvidenceList.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.EvidenceList.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.EvidenceList.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.EvidenceList} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.EvidenceList.toObject = function(includeInstance, msg) { + var f, obj = { + evidenceList: jspb.Message.toObjectList(msg.getEvidenceList(), + proto.tendermint.types.Evidence.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.EvidenceList} + */ +proto.tendermint.types.EvidenceList.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.EvidenceList; + return proto.tendermint.types.EvidenceList.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.EvidenceList} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.EvidenceList} + */ +proto.tendermint.types.EvidenceList.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.types.Evidence; + reader.readMessage(value,proto.tendermint.types.Evidence.deserializeBinaryFromReader); + msg.addEvidence(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.EvidenceList.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.EvidenceList.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.EvidenceList} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.EvidenceList.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEvidenceList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.tendermint.types.Evidence.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated Evidence evidence = 1; + * @return {!Array} + */ +proto.tendermint.types.EvidenceList.prototype.getEvidenceList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.types.Evidence, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.types.EvidenceList} returns this +*/ +proto.tendermint.types.EvidenceList.prototype.setEvidenceList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.tendermint.types.Evidence=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.types.Evidence} + */ +proto.tendermint.types.EvidenceList.prototype.addEvidence = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.tendermint.types.Evidence, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.types.EvidenceList} returns this + */ +proto.tendermint.types.EvidenceList.prototype.clearEvidenceList = function() { + return this.setEvidenceList([]); +}; + + +goog.object.extend(exports, proto.tendermint.types); diff --git a/js/proto/tendermint/types/params_grpc_pb.js b/js/proto/tendermint/types/params_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/types/params_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/types/params_pb.d.ts b/js/proto/tendermint/types/params_pb.d.ts new file mode 100644 index 000000000..a36d5a879 --- /dev/null +++ b/js/proto/tendermint/types/params_pb.d.ts @@ -0,0 +1,184 @@ +// package: tendermint.types +// file: tendermint/types/params.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb"; + +export class ConsensusParams extends jspb.Message { + + hasBlock(): boolean; + clearBlock(): void; + getBlock(): BlockParams | undefined; + setBlock(value?: BlockParams): ConsensusParams; + + + hasEvidence(): boolean; + clearEvidence(): void; + getEvidence(): EvidenceParams | undefined; + setEvidence(value?: EvidenceParams): ConsensusParams; + + + hasValidator(): boolean; + clearValidator(): void; + getValidator(): ValidatorParams | undefined; + setValidator(value?: ValidatorParams): ConsensusParams; + + + hasVersion(): boolean; + clearVersion(): void; + getVersion(): VersionParams | undefined; + setVersion(value?: VersionParams): ConsensusParams; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ConsensusParams.AsObject; + static toObject(includeInstance: boolean, msg: ConsensusParams): ConsensusParams.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ConsensusParams, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ConsensusParams; + static deserializeBinaryFromReader(message: ConsensusParams, reader: jspb.BinaryReader): ConsensusParams; +} + +export namespace ConsensusParams { + export type AsObject = { + block?: BlockParams.AsObject, + evidence?: EvidenceParams.AsObject, + validator?: ValidatorParams.AsObject, + version?: VersionParams.AsObject, + } +} + +export class BlockParams extends jspb.Message { + getMaxBytes(): number; + setMaxBytes(value: number): BlockParams; + + getMaxGas(): number; + setMaxGas(value: number): BlockParams; + + getTimeIotaMs(): number; + setTimeIotaMs(value: number): BlockParams; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockParams.AsObject; + static toObject(includeInstance: boolean, msg: BlockParams): BlockParams.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockParams, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockParams; + static deserializeBinaryFromReader(message: BlockParams, reader: jspb.BinaryReader): BlockParams; +} + +export namespace BlockParams { + export type AsObject = { + maxBytes: number, + maxGas: number, + timeIotaMs: number, + } +} + +export class EvidenceParams extends jspb.Message { + getMaxAgeNumBlocks(): number; + setMaxAgeNumBlocks(value: number): EvidenceParams; + + + hasMaxAgeDuration(): boolean; + clearMaxAgeDuration(): void; + getMaxAgeDuration(): google_protobuf_duration_pb.Duration | undefined; + setMaxAgeDuration(value?: google_protobuf_duration_pb.Duration): EvidenceParams; + + getMaxBytes(): number; + setMaxBytes(value: number): EvidenceParams; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EvidenceParams.AsObject; + static toObject(includeInstance: boolean, msg: EvidenceParams): EvidenceParams.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EvidenceParams, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EvidenceParams; + static deserializeBinaryFromReader(message: EvidenceParams, reader: jspb.BinaryReader): EvidenceParams; +} + +export namespace EvidenceParams { + export type AsObject = { + maxAgeNumBlocks: number, + maxAgeDuration?: google_protobuf_duration_pb.Duration.AsObject, + maxBytes: number, + } +} + +export class ValidatorParams extends jspb.Message { + clearPubKeyTypesList(): void; + getPubKeyTypesList(): Array; + setPubKeyTypesList(value: Array): ValidatorParams; + addPubKeyTypes(value: string, index?: number): string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ValidatorParams.AsObject; + static toObject(includeInstance: boolean, msg: ValidatorParams): ValidatorParams.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ValidatorParams, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ValidatorParams; + static deserializeBinaryFromReader(message: ValidatorParams, reader: jspb.BinaryReader): ValidatorParams; +} + +export namespace ValidatorParams { + export type AsObject = { + pubKeyTypesList: Array, + } +} + +export class VersionParams extends jspb.Message { + getAppVersion(): number; + setAppVersion(value: number): VersionParams; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): VersionParams.AsObject; + static toObject(includeInstance: boolean, msg: VersionParams): VersionParams.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: VersionParams, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): VersionParams; + static deserializeBinaryFromReader(message: VersionParams, reader: jspb.BinaryReader): VersionParams; +} + +export namespace VersionParams { + export type AsObject = { + appVersion: number, + } +} + +export class HashedParams extends jspb.Message { + getBlockMaxBytes(): number; + setBlockMaxBytes(value: number): HashedParams; + + getBlockMaxGas(): number; + setBlockMaxGas(value: number): HashedParams; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): HashedParams.AsObject; + static toObject(includeInstance: boolean, msg: HashedParams): HashedParams.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: HashedParams, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): HashedParams; + static deserializeBinaryFromReader(message: HashedParams, reader: jspb.BinaryReader): HashedParams; +} + +export namespace HashedParams { + export type AsObject = { + blockMaxBytes: number, + blockMaxGas: number, + } +} diff --git a/js/proto/tendermint/types/params_pb.js b/js/proto/tendermint/types/params_pb.js new file mode 100644 index 000000000..bf1817385 --- /dev/null +++ b/js/proto/tendermint/types/params_pb.js @@ -0,0 +1,1304 @@ +// source: tendermint/types/params.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js'); +goog.object.extend(proto, google_protobuf_duration_pb); +goog.exportSymbol('proto.tendermint.types.BlockParams', null, global); +goog.exportSymbol('proto.tendermint.types.ConsensusParams', null, global); +goog.exportSymbol('proto.tendermint.types.EvidenceParams', null, global); +goog.exportSymbol('proto.tendermint.types.HashedParams', null, global); +goog.exportSymbol('proto.tendermint.types.ValidatorParams', null, global); +goog.exportSymbol('proto.tendermint.types.VersionParams', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.ConsensusParams = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.ConsensusParams, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.ConsensusParams.displayName = 'proto.tendermint.types.ConsensusParams'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.BlockParams = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.BlockParams, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.BlockParams.displayName = 'proto.tendermint.types.BlockParams'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.EvidenceParams = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.EvidenceParams, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.EvidenceParams.displayName = 'proto.tendermint.types.EvidenceParams'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.ValidatorParams = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.types.ValidatorParams.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.types.ValidatorParams, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.ValidatorParams.displayName = 'proto.tendermint.types.ValidatorParams'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.VersionParams = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.VersionParams, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.VersionParams.displayName = 'proto.tendermint.types.VersionParams'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.HashedParams = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.HashedParams, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.HashedParams.displayName = 'proto.tendermint.types.HashedParams'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.ConsensusParams.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.ConsensusParams.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.ConsensusParams} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.ConsensusParams.toObject = function(includeInstance, msg) { + var f, obj = { + block: (f = msg.getBlock()) && proto.tendermint.types.BlockParams.toObject(includeInstance, f), + evidence: (f = msg.getEvidence()) && proto.tendermint.types.EvidenceParams.toObject(includeInstance, f), + validator: (f = msg.getValidator()) && proto.tendermint.types.ValidatorParams.toObject(includeInstance, f), + version: (f = msg.getVersion()) && proto.tendermint.types.VersionParams.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.ConsensusParams} + */ +proto.tendermint.types.ConsensusParams.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.ConsensusParams; + return proto.tendermint.types.ConsensusParams.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.ConsensusParams} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.ConsensusParams} + */ +proto.tendermint.types.ConsensusParams.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.types.BlockParams; + reader.readMessage(value,proto.tendermint.types.BlockParams.deserializeBinaryFromReader); + msg.setBlock(value); + break; + case 2: + var value = new proto.tendermint.types.EvidenceParams; + reader.readMessage(value,proto.tendermint.types.EvidenceParams.deserializeBinaryFromReader); + msg.setEvidence(value); + break; + case 3: + var value = new proto.tendermint.types.ValidatorParams; + reader.readMessage(value,proto.tendermint.types.ValidatorParams.deserializeBinaryFromReader); + msg.setValidator(value); + break; + case 4: + var value = new proto.tendermint.types.VersionParams; + reader.readMessage(value,proto.tendermint.types.VersionParams.deserializeBinaryFromReader); + msg.setVersion(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.ConsensusParams.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.ConsensusParams.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.ConsensusParams} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.ConsensusParams.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.types.BlockParams.serializeBinaryToWriter + ); + } + f = message.getEvidence(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.types.EvidenceParams.serializeBinaryToWriter + ); + } + f = message.getValidator(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.types.ValidatorParams.serializeBinaryToWriter + ); + } + f = message.getVersion(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.types.VersionParams.serializeBinaryToWriter + ); + } +}; + + +/** + * optional BlockParams block = 1; + * @return {?proto.tendermint.types.BlockParams} + */ +proto.tendermint.types.ConsensusParams.prototype.getBlock = function() { + return /** @type{?proto.tendermint.types.BlockParams} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.BlockParams, 1)); +}; + + +/** + * @param {?proto.tendermint.types.BlockParams|undefined} value + * @return {!proto.tendermint.types.ConsensusParams} returns this +*/ +proto.tendermint.types.ConsensusParams.prototype.setBlock = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.ConsensusParams} returns this + */ +proto.tendermint.types.ConsensusParams.prototype.clearBlock = function() { + return this.setBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.ConsensusParams.prototype.hasBlock = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional EvidenceParams evidence = 2; + * @return {?proto.tendermint.types.EvidenceParams} + */ +proto.tendermint.types.ConsensusParams.prototype.getEvidence = function() { + return /** @type{?proto.tendermint.types.EvidenceParams} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.EvidenceParams, 2)); +}; + + +/** + * @param {?proto.tendermint.types.EvidenceParams|undefined} value + * @return {!proto.tendermint.types.ConsensusParams} returns this +*/ +proto.tendermint.types.ConsensusParams.prototype.setEvidence = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.ConsensusParams} returns this + */ +proto.tendermint.types.ConsensusParams.prototype.clearEvidence = function() { + return this.setEvidence(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.ConsensusParams.prototype.hasEvidence = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ValidatorParams validator = 3; + * @return {?proto.tendermint.types.ValidatorParams} + */ +proto.tendermint.types.ConsensusParams.prototype.getValidator = function() { + return /** @type{?proto.tendermint.types.ValidatorParams} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.ValidatorParams, 3)); +}; + + +/** + * @param {?proto.tendermint.types.ValidatorParams|undefined} value + * @return {!proto.tendermint.types.ConsensusParams} returns this +*/ +proto.tendermint.types.ConsensusParams.prototype.setValidator = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.ConsensusParams} returns this + */ +proto.tendermint.types.ConsensusParams.prototype.clearValidator = function() { + return this.setValidator(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.ConsensusParams.prototype.hasValidator = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional VersionParams version = 4; + * @return {?proto.tendermint.types.VersionParams} + */ +proto.tendermint.types.ConsensusParams.prototype.getVersion = function() { + return /** @type{?proto.tendermint.types.VersionParams} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.VersionParams, 4)); +}; + + +/** + * @param {?proto.tendermint.types.VersionParams|undefined} value + * @return {!proto.tendermint.types.ConsensusParams} returns this +*/ +proto.tendermint.types.ConsensusParams.prototype.setVersion = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.ConsensusParams} returns this + */ +proto.tendermint.types.ConsensusParams.prototype.clearVersion = function() { + return this.setVersion(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.ConsensusParams.prototype.hasVersion = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.BlockParams.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.BlockParams.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.BlockParams} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.BlockParams.toObject = function(includeInstance, msg) { + var f, obj = { + maxBytes: jspb.Message.getFieldWithDefault(msg, 1, 0), + maxGas: jspb.Message.getFieldWithDefault(msg, 2, 0), + timeIotaMs: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.BlockParams} + */ +proto.tendermint.types.BlockParams.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.BlockParams; + return proto.tendermint.types.BlockParams.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.BlockParams} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.BlockParams} + */ +proto.tendermint.types.BlockParams.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMaxBytes(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMaxGas(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTimeIotaMs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.BlockParams.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.BlockParams.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.BlockParams} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.BlockParams.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMaxBytes(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getMaxGas(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getTimeIotaMs(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } +}; + + +/** + * optional int64 max_bytes = 1; + * @return {number} + */ +proto.tendermint.types.BlockParams.prototype.getMaxBytes = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.BlockParams} returns this + */ +proto.tendermint.types.BlockParams.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int64 max_gas = 2; + * @return {number} + */ +proto.tendermint.types.BlockParams.prototype.getMaxGas = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.BlockParams} returns this + */ +proto.tendermint.types.BlockParams.prototype.setMaxGas = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional int64 time_iota_ms = 3; + * @return {number} + */ +proto.tendermint.types.BlockParams.prototype.getTimeIotaMs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.BlockParams} returns this + */ +proto.tendermint.types.BlockParams.prototype.setTimeIotaMs = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.EvidenceParams.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.EvidenceParams.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.EvidenceParams} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.EvidenceParams.toObject = function(includeInstance, msg) { + var f, obj = { + maxAgeNumBlocks: jspb.Message.getFieldWithDefault(msg, 1, 0), + maxAgeDuration: (f = msg.getMaxAgeDuration()) && google_protobuf_duration_pb.Duration.toObject(includeInstance, f), + maxBytes: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.EvidenceParams} + */ +proto.tendermint.types.EvidenceParams.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.EvidenceParams; + return proto.tendermint.types.EvidenceParams.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.EvidenceParams} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.EvidenceParams} + */ +proto.tendermint.types.EvidenceParams.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMaxAgeNumBlocks(value); + break; + case 2: + var value = new google_protobuf_duration_pb.Duration; + reader.readMessage(value,google_protobuf_duration_pb.Duration.deserializeBinaryFromReader); + msg.setMaxAgeDuration(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMaxBytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.EvidenceParams.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.EvidenceParams.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.EvidenceParams} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.EvidenceParams.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMaxAgeNumBlocks(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getMaxAgeDuration(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_duration_pb.Duration.serializeBinaryToWriter + ); + } + f = message.getMaxBytes(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } +}; + + +/** + * optional int64 max_age_num_blocks = 1; + * @return {number} + */ +proto.tendermint.types.EvidenceParams.prototype.getMaxAgeNumBlocks = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.EvidenceParams} returns this + */ +proto.tendermint.types.EvidenceParams.prototype.setMaxAgeNumBlocks = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional google.protobuf.Duration max_age_duration = 2; + * @return {?proto.google.protobuf.Duration} + */ +proto.tendermint.types.EvidenceParams.prototype.getMaxAgeDuration = function() { + return /** @type{?proto.google.protobuf.Duration} */ ( + jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 2)); +}; + + +/** + * @param {?proto.google.protobuf.Duration|undefined} value + * @return {!proto.tendermint.types.EvidenceParams} returns this +*/ +proto.tendermint.types.EvidenceParams.prototype.setMaxAgeDuration = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.EvidenceParams} returns this + */ +proto.tendermint.types.EvidenceParams.prototype.clearMaxAgeDuration = function() { + return this.setMaxAgeDuration(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.EvidenceParams.prototype.hasMaxAgeDuration = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int64 max_bytes = 3; + * @return {number} + */ +proto.tendermint.types.EvidenceParams.prototype.getMaxBytes = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.EvidenceParams} returns this + */ +proto.tendermint.types.EvidenceParams.prototype.setMaxBytes = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.types.ValidatorParams.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.ValidatorParams.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.ValidatorParams.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.ValidatorParams} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.ValidatorParams.toObject = function(includeInstance, msg) { + var f, obj = { + pubKeyTypesList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.ValidatorParams} + */ +proto.tendermint.types.ValidatorParams.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.ValidatorParams; + return proto.tendermint.types.ValidatorParams.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.ValidatorParams} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.ValidatorParams} + */ +proto.tendermint.types.ValidatorParams.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.addPubKeyTypes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.ValidatorParams.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.ValidatorParams.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.ValidatorParams} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.ValidatorParams.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubKeyTypesList(); + if (f.length > 0) { + writer.writeRepeatedString( + 1, + f + ); + } +}; + + +/** + * repeated string pub_key_types = 1; + * @return {!Array} + */ +proto.tendermint.types.ValidatorParams.prototype.getPubKeyTypesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.types.ValidatorParams} returns this + */ +proto.tendermint.types.ValidatorParams.prototype.setPubKeyTypesList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.tendermint.types.ValidatorParams} returns this + */ +proto.tendermint.types.ValidatorParams.prototype.addPubKeyTypes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.types.ValidatorParams} returns this + */ +proto.tendermint.types.ValidatorParams.prototype.clearPubKeyTypesList = function() { + return this.setPubKeyTypesList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.VersionParams.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.VersionParams.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.VersionParams} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.VersionParams.toObject = function(includeInstance, msg) { + var f, obj = { + appVersion: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.VersionParams} + */ +proto.tendermint.types.VersionParams.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.VersionParams; + return proto.tendermint.types.VersionParams.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.VersionParams} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.VersionParams} + */ +proto.tendermint.types.VersionParams.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setAppVersion(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.VersionParams.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.VersionParams.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.VersionParams} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.VersionParams.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAppVersion(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } +}; + + +/** + * optional uint64 app_version = 1; + * @return {number} + */ +proto.tendermint.types.VersionParams.prototype.getAppVersion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.VersionParams} returns this + */ +proto.tendermint.types.VersionParams.prototype.setAppVersion = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.HashedParams.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.HashedParams.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.HashedParams} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.HashedParams.toObject = function(includeInstance, msg) { + var f, obj = { + blockMaxBytes: jspb.Message.getFieldWithDefault(msg, 1, 0), + blockMaxGas: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.HashedParams} + */ +proto.tendermint.types.HashedParams.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.HashedParams; + return proto.tendermint.types.HashedParams.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.HashedParams} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.HashedParams} + */ +proto.tendermint.types.HashedParams.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setBlockMaxBytes(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setBlockMaxGas(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.HashedParams.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.HashedParams.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.HashedParams} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.HashedParams.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlockMaxBytes(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getBlockMaxGas(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional int64 block_max_bytes = 1; + * @return {number} + */ +proto.tendermint.types.HashedParams.prototype.getBlockMaxBytes = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.HashedParams} returns this + */ +proto.tendermint.types.HashedParams.prototype.setBlockMaxBytes = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int64 block_max_gas = 2; + * @return {number} + */ +proto.tendermint.types.HashedParams.prototype.getBlockMaxGas = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.HashedParams} returns this + */ +proto.tendermint.types.HashedParams.prototype.setBlockMaxGas = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +goog.object.extend(exports, proto.tendermint.types); diff --git a/js/proto/tendermint/types/types_grpc_pb.js b/js/proto/tendermint/types/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/types/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/types/types_pb.d.ts b/js/proto/tendermint/types/types_pb.d.ts new file mode 100644 index 000000000..73939a4d3 --- /dev/null +++ b/js/proto/tendermint/types/types_pb.d.ts @@ -0,0 +1,569 @@ +// package: tendermint.types +// file: tendermint/types/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as tendermint_crypto_proof_pb from "../../tendermint/crypto/proof_pb"; +import * as tendermint_version_types_pb from "../../tendermint/version/types_pb"; +import * as tendermint_types_validator_pb from "../../tendermint/types/validator_pb"; + +export class PartSetHeader extends jspb.Message { + getTotal(): number; + setTotal(value: number): PartSetHeader; + + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): PartSetHeader; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PartSetHeader.AsObject; + static toObject(includeInstance: boolean, msg: PartSetHeader): PartSetHeader.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PartSetHeader, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PartSetHeader; + static deserializeBinaryFromReader(message: PartSetHeader, reader: jspb.BinaryReader): PartSetHeader; +} + +export namespace PartSetHeader { + export type AsObject = { + total: number, + hash: Uint8Array | string, + } +} + +export class Part extends jspb.Message { + getIndex(): number; + setIndex(value: number): Part; + + getBytes(): Uint8Array | string; + getBytes_asU8(): Uint8Array; + getBytes_asB64(): string; + setBytes(value: Uint8Array | string): Part; + + + hasProof(): boolean; + clearProof(): void; + getProof(): tendermint_crypto_proof_pb.Proof | undefined; + setProof(value?: tendermint_crypto_proof_pb.Proof): Part; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Part.AsObject; + static toObject(includeInstance: boolean, msg: Part): Part.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Part, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Part; + static deserializeBinaryFromReader(message: Part, reader: jspb.BinaryReader): Part; +} + +export namespace Part { + export type AsObject = { + index: number, + bytes: Uint8Array | string, + proof?: tendermint_crypto_proof_pb.Proof.AsObject, + } +} + +export class BlockID extends jspb.Message { + getHash(): Uint8Array | string; + getHash_asU8(): Uint8Array; + getHash_asB64(): string; + setHash(value: Uint8Array | string): BlockID; + + + hasPartSetHeader(): boolean; + clearPartSetHeader(): void; + getPartSetHeader(): PartSetHeader | undefined; + setPartSetHeader(value?: PartSetHeader): BlockID; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockID.AsObject; + static toObject(includeInstance: boolean, msg: BlockID): BlockID.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockID, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockID; + static deserializeBinaryFromReader(message: BlockID, reader: jspb.BinaryReader): BlockID; +} + +export namespace BlockID { + export type AsObject = { + hash: Uint8Array | string, + partSetHeader?: PartSetHeader.AsObject, + } +} + +export class Header extends jspb.Message { + + hasVersion(): boolean; + clearVersion(): void; + getVersion(): tendermint_version_types_pb.Consensus | undefined; + setVersion(value?: tendermint_version_types_pb.Consensus): Header; + + getChainId(): string; + setChainId(value: string): Header; + + getHeight(): number; + setHeight(value: number): Header; + + + hasTime(): boolean; + clearTime(): void; + getTime(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTime(value?: google_protobuf_timestamp_pb.Timestamp): Header; + + + hasLastBlockId(): boolean; + clearLastBlockId(): void; + getLastBlockId(): BlockID | undefined; + setLastBlockId(value?: BlockID): Header; + + getLastCommitHash(): Uint8Array | string; + getLastCommitHash_asU8(): Uint8Array; + getLastCommitHash_asB64(): string; + setLastCommitHash(value: Uint8Array | string): Header; + + getDataHash(): Uint8Array | string; + getDataHash_asU8(): Uint8Array; + getDataHash_asB64(): string; + setDataHash(value: Uint8Array | string): Header; + + getValidatorsHash(): Uint8Array | string; + getValidatorsHash_asU8(): Uint8Array; + getValidatorsHash_asB64(): string; + setValidatorsHash(value: Uint8Array | string): Header; + + getNextValidatorsHash(): Uint8Array | string; + getNextValidatorsHash_asU8(): Uint8Array; + getNextValidatorsHash_asB64(): string; + setNextValidatorsHash(value: Uint8Array | string): Header; + + getConsensusHash(): Uint8Array | string; + getConsensusHash_asU8(): Uint8Array; + getConsensusHash_asB64(): string; + setConsensusHash(value: Uint8Array | string): Header; + + getAppHash(): Uint8Array | string; + getAppHash_asU8(): Uint8Array; + getAppHash_asB64(): string; + setAppHash(value: Uint8Array | string): Header; + + getLastResultsHash(): Uint8Array | string; + getLastResultsHash_asU8(): Uint8Array; + getLastResultsHash_asB64(): string; + setLastResultsHash(value: Uint8Array | string): Header; + + getEvidenceHash(): Uint8Array | string; + getEvidenceHash_asU8(): Uint8Array; + getEvidenceHash_asB64(): string; + setEvidenceHash(value: Uint8Array | string): Header; + + getProposerAddress(): Uint8Array | string; + getProposerAddress_asU8(): Uint8Array; + getProposerAddress_asB64(): string; + setProposerAddress(value: Uint8Array | string): Header; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Header.AsObject; + static toObject(includeInstance: boolean, msg: Header): Header.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Header, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Header; + static deserializeBinaryFromReader(message: Header, reader: jspb.BinaryReader): Header; +} + +export namespace Header { + export type AsObject = { + version?: tendermint_version_types_pb.Consensus.AsObject, + chainId: string, + height: number, + time?: google_protobuf_timestamp_pb.Timestamp.AsObject, + lastBlockId?: BlockID.AsObject, + lastCommitHash: Uint8Array | string, + dataHash: Uint8Array | string, + validatorsHash: Uint8Array | string, + nextValidatorsHash: Uint8Array | string, + consensusHash: Uint8Array | string, + appHash: Uint8Array | string, + lastResultsHash: Uint8Array | string, + evidenceHash: Uint8Array | string, + proposerAddress: Uint8Array | string, + } +} + +export class Data extends jspb.Message { + clearTxsList(): void; + getTxsList(): Array; + getTxsList_asU8(): Array; + getTxsList_asB64(): Array; + setTxsList(value: Array): Data; + addTxs(value: Uint8Array | string, index?: number): Uint8Array | string; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Data.AsObject; + static toObject(includeInstance: boolean, msg: Data): Data.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Data, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Data; + static deserializeBinaryFromReader(message: Data, reader: jspb.BinaryReader): Data; +} + +export namespace Data { + export type AsObject = { + txsList: Array, + } +} + +export class Vote extends jspb.Message { + getType(): SignedMsgType; + setType(value: SignedMsgType): Vote; + + getHeight(): number; + setHeight(value: number): Vote; + + getRound(): number; + setRound(value: number): Vote; + + + hasBlockId(): boolean; + clearBlockId(): void; + getBlockId(): BlockID | undefined; + setBlockId(value?: BlockID): Vote; + + + hasTimestamp(): boolean; + clearTimestamp(): void; + getTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): Vote; + + getValidatorAddress(): Uint8Array | string; + getValidatorAddress_asU8(): Uint8Array; + getValidatorAddress_asB64(): string; + setValidatorAddress(value: Uint8Array | string): Vote; + + getValidatorIndex(): number; + setValidatorIndex(value: number): Vote; + + getSignature(): Uint8Array | string; + getSignature_asU8(): Uint8Array; + getSignature_asB64(): string; + setSignature(value: Uint8Array | string): Vote; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Vote.AsObject; + static toObject(includeInstance: boolean, msg: Vote): Vote.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Vote, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Vote; + static deserializeBinaryFromReader(message: Vote, reader: jspb.BinaryReader): Vote; +} + +export namespace Vote { + export type AsObject = { + type: SignedMsgType, + height: number, + round: number, + blockId?: BlockID.AsObject, + timestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + validatorAddress: Uint8Array | string, + validatorIndex: number, + signature: Uint8Array | string, + } +} + +export class Commit extends jspb.Message { + getHeight(): number; + setHeight(value: number): Commit; + + getRound(): number; + setRound(value: number): Commit; + + + hasBlockId(): boolean; + clearBlockId(): void; + getBlockId(): BlockID | undefined; + setBlockId(value?: BlockID): Commit; + + clearSignaturesList(): void; + getSignaturesList(): Array; + setSignaturesList(value: Array): Commit; + addSignatures(value?: CommitSig, index?: number): CommitSig; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Commit.AsObject; + static toObject(includeInstance: boolean, msg: Commit): Commit.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Commit, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Commit; + static deserializeBinaryFromReader(message: Commit, reader: jspb.BinaryReader): Commit; +} + +export namespace Commit { + export type AsObject = { + height: number, + round: number, + blockId?: BlockID.AsObject, + signaturesList: Array, + } +} + +export class CommitSig extends jspb.Message { + getBlockIdFlag(): BlockIDFlag; + setBlockIdFlag(value: BlockIDFlag): CommitSig; + + getValidatorAddress(): Uint8Array | string; + getValidatorAddress_asU8(): Uint8Array; + getValidatorAddress_asB64(): string; + setValidatorAddress(value: Uint8Array | string): CommitSig; + + + hasTimestamp(): boolean; + clearTimestamp(): void; + getTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): CommitSig; + + getSignature(): Uint8Array | string; + getSignature_asU8(): Uint8Array; + getSignature_asB64(): string; + setSignature(value: Uint8Array | string): CommitSig; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CommitSig.AsObject; + static toObject(includeInstance: boolean, msg: CommitSig): CommitSig.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CommitSig, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CommitSig; + static deserializeBinaryFromReader(message: CommitSig, reader: jspb.BinaryReader): CommitSig; +} + +export namespace CommitSig { + export type AsObject = { + blockIdFlag: BlockIDFlag, + validatorAddress: Uint8Array | string, + timestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + signature: Uint8Array | string, + } +} + +export class Proposal extends jspb.Message { + getType(): SignedMsgType; + setType(value: SignedMsgType): Proposal; + + getHeight(): number; + setHeight(value: number): Proposal; + + getRound(): number; + setRound(value: number): Proposal; + + getPolRound(): number; + setPolRound(value: number): Proposal; + + + hasBlockId(): boolean; + clearBlockId(): void; + getBlockId(): BlockID | undefined; + setBlockId(value?: BlockID): Proposal; + + + hasTimestamp(): boolean; + clearTimestamp(): void; + getTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): Proposal; + + getSignature(): Uint8Array | string; + getSignature_asU8(): Uint8Array; + getSignature_asB64(): string; + setSignature(value: Uint8Array | string): Proposal; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Proposal.AsObject; + static toObject(includeInstance: boolean, msg: Proposal): Proposal.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Proposal, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Proposal; + static deserializeBinaryFromReader(message: Proposal, reader: jspb.BinaryReader): Proposal; +} + +export namespace Proposal { + export type AsObject = { + type: SignedMsgType, + height: number, + round: number, + polRound: number, + blockId?: BlockID.AsObject, + timestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + signature: Uint8Array | string, + } +} + +export class SignedHeader extends jspb.Message { + + hasHeader(): boolean; + clearHeader(): void; + getHeader(): Header | undefined; + setHeader(value?: Header): SignedHeader; + + + hasCommit(): boolean; + clearCommit(): void; + getCommit(): Commit | undefined; + setCommit(value?: Commit): SignedHeader; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SignedHeader.AsObject; + static toObject(includeInstance: boolean, msg: SignedHeader): SignedHeader.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SignedHeader, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SignedHeader; + static deserializeBinaryFromReader(message: SignedHeader, reader: jspb.BinaryReader): SignedHeader; +} + +export namespace SignedHeader { + export type AsObject = { + header?: Header.AsObject, + commit?: Commit.AsObject, + } +} + +export class LightBlock extends jspb.Message { + + hasSignedHeader(): boolean; + clearSignedHeader(): void; + getSignedHeader(): SignedHeader | undefined; + setSignedHeader(value?: SignedHeader): LightBlock; + + + hasValidatorSet(): boolean; + clearValidatorSet(): void; + getValidatorSet(): tendermint_types_validator_pb.ValidatorSet | undefined; + setValidatorSet(value?: tendermint_types_validator_pb.ValidatorSet): LightBlock; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): LightBlock.AsObject; + static toObject(includeInstance: boolean, msg: LightBlock): LightBlock.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: LightBlock, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): LightBlock; + static deserializeBinaryFromReader(message: LightBlock, reader: jspb.BinaryReader): LightBlock; +} + +export namespace LightBlock { + export type AsObject = { + signedHeader?: SignedHeader.AsObject, + validatorSet?: tendermint_types_validator_pb.ValidatorSet.AsObject, + } +} + +export class BlockMeta extends jspb.Message { + + hasBlockId(): boolean; + clearBlockId(): void; + getBlockId(): BlockID | undefined; + setBlockId(value?: BlockID): BlockMeta; + + getBlockSize(): number; + setBlockSize(value: number): BlockMeta; + + + hasHeader(): boolean; + clearHeader(): void; + getHeader(): Header | undefined; + setHeader(value?: Header): BlockMeta; + + getNumTxs(): number; + setNumTxs(value: number): BlockMeta; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BlockMeta.AsObject; + static toObject(includeInstance: boolean, msg: BlockMeta): BlockMeta.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BlockMeta, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BlockMeta; + static deserializeBinaryFromReader(message: BlockMeta, reader: jspb.BinaryReader): BlockMeta; +} + +export namespace BlockMeta { + export type AsObject = { + blockId?: BlockID.AsObject, + blockSize: number, + header?: Header.AsObject, + numTxs: number, + } +} + +export class TxProof extends jspb.Message { + getRootHash(): Uint8Array | string; + getRootHash_asU8(): Uint8Array; + getRootHash_asB64(): string; + setRootHash(value: Uint8Array | string): TxProof; + + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): TxProof; + + + hasProof(): boolean; + clearProof(): void; + getProof(): tendermint_crypto_proof_pb.Proof | undefined; + setProof(value?: tendermint_crypto_proof_pb.Proof): TxProof; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TxProof.AsObject; + static toObject(includeInstance: boolean, msg: TxProof): TxProof.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TxProof, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TxProof; + static deserializeBinaryFromReader(message: TxProof, reader: jspb.BinaryReader): TxProof; +} + +export namespace TxProof { + export type AsObject = { + rootHash: Uint8Array | string, + data: Uint8Array | string, + proof?: tendermint_crypto_proof_pb.Proof.AsObject, + } +} + +export enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = 0, + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + BLOCK_ID_FLAG_NIL = 3, +} + +export enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = 0, + SIGNED_MSG_TYPE_PREVOTE = 1, + SIGNED_MSG_TYPE_PRECOMMIT = 2, + SIGNED_MSG_TYPE_PROPOSAL = 32, +} diff --git a/js/proto/tendermint/types/types_pb.js b/js/proto/tendermint/types/types_pb.js new file mode 100644 index 000000000..aeaa1003a --- /dev/null +++ b/js/proto/tendermint/types/types_pb.js @@ -0,0 +1,4229 @@ +// source: tendermint/types/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +var tendermint_crypto_proof_pb = require('../../tendermint/crypto/proof_pb.js'); +goog.object.extend(proto, tendermint_crypto_proof_pb); +var tendermint_version_types_pb = require('../../tendermint/version/types_pb.js'); +goog.object.extend(proto, tendermint_version_types_pb); +var tendermint_types_validator_pb = require('../../tendermint/types/validator_pb.js'); +goog.object.extend(proto, tendermint_types_validator_pb); +goog.exportSymbol('proto.tendermint.types.BlockID', null, global); +goog.exportSymbol('proto.tendermint.types.BlockIDFlag', null, global); +goog.exportSymbol('proto.tendermint.types.BlockMeta', null, global); +goog.exportSymbol('proto.tendermint.types.Commit', null, global); +goog.exportSymbol('proto.tendermint.types.CommitSig', null, global); +goog.exportSymbol('proto.tendermint.types.Data', null, global); +goog.exportSymbol('proto.tendermint.types.Header', null, global); +goog.exportSymbol('proto.tendermint.types.LightBlock', null, global); +goog.exportSymbol('proto.tendermint.types.Part', null, global); +goog.exportSymbol('proto.tendermint.types.PartSetHeader', null, global); +goog.exportSymbol('proto.tendermint.types.Proposal', null, global); +goog.exportSymbol('proto.tendermint.types.SignedHeader', null, global); +goog.exportSymbol('proto.tendermint.types.SignedMsgType', null, global); +goog.exportSymbol('proto.tendermint.types.TxProof', null, global); +goog.exportSymbol('proto.tendermint.types.Vote', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.PartSetHeader = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.PartSetHeader, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.PartSetHeader.displayName = 'proto.tendermint.types.PartSetHeader'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Part = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.Part, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Part.displayName = 'proto.tendermint.types.Part'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.BlockID = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.BlockID, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.BlockID.displayName = 'proto.tendermint.types.BlockID'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Header = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.Header, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Header.displayName = 'proto.tendermint.types.Header'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Data = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.types.Data.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.types.Data, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Data.displayName = 'proto.tendermint.types.Data'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Vote = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.Vote, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Vote.displayName = 'proto.tendermint.types.Vote'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Commit = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.types.Commit.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.types.Commit, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Commit.displayName = 'proto.tendermint.types.Commit'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.CommitSig = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.CommitSig, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.CommitSig.displayName = 'proto.tendermint.types.CommitSig'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Proposal = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.Proposal, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Proposal.displayName = 'proto.tendermint.types.Proposal'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.SignedHeader = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.SignedHeader, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.SignedHeader.displayName = 'proto.tendermint.types.SignedHeader'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.LightBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.LightBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.LightBlock.displayName = 'proto.tendermint.types.LightBlock'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.BlockMeta = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.BlockMeta, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.BlockMeta.displayName = 'proto.tendermint.types.BlockMeta'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.TxProof = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.TxProof, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.TxProof.displayName = 'proto.tendermint.types.TxProof'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.PartSetHeader.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.PartSetHeader.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.PartSetHeader} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.PartSetHeader.toObject = function(includeInstance, msg) { + var f, obj = { + total: jspb.Message.getFieldWithDefault(msg, 1, 0), + hash: msg.getHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.PartSetHeader} + */ +proto.tendermint.types.PartSetHeader.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.PartSetHeader; + return proto.tendermint.types.PartSetHeader.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.PartSetHeader} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.PartSetHeader} + */ +proto.tendermint.types.PartSetHeader.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setTotal(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.PartSetHeader.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.PartSetHeader.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.PartSetHeader} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.PartSetHeader.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTotal(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional uint32 total = 1; + * @return {number} + */ +proto.tendermint.types.PartSetHeader.prototype.getTotal = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.PartSetHeader} returns this + */ +proto.tendermint.types.PartSetHeader.prototype.setTotal = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes hash = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.PartSetHeader.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes hash = 2; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.tendermint.types.PartSetHeader.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.PartSetHeader.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.PartSetHeader} returns this + */ +proto.tendermint.types.PartSetHeader.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Part.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Part.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Part} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Part.toObject = function(includeInstance, msg) { + var f, obj = { + index: jspb.Message.getFieldWithDefault(msg, 1, 0), + bytes: msg.getBytes_asB64(), + proof: (f = msg.getProof()) && tendermint_crypto_proof_pb.Proof.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Part} + */ +proto.tendermint.types.Part.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Part; + return proto.tendermint.types.Part.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Part} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Part} + */ +proto.tendermint.types.Part.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setIndex(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytes(value); + break; + case 3: + var value = new tendermint_crypto_proof_pb.Proof; + reader.readMessage(value,tendermint_crypto_proof_pb.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Part.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Part.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Part} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Part.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIndex(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getBytes_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 3, + f, + tendermint_crypto_proof_pb.Proof.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint32 index = 1; + * @return {number} + */ +proto.tendermint.types.Part.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Part} returns this + */ +proto.tendermint.types.Part.prototype.setIndex = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes bytes = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Part.prototype.getBytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes bytes = 2; + * This is a type-conversion wrapper around `getBytes()` + * @return {string} + */ +proto.tendermint.types.Part.prototype.getBytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytes())); +}; + + +/** + * optional bytes bytes = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBytes()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Part.prototype.getBytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Part} returns this + */ +proto.tendermint.types.Part.prototype.setBytes = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional tendermint.crypto.Proof proof = 3; + * @return {?proto.tendermint.crypto.Proof} + */ +proto.tendermint.types.Part.prototype.getProof = function() { + return /** @type{?proto.tendermint.crypto.Proof} */ ( + jspb.Message.getWrapperField(this, tendermint_crypto_proof_pb.Proof, 3)); +}; + + +/** + * @param {?proto.tendermint.crypto.Proof|undefined} value + * @return {!proto.tendermint.types.Part} returns this +*/ +proto.tendermint.types.Part.prototype.setProof = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Part} returns this + */ +proto.tendermint.types.Part.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Part.prototype.hasProof = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.BlockID.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.BlockID.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.BlockID} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.BlockID.toObject = function(includeInstance, msg) { + var f, obj = { + hash: msg.getHash_asB64(), + partSetHeader: (f = msg.getPartSetHeader()) && proto.tendermint.types.PartSetHeader.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.BlockID} + */ +proto.tendermint.types.BlockID.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.BlockID; + return proto.tendermint.types.BlockID.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.BlockID} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.BlockID} + */ +proto.tendermint.types.BlockID.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 2: + var value = new proto.tendermint.types.PartSetHeader; + reader.readMessage(value,proto.tendermint.types.PartSetHeader.deserializeBinaryFromReader); + msg.setPartSetHeader(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.BlockID.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.BlockID.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.BlockID} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.BlockID.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPartSetHeader(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.types.PartSetHeader.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes hash = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.BlockID.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes hash = 1; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.tendermint.types.BlockID.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.BlockID.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.BlockID} returns this + */ +proto.tendermint.types.BlockID.prototype.setHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional PartSetHeader part_set_header = 2; + * @return {?proto.tendermint.types.PartSetHeader} + */ +proto.tendermint.types.BlockID.prototype.getPartSetHeader = function() { + return /** @type{?proto.tendermint.types.PartSetHeader} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.PartSetHeader, 2)); +}; + + +/** + * @param {?proto.tendermint.types.PartSetHeader|undefined} value + * @return {!proto.tendermint.types.BlockID} returns this +*/ +proto.tendermint.types.BlockID.prototype.setPartSetHeader = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.BlockID} returns this + */ +proto.tendermint.types.BlockID.prototype.clearPartSetHeader = function() { + return this.setPartSetHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.BlockID.prototype.hasPartSetHeader = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Header.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Header.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Header} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Header.toObject = function(includeInstance, msg) { + var f, obj = { + version: (f = msg.getVersion()) && tendermint_version_types_pb.Consensus.toObject(includeInstance, f), + chainId: jspb.Message.getFieldWithDefault(msg, 2, ""), + height: jspb.Message.getFieldWithDefault(msg, 3, 0), + time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + lastBlockId: (f = msg.getLastBlockId()) && proto.tendermint.types.BlockID.toObject(includeInstance, f), + lastCommitHash: msg.getLastCommitHash_asB64(), + dataHash: msg.getDataHash_asB64(), + validatorsHash: msg.getValidatorsHash_asB64(), + nextValidatorsHash: msg.getNextValidatorsHash_asB64(), + consensusHash: msg.getConsensusHash_asB64(), + appHash: msg.getAppHash_asB64(), + lastResultsHash: msg.getLastResultsHash_asB64(), + evidenceHash: msg.getEvidenceHash_asB64(), + proposerAddress: msg.getProposerAddress_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Header} + */ +proto.tendermint.types.Header.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Header; + return proto.tendermint.types.Header.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Header} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Header} + */ +proto.tendermint.types.Header.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_version_types_pb.Consensus; + reader.readMessage(value,tendermint_version_types_pb.Consensus.deserializeBinaryFromReader); + msg.setVersion(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setChainId(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 4: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTime(value); + break; + case 5: + var value = new proto.tendermint.types.BlockID; + reader.readMessage(value,proto.tendermint.types.BlockID.deserializeBinaryFromReader); + msg.setLastBlockId(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLastCommitHash(value); + break; + case 7: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setDataHash(value); + break; + case 8: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValidatorsHash(value); + break; + case 9: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setNextValidatorsHash(value); + break; + case 10: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setConsensusHash(value); + break; + case 11: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAppHash(value); + break; + case 12: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLastResultsHash(value); + break; + case 13: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setEvidenceHash(value); + break; + case 14: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setProposerAddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Header.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Header} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Header.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getVersion(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_version_types_pb.Consensus.serializeBinaryToWriter + ); + } + f = message.getChainId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } + f = message.getTime(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getLastBlockId(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.tendermint.types.BlockID.serializeBinaryToWriter + ); + } + f = message.getLastCommitHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 6, + f + ); + } + f = message.getDataHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 7, + f + ); + } + f = message.getValidatorsHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 8, + f + ); + } + f = message.getNextValidatorsHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 9, + f + ); + } + f = message.getConsensusHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 10, + f + ); + } + f = message.getAppHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 11, + f + ); + } + f = message.getLastResultsHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 12, + f + ); + } + f = message.getEvidenceHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 13, + f + ); + } + f = message.getProposerAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 14, + f + ); + } +}; + + +/** + * optional tendermint.version.Consensus version = 1; + * @return {?proto.tendermint.version.Consensus} + */ +proto.tendermint.types.Header.prototype.getVersion = function() { + return /** @type{?proto.tendermint.version.Consensus} */ ( + jspb.Message.getWrapperField(this, tendermint_version_types_pb.Consensus, 1)); +}; + + +/** + * @param {?proto.tendermint.version.Consensus|undefined} value + * @return {!proto.tendermint.types.Header} returns this +*/ +proto.tendermint.types.Header.prototype.setVersion = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.clearVersion = function() { + return this.setVersion(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Header.prototype.hasVersion = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string chain_id = 2; + * @return {string} + */ +proto.tendermint.types.Header.prototype.getChainId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setChainId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional int64 height = 3; + * @return {number} + */ +proto.tendermint.types.Header.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional google.protobuf.Timestamp time = 4; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.types.Header.prototype.getTime = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 4)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.types.Header} returns this +*/ +proto.tendermint.types.Header.prototype.setTime = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.clearTime = function() { + return this.setTime(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Header.prototype.hasTime = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional BlockID last_block_id = 5; + * @return {?proto.tendermint.types.BlockID} + */ +proto.tendermint.types.Header.prototype.getLastBlockId = function() { + return /** @type{?proto.tendermint.types.BlockID} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.BlockID, 5)); +}; + + +/** + * @param {?proto.tendermint.types.BlockID|undefined} value + * @return {!proto.tendermint.types.Header} returns this +*/ +proto.tendermint.types.Header.prototype.setLastBlockId = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.clearLastBlockId = function() { + return this.setLastBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Header.prototype.hasLastBlockId = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional bytes last_commit_hash = 6; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getLastCommitHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes last_commit_hash = 6; + * This is a type-conversion wrapper around `getLastCommitHash()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getLastCommitHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLastCommitHash())); +}; + + +/** + * optional bytes last_commit_hash = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLastCommitHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getLastCommitHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLastCommitHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setLastCommitHash = function(value) { + return jspb.Message.setProto3BytesField(this, 6, value); +}; + + +/** + * optional bytes data_hash = 7; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getDataHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * optional bytes data_hash = 7; + * This is a type-conversion wrapper around `getDataHash()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getDataHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getDataHash())); +}; + + +/** + * optional bytes data_hash = 7; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getDataHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getDataHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getDataHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setDataHash = function(value) { + return jspb.Message.setProto3BytesField(this, 7, value); +}; + + +/** + * optional bytes validators_hash = 8; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getValidatorsHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * optional bytes validators_hash = 8; + * This is a type-conversion wrapper around `getValidatorsHash()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getValidatorsHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValidatorsHash())); +}; + + +/** + * optional bytes validators_hash = 8; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValidatorsHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getValidatorsHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValidatorsHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setValidatorsHash = function(value) { + return jspb.Message.setProto3BytesField(this, 8, value); +}; + + +/** + * optional bytes next_validators_hash = 9; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getNextValidatorsHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 9, "")); +}; + + +/** + * optional bytes next_validators_hash = 9; + * This is a type-conversion wrapper around `getNextValidatorsHash()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getNextValidatorsHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getNextValidatorsHash())); +}; + + +/** + * optional bytes next_validators_hash = 9; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getNextValidatorsHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getNextValidatorsHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getNextValidatorsHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setNextValidatorsHash = function(value) { + return jspb.Message.setProto3BytesField(this, 9, value); +}; + + +/** + * optional bytes consensus_hash = 10; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getConsensusHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 10, "")); +}; + + +/** + * optional bytes consensus_hash = 10; + * This is a type-conversion wrapper around `getConsensusHash()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getConsensusHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getConsensusHash())); +}; + + +/** + * optional bytes consensus_hash = 10; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getConsensusHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getConsensusHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getConsensusHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setConsensusHash = function(value) { + return jspb.Message.setProto3BytesField(this, 10, value); +}; + + +/** + * optional bytes app_hash = 11; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getAppHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 11, "")); +}; + + +/** + * optional bytes app_hash = 11; + * This is a type-conversion wrapper around `getAppHash()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getAppHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAppHash())); +}; + + +/** + * optional bytes app_hash = 11; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAppHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getAppHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAppHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setAppHash = function(value) { + return jspb.Message.setProto3BytesField(this, 11, value); +}; + + +/** + * optional bytes last_results_hash = 12; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getLastResultsHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +}; + + +/** + * optional bytes last_results_hash = 12; + * This is a type-conversion wrapper around `getLastResultsHash()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getLastResultsHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLastResultsHash())); +}; + + +/** + * optional bytes last_results_hash = 12; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLastResultsHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getLastResultsHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLastResultsHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setLastResultsHash = function(value) { + return jspb.Message.setProto3BytesField(this, 12, value); +}; + + +/** + * optional bytes evidence_hash = 13; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getEvidenceHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 13, "")); +}; + + +/** + * optional bytes evidence_hash = 13; + * This is a type-conversion wrapper around `getEvidenceHash()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getEvidenceHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getEvidenceHash())); +}; + + +/** + * optional bytes evidence_hash = 13; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getEvidenceHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getEvidenceHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getEvidenceHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setEvidenceHash = function(value) { + return jspb.Message.setProto3BytesField(this, 13, value); +}; + + +/** + * optional bytes proposer_address = 14; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Header.prototype.getProposerAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 14, "")); +}; + + +/** + * optional bytes proposer_address = 14; + * This is a type-conversion wrapper around `getProposerAddress()` + * @return {string} + */ +proto.tendermint.types.Header.prototype.getProposerAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getProposerAddress())); +}; + + +/** + * optional bytes proposer_address = 14; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getProposerAddress()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Header.prototype.getProposerAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getProposerAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Header} returns this + */ +proto.tendermint.types.Header.prototype.setProposerAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 14, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.types.Data.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Data.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Data.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Data} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Data.toObject = function(includeInstance, msg) { + var f, obj = { + txsList: msg.getTxsList_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Data} + */ +proto.tendermint.types.Data.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Data; + return proto.tendermint.types.Data.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Data} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Data} + */ +proto.tendermint.types.Data.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addTxs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Data.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Data.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Data} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Data.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } +}; + + +/** + * repeated bytes txs = 1; + * @return {!(Array|Array)} + */ +proto.tendermint.types.Data.prototype.getTxsList = function() { + return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * repeated bytes txs = 1; + * This is a type-conversion wrapper around `getTxsList()` + * @return {!Array} + */ +proto.tendermint.types.Data.prototype.getTxsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getTxsList())); +}; + + +/** + * repeated bytes txs = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTxsList()` + * @return {!Array} + */ +proto.tendermint.types.Data.prototype.getTxsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getTxsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.tendermint.types.Data} returns this + */ +proto.tendermint.types.Data.prototype.setTxsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.tendermint.types.Data} returns this + */ +proto.tendermint.types.Data.prototype.addTxs = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.types.Data} returns this + */ +proto.tendermint.types.Data.prototype.clearTxsList = function() { + return this.setTxsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Vote.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Vote.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Vote} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Vote.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + height: jspb.Message.getFieldWithDefault(msg, 2, 0), + round: jspb.Message.getFieldWithDefault(msg, 3, 0), + blockId: (f = msg.getBlockId()) && proto.tendermint.types.BlockID.toObject(includeInstance, f), + timestamp: (f = msg.getTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + validatorAddress: msg.getValidatorAddress_asB64(), + validatorIndex: jspb.Message.getFieldWithDefault(msg, 7, 0), + signature: msg.getSignature_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Vote} + */ +proto.tendermint.types.Vote.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Vote; + return proto.tendermint.types.Vote.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Vote} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Vote} + */ +proto.tendermint.types.Vote.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.tendermint.types.SignedMsgType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 4: + var value = new proto.tendermint.types.BlockID; + reader.readMessage(value,proto.tendermint.types.BlockID.deserializeBinaryFromReader); + msg.setBlockId(value); + break; + case 5: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTimestamp(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValidatorAddress(value); + break; + case 7: + var value = /** @type {number} */ (reader.readInt32()); + msg.setValidatorIndex(value); + break; + case 8: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Vote.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Vote.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Vote} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Vote.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 3, + f + ); + } + f = message.getBlockId(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.tendermint.types.BlockID.serializeBinaryToWriter + ); + } + f = message.getTimestamp(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getValidatorAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 6, + f + ); + } + f = message.getValidatorIndex(); + if (f !== 0) { + writer.writeInt32( + 7, + f + ); + } + f = message.getSignature_asU8(); + if (f.length > 0) { + writer.writeBytes( + 8, + f + ); + } +}; + + +/** + * optional SignedMsgType type = 1; + * @return {!proto.tendermint.types.SignedMsgType} + */ +proto.tendermint.types.Vote.prototype.getType = function() { + return /** @type {!proto.tendermint.types.SignedMsgType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.tendermint.types.SignedMsgType} value + * @return {!proto.tendermint.types.Vote} returns this + */ +proto.tendermint.types.Vote.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional int64 height = 2; + * @return {number} + */ +proto.tendermint.types.Vote.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Vote} returns this + */ +proto.tendermint.types.Vote.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional int32 round = 3; + * @return {number} + */ +proto.tendermint.types.Vote.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Vote} returns this + */ +proto.tendermint.types.Vote.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional BlockID block_id = 4; + * @return {?proto.tendermint.types.BlockID} + */ +proto.tendermint.types.Vote.prototype.getBlockId = function() { + return /** @type{?proto.tendermint.types.BlockID} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.BlockID, 4)); +}; + + +/** + * @param {?proto.tendermint.types.BlockID|undefined} value + * @return {!proto.tendermint.types.Vote} returns this +*/ +proto.tendermint.types.Vote.prototype.setBlockId = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Vote} returns this + */ +proto.tendermint.types.Vote.prototype.clearBlockId = function() { + return this.setBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Vote.prototype.hasBlockId = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional google.protobuf.Timestamp timestamp = 5; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.types.Vote.prototype.getTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.types.Vote} returns this +*/ +proto.tendermint.types.Vote.prototype.setTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Vote} returns this + */ +proto.tendermint.types.Vote.prototype.clearTimestamp = function() { + return this.setTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Vote.prototype.hasTimestamp = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional bytes validator_address = 6; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Vote.prototype.getValidatorAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes validator_address = 6; + * This is a type-conversion wrapper around `getValidatorAddress()` + * @return {string} + */ +proto.tendermint.types.Vote.prototype.getValidatorAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValidatorAddress())); +}; + + +/** + * optional bytes validator_address = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValidatorAddress()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Vote.prototype.getValidatorAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValidatorAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Vote} returns this + */ +proto.tendermint.types.Vote.prototype.setValidatorAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 6, value); +}; + + +/** + * optional int32 validator_index = 7; + * @return {number} + */ +proto.tendermint.types.Vote.prototype.getValidatorIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Vote} returns this + */ +proto.tendermint.types.Vote.prototype.setValidatorIndex = function(value) { + return jspb.Message.setProto3IntField(this, 7, value); +}; + + +/** + * optional bytes signature = 8; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Vote.prototype.getSignature = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * optional bytes signature = 8; + * This is a type-conversion wrapper around `getSignature()` + * @return {string} + */ +proto.tendermint.types.Vote.prototype.getSignature_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSignature())); +}; + + +/** + * optional bytes signature = 8; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSignature()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Vote.prototype.getSignature_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSignature())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Vote} returns this + */ +proto.tendermint.types.Vote.prototype.setSignature = function(value) { + return jspb.Message.setProto3BytesField(this, 8, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.types.Commit.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Commit.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Commit.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Commit} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Commit.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + round: jspb.Message.getFieldWithDefault(msg, 2, 0), + blockId: (f = msg.getBlockId()) && proto.tendermint.types.BlockID.toObject(includeInstance, f), + signaturesList: jspb.Message.toObjectList(msg.getSignaturesList(), + proto.tendermint.types.CommitSig.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Commit} + */ +proto.tendermint.types.Commit.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Commit; + return proto.tendermint.types.Commit.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Commit} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Commit} + */ +proto.tendermint.types.Commit.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 3: + var value = new proto.tendermint.types.BlockID; + reader.readMessage(value,proto.tendermint.types.BlockID.deserializeBinaryFromReader); + msg.setBlockId(value); + break; + case 4: + var value = new proto.tendermint.types.CommitSig; + reader.readMessage(value,proto.tendermint.types.CommitSig.deserializeBinaryFromReader); + msg.addSignatures(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Commit.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Commit.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Commit} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Commit.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } + f = message.getBlockId(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.types.BlockID.serializeBinaryToWriter + ); + } + f = message.getSignaturesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.tendermint.types.CommitSig.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int64 height = 1; + * @return {number} + */ +proto.tendermint.types.Commit.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Commit} returns this + */ +proto.tendermint.types.Commit.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 round = 2; + * @return {number} + */ +proto.tendermint.types.Commit.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Commit} returns this + */ +proto.tendermint.types.Commit.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional BlockID block_id = 3; + * @return {?proto.tendermint.types.BlockID} + */ +proto.tendermint.types.Commit.prototype.getBlockId = function() { + return /** @type{?proto.tendermint.types.BlockID} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.BlockID, 3)); +}; + + +/** + * @param {?proto.tendermint.types.BlockID|undefined} value + * @return {!proto.tendermint.types.Commit} returns this +*/ +proto.tendermint.types.Commit.prototype.setBlockId = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Commit} returns this + */ +proto.tendermint.types.Commit.prototype.clearBlockId = function() { + return this.setBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Commit.prototype.hasBlockId = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated CommitSig signatures = 4; + * @return {!Array} + */ +proto.tendermint.types.Commit.prototype.getSignaturesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.types.CommitSig, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.types.Commit} returns this +*/ +proto.tendermint.types.Commit.prototype.setSignaturesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.tendermint.types.CommitSig=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.types.CommitSig} + */ +proto.tendermint.types.Commit.prototype.addSignatures = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.tendermint.types.CommitSig, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.types.Commit} returns this + */ +proto.tendermint.types.Commit.prototype.clearSignaturesList = function() { + return this.setSignaturesList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.CommitSig.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.CommitSig.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.CommitSig} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CommitSig.toObject = function(includeInstance, msg) { + var f, obj = { + blockIdFlag: jspb.Message.getFieldWithDefault(msg, 1, 0), + validatorAddress: msg.getValidatorAddress_asB64(), + timestamp: (f = msg.getTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + signature: msg.getSignature_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.CommitSig} + */ +proto.tendermint.types.CommitSig.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.CommitSig; + return proto.tendermint.types.CommitSig.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.CommitSig} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.CommitSig} + */ +proto.tendermint.types.CommitSig.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.tendermint.types.BlockIDFlag} */ (reader.readEnum()); + msg.setBlockIdFlag(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValidatorAddress(value); + break; + case 3: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTimestamp(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.CommitSig.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.CommitSig.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.CommitSig} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.CommitSig.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlockIdFlag(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getValidatorAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getTimestamp(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getSignature_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional BlockIDFlag block_id_flag = 1; + * @return {!proto.tendermint.types.BlockIDFlag} + */ +proto.tendermint.types.CommitSig.prototype.getBlockIdFlag = function() { + return /** @type {!proto.tendermint.types.BlockIDFlag} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.tendermint.types.BlockIDFlag} value + * @return {!proto.tendermint.types.CommitSig} returns this + */ +proto.tendermint.types.CommitSig.prototype.setBlockIdFlag = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional bytes validator_address = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.CommitSig.prototype.getValidatorAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes validator_address = 2; + * This is a type-conversion wrapper around `getValidatorAddress()` + * @return {string} + */ +proto.tendermint.types.CommitSig.prototype.getValidatorAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValidatorAddress())); +}; + + +/** + * optional bytes validator_address = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValidatorAddress()` + * @return {!Uint8Array} + */ +proto.tendermint.types.CommitSig.prototype.getValidatorAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValidatorAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.CommitSig} returns this + */ +proto.tendermint.types.CommitSig.prototype.setValidatorAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional google.protobuf.Timestamp timestamp = 3; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.types.CommitSig.prototype.getTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 3)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.types.CommitSig} returns this +*/ +proto.tendermint.types.CommitSig.prototype.setTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.CommitSig} returns this + */ +proto.tendermint.types.CommitSig.prototype.clearTimestamp = function() { + return this.setTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.CommitSig.prototype.hasTimestamp = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional bytes signature = 4; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.CommitSig.prototype.getSignature = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes signature = 4; + * This is a type-conversion wrapper around `getSignature()` + * @return {string} + */ +proto.tendermint.types.CommitSig.prototype.getSignature_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSignature())); +}; + + +/** + * optional bytes signature = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSignature()` + * @return {!Uint8Array} + */ +proto.tendermint.types.CommitSig.prototype.getSignature_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSignature())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.CommitSig} returns this + */ +proto.tendermint.types.CommitSig.prototype.setSignature = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Proposal.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Proposal.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Proposal} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Proposal.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + height: jspb.Message.getFieldWithDefault(msg, 2, 0), + round: jspb.Message.getFieldWithDefault(msg, 3, 0), + polRound: jspb.Message.getFieldWithDefault(msg, 4, 0), + blockId: (f = msg.getBlockId()) && proto.tendermint.types.BlockID.toObject(includeInstance, f), + timestamp: (f = msg.getTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + signature: msg.getSignature_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Proposal} + */ +proto.tendermint.types.Proposal.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Proposal; + return proto.tendermint.types.Proposal.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Proposal} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Proposal} + */ +proto.tendermint.types.Proposal.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.tendermint.types.SignedMsgType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setHeight(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setRound(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt32()); + msg.setPolRound(value); + break; + case 5: + var value = new proto.tendermint.types.BlockID; + reader.readMessage(value,proto.tendermint.types.BlockID.deserializeBinaryFromReader); + msg.setBlockId(value); + break; + case 6: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setTimestamp(value); + break; + case 7: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Proposal.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Proposal.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Proposal} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Proposal.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getRound(); + if (f !== 0) { + writer.writeInt32( + 3, + f + ); + } + f = message.getPolRound(); + if (f !== 0) { + writer.writeInt32( + 4, + f + ); + } + f = message.getBlockId(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.tendermint.types.BlockID.serializeBinaryToWriter + ); + } + f = message.getTimestamp(); + if (f != null) { + writer.writeMessage( + 6, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getSignature_asU8(); + if (f.length > 0) { + writer.writeBytes( + 7, + f + ); + } +}; + + +/** + * optional SignedMsgType type = 1; + * @return {!proto.tendermint.types.SignedMsgType} + */ +proto.tendermint.types.Proposal.prototype.getType = function() { + return /** @type {!proto.tendermint.types.SignedMsgType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.tendermint.types.SignedMsgType} value + * @return {!proto.tendermint.types.Proposal} returns this + */ +proto.tendermint.types.Proposal.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional int64 height = 2; + * @return {number} + */ +proto.tendermint.types.Proposal.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Proposal} returns this + */ +proto.tendermint.types.Proposal.prototype.setHeight = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional int32 round = 3; + * @return {number} + */ +proto.tendermint.types.Proposal.prototype.getRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Proposal} returns this + */ +proto.tendermint.types.Proposal.prototype.setRound = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int32 pol_round = 4; + * @return {number} + */ +proto.tendermint.types.Proposal.prototype.getPolRound = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Proposal} returns this + */ +proto.tendermint.types.Proposal.prototype.setPolRound = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional BlockID block_id = 5; + * @return {?proto.tendermint.types.BlockID} + */ +proto.tendermint.types.Proposal.prototype.getBlockId = function() { + return /** @type{?proto.tendermint.types.BlockID} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.BlockID, 5)); +}; + + +/** + * @param {?proto.tendermint.types.BlockID|undefined} value + * @return {!proto.tendermint.types.Proposal} returns this +*/ +proto.tendermint.types.Proposal.prototype.setBlockId = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Proposal} returns this + */ +proto.tendermint.types.Proposal.prototype.clearBlockId = function() { + return this.setBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Proposal.prototype.hasBlockId = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional google.protobuf.Timestamp timestamp = 6; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.tendermint.types.Proposal.prototype.getTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 6)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.tendermint.types.Proposal} returns this +*/ +proto.tendermint.types.Proposal.prototype.setTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Proposal} returns this + */ +proto.tendermint.types.Proposal.prototype.clearTimestamp = function() { + return this.setTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Proposal.prototype.hasTimestamp = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bytes signature = 7; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Proposal.prototype.getSignature = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * optional bytes signature = 7; + * This is a type-conversion wrapper around `getSignature()` + * @return {string} + */ +proto.tendermint.types.Proposal.prototype.getSignature_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSignature())); +}; + + +/** + * optional bytes signature = 7; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSignature()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Proposal.prototype.getSignature_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSignature())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Proposal} returns this + */ +proto.tendermint.types.Proposal.prototype.setSignature = function(value) { + return jspb.Message.setProto3BytesField(this, 7, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.SignedHeader.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.SignedHeader.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.SignedHeader} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.SignedHeader.toObject = function(includeInstance, msg) { + var f, obj = { + header: (f = msg.getHeader()) && proto.tendermint.types.Header.toObject(includeInstance, f), + commit: (f = msg.getCommit()) && proto.tendermint.types.Commit.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.SignedHeader} + */ +proto.tendermint.types.SignedHeader.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.SignedHeader; + return proto.tendermint.types.SignedHeader.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.SignedHeader} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.SignedHeader} + */ +proto.tendermint.types.SignedHeader.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.types.Header; + reader.readMessage(value,proto.tendermint.types.Header.deserializeBinaryFromReader); + msg.setHeader(value); + break; + case 2: + var value = new proto.tendermint.types.Commit; + reader.readMessage(value,proto.tendermint.types.Commit.deserializeBinaryFromReader); + msg.setCommit(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.SignedHeader.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.SignedHeader.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.SignedHeader} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.SignedHeader.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeader(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.types.Header.serializeBinaryToWriter + ); + } + f = message.getCommit(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.types.Commit.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Header header = 1; + * @return {?proto.tendermint.types.Header} + */ +proto.tendermint.types.SignedHeader.prototype.getHeader = function() { + return /** @type{?proto.tendermint.types.Header} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.Header, 1)); +}; + + +/** + * @param {?proto.tendermint.types.Header|undefined} value + * @return {!proto.tendermint.types.SignedHeader} returns this +*/ +proto.tendermint.types.SignedHeader.prototype.setHeader = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.SignedHeader} returns this + */ +proto.tendermint.types.SignedHeader.prototype.clearHeader = function() { + return this.setHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.SignedHeader.prototype.hasHeader = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Commit commit = 2; + * @return {?proto.tendermint.types.Commit} + */ +proto.tendermint.types.SignedHeader.prototype.getCommit = function() { + return /** @type{?proto.tendermint.types.Commit} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.Commit, 2)); +}; + + +/** + * @param {?proto.tendermint.types.Commit|undefined} value + * @return {!proto.tendermint.types.SignedHeader} returns this +*/ +proto.tendermint.types.SignedHeader.prototype.setCommit = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.SignedHeader} returns this + */ +proto.tendermint.types.SignedHeader.prototype.clearCommit = function() { + return this.setCommit(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.SignedHeader.prototype.hasCommit = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.LightBlock.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.LightBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.LightBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.LightBlock.toObject = function(includeInstance, msg) { + var f, obj = { + signedHeader: (f = msg.getSignedHeader()) && proto.tendermint.types.SignedHeader.toObject(includeInstance, f), + validatorSet: (f = msg.getValidatorSet()) && tendermint_types_validator_pb.ValidatorSet.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.LightBlock} + */ +proto.tendermint.types.LightBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.LightBlock; + return proto.tendermint.types.LightBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.LightBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.LightBlock} + */ +proto.tendermint.types.LightBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.types.SignedHeader; + reader.readMessage(value,proto.tendermint.types.SignedHeader.deserializeBinaryFromReader); + msg.setSignedHeader(value); + break; + case 2: + var value = new tendermint_types_validator_pb.ValidatorSet; + reader.readMessage(value,tendermint_types_validator_pb.ValidatorSet.deserializeBinaryFromReader); + msg.setValidatorSet(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.LightBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.LightBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.LightBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.LightBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSignedHeader(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.types.SignedHeader.serializeBinaryToWriter + ); + } + f = message.getValidatorSet(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_types_validator_pb.ValidatorSet.serializeBinaryToWriter + ); + } +}; + + +/** + * optional SignedHeader signed_header = 1; + * @return {?proto.tendermint.types.SignedHeader} + */ +proto.tendermint.types.LightBlock.prototype.getSignedHeader = function() { + return /** @type{?proto.tendermint.types.SignedHeader} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.SignedHeader, 1)); +}; + + +/** + * @param {?proto.tendermint.types.SignedHeader|undefined} value + * @return {!proto.tendermint.types.LightBlock} returns this +*/ +proto.tendermint.types.LightBlock.prototype.setSignedHeader = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.LightBlock} returns this + */ +proto.tendermint.types.LightBlock.prototype.clearSignedHeader = function() { + return this.setSignedHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.LightBlock.prototype.hasSignedHeader = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional ValidatorSet validator_set = 2; + * @return {?proto.tendermint.types.ValidatorSet} + */ +proto.tendermint.types.LightBlock.prototype.getValidatorSet = function() { + return /** @type{?proto.tendermint.types.ValidatorSet} */ ( + jspb.Message.getWrapperField(this, tendermint_types_validator_pb.ValidatorSet, 2)); +}; + + +/** + * @param {?proto.tendermint.types.ValidatorSet|undefined} value + * @return {!proto.tendermint.types.LightBlock} returns this +*/ +proto.tendermint.types.LightBlock.prototype.setValidatorSet = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.LightBlock} returns this + */ +proto.tendermint.types.LightBlock.prototype.clearValidatorSet = function() { + return this.setValidatorSet(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.LightBlock.prototype.hasValidatorSet = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.BlockMeta.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.BlockMeta.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.BlockMeta} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.BlockMeta.toObject = function(includeInstance, msg) { + var f, obj = { + blockId: (f = msg.getBlockId()) && proto.tendermint.types.BlockID.toObject(includeInstance, f), + blockSize: jspb.Message.getFieldWithDefault(msg, 2, 0), + header: (f = msg.getHeader()) && proto.tendermint.types.Header.toObject(includeInstance, f), + numTxs: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.BlockMeta} + */ +proto.tendermint.types.BlockMeta.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.BlockMeta; + return proto.tendermint.types.BlockMeta.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.BlockMeta} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.BlockMeta} + */ +proto.tendermint.types.BlockMeta.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.types.BlockID; + reader.readMessage(value,proto.tendermint.types.BlockID.deserializeBinaryFromReader); + msg.setBlockId(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setBlockSize(value); + break; + case 3: + var value = new proto.tendermint.types.Header; + reader.readMessage(value,proto.tendermint.types.Header.deserializeBinaryFromReader); + msg.setHeader(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setNumTxs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.BlockMeta.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.BlockMeta.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.BlockMeta} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.BlockMeta.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlockId(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.tendermint.types.BlockID.serializeBinaryToWriter + ); + } + f = message.getBlockSize(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getHeader(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.tendermint.types.Header.serializeBinaryToWriter + ); + } + f = message.getNumTxs(); + if (f !== 0) { + writer.writeInt64( + 4, + f + ); + } +}; + + +/** + * optional BlockID block_id = 1; + * @return {?proto.tendermint.types.BlockID} + */ +proto.tendermint.types.BlockMeta.prototype.getBlockId = function() { + return /** @type{?proto.tendermint.types.BlockID} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.BlockID, 1)); +}; + + +/** + * @param {?proto.tendermint.types.BlockID|undefined} value + * @return {!proto.tendermint.types.BlockMeta} returns this +*/ +proto.tendermint.types.BlockMeta.prototype.setBlockId = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.BlockMeta} returns this + */ +proto.tendermint.types.BlockMeta.prototype.clearBlockId = function() { + return this.setBlockId(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.BlockMeta.prototype.hasBlockId = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int64 block_size = 2; + * @return {number} + */ +proto.tendermint.types.BlockMeta.prototype.getBlockSize = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.BlockMeta} returns this + */ +proto.tendermint.types.BlockMeta.prototype.setBlockSize = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional Header header = 3; + * @return {?proto.tendermint.types.Header} + */ +proto.tendermint.types.BlockMeta.prototype.getHeader = function() { + return /** @type{?proto.tendermint.types.Header} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.Header, 3)); +}; + + +/** + * @param {?proto.tendermint.types.Header|undefined} value + * @return {!proto.tendermint.types.BlockMeta} returns this +*/ +proto.tendermint.types.BlockMeta.prototype.setHeader = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.BlockMeta} returns this + */ +proto.tendermint.types.BlockMeta.prototype.clearHeader = function() { + return this.setHeader(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.BlockMeta.prototype.hasHeader = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional int64 num_txs = 4; + * @return {number} + */ +proto.tendermint.types.BlockMeta.prototype.getNumTxs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.BlockMeta} returns this + */ +proto.tendermint.types.BlockMeta.prototype.setNumTxs = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.TxProof.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.TxProof.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.TxProof} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.TxProof.toObject = function(includeInstance, msg) { + var f, obj = { + rootHash: msg.getRootHash_asB64(), + data: msg.getData_asB64(), + proof: (f = msg.getProof()) && tendermint_crypto_proof_pb.Proof.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.TxProof} + */ +proto.tendermint.types.TxProof.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.TxProof; + return proto.tendermint.types.TxProof.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.TxProof} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.TxProof} + */ +proto.tendermint.types.TxProof.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setRootHash(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + case 3: + var value = new tendermint_crypto_proof_pb.Proof; + reader.readMessage(value,tendermint_crypto_proof_pb.Proof.deserializeBinaryFromReader); + msg.setProof(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.TxProof.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.TxProof.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.TxProof} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.TxProof.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getRootHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getProof(); + if (f != null) { + writer.writeMessage( + 3, + f, + tendermint_crypto_proof_pb.Proof.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes root_hash = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.TxProof.prototype.getRootHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes root_hash = 1; + * This is a type-conversion wrapper around `getRootHash()` + * @return {string} + */ +proto.tendermint.types.TxProof.prototype.getRootHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getRootHash())); +}; + + +/** + * optional bytes root_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getRootHash()` + * @return {!Uint8Array} + */ +proto.tendermint.types.TxProof.prototype.getRootHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getRootHash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.TxProof} returns this + */ +proto.tendermint.types.TxProof.prototype.setRootHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.TxProof.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.tendermint.types.TxProof.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.tendermint.types.TxProof.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.TxProof} returns this + */ +proto.tendermint.types.TxProof.prototype.setData = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional tendermint.crypto.Proof proof = 3; + * @return {?proto.tendermint.crypto.Proof} + */ +proto.tendermint.types.TxProof.prototype.getProof = function() { + return /** @type{?proto.tendermint.crypto.Proof} */ ( + jspb.Message.getWrapperField(this, tendermint_crypto_proof_pb.Proof, 3)); +}; + + +/** + * @param {?proto.tendermint.crypto.Proof|undefined} value + * @return {!proto.tendermint.types.TxProof} returns this +*/ +proto.tendermint.types.TxProof.prototype.setProof = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.TxProof} returns this + */ +proto.tendermint.types.TxProof.prototype.clearProof = function() { + return this.setProof(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.TxProof.prototype.hasProof = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * @enum {number} + */ +proto.tendermint.types.BlockIDFlag = { + BLOCK_ID_FLAG_UNKNOWN: 0, + BLOCK_ID_FLAG_ABSENT: 1, + BLOCK_ID_FLAG_COMMIT: 2, + BLOCK_ID_FLAG_NIL: 3 +}; + +/** + * @enum {number} + */ +proto.tendermint.types.SignedMsgType = { + SIGNED_MSG_TYPE_UNKNOWN: 0, + SIGNED_MSG_TYPE_PREVOTE: 1, + SIGNED_MSG_TYPE_PRECOMMIT: 2, + SIGNED_MSG_TYPE_PROPOSAL: 32 +}; + +goog.object.extend(exports, proto.tendermint.types); diff --git a/js/proto/tendermint/types/validator_grpc_pb.js b/js/proto/tendermint/types/validator_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/types/validator_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/types/validator_pb.d.ts b/js/proto/tendermint/types/validator_pb.d.ts new file mode 100644 index 000000000..ce221b924 --- /dev/null +++ b/js/proto/tendermint/types/validator_pb.d.ts @@ -0,0 +1,109 @@ +// package: tendermint.types +// file: tendermint/types/validator.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; +import * as tendermint_crypto_keys_pb from "../../tendermint/crypto/keys_pb"; + +export class ValidatorSet extends jspb.Message { + clearValidatorsList(): void; + getValidatorsList(): Array; + setValidatorsList(value: Array): ValidatorSet; + addValidators(value?: Validator, index?: number): Validator; + + + hasProposer(): boolean; + clearProposer(): void; + getProposer(): Validator | undefined; + setProposer(value?: Validator): ValidatorSet; + + getTotalVotingPower(): number; + setTotalVotingPower(value: number): ValidatorSet; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ValidatorSet.AsObject; + static toObject(includeInstance: boolean, msg: ValidatorSet): ValidatorSet.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ValidatorSet, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ValidatorSet; + static deserializeBinaryFromReader(message: ValidatorSet, reader: jspb.BinaryReader): ValidatorSet; +} + +export namespace ValidatorSet { + export type AsObject = { + validatorsList: Array, + proposer?: Validator.AsObject, + totalVotingPower: number, + } +} + +export class Validator extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): Validator; + + + hasPubKey(): boolean; + clearPubKey(): void; + getPubKey(): tendermint_crypto_keys_pb.PublicKey | undefined; + setPubKey(value?: tendermint_crypto_keys_pb.PublicKey): Validator; + + getVotingPower(): number; + setVotingPower(value: number): Validator; + + getProposerPriority(): number; + setProposerPriority(value: number): Validator; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Validator.AsObject; + static toObject(includeInstance: boolean, msg: Validator): Validator.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Validator, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Validator; + static deserializeBinaryFromReader(message: Validator, reader: jspb.BinaryReader): Validator; +} + +export namespace Validator { + export type AsObject = { + address: Uint8Array | string, + pubKey?: tendermint_crypto_keys_pb.PublicKey.AsObject, + votingPower: number, + proposerPriority: number, + } +} + +export class SimpleValidator extends jspb.Message { + + hasPubKey(): boolean; + clearPubKey(): void; + getPubKey(): tendermint_crypto_keys_pb.PublicKey | undefined; + setPubKey(value?: tendermint_crypto_keys_pb.PublicKey): SimpleValidator; + + getVotingPower(): number; + setVotingPower(value: number): SimpleValidator; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SimpleValidator.AsObject; + static toObject(includeInstance: boolean, msg: SimpleValidator): SimpleValidator.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SimpleValidator, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SimpleValidator; + static deserializeBinaryFromReader(message: SimpleValidator, reader: jspb.BinaryReader): SimpleValidator; +} + +export namespace SimpleValidator { + export type AsObject = { + pubKey?: tendermint_crypto_keys_pb.PublicKey.AsObject, + votingPower: number, + } +} diff --git a/js/proto/tendermint/types/validator_pb.js b/js/proto/tendermint/types/validator_pb.js new file mode 100644 index 000000000..6314e5c75 --- /dev/null +++ b/js/proto/tendermint/types/validator_pb.js @@ -0,0 +1,774 @@ +// source: tendermint/types/validator.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var tendermint_crypto_keys_pb = require('../../tendermint/crypto/keys_pb.js'); +goog.object.extend(proto, tendermint_crypto_keys_pb); +goog.exportSymbol('proto.tendermint.types.SimpleValidator', null, global); +goog.exportSymbol('proto.tendermint.types.Validator', null, global); +goog.exportSymbol('proto.tendermint.types.ValidatorSet', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.ValidatorSet = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.tendermint.types.ValidatorSet.repeatedFields_, null); +}; +goog.inherits(proto.tendermint.types.ValidatorSet, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.ValidatorSet.displayName = 'proto.tendermint.types.ValidatorSet'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.Validator = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.Validator, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.Validator.displayName = 'proto.tendermint.types.Validator'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.types.SimpleValidator = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.types.SimpleValidator, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.types.SimpleValidator.displayName = 'proto.tendermint.types.SimpleValidator'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.tendermint.types.ValidatorSet.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.ValidatorSet.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.ValidatorSet.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.ValidatorSet} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.ValidatorSet.toObject = function(includeInstance, msg) { + var f, obj = { + validatorsList: jspb.Message.toObjectList(msg.getValidatorsList(), + proto.tendermint.types.Validator.toObject, includeInstance), + proposer: (f = msg.getProposer()) && proto.tendermint.types.Validator.toObject(includeInstance, f), + totalVotingPower: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.ValidatorSet} + */ +proto.tendermint.types.ValidatorSet.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.ValidatorSet; + return proto.tendermint.types.ValidatorSet.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.ValidatorSet} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.ValidatorSet} + */ +proto.tendermint.types.ValidatorSet.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.tendermint.types.Validator; + reader.readMessage(value,proto.tendermint.types.Validator.deserializeBinaryFromReader); + msg.addValidators(value); + break; + case 2: + var value = new proto.tendermint.types.Validator; + reader.readMessage(value,proto.tendermint.types.Validator.deserializeBinaryFromReader); + msg.setProposer(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTotalVotingPower(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.ValidatorSet.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.ValidatorSet.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.ValidatorSet} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.ValidatorSet.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getValidatorsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.tendermint.types.Validator.serializeBinaryToWriter + ); + } + f = message.getProposer(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.tendermint.types.Validator.serializeBinaryToWriter + ); + } + f = message.getTotalVotingPower(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } +}; + + +/** + * repeated Validator validators = 1; + * @return {!Array} + */ +proto.tendermint.types.ValidatorSet.prototype.getValidatorsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.tendermint.types.Validator, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.tendermint.types.ValidatorSet} returns this +*/ +proto.tendermint.types.ValidatorSet.prototype.setValidatorsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.tendermint.types.Validator=} opt_value + * @param {number=} opt_index + * @return {!proto.tendermint.types.Validator} + */ +proto.tendermint.types.ValidatorSet.prototype.addValidators = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.tendermint.types.Validator, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.tendermint.types.ValidatorSet} returns this + */ +proto.tendermint.types.ValidatorSet.prototype.clearValidatorsList = function() { + return this.setValidatorsList([]); +}; + + +/** + * optional Validator proposer = 2; + * @return {?proto.tendermint.types.Validator} + */ +proto.tendermint.types.ValidatorSet.prototype.getProposer = function() { + return /** @type{?proto.tendermint.types.Validator} */ ( + jspb.Message.getWrapperField(this, proto.tendermint.types.Validator, 2)); +}; + + +/** + * @param {?proto.tendermint.types.Validator|undefined} value + * @return {!proto.tendermint.types.ValidatorSet} returns this +*/ +proto.tendermint.types.ValidatorSet.prototype.setProposer = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.ValidatorSet} returns this + */ +proto.tendermint.types.ValidatorSet.prototype.clearProposer = function() { + return this.setProposer(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.ValidatorSet.prototype.hasProposer = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int64 total_voting_power = 3; + * @return {number} + */ +proto.tendermint.types.ValidatorSet.prototype.getTotalVotingPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.ValidatorSet} returns this + */ +proto.tendermint.types.ValidatorSet.prototype.setTotalVotingPower = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.Validator.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.Validator.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.Validator} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Validator.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + pubKey: (f = msg.getPubKey()) && tendermint_crypto_keys_pb.PublicKey.toObject(includeInstance, f), + votingPower: jspb.Message.getFieldWithDefault(msg, 3, 0), + proposerPriority: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.Validator} + */ +proto.tendermint.types.Validator.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.Validator; + return proto.tendermint.types.Validator.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.Validator} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.Validator} + */ +proto.tendermint.types.Validator.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = new tendermint_crypto_keys_pb.PublicKey; + reader.readMessage(value,tendermint_crypto_keys_pb.PublicKey.deserializeBinaryFromReader); + msg.setPubKey(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setVotingPower(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setProposerPriority(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.Validator.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.Validator.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.Validator} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.Validator.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPubKey(); + if (f != null) { + writer.writeMessage( + 2, + f, + tendermint_crypto_keys_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getVotingPower(); + if (f !== 0) { + writer.writeInt64( + 3, + f + ); + } + f = message.getProposerPriority(); + if (f !== 0) { + writer.writeInt64( + 4, + f + ); + } +}; + + +/** + * optional bytes address = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.types.Validator.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.tendermint.types.Validator.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.tendermint.types.Validator.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.types.Validator} returns this + */ +proto.tendermint.types.Validator.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional tendermint.crypto.PublicKey pub_key = 2; + * @return {?proto.tendermint.crypto.PublicKey} + */ +proto.tendermint.types.Validator.prototype.getPubKey = function() { + return /** @type{?proto.tendermint.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, tendermint_crypto_keys_pb.PublicKey, 2)); +}; + + +/** + * @param {?proto.tendermint.crypto.PublicKey|undefined} value + * @return {!proto.tendermint.types.Validator} returns this +*/ +proto.tendermint.types.Validator.prototype.setPubKey = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.Validator} returns this + */ +proto.tendermint.types.Validator.prototype.clearPubKey = function() { + return this.setPubKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.Validator.prototype.hasPubKey = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int64 voting_power = 3; + * @return {number} + */ +proto.tendermint.types.Validator.prototype.getVotingPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Validator} returns this + */ +proto.tendermint.types.Validator.prototype.setVotingPower = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int64 proposer_priority = 4; + * @return {number} + */ +proto.tendermint.types.Validator.prototype.getProposerPriority = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.Validator} returns this + */ +proto.tendermint.types.Validator.prototype.setProposerPriority = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.types.SimpleValidator.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.types.SimpleValidator.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.types.SimpleValidator} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.SimpleValidator.toObject = function(includeInstance, msg) { + var f, obj = { + pubKey: (f = msg.getPubKey()) && tendermint_crypto_keys_pb.PublicKey.toObject(includeInstance, f), + votingPower: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.types.SimpleValidator} + */ +proto.tendermint.types.SimpleValidator.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.types.SimpleValidator; + return proto.tendermint.types.SimpleValidator.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.types.SimpleValidator} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.types.SimpleValidator} + */ +proto.tendermint.types.SimpleValidator.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new tendermint_crypto_keys_pb.PublicKey; + reader.readMessage(value,tendermint_crypto_keys_pb.PublicKey.deserializeBinaryFromReader); + msg.setPubKey(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setVotingPower(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.types.SimpleValidator.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.types.SimpleValidator.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.types.SimpleValidator} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.types.SimpleValidator.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubKey(); + if (f != null) { + writer.writeMessage( + 1, + f, + tendermint_crypto_keys_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getVotingPower(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * optional tendermint.crypto.PublicKey pub_key = 1; + * @return {?proto.tendermint.crypto.PublicKey} + */ +proto.tendermint.types.SimpleValidator.prototype.getPubKey = function() { + return /** @type{?proto.tendermint.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, tendermint_crypto_keys_pb.PublicKey, 1)); +}; + + +/** + * @param {?proto.tendermint.crypto.PublicKey|undefined} value + * @return {!proto.tendermint.types.SimpleValidator} returns this +*/ +proto.tendermint.types.SimpleValidator.prototype.setPubKey = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.tendermint.types.SimpleValidator} returns this + */ +proto.tendermint.types.SimpleValidator.prototype.clearPubKey = function() { + return this.setPubKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.tendermint.types.SimpleValidator.prototype.hasPubKey = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional int64 voting_power = 2; + * @return {number} + */ +proto.tendermint.types.SimpleValidator.prototype.getVotingPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.types.SimpleValidator} returns this + */ +proto.tendermint.types.SimpleValidator.prototype.setVotingPower = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +goog.object.extend(exports, proto.tendermint.types); diff --git a/js/proto/tendermint/version/types_grpc_pb.js b/js/proto/tendermint/version/types_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint/version/types_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint/version/types_pb.d.ts b/js/proto/tendermint/version/types_pb.d.ts new file mode 100644 index 000000000..efa883cbf --- /dev/null +++ b/js/proto/tendermint/version/types_pb.d.ts @@ -0,0 +1,58 @@ +// package: tendermint.version +// file: tendermint/version/types.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "../../gogoproto/gogo_pb"; + +export class App extends jspb.Message { + getProtocol(): number; + setProtocol(value: number): App; + + getSoftware(): string; + setSoftware(value: string): App; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): App.AsObject; + static toObject(includeInstance: boolean, msg: App): App.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: App, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): App; + static deserializeBinaryFromReader(message: App, reader: jspb.BinaryReader): App; +} + +export namespace App { + export type AsObject = { + protocol: number, + software: string, + } +} + +export class Consensus extends jspb.Message { + getBlock(): number; + setBlock(value: number): Consensus; + + getApp(): number; + setApp(value: number): Consensus; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Consensus.AsObject; + static toObject(includeInstance: boolean, msg: Consensus): Consensus.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Consensus, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Consensus; + static deserializeBinaryFromReader(message: Consensus, reader: jspb.BinaryReader): Consensus; +} + +export namespace Consensus { + export type AsObject = { + block: number, + app: number, + } +} diff --git a/js/proto/tendermint/version/types_pb.js b/js/proto/tendermint/version/types_pb.js new file mode 100644 index 000000000..2617a64b2 --- /dev/null +++ b/js/proto/tendermint/version/types_pb.js @@ -0,0 +1,383 @@ +// source: tendermint/version/types.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('../../gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.tendermint.version.App', null, global); +goog.exportSymbol('proto.tendermint.version.Consensus', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.version.App = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.version.App, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.version.App.displayName = 'proto.tendermint.version.App'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.version.Consensus = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.version.Consensus, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.version.Consensus.displayName = 'proto.tendermint.version.Consensus'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.version.App.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.version.App.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.version.App} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.version.App.toObject = function(includeInstance, msg) { + var f, obj = { + protocol: jspb.Message.getFieldWithDefault(msg, 1, 0), + software: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.version.App} + */ +proto.tendermint.version.App.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.version.App; + return proto.tendermint.version.App.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.version.App} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.version.App} + */ +proto.tendermint.version.App.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setProtocol(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setSoftware(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.version.App.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.version.App.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.version.App} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.version.App.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProtocol(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getSoftware(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional uint64 protocol = 1; + * @return {number} + */ +proto.tendermint.version.App.prototype.getProtocol = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.version.App} returns this + */ +proto.tendermint.version.App.prototype.setProtocol = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string software = 2; + * @return {string} + */ +proto.tendermint.version.App.prototype.getSoftware = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.version.App} returns this + */ +proto.tendermint.version.App.prototype.setSoftware = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.version.Consensus.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.version.Consensus.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.version.Consensus} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.version.Consensus.toObject = function(includeInstance, msg) { + var f, obj = { + block: jspb.Message.getFieldWithDefault(msg, 1, 0), + app: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.version.Consensus} + */ +proto.tendermint.version.Consensus.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.version.Consensus; + return proto.tendermint.version.Consensus.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.version.Consensus} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.version.Consensus} + */ +proto.tendermint.version.Consensus.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setBlock(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setApp(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.version.Consensus.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.version.Consensus.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.version.Consensus} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.version.Consensus.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getApp(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * optional uint64 block = 1; + * @return {number} + */ +proto.tendermint.version.Consensus.prototype.getBlock = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.version.Consensus} returns this + */ +proto.tendermint.version.Consensus.prototype.setBlock = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 app = 2; + * @return {number} + */ +proto.tendermint.version.Consensus.prototype.getApp = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.tendermint.version.Consensus} returns this + */ +proto.tendermint.version.Consensus.prototype.setApp = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +goog.object.extend(exports, proto.tendermint.version); diff --git a/js/proto/tendermint_grpc_pb.js b/js/proto/tendermint_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/tendermint_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/tendermint_pb.d.ts b/js/proto/tendermint_pb.d.ts new file mode 100644 index 000000000..e07b68a42 --- /dev/null +++ b/js/proto/tendermint_pb.d.ts @@ -0,0 +1,61 @@ +// package: tendermint +// file: tendermint.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; + +export class NodeInfo extends jspb.Message { + getId(): Uint8Array | string; + getId_asU8(): Uint8Array; + getId_asB64(): string; + setId(value: Uint8Array | string): NodeInfo; + + getListenaddress(): string; + setListenaddress(value: string): NodeInfo; + + getNetwork(): string; + setNetwork(value: string): NodeInfo; + + getVersion(): string; + setVersion(value: string): NodeInfo; + + getChannels(): Uint8Array | string; + getChannels_asU8(): Uint8Array; + getChannels_asB64(): string; + setChannels(value: Uint8Array | string): NodeInfo; + + getMoniker(): string; + setMoniker(value: string): NodeInfo; + + getRpcaddress(): string; + setRpcaddress(value: string): NodeInfo; + + getTxindex(): string; + setTxindex(value: string): NodeInfo; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NodeInfo.AsObject; + static toObject(includeInstance: boolean, msg: NodeInfo): NodeInfo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NodeInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NodeInfo; + static deserializeBinaryFromReader(message: NodeInfo, reader: jspb.BinaryReader): NodeInfo; +} + +export namespace NodeInfo { + export type AsObject = { + id: Uint8Array | string, + listenaddress: string, + network: string, + version: string, + channels: Uint8Array | string, + moniker: string, + rpcaddress: string, + txindex: string, + } +} diff --git a/js/proto/tendermint_pb.js b/js/proto/tendermint_pb.js new file mode 100644 index 000000000..f2c88d2ec --- /dev/null +++ b/js/proto/tendermint_pb.js @@ -0,0 +1,429 @@ +// source: tendermint.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +goog.exportSymbol('proto.tendermint.NodeInfo', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.tendermint.NodeInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.tendermint.NodeInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.tendermint.NodeInfo.displayName = 'proto.tendermint.NodeInfo'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.tendermint.NodeInfo.prototype.toObject = function(opt_includeInstance) { + return proto.tendermint.NodeInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.tendermint.NodeInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.NodeInfo.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64(), + listenaddress: jspb.Message.getFieldWithDefault(msg, 2, ""), + network: jspb.Message.getFieldWithDefault(msg, 3, ""), + version: jspb.Message.getFieldWithDefault(msg, 4, ""), + channels: msg.getChannels_asB64(), + moniker: jspb.Message.getFieldWithDefault(msg, 6, ""), + rpcaddress: jspb.Message.getFieldWithDefault(msg, 7, ""), + txindex: jspb.Message.getFieldWithDefault(msg, 8, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.tendermint.NodeInfo} + */ +proto.tendermint.NodeInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.tendermint.NodeInfo; + return proto.tendermint.NodeInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.tendermint.NodeInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.tendermint.NodeInfo} + */ +proto.tendermint.NodeInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setListenaddress(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setNetwork(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setVersion(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setChannels(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setMoniker(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setRpcaddress(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setTxindex(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.tendermint.NodeInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.tendermint.NodeInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.tendermint.NodeInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.tendermint.NodeInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getListenaddress(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getNetwork(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getVersion(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getChannels_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getMoniker(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } + f = message.getRpcaddress(); + if (f.length > 0) { + writer.writeString( + 7, + f + ); + } + f = message.getTxindex(); + if (f.length > 0) { + writer.writeString( + 8, + f + ); + } +}; + + +/** + * optional bytes ID = 1; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.NodeInfo.prototype.getId = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes ID = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} + */ +proto.tendermint.NodeInfo.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); +}; + + +/** + * optional bytes ID = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} + */ +proto.tendermint.NodeInfo.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.NodeInfo} returns this + */ +proto.tendermint.NodeInfo.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional string ListenAddress = 2; + * @return {string} + */ +proto.tendermint.NodeInfo.prototype.getListenaddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.NodeInfo} returns this + */ +proto.tendermint.NodeInfo.prototype.setListenaddress = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string Network = 3; + * @return {string} + */ +proto.tendermint.NodeInfo.prototype.getNetwork = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.NodeInfo} returns this + */ +proto.tendermint.NodeInfo.prototype.setNetwork = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string Version = 4; + * @return {string} + */ +proto.tendermint.NodeInfo.prototype.getVersion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.NodeInfo} returns this + */ +proto.tendermint.NodeInfo.prototype.setVersion = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional bytes Channels = 5; + * @return {!(string|Uint8Array)} + */ +proto.tendermint.NodeInfo.prototype.getChannels = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes Channels = 5; + * This is a type-conversion wrapper around `getChannels()` + * @return {string} + */ +proto.tendermint.NodeInfo.prototype.getChannels_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getChannels())); +}; + + +/** + * optional bytes Channels = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getChannels()` + * @return {!Uint8Array} + */ +proto.tendermint.NodeInfo.prototype.getChannels_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getChannels())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.tendermint.NodeInfo} returns this + */ +proto.tendermint.NodeInfo.prototype.setChannels = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + +/** + * optional string Moniker = 6; + * @return {string} + */ +proto.tendermint.NodeInfo.prototype.getMoniker = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.NodeInfo} returns this + */ +proto.tendermint.NodeInfo.prototype.setMoniker = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + +/** + * optional string RPCAddress = 7; + * @return {string} + */ +proto.tendermint.NodeInfo.prototype.getRpcaddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.NodeInfo} returns this + */ +proto.tendermint.NodeInfo.prototype.setRpcaddress = function(value) { + return jspb.Message.setProto3StringField(this, 7, value); +}; + + +/** + * optional string TxIndex = 8; + * @return {string} + */ +proto.tendermint.NodeInfo.prototype.getTxindex = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * @param {string} value + * @return {!proto.tendermint.NodeInfo} returns this + */ +proto.tendermint.NodeInfo.prototype.setTxindex = function(value) { + return jspb.Message.setProto3StringField(this, 8, value); +}; + + +goog.object.extend(exports, proto.tendermint); diff --git a/js/proto/txs_grpc_pb.js b/js/proto/txs_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/txs_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/txs_pb.d.ts b/js/proto/txs_pb.d.ts new file mode 100644 index 000000000..567732c17 --- /dev/null +++ b/js/proto/txs_pb.d.ts @@ -0,0 +1,122 @@ +// package: txs +// file: txs.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as crypto_pb from "./crypto_pb"; + +export class Envelope extends jspb.Message { + clearSignatoriesList(): void; + getSignatoriesList(): Array; + setSignatoriesList(value: Array): Envelope; + addSignatories(value?: Signatory, index?: number): Signatory; + + getTx(): Uint8Array | string; + getTx_asU8(): Uint8Array; + getTx_asB64(): string; + setTx(value: Uint8Array | string): Envelope; + + getEncoding(): Envelope.EncodingType; + setEncoding(value: Envelope.EncodingType): Envelope; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Envelope.AsObject; + static toObject(includeInstance: boolean, msg: Envelope): Envelope.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Envelope, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Envelope; + static deserializeBinaryFromReader(message: Envelope, reader: jspb.BinaryReader): Envelope; +} + +export namespace Envelope { + export type AsObject = { + signatoriesList: Array, + tx: Uint8Array | string, + encoding: Envelope.EncodingType, + } + + export enum EncodingType { + JSON = 0, + RLP = 1, + } + +} + +export class Signatory extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): Signatory; + + + hasPublickey(): boolean; + clearPublickey(): void; + getPublickey(): crypto_pb.PublicKey | undefined; + setPublickey(value?: crypto_pb.PublicKey): Signatory; + + + hasSignature(): boolean; + clearSignature(): void; + getSignature(): crypto_pb.Signature | undefined; + setSignature(value?: crypto_pb.Signature): Signatory; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Signatory.AsObject; + static toObject(includeInstance: boolean, msg: Signatory): Signatory.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Signatory, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Signatory; + static deserializeBinaryFromReader(message: Signatory, reader: jspb.BinaryReader): Signatory; +} + +export namespace Signatory { + export type AsObject = { + address: Uint8Array | string, + publickey?: crypto_pb.PublicKey.AsObject, + signature?: crypto_pb.Signature.AsObject, + } +} + +export class Receipt extends jspb.Message { + getTxtype(): number; + setTxtype(value: number): Receipt; + + getTxhash(): Uint8Array | string; + getTxhash_asU8(): Uint8Array; + getTxhash_asB64(): string; + setTxhash(value: Uint8Array | string): Receipt; + + getCreatescontract(): boolean; + setCreatescontract(value: boolean): Receipt; + + getContractaddress(): Uint8Array | string; + getContractaddress_asU8(): Uint8Array; + getContractaddress_asB64(): string; + setContractaddress(value: Uint8Array | string): Receipt; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Receipt.AsObject; + static toObject(includeInstance: boolean, msg: Receipt): Receipt.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Receipt, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Receipt; + static deserializeBinaryFromReader(message: Receipt, reader: jspb.BinaryReader): Receipt; +} + +export namespace Receipt { + export type AsObject = { + txtype: number, + txhash: Uint8Array | string, + createscontract: boolean, + contractaddress: Uint8Array | string, + } +} diff --git a/js/proto/txs_pb.js b/js/proto/txs_pb.js new file mode 100644 index 000000000..a266996c7 --- /dev/null +++ b/js/proto/txs_pb.js @@ -0,0 +1,864 @@ +// source: txs.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var crypto_pb = require('./crypto_pb.js'); +goog.object.extend(proto, crypto_pb); +goog.exportSymbol('proto.txs.Envelope', null, global); +goog.exportSymbol('proto.txs.Envelope.EncodingType', null, global); +goog.exportSymbol('proto.txs.Receipt', null, global); +goog.exportSymbol('proto.txs.Signatory', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.txs.Envelope = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.txs.Envelope.repeatedFields_, null); +}; +goog.inherits(proto.txs.Envelope, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.txs.Envelope.displayName = 'proto.txs.Envelope'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.txs.Signatory = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.txs.Signatory, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.txs.Signatory.displayName = 'proto.txs.Signatory'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.txs.Receipt = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.txs.Receipt, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.txs.Receipt.displayName = 'proto.txs.Receipt'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.txs.Envelope.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.txs.Envelope.prototype.toObject = function(opt_includeInstance) { + return proto.txs.Envelope.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.txs.Envelope} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.txs.Envelope.toObject = function(includeInstance, msg) { + var f, obj = { + signatoriesList: jspb.Message.toObjectList(msg.getSignatoriesList(), + proto.txs.Signatory.toObject, includeInstance), + tx: msg.getTx_asB64(), + encoding: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.txs.Envelope} + */ +proto.txs.Envelope.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.txs.Envelope; + return proto.txs.Envelope.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.txs.Envelope} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.txs.Envelope} + */ +proto.txs.Envelope.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.txs.Signatory; + reader.readMessage(value,proto.txs.Signatory.deserializeBinaryFromReader); + msg.addSignatories(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTx(value); + break; + case 3: + var value = /** @type {!proto.txs.Envelope.EncodingType} */ (reader.readEnum()); + msg.setEncoding(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.txs.Envelope.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.txs.Envelope.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.txs.Envelope} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.txs.Envelope.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSignatoriesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.txs.Signatory.serializeBinaryToWriter + ); + } + f = message.getTx_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getEncoding(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.txs.Envelope.EncodingType = { + JSON: 0, + RLP: 1 +}; + +/** + * repeated Signatory Signatories = 1; + * @return {!Array} + */ +proto.txs.Envelope.prototype.getSignatoriesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.txs.Signatory, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.txs.Envelope} returns this +*/ +proto.txs.Envelope.prototype.setSignatoriesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.txs.Signatory=} opt_value + * @param {number=} opt_index + * @return {!proto.txs.Signatory} + */ +proto.txs.Envelope.prototype.addSignatories = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.txs.Signatory, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.txs.Envelope} returns this + */ +proto.txs.Envelope.prototype.clearSignatoriesList = function() { + return this.setSignatoriesList([]); +}; + + +/** + * optional bytes Tx = 2; + * @return {!(string|Uint8Array)} + */ +proto.txs.Envelope.prototype.getTx = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes Tx = 2; + * This is a type-conversion wrapper around `getTx()` + * @return {string} + */ +proto.txs.Envelope.prototype.getTx_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTx())); +}; + + +/** + * optional bytes Tx = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTx()` + * @return {!Uint8Array} + */ +proto.txs.Envelope.prototype.getTx_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTx())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.txs.Envelope} returns this + */ +proto.txs.Envelope.prototype.setTx = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional EncodingType Encoding = 3; + * @return {!proto.txs.Envelope.EncodingType} + */ +proto.txs.Envelope.prototype.getEncoding = function() { + return /** @type {!proto.txs.Envelope.EncodingType} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {!proto.txs.Envelope.EncodingType} value + * @return {!proto.txs.Envelope} returns this + */ +proto.txs.Envelope.prototype.setEncoding = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.txs.Signatory.prototype.toObject = function(opt_includeInstance) { + return proto.txs.Signatory.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.txs.Signatory} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.txs.Signatory.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + publickey: (f = msg.getPublickey()) && crypto_pb.PublicKey.toObject(includeInstance, f), + signature: (f = msg.getSignature()) && crypto_pb.Signature.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.txs.Signatory} + */ +proto.txs.Signatory.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.txs.Signatory; + return proto.txs.Signatory.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.txs.Signatory} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.txs.Signatory} + */ +proto.txs.Signatory.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = new crypto_pb.PublicKey; + reader.readMessage(value,crypto_pb.PublicKey.deserializeBinaryFromReader); + msg.setPublickey(value); + break; + case 4: + var value = new crypto_pb.Signature; + reader.readMessage(value,crypto_pb.Signature.deserializeBinaryFromReader); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.txs.Signatory.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.txs.Signatory.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.txs.Signatory} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.txs.Signatory.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPublickey(); + if (f != null) { + writer.writeMessage( + 2, + f, + crypto_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getSignature(); + if (f != null) { + writer.writeMessage( + 4, + f, + crypto_pb.Signature.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.txs.Signatory.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.txs.Signatory.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.txs.Signatory.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.txs.Signatory} returns this + */ +proto.txs.Signatory.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional crypto.PublicKey PublicKey = 2; + * @return {?proto.crypto.PublicKey} + */ +proto.txs.Signatory.prototype.getPublickey = function() { + return /** @type{?proto.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, crypto_pb.PublicKey, 2)); +}; + + +/** + * @param {?proto.crypto.PublicKey|undefined} value + * @return {!proto.txs.Signatory} returns this +*/ +proto.txs.Signatory.prototype.setPublickey = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.txs.Signatory} returns this + */ +proto.txs.Signatory.prototype.clearPublickey = function() { + return this.setPublickey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.txs.Signatory.prototype.hasPublickey = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional crypto.Signature Signature = 4; + * @return {?proto.crypto.Signature} + */ +proto.txs.Signatory.prototype.getSignature = function() { + return /** @type{?proto.crypto.Signature} */ ( + jspb.Message.getWrapperField(this, crypto_pb.Signature, 4)); +}; + + +/** + * @param {?proto.crypto.Signature|undefined} value + * @return {!proto.txs.Signatory} returns this +*/ +proto.txs.Signatory.prototype.setSignature = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.txs.Signatory} returns this + */ +proto.txs.Signatory.prototype.clearSignature = function() { + return this.setSignature(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.txs.Signatory.prototype.hasSignature = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.txs.Receipt.prototype.toObject = function(opt_includeInstance) { + return proto.txs.Receipt.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.txs.Receipt} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.txs.Receipt.toObject = function(includeInstance, msg) { + var f, obj = { + txtype: jspb.Message.getFieldWithDefault(msg, 1, 0), + txhash: msg.getTxhash_asB64(), + createscontract: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + contractaddress: msg.getContractaddress_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.txs.Receipt} + */ +proto.txs.Receipt.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.txs.Receipt; + return proto.txs.Receipt.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.txs.Receipt} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.txs.Receipt} + */ +proto.txs.Receipt.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setTxtype(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTxhash(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setCreatescontract(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContractaddress(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.txs.Receipt.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.txs.Receipt.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.txs.Receipt} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.txs.Receipt.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTxtype(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getTxhash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getCreatescontract(); + if (f) { + writer.writeBool( + 3, + f + ); + } + f = message.getContractaddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional uint32 TxType = 1; + * @return {number} + */ +proto.txs.Receipt.prototype.getTxtype = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.txs.Receipt} returns this + */ +proto.txs.Receipt.prototype.setTxtype = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes TxHash = 2; + * @return {!(string|Uint8Array)} + */ +proto.txs.Receipt.prototype.getTxhash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes TxHash = 2; + * This is a type-conversion wrapper around `getTxhash()` + * @return {string} + */ +proto.txs.Receipt.prototype.getTxhash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTxhash())); +}; + + +/** + * optional bytes TxHash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTxhash()` + * @return {!Uint8Array} + */ +proto.txs.Receipt.prototype.getTxhash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTxhash())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.txs.Receipt} returns this + */ +proto.txs.Receipt.prototype.setTxhash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bool CreatesContract = 3; + * @return {boolean} + */ +proto.txs.Receipt.prototype.getCreatescontract = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.txs.Receipt} returns this + */ +proto.txs.Receipt.prototype.setCreatescontract = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional bytes ContractAddress = 4; + * @return {!(string|Uint8Array)} + */ +proto.txs.Receipt.prototype.getContractaddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes ContractAddress = 4; + * This is a type-conversion wrapper around `getContractaddress()` + * @return {string} + */ +proto.txs.Receipt.prototype.getContractaddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContractaddress())); +}; + + +/** + * optional bytes ContractAddress = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContractaddress()` + * @return {!Uint8Array} + */ +proto.txs.Receipt.prototype.getContractaddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContractaddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.txs.Receipt} returns this + */ +proto.txs.Receipt.prototype.setContractaddress = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +goog.object.extend(exports, proto.txs); diff --git a/js/proto/validator_grpc_pb.js b/js/proto/validator_grpc_pb.js new file mode 100644 index 000000000..97b3a2461 --- /dev/null +++ b/js/proto/validator_grpc_pb.js @@ -0,0 +1 @@ +// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file diff --git a/js/proto/validator_pb.d.ts b/js/proto/validator_pb.d.ts new file mode 100644 index 000000000..ae6ef0aca --- /dev/null +++ b/js/proto/validator_pb.d.ts @@ -0,0 +1,43 @@ +// package: validator +// file: validator.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; +import * as gogoproto_gogo_pb from "./gogoproto/gogo_pb"; +import * as crypto_pb from "./crypto_pb"; + +export class Validator extends jspb.Message { + getAddress(): Uint8Array | string; + getAddress_asU8(): Uint8Array; + getAddress_asB64(): string; + setAddress(value: Uint8Array | string): Validator; + + + hasPublickey(): boolean; + clearPublickey(): void; + getPublickey(): crypto_pb.PublicKey | undefined; + setPublickey(value?: crypto_pb.PublicKey): Validator; + + getPower(): number; + setPower(value: number): Validator; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Validator.AsObject; + static toObject(includeInstance: boolean, msg: Validator): Validator.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Validator, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Validator; + static deserializeBinaryFromReader(message: Validator, reader: jspb.BinaryReader): Validator; +} + +export namespace Validator { + export type AsObject = { + address: Uint8Array | string, + publickey?: crypto_pb.PublicKey.AsObject, + power: number, + } +} diff --git a/js/proto/validator_pb.js b/js/proto/validator_pb.js new file mode 100644 index 000000000..7d7c89680 --- /dev/null +++ b/js/proto/validator_pb.js @@ -0,0 +1,278 @@ +// source: validator.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var gogoproto_gogo_pb = require('./gogoproto/gogo_pb.js'); +goog.object.extend(proto, gogoproto_gogo_pb); +var crypto_pb = require('./crypto_pb.js'); +goog.object.extend(proto, crypto_pb); +goog.exportSymbol('proto.validator.Validator', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.validator.Validator = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.validator.Validator, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.validator.Validator.displayName = 'proto.validator.Validator'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.validator.Validator.prototype.toObject = function(opt_includeInstance) { + return proto.validator.Validator.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.validator.Validator} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.validator.Validator.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + publickey: (f = msg.getPublickey()) && crypto_pb.PublicKey.toObject(includeInstance, f), + power: jspb.Message.getFieldWithDefault(msg, 3, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.validator.Validator} + */ +proto.validator.Validator.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.validator.Validator; + return proto.validator.Validator.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.validator.Validator} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.validator.Validator} + */ +proto.validator.Validator.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); + break; + case 2: + var value = new crypto_pb.PublicKey; + reader.readMessage(value,crypto_pb.PublicKey.deserializeBinaryFromReader); + msg.setPublickey(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setPower(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.validator.Validator.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.validator.Validator.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.validator.Validator} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.validator.Validator.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPublickey(); + if (f != null) { + writer.writeMessage( + 2, + f, + crypto_pb.PublicKey.serializeBinaryToWriter + ); + } + f = message.getPower(); + if (f !== 0) { + writer.writeUint64( + 3, + f + ); + } +}; + + +/** + * optional bytes Address = 1; + * @return {!(string|Uint8Array)} + */ +proto.validator.Validator.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes Address = 1; + * This is a type-conversion wrapper around `getAddress()` + * @return {string} + */ +proto.validator.Validator.prototype.getAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getAddress())); +}; + + +/** + * optional bytes Address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getAddress()` + * @return {!Uint8Array} + */ +proto.validator.Validator.prototype.getAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getAddress())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.validator.Validator} returns this + */ +proto.validator.Validator.prototype.setAddress = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional crypto.PublicKey PublicKey = 2; + * @return {?proto.crypto.PublicKey} + */ +proto.validator.Validator.prototype.getPublickey = function() { + return /** @type{?proto.crypto.PublicKey} */ ( + jspb.Message.getWrapperField(this, crypto_pb.PublicKey, 2)); +}; + + +/** + * @param {?proto.crypto.PublicKey|undefined} value + * @return {!proto.validator.Validator} returns this +*/ +proto.validator.Validator.prototype.setPublickey = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.validator.Validator} returns this + */ +proto.validator.Validator.prototype.clearPublickey = function() { + return this.setPublickey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.validator.Validator.prototype.hasPublickey = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint64 Power = 3; + * @return {number} + */ +proto.validator.Validator.prototype.getPower = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.validator.Validator} returns this + */ +proto.validator.Validator.prototype.setPower = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +goog.object.extend(exports, proto.validator); diff --git a/js/src/index.ts b/js/src/index.ts new file mode 100644 index 000000000..5e558d65b --- /dev/null +++ b/js/src/index.ts @@ -0,0 +1,5 @@ +export { Burrow } from './lib/burrow'; +export { Contract } from './lib/contracts/contract'; +export * from './lib/utils/utils'; +export { TxInput, CallTx } from '../proto/payload_pb' +export { TxExecution } from '../proto/exec_pb'; \ No newline at end of file diff --git a/js/src/lib/burrow.ts b/js/src/lib/burrow.ts new file mode 100644 index 000000000..3731a689b --- /dev/null +++ b/js/src/lib/burrow.ts @@ -0,0 +1,52 @@ +import * as grpc from "@grpc/grpc-js"; +import {makeClientConstructor} from "@grpc/grpc-js"; +import {IExecutionEventsClient} from "../../proto/rpcevents_grpc_pb"; +import {IQueryClient} from '../../proto/rpcquery_grpc_pb'; +import {ITransactClient} from '../../proto/rpctransact_grpc_pb'; +import {ContractManager} from './contracts/manager'; +import {Events} from './events'; +import {Namereg} from './namereg'; +import {Pipe} from './pipe'; + +export type Error = grpc.ServiceError; + +export class Burrow { + URL: string; + account: string; + + events: Events; + pipe: Pipe; + contracts: ContractManager; + namereg: Namereg; + + ec: IExecutionEventsClient; + tc: ITransactClient; + qc: IQueryClient; + + constructor(URL: string, account: string) { + this.URL = URL; + this.account = account; + + + this.ec = newClient('rpcevents', 'ExecutionEvents', URL); + this.tc = newClient('rpctransact', 'Transact', URL); + this.qc = newClient('rpcquery', 'Query', URL); + + // This is the execution events streaming service running on top of the raw streaming function. + this.events = new Events(this.ec); + + // Contracts stuff running on top of grpc + this.pipe = new Pipe(this.tc, this.events); + this.contracts = new ContractManager(this); + + this.namereg = new Namereg(this.tc, this.qc, this.account); + } +} + +function newClient(pkg: string, service: string, URL: string): T { + const imp = require(`../../proto/${pkg}_grpc_pb`); + // As per https://github.com/agreatfool/grpc_tools_node_protoc_ts/blob/master/examples/src/grpcjs/client.ts + const cons = makeClientConstructor(imp[`${pkg}.${service}`], service); + // ugh + return new cons(URL, grpc.credentials.createInsecure()) as unknown as T +} diff --git a/js/src/lib/client.ts b/js/src/lib/client.ts new file mode 100644 index 000000000..3ddf1841a --- /dev/null +++ b/js/src/lib/client.ts @@ -0,0 +1,70 @@ +import { Burrow } from './burrow' +import * as convert from './utils/convert'; +import * as coder from 'ethereumjs-abi'; +import { Readable } from 'stream'; +import { TxInput, CallTx } from '../../proto/payload_pb' +import { TxExecution } from '../../proto/exec_pb'; + +export type Interceptor = (result: TxExecution) => Promise; + +export class Client extends Burrow { + interceptor: Interceptor; + + constructor(url: string, account: string) { + super(url, account); + + this.interceptor = async (data) => data; + } + + deploy(msg: CallTx, callback: (err: Error, addr: Uint8Array) => void) { + this.pipe.transact(msg, (err, exec) => { + if (err) callback(err, null); + else if (exec.hasException()) callback(new Error(exec.getException().getException()), null); + else callback(null, exec.getReceipt().getContractaddress_asU8()); + }) + } + + call(msg: CallTx, callback: (err: Error, exec: Uint8Array) => void) { + this.pipe.transact(msg, (err, exec) => { + if (err) callback(err, null); + else if (exec.hasException()) callback(new Error(exec.getException().getException()), null); + else this.interceptor(exec).then(exec => callback(null, exec.getResult().getReturn_asU8())); + }) + } + + callSim(msg: CallTx, callback: (err: Error, exec: Uint8Array) => void) { + this.pipe.call(msg, (err, exec) => { + if (err) callback(err, null); + else if (exec.hasException()) callback(new Error(exec.getException().getException()), null); + else this.interceptor(exec).then(exec => callback(null, exec.getResult().getReturn_asU8())); + }) + } + + listen(signature: string, address: string, callback: (err: Error, event: any) => void): Readable { + return this.events.subContractEvents(address, signature, callback) + } + + payload(data: string, address?: string): CallTx { + const input = new TxInput(); + input.setAddress(Buffer.from(this.account, 'hex')); + input.setAmount(0); + + const payload = new CallTx(); + payload.setInput(input); + if (address) payload.setAddress(Buffer.from(address, 'hex')); + payload.setGaslimit(1000000); + payload.setFee(0); + payload.setData(Buffer.from(data, 'hex')); + + return payload + } + + encode(name: string, inputs: string[], ...args: any[]): string { + args = convert.burrowToAbi(inputs, args); + return name + convert.bytesTB(coder.rawEncode(inputs, args)); + } + + decode(data: Uint8Array, outputs: string[]): any { + return convert.abiToBurrow(outputs, coder.rawDecode(outputs, Buffer.from(data))); + } +} \ No newline at end of file diff --git a/js/src/lib/contracts/contract.ts b/js/src/lib/contracts/contract.ts new file mode 100644 index 000000000..34a8a3ebd --- /dev/null +++ b/js/src/lib/contracts/contract.ts @@ -0,0 +1,100 @@ +import {SolidityEvent} from './event'; +import {SolidityFunction, Handler} from './function'; +import {Burrow} from '../burrow'; +import {Function, Event} from 'solc'; + + +export type FunctionOrEvent = Function | Event; + +export type ABI = Array + +export type Bytecode = { bytecode: string, deployedBytecode?: string } + + +export interface Handlers { + call?: Handler + deploy?: Handler +} + +const defaultHandlers: Handlers = { + call: function (result) { + return result.raw + }, + deploy: function (result) { + return result.contractAddress + } +} + +export class Contract { + abi: ABI; + address: string; + code: Bytecode; + burrow: Burrow; + handlers: Handlers; + + _constructor: any; + + constructor(abi: Array, code: string | Bytecode, address: string, burrow: Burrow, handlers?: Handlers) { + handlers = Object.assign({}, defaultHandlers, handlers); + + this.address = address; + this.abi = abi; + this.code = typeof (code) === 'string' ? {bytecode: code} : code; + this.burrow = burrow; + this.handlers = handlers; + addFunctionsToContract(this); + addEventsToContract(this); + } + +} + +const addFunctionsToContract = function (contract: Contract) { + (contract.abi.filter(json => { + return (json.type === 'function' || json.type === 'constructor'); + }) as Function[]).forEach(function (json) { + let {displayName, typeName, call, encode, decode} = SolidityFunction(json, contract.burrow); + + if (json.type === 'constructor') { + contract._constructor = call.bind(contract, false, contract.handlers.deploy, ''); + } else { + // bind the function call to the contract, specify if call or transact is desired + let execute = call.bind(contract, json.constant, contract.handlers.call, null); + execute.sim = call.bind(contract, true, contract.handlers.call, null); + // These allow the interface to be used for a generic contract of this type + execute.at = call.bind(contract, json.constant, contract.handlers.call); + execute.atSim = call.bind(contract, true, contract.handlers.call); + + execute.encode = encode.bind(contract); + execute.decode = decode.bind(contract); + + // Attach to the contract object + if (!contract[displayName]) { + contract[displayName] = execute; + } + contract[displayName][typeName] = execute; + } + }) + + // Not every abi has a constructor specification. + // If it doesn't we force a _constructor with null abi + if (!contract._constructor) { + const {call} = SolidityFunction(null, contract.burrow); + contract._constructor = call.bind(contract, false, contract.handlers.deploy, ''); + } +} + +const addEventsToContract = function (contract: Contract) { + (contract.abi.filter(json => { + return json.type === 'event' + }) as Event[]).forEach(json => { + const {displayName, typeName, call} = SolidityEvent(json, contract.burrow); + + const execute = call.bind(contract, null); + execute.once = call.bind(contract, null); + execute.at = call.bind(contract); + if (!contract[displayName]) { + contract[displayName] = execute; + } + contract[displayName][typeName] = call.bind(contract); + }) +} diff --git a/js/src/lib/contracts/event.ts b/js/src/lib/contracts/event.ts new file mode 100644 index 000000000..9e061aa50 --- /dev/null +++ b/js/src/lib/contracts/event.ts @@ -0,0 +1,62 @@ +import {ServiceError} from "@grpc/grpc-js"; +import * as utils from '../utils/utils'; +import * as coder from 'ethereumjs-abi'; +import * as convert from '../utils/convert'; +import sha3 from '../utils/sha3'; +import { Burrow, Error } from '../burrow'; +import { LogEvent } from '../../../proto/exec_pb' +import { Event, EventInput } from 'solc'; + +const types = (abi: Array, indexed: boolean) => + abi.filter(i => i.indexed === indexed).map(i => i.type); + +type EventResult = { + event?: string + address?: Uint8Array + args?: Record +} + +const decode = function (abi: Event, data: LogEvent): EventResult { + if (!data) return + + const argTopics = abi.anonymous ? data.getTopicsList_asU8() : data.getTopicsList_asU8().slice(1) + const indexedParamsABI = types(abi.inputs, true) + const nonIndexedParamsABI = types(abi.inputs, false) + const indexedData = Buffer.concat(argTopics) + const indexedParams = convert.abiToBurrow(indexedParamsABI, coder.rawDecode(indexedParamsABI, indexedData)) + const nonIndexedParams = convert.abiToBurrow(nonIndexedParamsABI, coder.rawDecode(nonIndexedParamsABI, Buffer.from(data.getData_asU8()))) + + return { + event: utils.transformToFullName(abi), + address: data.getAddress_asU8(), + args: abi.inputs.reduce(function (acc, current) { + acc[current.name] = current.indexed ? indexedParams.shift() : nonIndexedParams.shift() + return acc + }, {}), + }; +} + +export const SolidityEvent = function (abi: Event, burrow: Burrow) { + const name = utils.transformToFullName(abi); + const displayName = utils.extractDisplayName(name); + const typeName = utils.extractTypeName(name); + const signature = sha3(name); + + const call = function (address: string, callback: (err: Error, decoded: EventResult) => void) { + address = address || this.address; + if (!callback) throw new Error('Can not subscribe to an event without a callback.'); + + return burrow.pipe.eventSub(address, signature, (err, event) => { + if (err) callback(err, null); + let decoded: EventResult; + try { + decoded = decode(abi, event); + } catch (err) { + return callback(err, null); + } + callback(null, decoded); + }); + } + + return {displayName, typeName, call}; +} diff --git a/js/src/lib/contracts/function.ts b/js/src/lib/contracts/function.ts new file mode 100644 index 000000000..7e95a06da --- /dev/null +++ b/js/src/lib/contracts/function.ts @@ -0,0 +1,229 @@ +import { Metadata } from "@grpc/grpc-js"; +import { callErrorFromStatus } from "@grpc/grpc-js/build/src/call"; +import { Keccak } from "sha3"; +import * as utils from '../utils/utils'; +import * as coder from 'ethereumjs-abi'; +import * as convert from '../utils/convert'; +import * as grpc from '@grpc/grpc-js'; +import sha3 from '../utils/sha3'; +import { TxInput, CallTx, ContractMeta } from '../../../proto/payload_pb'; +import { TxExecution, Result } from '../../../proto/exec_pb'; +import { Burrow, Error } from '../burrow'; +import { Envelope } from '../../../proto/txs_pb'; +import { Function, FunctionInput, FunctionOutput } from 'solc'; +import { ABI, Contract } from "./contract"; + +type FunctionIO = FunctionInput & FunctionOutput; + +export const DEFAULT_GAS = 1111111111; + +type TransactionResult = { + contractAddress: string + height: number + index: number + hash: string + type: number + result: Result.AsObject + tx: Envelope.AsObject + caller: string | string[] +} & DecodedResult + +type DecodedResult = { + raw?: any[] + values?: Record +} + +export type Handler = (result: TransactionResult) => any + +function fnSignature(abi: Function) { + const name = utils.transformToFullName(abi) + return sha3(name).slice(0, 8) +} + +const types = (args: Array) => args.map(arg => arg.type); + +function txPayload(data: string, account: string, address: string, contract?: Contract): CallTx { + const input = new TxInput(); + input.setAddress(Buffer.from(account, 'hex')); + input.setAmount(0); + + const payload = new CallTx(); + payload.setInput(input); + if (address) payload.setAddress(Buffer.from(address, 'hex')); + payload.setGaslimit(DEFAULT_GAS); + payload.setFee(0); + const code = Buffer.from(data, 'hex'); + // if we are deploying and it looks like wasm, it must be wasm. Note that + // evm opcode 0 is stop, so this would not make any sense. + const wasm_magic = Buffer.from('\0asm'); + if (!address && !Buffer.compare(code.slice(0, 4), wasm_magic)) { + payload.setWasm(code); + } else { + payload.setData(code); + } + // If address is null then we are creating a new contract, if we have the deployedBytecode then send it with the ABI + if (!address && contract.code.deployedBytecode) { + const meta = new ContractMeta() + // TODO: document/formalise the expected structure of the contract metadata + meta.setMeta(JSON.stringify({ Abi: contract.abi })) + const codeHash = (new Keccak(256)).update(contract.code.deployedBytecode, "hex").digest() + meta.setCodehash(codeHash) + payload.setContractmetaList([meta]) + } + + return payload +} + +const encodeF = function (abi: Function, args: Array, bytecode: string): string { + let abiInputs: string[]; + if (abi) { + abiInputs = types(abi.inputs) + args = convert.burrowToAbi(abiInputs, args) // If abi is passed, convert values accordingly + } + + // If bytecode provided then this is a creation call, bytecode goes first + if (bytecode) { + let data = bytecode + if (abi) data += convert.bytesTB(coder.rawEncode(abiInputs, args)) + return data + } else { + return fnSignature(abi) + convert.bytesTB(coder.rawEncode(abiInputs, args)) + } +} + +const decodeF = function (abi: Function, output: Uint8Array): DecodedResult { + if (!output) return + + let outputs = abi.outputs; + let outputTypes = types(outputs); + + // Decode raw bytes to arguments + let raw = convert.abiToBurrow(outputTypes, coder.rawDecode(outputTypes, Buffer.from(output))); + let result: DecodedResult = { raw: raw.slice() } + + result.values = outputs.reduce(function (acc, current) { + let value = raw.shift(); + if (current.name) { + acc[current.name] = value; + } + return acc; + }, {}); + + return result; +} + +export const SolidityFunction = function (abi: Function, burrow: Burrow) { + let isConstructor = (abi == null || abi.type === 'constructor'); + let name: string; + let displayName: string; + let typeName: string; + if (!isConstructor) { + name = utils.transformToFullName(abi); + displayName = utils.extractDisplayName(name); + typeName = utils.extractTypeName(name); + } + + // It might seem weird to include copies of the functions in here and above + // My reason is the code above can be used "functionally" whereas this version + // Uses implicit attributes of this object. + // I want to keep them separate in the case that we want to move all the functional + // components together and maybe even... write tests for them (gasp!) + const encode = function () { + // Call should always be bound to a Contract + const contract: Contract = this; + let args = Array.prototype.slice.call(arguments) + return encodeF(abi, args, isConstructor ? contract.code.bytecode : null) + } + + const decode = function (data) { + // Call should always be bound to a Contract + const contract: Contract = this; + return decodeF(abi, data) + } + + const call = async function (isSim: boolean, handler: Handler, address: string, ...args: any[]) { + // Call should always be bound to a Contract + const contract: Contract = this; + + handler = handler || function (result) { + return result + }; + address = address || contract.address; + if (isConstructor) { + address = null + } + + + let P = new Promise(function (resolve, reject) { + if (address == null && !isConstructor) reject(new Error('Address not provided to call')) + if (abi != null && abi.inputs.length !== args.length) reject(new Error('Insufficient arguments passed to function: ' + (isConstructor ? 'constructor' : name))) + // Post process the return + let post = function (error: Error, result: TxExecution) { + if (error) return reject(error) + + // Handle execution reversions + if (result.hasException()) { + // Decode error message if there is one otherwise default + if (result.getResult().getReturn().length === 0) { + return reject(callErrorFromStatus({ + code: grpc.status.ABORTED, + metadata: new Metadata(), + details: 'Execution Reverted', + })) + } else { + // Strip first 4 bytes(function signature) the decode as a string + return reject(callErrorFromStatus({ + code: grpc.status.ABORTED, + metadata: new Metadata(), + details: coder.rawDecode(['string'], Buffer.from(result.getResult().getReturn_asU8().slice(4)))[0], + })) + } + } + + // Meta Data (address, caller, height, etc) + let returnObj: TransactionResult = { + contractAddress: Buffer.from(result.getReceipt().getContractaddress_asU8()).toString('hex').toUpperCase(), + height: result.getHeader().getHeight(), + index: result.getHeader().getIndex(), + hash: Buffer.from(result.getHeader().getTxhash_asU8()).toString('hex').toUpperCase(), + type: result.getHeader().getTxtype(), + result: result.getResult().toObject(), + tx: result.getEnvelope().toObject(), + caller: convert.recApply(convert.bytesTB, result.getEnvelope().getSignatoriesList().map(sig => sig.getAddress_asU8())), + } + + // Unpack return arguments + if (!isConstructor) { + try { + let { raw, values } = decodeF(abi, result.getResult().getReturn_asU8()); + returnObj.raw = raw; + returnObj.values = values; + } catch (e) { + return reject(e) + } + } + + return resolve(returnObj); + } + + // Decide if to make a "call" or a "transaction" + // For the moment we need to use the burrowtoweb3 function to prefix bytes with 0x + // otherwise the coder will give an error with bignumber not a number + // TODO investigate if other libs or an updated lib will fix this + // let data = encodeF(abi, utils.burrowToWeb3(args), isCon ? self.code : null) + let data = encodeF(abi, args, isConstructor ? contract.code.bytecode : null) + let payload = txPayload(data, burrow.account, address, contract) + + if (isSim) { + burrow.pipe.call(payload, post) + } else { + burrow.pipe.transact(payload, post) + } + }) + + const result = await P; + return handler(result); + } + + return { displayName, typeName, call, encode, decode } +} diff --git a/js/src/lib/contracts/manager.ts b/js/src/lib/contracts/manager.ts new file mode 100644 index 000000000..78fd73a8c --- /dev/null +++ b/js/src/lib/contracts/manager.ts @@ -0,0 +1,46 @@ +import {Event, Function} from 'solc'; +import {GetMetadataParam} from '../../../proto/rpcquery_pb'; +import {Burrow} from '../burrow'; +import {Contract, Handlers} from './contract'; + +type FunctionOrEvent = Function | Event; + +export class ContractManager { + burrow: Burrow; + + constructor(burrow: Burrow) { + this.burrow = burrow; + } + + async deploy(abi: Array, byteCode: string | { bytecode: string, deployedBytecode: string }, + handlers?: Handlers, ...args: any[]): Promise { + const contract = new Contract(abi, byteCode, null, this.burrow, handlers) + contract.address = await contract._constructor.apply(contract, args); + return contract; + } + + /** + * Looks up the ABI for a deployed contract from Burrow's contract metadata store. + * Contract metadata is only stored when provided by the contract deployer so is not guaranteed to exist. + * + * @method address + * @param {string} address + * @throws an error if no metadata found and contract could not be instantiated + * @returns {Contract} interface object + */ + fromAddress(address: string, handlers?: Handlers): Promise { + const msg = new GetMetadataParam(); + msg.setAddress(Buffer.from(address, 'hex')); + + return new Promise((resolve, reject) => + this.burrow.qc.getMetadata(msg, (err, res) => { + if (err) reject(err); + const metadata = res.getMetadata(); + if (!metadata) { + throw new Error(`could not find any metadata for account ${address}`) + } + const abi = JSON.parse(metadata).Abi; + resolve(new Contract(abi, null, address, this.burrow, handlers)); + })) + } +} diff --git a/js/src/lib/events.ts b/js/src/lib/events.ts new file mode 100644 index 000000000..ede13f553 --- /dev/null +++ b/js/src/lib/events.ts @@ -0,0 +1,44 @@ +import {IExecutionEventsClient} from '../../proto/rpcevents_grpc_pb'; +import {BlocksRequest, BlockRange, Bound, EventsResponse} from '../../proto/rpcevents_pb'; +import {LogEvent} from '../../proto/exec_pb'; +import {Error} from './burrow'; +import * as grpc from '@grpc/grpc-js'; + +export type EventStream = grpc.ClientReadableStream; + +export class Events { + + constructor(private burrow: IExecutionEventsClient) { + } + + listen(query: string, callback: (err: Error, log: LogEvent) => void): EventStream { + const start = new Bound(); + start.setType(3); + start.setIndex(0); + const end = new Bound(); + end.setType(4); + end.setIndex(0); + + const range = new BlockRange(); + range.setStart(start); + range.setEnd(end); + + const arg = new BlocksRequest(); + arg.setBlockrange(range); + arg.setQuery(query); + + let stream = this.burrow.events(arg); + stream.on('data', (data: EventsResponse) => { + data.getEventsList().map(event => { + callback(null, event.getLog()); + }); + }); + stream.on('error', (err: Error) => err.code === grpc.status.CANCELLED || callback(err, null)); + return stream; + } + + subContractEvents(address: string, signature: string, callback: (err: Error, log: LogEvent) => void) { + const filter = "EventType = 'LogEvent' AND Address = '" + address.toUpperCase() + "'" + " AND Log0 = '" + signature.toUpperCase() + "'"; + return this.listen(filter, callback); + } +} diff --git a/js/src/lib/namereg.ts b/js/src/lib/namereg.ts new file mode 100644 index 000000000..4bb92f543 --- /dev/null +++ b/js/src/lib/namereg.ts @@ -0,0 +1,47 @@ +import {IQueryClient} from '../../proto/rpcquery_grpc_pb'; +import {GetNameParam} from '../../proto/rpcquery_pb'; +import {Entry} from '../../proto/names_pb'; +import {ITransactClient} from '../../proto/rpctransact_grpc_pb'; +import {TxInput, NameTx} from '../../proto/payload_pb'; +import {TxExecution} from '../../proto/exec_pb'; +import * as grpc from '@grpc/grpc-js'; + +export class Namereg { + + constructor(private transact: ITransactClient, private query: IQueryClient, private account: string) { + } + + set(name: string, data: string, lease = 50000, fee = 5000): Promise { + const input = new TxInput(); + input.setAddress(Buffer.from(this.account, 'hex')); + input.setAmount(lease); + + const payload = new NameTx(); + payload.setInput(input); + payload.setName(name); + payload.setData(data); + payload.setFee(fee); + + return new Promise((resolve, reject) => { + this.transact.nameTxSync(payload, (err, txe) => { + if (err) { + reject(err) + } + resolve(txe) + }); + }) + } + + get(name: string): Promise { + const payload = new GetNameParam(); + payload.setName(name); + return new Promise((resolve, reject) => { + this.query.getName(payload, (err, entry) => { + if (err) { + reject(err) + } + resolve(entry) + }) + }) + } +} diff --git a/js/src/lib/pipe.ts b/js/src/lib/pipe.ts new file mode 100644 index 000000000..83a751fdf --- /dev/null +++ b/js/src/lib/pipe.ts @@ -0,0 +1,32 @@ +import {ServiceError} from "@grpc/grpc-js"; +import { ITransactClient } from '../../proto/rpctransact_grpc_pb'; +import { CallTx } from '../../proto/payload_pb'; +import { TxExecution } from '../../proto/exec_pb'; +import { Events } from './events'; +import { LogEvent } from '../../proto/exec_pb'; +import * as grpc from '@grpc/grpc-js'; + +export type TxCallback = grpc.requestCallback; + +export class Pipe { + burrow: ITransactClient; + events: Events; + + constructor(burrow: ITransactClient, events: Events) { + this.burrow = burrow; + this.events = events; + } + + transact(payload: CallTx, callback: TxCallback) { + return this.burrow.callTxSync(payload, callback) + } + + call(payload: CallTx, callback: TxCallback) { + this.burrow.callTxSim(payload, callback) + } + + eventSub(accountAddress: string, signature: string, callback: (err: ServiceError, log: LogEvent) => void) { + return this.events.subContractEvents(accountAddress, signature, callback) + } +} + diff --git a/js/src/lib/utils/convert.ts b/js/src/lib/utils/convert.ts new file mode 100644 index 000000000..767c5653b --- /dev/null +++ b/js/src/lib/utils/convert.ts @@ -0,0 +1,77 @@ +import BN from 'bn.js'; + +export const recApply = function (func: (input: A) => B, args: A | A[]): B | B[] { + if (Array.isArray(args)) { + let next: any = []; + for (let i = 0; i < args.length; i++) { + next.push(recApply(func, args[i])); + }; + return next; + } + return func(args); +} + +export const addressTB = function (arg: string) { + return arg.toUpperCase(); +} + +export const addressTA = function (arg: string) { + if (!/^0x/i.test(arg)) { + return '0x' + arg; + } + return arg; +} + +export const bytesTB = function (arg: Buffer) { + return arg.toString('hex').toUpperCase(); +} + +export const bytesTA = function (arg: string) { + if (typeof (arg) === 'string' && /^0x/i.test(arg)) { + arg = arg.slice(2); + } + return Buffer.from(arg, 'hex'); +} + +export const numberTB = function (arg: BN) { + let res: BN | number; + try { + // number is limited to 53 bits, BN will throw Error + res = arg.toNumber(); + } + catch { + // arg does not fit into number type, so keep it as BN + res = arg; + } + return res; +} + +export const abiToBurrow = function (puts: string[], args: Array) { + let out: any[] = []; + for (let i = 0; i < puts.length; i++) { + if (/address/i.test(puts[i])) { + out.push(recApply(addressTB, args[i])); + } else if (/bytes/i.test(puts[i])) { + out.push(recApply(bytesTB, args[i])); + } else if (/int/i.test(puts[i])) { + out.push(recApply(numberTB, args[i])); + } else { + out.push(args[i]); + } + } + return out +} + +export const burrowToAbi = function (puts: string[], args: Array) { + let out = []; + for (let i = 0; i < puts.length; i++) { + if (/address/i.test(puts[i])) { + out.push(recApply(addressTA, args[i])); + } else if (/bytes/i.test(puts[i])) { + out.push(recApply(bytesTA, args[i])); + } else { + out.push(args[i]); + } + }; + return out; +} \ No newline at end of file diff --git a/js/src/lib/utils/sha3.ts b/js/src/lib/utils/sha3.ts new file mode 100644 index 000000000..d6ba342ea --- /dev/null +++ b/js/src/lib/utils/sha3.ts @@ -0,0 +1,6 @@ +import { Keccak } from 'sha3'; + +export default function SHA3(str: string) { + const hash = (new Keccak(256)).update(str); + return hash.digest('hex').toUpperCase(); +} \ No newline at end of file diff --git a/js/src/lib/utils/utils.ts b/js/src/lib/utils/utils.ts new file mode 100644 index 000000000..e0d95c144 --- /dev/null +++ b/js/src/lib/utils/utils.ts @@ -0,0 +1,24 @@ +import { Function, FunctionInput, FunctionOutput, Event, EventInput } from 'solc'; + +type FunctionIO = FunctionInput & FunctionOutput; + +export function transformToFullName(abi: Function | Event): string { + if (abi.name.indexOf('(') !== -1) return abi.name; + const typeName = (abi.inputs as (EventInput | FunctionIO)[]).map(i => i.type).join(); + return abi.name + '(' + typeName + ')'; +} + +export function extractDisplayName(name: string): string { + let length = name.indexOf('(') + return length !== -1 ? name.substr(0, length) : name +} + +export function extractTypeName(name: string): string { + /// TODO: make it invulnerable + let length = name.indexOf('(') + return length !== -1 ? name.substr(length + 1, name.length - 1 - (length + 1)).replace(' ', '') : '' +} + +export function isFunction(object: object): boolean { + return typeof object === 'function' +} \ No newline at end of file diff --git a/js/src/test.ts b/js/src/test.ts new file mode 100644 index 000000000..fd137513e --- /dev/null +++ b/js/src/test.ts @@ -0,0 +1,21 @@ +import {Burrow} from './index'; +import * as solc from 'solc'; + +// convenience function to compile solidity in tests +export const compile = (source: string, name: string) => { + let desc: solc.InputDescription = {language: 'Solidity', sources: {}}; + desc.sources[name] = {content: source}; + desc.settings = {outputSelection: {'*': {'*': ['*']}}}; + + const json = solc.compile(JSON.stringify(desc)); + const compiled: solc.OutputDescription = JSON.parse(json); + if (compiled.errors) throw new Error(compiled.errors.map(err => err.formattedMessage).toString()); + const contract = compiled.contracts[name][name]; + return {abi: contract.abi, code: {bytecode: contract.evm.bytecode.object, deployedBytecode: contract.evm.deployedBytecode.object} }; +} + +const url = process.env.BURROW_URL || 'localhost:20997'; +const addr = process.env.SIGNING_ADDRESS || 'C9F239591C593CB8EE192B0009C6A0F2C9F8D768'; +console.log(`Connecting to Burrow at ${url}...`) +export const burrow = new Burrow(url, addr); + diff --git a/js/src/test/175.test.ts b/js/src/test/175.test.ts new file mode 100644 index 000000000..c2ed9314c --- /dev/null +++ b/js/src/test/175.test.ts @@ -0,0 +1,34 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('#175', function () {it('#175', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Contract { + string thename; + constructor(string memory newName) public { + thename = newName; + } + function getName() public view returns (string memory name) { + return thename; + } + } + ` + var contract + let A2 + + const {abi, code} = compile(source, 'Contract') + return burrow.contracts.deploy(abi, code, null, 'contract1').then((C) => { + contract = C + return contract._constructor('contract2') + }).then((address) => { + A2 = address + return Promise.all( + [contract.getName(), // Note using the default address from the deploy + contract.getName.at(A2)]) // Using the .at() to specify the second deployed contract + }).then(([result1, result2]) => { + assert.strictEqual(result1[0], 'contract1') + assert.strictEqual(result2[0], 'contract2') + }) + }) +}) diff --git a/js/src/test/44.test.ts b/js/src/test/44.test.ts new file mode 100644 index 000000000..b22fd9679 --- /dev/null +++ b/js/src/test/44.test.ts @@ -0,0 +1,27 @@ +import * as assert from 'assert'; +import {burrow, compile} from "../test"; + +describe('#44', function () { + it('#44', async () => { + const source = ` + pragma solidity >=0.0.0; + contract SimpleStorage { + address storedData; + + function set(address x) public { + storedData = x; + } + + function get() public view returns (address retVal) { + return storedData; + } + } + ` + const {abi, code} = compile(source, 'SimpleStorage'); + const contract: any = await burrow.contracts.deploy(abi, code); + await contract.set('88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F'); + + const data = await contract.get(); + assert.deepStrictEqual(data,[ '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F']); + }) +}) diff --git a/js/src/test/45.test.ts b/js/src/test/45.test.ts new file mode 100644 index 000000000..c06f274e4 --- /dev/null +++ b/js/src/test/45.test.ts @@ -0,0 +1,59 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('#45', function () { + + it('nottherealbatman', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Test { + string _name; + + function add(int a, int b) public pure returns (int sum) { + sum = a + b; + } + + function setName(string memory newname) public { + _name = newname; + } + + function getName() public view returns (string memory) { + return _name; + } + } + ` + const {abi, code} = compile(source, 'Test') + return burrow.contracts.deploy(abi, code).then((contract: any) => + contract.setName('Batman') + .then(() => contract.getName()) + ).then((value) => { + assert.deepStrictEqual(value, ['Batman']) + }) + }) + + it('rguikers', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Test { + + function getAddress() public view returns (address) { + return address(this); + } + + function getNumber() public pure returns (uint) { + return 100; + } + + } + ` + + const {abi, code} = compile(source, 'Test') + return burrow.contracts.deploy(abi, code).then((contract: any) => + Promise.all([contract.getAddress(), contract.getNumber()]) + .then(([address, number]) => { + assert.strictEqual(address[0].length, 40) + assert.strictEqual(number[0], 100) + }) + ) + }) +}) diff --git a/js/src/test/46.test.ts b/js/src/test/46.test.ts new file mode 100644 index 000000000..0154fdc84 --- /dev/null +++ b/js/src/test/46.test.ts @@ -0,0 +1,33 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('#46', function () {it('#46', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Test{ + + string _name; + + function setName(string memory newname) public { + _name = newname; + } + + function getNameConstant() public view returns (string memory) { + return _name; + } + + function getName() public view returns (string memory) { + return _name; + } + } + ` + + const {abi, code} = compile(source, 'Test') + return burrow.contracts.deploy(abi, code) + .then((contract: any) => contract.setName('Batman') + .then(() => Promise.all([contract.getNameConstant(), contract.getName()]))) + .then(([constant, nonConstant]) => { + assert.strictEqual(constant[0], nonConstant[0]) + }) + }) +}) diff --git a/js/src/test/47.test.ts b/js/src/test/47.test.ts new file mode 100644 index 000000000..cf38fbae9 --- /dev/null +++ b/js/src/test/47.test.ts @@ -0,0 +1,28 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('#47', function () {it('#47', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Test{ + string _withSpace = " Pieter"; + string _withoutSpace = "Pieter"; + + function getWithSpaceConstant() public view returns (string memory) { + return _withSpace; + } + + function getWithoutSpaceConstant () public view returns (string memory) { + return _withoutSpace; + } + } + ` + const {abi, code} = compile(source, 'Test') + return burrow.contracts.deploy(abi, code) + .then((contract: any) => Promise.all([contract.getWithSpaceConstant(), contract.getWithoutSpaceConstant()])) + .then(([withSpace, withoutSpace]) => { + assert.deepStrictEqual(withSpace, [' Pieter']) + assert.deepStrictEqual(withoutSpace, ['Pieter']) + }) + }) +}) diff --git a/js/src/test/48.test.ts b/js/src/test/48.test.ts new file mode 100644 index 000000000..06f974c25 --- /dev/null +++ b/js/src/test/48.test.ts @@ -0,0 +1,32 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('#48', function () {it('#48', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Test { + + function getAddress() public view returns (address) { + return address(this); + } + + function getNumber() public pure returns (uint) { + return 100; + } + + function getCombination() public view returns (uint _number, address _address) { + _number = 100; + _address = address(this); + } + + } + ` + const {abi, code} = compile(source, 'Test') + return burrow.contracts.deploy(abi, code) + .then((contract: any) => contract.getCombination()) + .then(([number, address]) => { + assert.strictEqual(number, 100) + assert.strictEqual(address.length, 40) + }) + }) +}) diff --git a/js/src/test/50.test.ts b/js/src/test/50.test.ts new file mode 100644 index 000000000..d7d692545 --- /dev/null +++ b/js/src/test/50.test.ts @@ -0,0 +1,27 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('#50', function () {it('#50', async () => { + const source = ` + pragma solidity >=0.0.0; + contract SimpleStorage { + uint storedData; + + function set(uint x) public { + storedData = x; + } + + function get() public view returns (uint retVal) { + return storedData; + } + } + ` + const {abi, code} = compile(source, 'SimpleStorage') + return burrow.contracts.deploy(abi, code) + .then((contract: any) => contract.set(42) + .then(() => contract.get.call()) + ).then((value) => { + assert.deepStrictEqual(value, [42]) + }) + }) +}) diff --git a/js/src/test/61.test.ts b/js/src/test/61.test.ts new file mode 100644 index 000000000..6cfa28c39 --- /dev/null +++ b/js/src/test/61.test.ts @@ -0,0 +1,26 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('#61', function () {it('#61', async () => { + const source = ` + pragma solidity >=0.0.0; + contract SimpleStorage { + address storedData; + + constructor(address x) public { + storedData = x; + } + + function get() public view returns (address retVal) { + return storedData; + } + } + ` + const {abi, code} = compile(source, 'SimpleStorage') + return burrow.contracts.deploy(abi, code, null, '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F') + .then((contract: any) => contract.get()) + .then((value) => { + assert.deepStrictEqual(value, ['88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F']) + }) + }) +}) diff --git a/js/test/README.md b/js/src/test/README.md similarity index 87% rename from js/test/README.md rename to js/src/test/README.md index c5a73b703..1dc989cd6 100644 --- a/js/test/README.md +++ b/js/src/test/README.md @@ -51,7 +51,7 @@ after(function () { it(`description of the test`, function () { // Compute results. - assert.equal(results, expectations) + assert.strictEqual(results, expectations) }) ``` @@ -67,12 +67,8 @@ const test = require('../../lib/test') const vector = test.Vector() describe('HTTP', function () { - before(vector.before(__dirname, {protocol: 'http:'})) - after(vector.after()) - - this.timeout(10 * 1000) - - it('sets and gets a value from a contract', vector.it(function (manager) { + before(vector.before(__dirname, {protocol: 'http:'}) + after(vector.after())it('sets and gets a value from a contract', vector.it(function (manager) { const source = ` contract SimpleStorage { uint storedData; @@ -87,7 +83,7 @@ describe('HTTP', function () { } ` - return test.compile(manager, source, 'SimpleStorage').then((contract) => + return compile(manager, source, 'SimpleStorage').then((contract) => Promise.fromCallback((callback) => contract.set(42, callback) ).then(() => @@ -96,9 +92,9 @@ describe('HTTP', function () { ) ) ).then((value) => { - assert.equal(value, 42) + assert.strictEqual(value, 42) }) - })) + }) }) ``` @@ -111,17 +107,17 @@ Tests written like this can then be used by the following commands: To test the library against pre-recorded vectors: ``` -npm test +yarn test ``` To test the library against Burrow while automatically recording vectors: ``` -TEST=record npm test +TEST=record yarn test ``` To test Burrow against pre-recorded vectors without exercising the client: ``` -TEST=server npm test +TEST=server yarn test ``` diff --git a/js/src/test/abis.test.ts b/js/src/test/abis.test.ts new file mode 100644 index 000000000..72d066df9 --- /dev/null +++ b/js/src/test/abis.test.ts @@ -0,0 +1,27 @@ +import * as assert from 'assert'; +import {burrow, compile} from "../test"; + +describe('Abi', function () { + + const source = ` +pragma solidity >=0.0.0; + +contract random { + function getRandomNumber() public pure returns (uint) { + return 55; + } +} + ` + // TODO: understand why abi storage isn't working + it('Call contract via burrow side Abi', async () => { + const {abi, code} = compile(source, 'random') + const contractIn: any = await burrow.contracts.deploy(abi, code) + await burrow.namereg.set('random', contractIn.address) + const entry = await burrow.namereg.get('random') + const address = entry.getData(); + console.log(address) + const contractOut: any = await burrow.contracts.fromAddress(address) + const number = await contractOut.getRandomNumber() + assert.strictEqual(number[0], 55) + }) +}) diff --git a/js/src/test/bn.test.ts b/js/src/test/bn.test.ts new file mode 100644 index 000000000..1eebe55d7 --- /dev/null +++ b/js/src/test/bn.test.ts @@ -0,0 +1,37 @@ +import * as assert from 'assert'; +import { burrow, compile } from '../test'; +import BN from 'bn.js'; + +describe('BN', function () { + it('BN', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Test { + function mul(int a, int b) public pure returns (int) { + return a * b; + } + + function getNumber() public pure returns (uint) { + return 1e19; + } + } + ` + const { abi, code } = compile(source, 'Test') + let contract: any = await burrow.contracts.deploy(abi, code); + + await contract.getNumber() + .then(([number]) => { + assert.strictEqual(new BN('10000000000000000000').cmp(number), 0) + }) + + await contract.mul(100, -300) + .then(([number]) => { + assert.strictEqual(number, -30000) + }) + + await contract.mul(new BN('18446744073709551616'), 102) + .then(([number]) => { + assert.strictEqual(new BN('1881567895518374264832').cmp(number), 0) + }) + }) +}) diff --git a/js/src/test/contract-event.test.ts b/js/src/test/contract-event.test.ts new file mode 100644 index 000000000..622d68f4a --- /dev/null +++ b/js/src/test/contract-event.test.ts @@ -0,0 +1,29 @@ +import {Contract} from '..'; +import {burrow, compile} from "../test"; + +describe('Nested contract event emission', function () { + + it('#38', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Contract { + event Event(); + + function announce() public { + emit Event(); + } + } + ` + const {abi, code} = compile(source, 'Contract') + const contract: any = await burrow.contracts.deploy(abi, code) + const secondContract: any = new Contract(abi, null, contract.address, burrow) + const stream = secondContract.Event.at(contract.address, function (error, event) { + if (error) { + throw error + } else { + stream.cancel() + } + secondContract.announce() + }) + }) +}) diff --git a/js/src/test/event-listen.test.ts b/js/src/test/event-listen.test.ts new file mode 100644 index 000000000..ba66713b5 --- /dev/null +++ b/js/src/test/event-listen.test.ts @@ -0,0 +1,75 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('Event listening', function () { + + it('listens to an event from a contract', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Contract { + event Pay( + address originator, + address beneficiary, + int amount, + string servicename, + string nickname, + string providername, + bytes32 randomBytes + ); + + function announce() public { + emit Pay( + 0x88977a37D05a4FE86d09E88c88a49C2fCF7d6d8F, + 0x721584fa4f1B9f51950018073A8E5ECF47f2d3b8, + 1, + "Energy", + "wasmachine", + "Eneco", + bytes32(uint256(0xDEADFEEDBEEFFACE)) + ); + } + } + ` + + const {abi, code} = compile(source, 'Contract') + const contract: any = await burrow.contracts.deploy(abi, code) + const promise = new Promise((resolve, reject) => { + const stream = contract.Pay((error, result) => { + if (error) { + reject(error); + } else { + const actual = Object.assign( + {}, + result.args, + {amount: Number(result.args.amount)} + ) + + assert.deepStrictEqual( + actual, + { + originator: '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F', + beneficiary: '721584FA4F1B9F51950018073A8E5ECF47F2D3B8', + amount: 1, + + servicename: 'Energy', + + nickname: 'wasmachine', + + providername: 'Eneco', + + randomBytes: '000000000000000000000000000000000000000000000000DEADFEEDBEEFFACE' + } + ) + + stream.cancel() + resolve() + } + }); + }) + + await contract.announce() + + return promise + }) +}); + diff --git a/js/src/test/event.test.ts b/js/src/test/event.test.ts new file mode 100644 index 000000000..df2ff5734 --- /dev/null +++ b/js/src/test/event.test.ts @@ -0,0 +1,39 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('event', function () { + it('listens to an event from a contract', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Contract { + event Event( + address from + ); + + function announce() public { + emit Event(msg.sender); + } + } + ` + const {abi, code} = compile(source, 'Contract') + const contract: any = await burrow.contracts.deploy(abi, code) + let count = 0; + + const stream = contract.Event((error, event) => { + if (error) { + throw(error) + } else { + assert.strictEqual(event.args.from.length, 40) + + count++ + + if (count === 2) { + stream.cancel() + } + } + }) + + contract.announce() + contract.announce() + }) +}) diff --git a/js/src/test/flipper.abi b/js/src/test/flipper.abi new file mode 100644 index 000000000..0f77bd51a --- /dev/null +++ b/js/src/test/flipper.abi @@ -0,0 +1 @@ +[{"type":"constructor","inputs":[{"name":"initvalue","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"flip","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"get","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"}] \ No newline at end of file diff --git a/js/src/test/flipper.sol b/js/src/test/flipper.sol new file mode 100644 index 000000000..4a3336e87 --- /dev/null +++ b/js/src/test/flipper.sol @@ -0,0 +1,20 @@ +contract flipper { + bool private value; + + /// Constructor that initializes the `bool` value to the given `init_value`. + constructor(bool initvalue) { + value = initvalue; + } + + /// A message that can be called on instantiated contracts. + /// This one flips the value of the stored `bool` from `true` + /// to `false` and vice versa. + function flip() public { + value = !value; + } + + /// Simply returns the current value of our `bool`. + function get() public view returns (bool) { + return value; + } +} diff --git a/js/src/test/flipper.test.ts b/js/src/test/flipper.test.ts new file mode 100644 index 000000000..cefd87bef --- /dev/null +++ b/js/src/test/flipper.test.ts @@ -0,0 +1,21 @@ +import * as assert from "assert"; +import { burrow } from "../test"; +import fs from 'fs'; + +describe('Wasm flipper:', function () { + let TestContract + + before(async () => { + const abi: any[] = JSON.parse(fs.readFileSync('src/test/flipper.abi', 'utf-8')) + const wasm: string = fs.readFileSync('src/test/flipper.wasm').toString('hex') + TestContract = await burrow.contracts.deploy(abi, wasm, null, true) + }) + + it('Flip', async () => { + let output = await TestContract.get() + assert.strictEqual(output[0], true) + await TestContract.flip() + output = await TestContract.get() + assert.strictEqual(output[0], false) + }) +}) diff --git a/js/src/test/flipper.wasm b/js/src/test/flipper.wasm new file mode 100644 index 000000000..029e7f31a Binary files /dev/null and b/js/src/test/flipper.wasm differ diff --git a/js/test/Functional/index.js b/js/src/test/functional.test.ts similarity index 66% rename from js/test/Functional/index.js rename to js/src/test/functional.test.ts index 12df9f52e..12167619f 100644 --- a/js/test/Functional/index.js +++ b/js/src/test/functional.test.ts @@ -1,19 +1,10 @@ -'use strict' +import * as assert from 'assert'; +import {burrow, compile} from '../test'; +import { Contract } from '..'; -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('Functional Contract Usage', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#Constructor usage', Test.it(function (burrow) { +describe('Functional Contract Usage', function () {it('#Constructor usage', async () => { const source = ` - pragma solidity ^0.4.21; + pragma solidity >=0.0.0; contract Test { address storedData; constructor(address x) public { @@ -21,37 +12,37 @@ describe('Functional Contract Usage', function () { } function getAddress() public view returns (address) { - return this; + return address(this); } function getNumber() public pure returns (uint) { return 100; } - function getCombination() public view returns (uint _number, address _address, string _saying, bytes32 _randomBytes, address _stored) { + function getCombination() public view returns (uint _number, address _address, string memory _saying, bytes32 _randomBytes, address _stored) { _number = 100; - _address = this; + _address = address(this); _saying = "hello moto"; - _randomBytes = 0xDEADBEEFFEEDFACE; + _randomBytes = bytes32(uint256(0xDEADBEEFFEEDFACE)); _stored = storedData; } } ` - const {abi, bytecode} = test.compile(source, ':Test') - const contract = burrow.contracts.new(abi, bytecode) + const {abi, code} = compile(source, 'Test') + const contract: any = new Contract(abi, code, null, burrow) let A1 let A2 - assert.equal(contract.address, null) + assert.strictEqual(contract.address, null) // Use the _contructor method to creat two contracts return Promise.all( [contract._constructor('88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F'), contract._constructor('ABCDEFABCDEFABCDEFABCDEFABCDEFABCDEF0123')]) .then(([address1, address2]) => { - assert.equal(contract.address, null) + assert.strictEqual(contract.address, null) A1 = address1 A2 = address2 @@ -65,5 +56,5 @@ describe('Functional Contract Usage', function () { assert.deepEqual(object1, expected1) assert.deepEqual(object2, expected2) }) - })) + }) }) diff --git a/js/src/test/get-set.test.ts b/js/src/test/get-set.test.ts new file mode 100644 index 000000000..439f4b2f9 --- /dev/null +++ b/js/src/test/get-set.test.ts @@ -0,0 +1,96 @@ +import * as assert from "assert"; +import {burrow, compile} from "../test"; + +describe('Setting and Getting Values:', function () { + const source = ` +pragma solidity >=0.0.0; + +contract GetSet { + + uint uintfield; + bytes32 bytesfield; + string stringfield; + bool boolfield; + + function testExist() public pure returns (uint output){ + return 1; + } + + function setUint(uint input) public { + uintfield = input; + return; + } + + function getUint() public view returns (uint output){ + output = uintfield; + return output; + } + + function setBytes(bytes32 input) public { + bytesfield = input; + return; + } + + function getBytes() public view returns (bytes32 output){ + output = bytesfield; + return output; + } + + function setString(string memory input) public { + stringfield = input; + return; + } + + function getString() public view returns (string memory output){ + output = stringfield; + return output; + } + + function setBool(bool input) public { + boolfield = input; + return; + } + + function getBool() public view returns (bool output){ + output = boolfield; + return output; + } +} +` + + const testUint = 42 + const testBytes = 'DEADBEEF00000000000000000000000000000000000000000000000000000000' + const testString = 'Hello World!' + const testBool = true + + let TestContract + + before(async () => { + const {abi, code} = compile(source, 'GetSet') + TestContract = await burrow.contracts.deploy(abi, code) + }) + + it('Uint', async () => { + await TestContract.setUint(testUint) + const output = await TestContract.getUint() + assert.strictEqual(output[0], testUint) + }) + + it('Bool', async () => { + await TestContract.setBool(testBool) + const output = await TestContract.getBool() + assert.strictEqual(output[0], testBool) + }) + + it('Bytes', async () => { + await TestContract.setBytes(testBytes) + const output = await TestContract.getBytes() + assert.strictEqual(output[0], testBytes) + }) + + it('String', async () => { + await TestContract.setString(testString) + const output = await TestContract.getString() + assert.strictEqual(output[0], testString) + }) +}) diff --git a/js/src/test/handler-overwriting.test.ts b/js/src/test/handler-overwriting.test.ts new file mode 100644 index 000000000..a608a3c78 --- /dev/null +++ b/js/src/test/handler-overwriting.test.ts @@ -0,0 +1,50 @@ +import * as assert from 'assert'; +import {burrow, compile} from "../test"; + + +describe('Testing Per-contract handler overwriting', function () { + // {handlers: {call: function (result) { return {super: result.values, man: result.raw} }}}) + + it('#17 Testing Per-contract handler overwriting', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Test { + + function getAddress() public view returns (address) { + return address(this); + } + + function getNumber() public pure returns (uint) { + return 100; + } + + function getCombination() public view returns (uint _number, address _address, string memory _saying, bytes32 _randomBytes) { + _number = 100; + _address = address(this); + _saying = "hello moto"; + _randomBytes = bytes32(uint256(0xDEADBEEFFEEDFACE)); + } + + } + ` + + const {abi, code} = compile(source, 'Test') + const contract: any = await burrow.contracts.deploy(abi, code, { + call: function (result_1) { + return {values: result_1.values, raw: result_1.raw}; + } + }); + let address = contract.address; + const returnObject = await contract.getCombination(); + const expected = { + values: { + _number: 100, + _address: address, + _saying: 'hello moto', + _randomBytes: '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE' + }, + raw: [100, address, 'hello moto', '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE'] + }; + assert.deepStrictEqual(returnObject, expected); + }) +}) diff --git a/js/src/test/infloop.test.ts b/js/src/test/infloop.test.ts new file mode 100644 index 000000000..a134b2f24 --- /dev/null +++ b/js/src/test/infloop.test.ts @@ -0,0 +1,42 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe.skip('Really Long Loop', function () { + let contract + this.timeout(1000000) + + before(async () => { + const source = ` + pragma solidity >=0.0.0; + contract main { + function test() public returns (string memory) { + c sub = new c(); + return sub.getString(); + } + } + contract c { + string s = "secret"; + uint n = 0; + function getString() public returns (string memory){ + for (uint i = 0; i < 10000000000000; i++) { + n += 1; + } + return s; + } + } + ` + + const {abi, code} = compile(source, 'main') + const c = await burrow.contracts.deploy(abi, code.bytecode); + contract = c; + }) + + it('It catches a revert when gas runs out', async () => { + return contract.test() + .then((str) => { + throw new Error('Did not catch revert error') + }).catch((err) => { + assert.strictEqual(err.message, 'ERR_EXECUTION_REVERT') + }) + }) +}) diff --git a/js/src/test/memory-bytes.test.ts b/js/src/test/memory-bytes.test.ts new file mode 100644 index 000000000..658fb55b1 --- /dev/null +++ b/js/src/test/memory-bytes.test.ts @@ -0,0 +1,52 @@ +import * as assert from 'assert'; +import {burrow, compile} from "../test"; + + +describe('issue #21', function () { + let contract: any; + + before(async () => { + const source = ` + pragma solidity >=0.0.0; + contract c { + function getBytes() public pure returns (byte[10] memory){ + byte[10] memory b; + string memory s = "hello"; + bytes memory sb = bytes(s); + + uint k = 0; + for (uint i = 0; i < sb.length; i++) b[k++] = sb[i]; + b[9] = 0xff; + return b; + } + + function deeper() public pure returns (byte[12][100] memory s, uint count) { + count = 42; + return (s, count); + } + } + ` + + const {abi, code} = compile(source, 'c') + return burrow.contracts.deploy(abi, code).then((c) => { + contract = c + }) + }) + + it('gets the static byte array decoded properly', async () => { + return contract.getBytes() + .then((bytes) => { + assert.deepStrictEqual( + bytes, + [['68', '65', '6C', '6C', '6F', '00', '00', '00', '00', 'FF']] + ) + }) + }) + + it('returns multiple values correctly from a function', function () { + return contract.deeper() + .then((values) => { + assert.strictEqual(Number(values[1]), 42) + }) + }) +}) diff --git a/js/src/test/namereg.test.ts b/js/src/test/namereg.test.ts new file mode 100644 index 000000000..8f75d9a96 --- /dev/null +++ b/js/src/test/namereg.test.ts @@ -0,0 +1,13 @@ +import * as assert from 'assert'; +import {burrow} from "../test"; + + +describe('Namereg', function () { + this.timeout(10 * 1000) + + it('Sets and gets a name correctly', async () => { + await burrow.namereg.set('DOUG', 'ABCDEF0123456789', 5000, 100) + const entry = await burrow.namereg.get('DOUG') + assert.strictEqual(entry.getData(), 'ABCDEF0123456789') + }); +}) diff --git a/js/src/test/return-types.test.ts b/js/src/test/return-types.test.ts new file mode 100644 index 000000000..0fdc7c4d3 --- /dev/null +++ b/js/src/test/return-types.test.ts @@ -0,0 +1,45 @@ +import * as assert from 'assert'; +import {burrow, compile} from "../test"; + +describe('Multiple return types', function () { + it('#42', async () => { + const source = ` + pragma solidity >=0.0.0; + contract Test { + + function getAddress() public view returns (address) { + return address(this); + } + + function getNumber() public pure returns (uint) { + return 100; + } + + function getCombination() public view returns (uint _number, address _address, string memory _saying, bytes32 _randomBytes) { + _number = 100; + _address = address(this); + _saying = "hello moto"; + _randomBytes = bytes32(uint256(0xDEADBEEFFEEDFACE)); + } + + } + ` + const {abi, code} = compile(source, 'Test') + const contract: any = await burrow.contracts.deploy(abi, code, { + call: function (result) { + return {values: result.values, raw: result.raw} + } + }) + const expected = { + values: { + _number: 100, + _address: contract.address, + _saying: 'hello moto', + _randomBytes: '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE' + }, + raw: [100, contract.address, 'hello moto', '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE'] + } + const result = await contract.getCombination(); + assert.deepStrictEqual(result, expected) + }) +}) diff --git a/js/src/test/revert.test.ts b/js/src/test/revert.test.ts new file mode 100644 index 000000000..c8a9e7412 --- /dev/null +++ b/js/src/test/revert.test.ts @@ -0,0 +1,45 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; +import * as grpc from '@grpc/grpc-js'; + +describe('REVERT constant', function () { + let contract: any; + + before(async () => { + const source = ` + pragma solidity >=0.0.0; + contract c { + string s = "secret"; + function getString(uint key) public view returns (string memory){ + if (key != 42){ + revert("Did not pass correct key"); + } else { + return s; + } + } + } + ` + + const {abi, code} = compile(source, 'c') + contract = await burrow.contracts.deploy(abi, code) + }) + + + it('gets the string when revert not called', async () => { + return contract.getString(42) + .then((str) => { + assert.deepStrictEqual(str, ['secret']) + }) + }) + + it('It catches a revert with the revert string', + async () => { + return contract.getString(1) + .then((str) => { + throw new Error('Did not catch revert error') + }).catch((err: grpc.ServiceError) => { + assert.strictEqual(err.code, grpc.status.ABORTED) + assert.strictEqual(err.message, '10 ABORTED: Did not pass correct key') + }) + }) +}) diff --git a/js/src/test/revert2.test.ts b/js/src/test/revert2.test.ts new file mode 100644 index 000000000..f5ba86a81 --- /dev/null +++ b/js/src/test/revert2.test.ts @@ -0,0 +1,48 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; +import * as grpc from '@grpc/grpc-js'; + +describe('REVERT non-constant', function () { + let contract: any; + + before(async () => { + const source = ` + pragma solidity >=0.0.0; + contract c { + string s = "secret"; + uint n = 0; + function getString(uint key) public returns (string memory){ + if (key != 42){ + revert("Did not pass correct key"); + } else { + n = n + 1; + return s; + } + } + } + ` + + const {abi, code} = compile(source, 'c') + return burrow.contracts.deploy(abi, code).then((c) => { + contract = c + }) + }) + + it('gets the string when revert not called', async () => { + return contract.getString(42) + .then((str) => { + assert.deepStrictEqual(str, ['secret']) + }) + }) + + it('It catches a revert with the revert string', + async () => { + return contract.getString(1) + .then((str) => { + throw new Error('Did not catch revert error') + }).catch((err: grpc.ServiceError) => { + assert.strictEqual(err.code, grpc.status.ABORTED) + assert.strictEqual(err.message, '10 ABORTED: Did not pass correct key') + }) + }) +}) diff --git a/js/src/test/revert3.test.ts b/js/src/test/revert3.test.ts new file mode 100644 index 000000000..1e5cc6752 --- /dev/null +++ b/js/src/test/revert3.test.ts @@ -0,0 +1,40 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; +import * as grpc from '@grpc/grpc-js'; + +describe('REVERT non-constant', function () { + let contract + + before(async () => { + const source = ` + pragma solidity >=0.0.0; + contract c { + string s = "secret"; + uint n = 0; + function getString(uint key) public returns (string memory){ + if (key != 42){ + revert(); + } else { + n = n + 1; + return s; + } + } + } + ` + + const {abi, code} = compile(source, 'c') + return burrow.contracts.deploy(abi, code).then((c) => { + contract = c + }) + }) + + it('It catches a revert with the revert string', + async () => { + return contract.getString(1) + .then((str) => { + throw new Error('Did not catch revert error') + }).catch((err: grpc.ServiceError) => { + assert.strictEqual(err.code, grpc.status.ABORTED) + }) + }) +}) diff --git a/js/src/test/simple-storage.test.ts b/js/src/test/simple-storage.test.ts new file mode 100644 index 000000000..4e9bc9705 --- /dev/null +++ b/js/src/test/simple-storage.test.ts @@ -0,0 +1,28 @@ +import * as assert from 'assert'; +import {burrow, compile} from '../test'; + +describe('Simple storage', function () { + it('sets and gets a value from a contract', async () => { + const source = ` + pragma solidity >=0.0.0; + contract SimpleStorage { + uint storedData; + + function set(uint x) public { + storedData = x; + } + + function get() view public returns (uint retVal) { + return storedData; + } + } + ` + const {abi, code} = compile(source, 'SimpleStorage') + return burrow.contracts.deploy(abi, code) + .then((contract: any) => contract.set(42) + .then(() => contract.get()) + ).then((value) => { + assert.deepStrictEqual(value, [42]) + }) + }) +}) diff --git a/js/test.sh b/js/test.sh new file mode 100755 index 000000000..4392a0c2b --- /dev/null +++ b/js/test.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +export this="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source "$this/../tests/test_runner.sh" + +test_setup +trap test_teardown EXIT + +cd $this +export SIGNING_ADDRESS="$key1_addr" +export BURROW_URL="$BURROW_HOST:$BURROW_GRPC_PORT" + +mocha --bail --exit -r ts-node/register "$1" +test_exit=$? diff --git a/js/test/#17/index.js b/js/test/#17/index.js deleted file mode 100644 index 1f4eeb34e..000000000 --- a/js/test/#17/index.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#17', function () { - before(Test.before({handlers: {call: function (result) { return {super: result.values, man: result.raw} }}})) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#17 Testing Per-contract handler overwriting', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Test { - - function getAddress() public view returns (address) { - return this; - } - - function getNumber() public pure returns (uint) { - return 100; - } - - function getCombination() public view returns (uint _number, address _address, string _saying, bytes32 _randomBytes) { - _number = 100; - _address = this; - _saying = "hello moto"; - _randomBytes = 0xDEADBEEFFEEDFACE; - } - - } - ` - let address - const {abi, bytecode} = test.compile(source, ':Test') - return burrow.contracts.deploy(abi, bytecode, {call: function (result) { return {values: result.values, raw: result.raw} }}).then((contract) => { - address = contract.address - return contract.getCombination() - }).then((returnObject) => { - const expected = { - values: { - _number: 100, - _address: address, - _saying: 'hello moto', - _randomBytes: '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE' - }, - raw: [100, address, 'hello moto', '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE'] - } - assert.deepEqual(returnObject, expected) - }) - })) -}) diff --git a/js/test/#175/index.js b/js/test/#175/index.js deleted file mode 100644 index 3265a9f22..000000000 --- a/js/test/#175/index.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict' - -const test = require('../../lib/test') -const assert = require('assert') - -const Test = test.Test() - -describe('#175', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#175', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Contract { - string thename; - constructor(string newName) public { - thename = newName; - } - function getName() public view returns (string name) { - return thename; - } - } - ` - var contract - let A2 - - const {abi, bytecode} = test.compile(source, ':Contract') - return burrow.contracts.deploy(abi, bytecode, 'contract1').then((C) => { - contract = C - return contract._constructor('contract2') - }).then((address) => { - A2 = address - return Promise.all( - [contract.getName(), // Note using the default address from the deploy - contract.getName.at(A2)]) // Using the .at() to specify the second deployed contract - }).then(([result1, result2]) => { - assert.equal(result1[0], 'contract1') - assert.equal(result2[0], 'contract2') - }) - })) -}) diff --git a/js/test/#21/index.js b/js/test/#21/index.js deleted file mode 100644 index 732a530ce..000000000 --- a/js/test/#21/index.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('issue #21', function () { - this.timeout(10 * 1000) - let contract - - before(Test.before(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract c { - function getBytes() public pure returns (byte[10]){ - byte[10] memory b; - string memory s = "hello"; - bytes memory sb = bytes(s); - - uint k = 0; - for (uint i = 0; i < sb.length; i++) b[k++] = sb[i]; - b[9] = 0xff; - return b; - } - - function deeper() public pure returns (byte[12][100] s, uint count) { - count = 42; - return (s, count); - } - } - ` - - const {abi, bytecode} = test.compile(source, ':c') - return burrow.contracts.deploy(abi, bytecode).then((c) => { - contract = c - }) - })) - - after(Test.after()) - - it('gets the static byte array decoded properly', Test.it(function () { - return contract.getBytes() - .then((bytes) => { - assert.deepEqual( - bytes, - [['68', '65', '6C', '6C', '6F', '00', '00', '00', '00', 'FF']] - ) - }) - })) - - it('returns multiple values correctly from a function', - Test.it(function () { - return contract.deeper() - .then((values) => { - assert.equal(Number(values[1]), 42) - }) - }) - ) -}) diff --git a/js/test/#38/index.js b/js/test/#38/index.js deleted file mode 100644 index d7ae1848c..000000000 --- a/js/test/#38/index.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict' - -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#38', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#38', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Contract { - event Event(); - - function emit() public { - emit Event(); - } - } - ` - const {abi, bytecode} = test.compile(source, ':Contract') - return burrow.contracts.deploy(abi, bytecode).then((contract) => { - const secondContract = burrow.contracts.new(abi, null, contract.address) - - return new Promise((resolve, reject) => { - secondContract.Event.once(function (error, event) { - if (error) { - reject(error) - } else { - resolve(event) - } - }) - - secondContract.emit() - }) - }) - })) -}) diff --git a/js/test/#42/index.js b/js/test/#42/index.js deleted file mode 100644 index a5f1a0759..000000000 --- a/js/test/#42/index.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#42', function () { - before(Test.before({handlers: {call: function (result) { return {values: result.values, raw: result.raw} }}})) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#42', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Test { - - function getAddress() public view returns (address) { - return this; - } - - function getNumber() public pure returns (uint) { - return 100; - } - - function getCombination() public view returns (uint _number, address _address, string _saying, bytes32 _randomBytes) { - _number = 100; - _address = this; - _saying = "hello moto"; - _randomBytes = 0xDEADBEEFFEEDFACE; - } - - } - ` - let address - const {abi, bytecode} = test.compile(source, ':Test') - return burrow.contracts.deploy(abi, bytecode).then((contract) => { - address = contract.address - return contract.getCombination() - }).then((returnObject) => { - const expected = { - values: { - _number: 100, - _address: address, - _saying: 'hello moto', - _randomBytes: '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE' - }, - raw: [100, address, 'hello moto', '000000000000000000000000000000000000000000000000DEADBEEFFEEDFACE'] - } - assert.deepEqual(returnObject, expected) - }) - })) -}) diff --git a/js/test/#44/index.js b/js/test/#44/index.js deleted file mode 100644 index 98a8cb2e0..000000000 --- a/js/test/#44/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#44', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(60 * 1000) - - it('#44', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract SimpleStorage { - address storedData; - - function set(address x) public { - storedData = x; - } - - function get() public constant returns (address retVal) { - return storedData; - } - } - ` - const {abi, bytecode} = test.compile(source, ':SimpleStorage') - return burrow.contracts.deploy(abi, bytecode).then((contract) => - contract.set('88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F') - .then(() => contract.get()) - ).then((value) => { - assert.equal(value, '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F') - }) - })) -}) diff --git a/js/test/#45/index.js b/js/test/#45/index.js deleted file mode 100644 index 0690b041c..000000000 --- a/js/test/#45/index.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#45', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('nottherealbatman', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Test { - string _name; - - function add(int a, int b) public pure returns (int sum) { - sum = a + b; - } - - function setName(string newname) public { - _name = newname; - } - - function getName() public view returns (string) { - return _name; - } - } - ` - const {abi, bytecode} = test.compile(source, ':Test') - return burrow.contracts.deploy(abi, bytecode).then((contract) => - contract.setName('Batman') - .then(() => contract.getName()) - ).then((value) => { - assert.equal(value, 'Batman') - }) - })) - - it('rguikers', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Test { - - function getAddress() public view returns (address) { - return this; - } - - function getNumber() public pure returns (uint) { - return 100; - } - - } - ` - - const {abi, bytecode} = test.compile(source, ':Test') - return burrow.contracts.deploy(abi, bytecode).then((contract) => - Promise.all([contract.getAddress(), contract.getNumber()]) - .then(([address, number]) => { - assert.equal(address[0].length, 40) - assert.equal(number[0], 100) - }) - ) - })) -}) diff --git a/js/test/#46/index.js b/js/test/#46/index.js deleted file mode 100644 index 1ccfa9ce5..000000000 --- a/js/test/#46/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#46', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#46', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Test{ - - string _name; - - function setName(string newname) public { - _name = newname; - } - - function getNameConstant() public view returns (string) { - return _name; - } - - function getName() public view returns (string) { - return _name; - } - } - ` - - const {abi, bytecode} = test.compile(source, ':Test') - return burrow.contracts.deploy(abi, bytecode) - .then((contract) => contract.setName('Batman') - .then(() => Promise.all([contract.getNameConstant(), contract.getName()]))) - .then(([constant, nonConstant]) => { - assert.equal(constant[0], nonConstant[0]) - }) - })) -}) diff --git a/js/test/#47/index.js b/js/test/#47/index.js deleted file mode 100644 index 2247de3ce..000000000 --- a/js/test/#47/index.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#47', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#47', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Test{ - string _withSpace = " Pieter"; - string _withoutSpace = "Pieter"; - - function getWithSpaceConstant() public constant returns (string) { - return _withSpace; - } - - function getWithoutSpaceConstant () public constant returns (string) { - return _withoutSpace; - } - } - ` - const {abi, bytecode} = test.compile(source, ':Test') - return burrow.contracts.deploy(abi, bytecode) - .then((contract) => Promise.all([contract.getWithSpaceConstant(), contract.getWithoutSpaceConstant()])) - .then(([withSpace, withoutSpace]) => { - assert.equal(withSpace, ' Pieter') - assert.equal(withoutSpace, 'Pieter') - }) - })) -}) diff --git a/js/test/#48/index.js b/js/test/#48/index.js deleted file mode 100644 index abd8741b2..000000000 --- a/js/test/#48/index.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#48', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#48', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Test { - - function getAddress() public view returns (address) { - return this; - } - - function getNumber() public pure returns (uint) { - return 100; - } - - function getCombination() public view returns (uint _number, address _address) { - _number = 100; - _address = this; - } - - } - ` - const {abi, bytecode} = test.compile(source, ':Test') - return burrow.contracts.deploy(abi, bytecode) - .then((contract) => contract.getCombination()) - .then(([number, address]) => { - assert.equal(number, 100) - assert.equal(address.length, 40) - }) - })) -}) diff --git a/js/test/#50/index.js b/js/test/#50/index.js deleted file mode 100644 index 7a137f61b..000000000 --- a/js/test/#50/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#50', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#50', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract SimpleStorage { - uint storedData; - - function set(uint x) public { - storedData = x; - } - - function get() public view returns (uint retVal) { - return storedData; - } - } - ` - const {abi, bytecode} = test.compile(source, ':SimpleStorage') - return burrow.contracts.deploy(abi, bytecode) - .then((contract) => contract.set(42) - .then(() => contract.get.call()) - ).then((value) => { - assert.equal(value, 42) - }) - })) -}) diff --git a/js/test/#61/index.js b/js/test/#61/index.js deleted file mode 100644 index 80a46315f..000000000 --- a/js/test/#61/index.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#61', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('#61', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract SimpleStorage { - address storedData; - - constructor(address x) public { - storedData = x; - } - - function get() public constant returns (address retVal) { - return storedData; - } - } - ` - const {abi, bytecode} = test.compile(source, ':SimpleStorage') - return burrow.contracts.deploy(abi, bytecode, '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F') - .then((contract) => contract.get()) - .then((value) => { - assert.equal(value, '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F') - }) - })) -}) diff --git a/js/test/#81/index.js b/js/test/#81/index.js deleted file mode 100644 index 26b16e626..000000000 --- a/js/test/#81/index.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('#81', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('listens to an event from a contract', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Contract { - event Pay( - address originator, - address beneficiary, - int amount, - string servicename, - string alias, - string providername, - bytes32 randomBytes - ); - - function emit() public { - emit Pay( - 0x88977a37D05a4FE86d09E88c88a49C2fCF7d6d8F, - 0x721584fa4f1B9f51950018073A8E5ECF47f2d3b8, - 1, - "Energy", - "wasmachine", - "Eneco", - 0xDEADFEEDBEEFFACE - ); - } - } - ` - - const {abi, bytecode} = test.compile(source, ':Contract') - return burrow.contracts.deploy(abi, bytecode) - .then((contract) => { - return new Promise((resolve, reject) => { - contract.Pay((error, {args}) => { - if (error) { - reject(error) - } else { - try { - const actual = Object.assign( - {}, - args, - {amount: Number(args.amount)} - ) - - assert.deepEqual( - actual, - { - originator: '88977A37D05A4FE86D09E88C88A49C2FCF7D6D8F', - beneficiary: '721584FA4F1B9F51950018073A8E5ECF47F2D3B8', - amount: 1, - - servicename: 'Energy', - - alias: 'wasmachine', - - providername: 'Eneco', - - randomBytes: '000000000000000000000000000000000000000000000000DEADFEEDBEEFFACE' - } - ) - } catch (exception) { - reject(exception) - } - - resolve() - } - }) - - contract.emit() - }) - }) - })) -}) diff --git a/js/test/Abis/index.js b/js/test/Abis/index.js deleted file mode 100644 index e76dca5ef..000000000 --- a/js/test/Abis/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('Abi', function () { - this.timeout(10 * 1000) - let burrow - - before(Test.before(function (_burrow) { - burrow = _burrow - })) - - after(Test.after()) - - it('Call contract via burrow side Abi', Test.it(function () { - return burrow.namereg.get('random') - .then((data) => { - let address = data.Data - return burrow.contracts.address(address) - }) - .then((contract) => { - return contract.getRandomNumber() - }) - .then((data) => { - assert.equal(data[0], 55) - }) - })) -}) diff --git a/js/test/HTTP/index.js b/js/test/HTTP/index.js deleted file mode 100644 index 719c71be5..000000000 --- a/js/test/HTTP/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('HTTP', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('sets and gets a value from a contract', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract SimpleStorage { - uint storedData; - - function set(uint x) public { - storedData = x; - } - - function get() constant public returns (uint retVal) { - return storedData; - } - } - ` - const {abi, bytecode} = test.compile(source, ':SimpleStorage') - return burrow.contracts.deploy(abi, bytecode) - .then((contract) => contract.set(42) - .then(() => contract.get()) - ).then((value) => { - assert.equal(value, 42) - }) - })) -}) diff --git a/js/test/Inf-Loop/index.js b/js/test/Inf-Loop/index.js deleted file mode 100644 index 450c60ae9..000000000 --- a/js/test/Inf-Loop/index.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe.skip('Really Long Loop', function () { - this.timeout(10 * 1000) - let contract - - before(Test.before(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract main { - function test() public returns (string) { - c sub = new c(); - return sub.getString(); - } - } - contract c { - string s = "secret"; - uint n = 0; - function getString() public returns (string){ - for (uint i = 0; i < 10000000000000; i++) { - n += 1; - } - return s; - } - } - ` - - const {abi, bytecode} = test.compile(source, ':main') - return burrow.contracts.deploy(abi, bytecode).then((c) => { - contract = c - }) - })) - - after(Test.after()) - - it('It catches a revert when gas runs out', - Test.it(function () { - return contract.test() - .then((str) => { - throw new Error('Did not catch revert error') - }).catch((err) => { - assert.equal(err.code, 'ERR_EXECUTION_REVERT') - }) - }) - ) -}) diff --git a/js/test/Namereg/index.js b/js/test/Namereg/index.js deleted file mode 100644 index 67f4b6337..000000000 --- a/js/test/Namereg/index.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('Namereg', function () { - this.timeout(10 * 1000) - let burrow - - before(Test.before(function (_burrow) { - burrow = _burrow - })) - - after(Test.after()) - - it('Sets and gets a name correctly', Test.it(function () { - return burrow.namereg.set('DOUG', 'ABCDEF0123456789', 20) - .then(() => { - return burrow.namereg.get('DOUG') - .then((data) => { - assert.equal(data.Data, 'ABCDEF0123456789') - }) - }) - })) -}) diff --git a/js/test/REVERT/index.js b/js/test/REVERT/index.js deleted file mode 100644 index 7b4c710fd..000000000 --- a/js/test/REVERT/index.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('REVERT constant', function () { - this.timeout(10 * 1000) - let contract - - before(Test.before(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract c { - string s = "secret"; - function getString(uint key) public constant returns (string){ - if (key != 42){ - revert("Did not pass correct key"); - } else { - return s; - } - } - } - ` - - const {abi, bytecode} = test.compile(source, ':c') - return burrow.contracts.deploy(abi, bytecode).then((c) => { - contract = c - }) - })) - - after(Test.after()) - - it('gets the string when revert not called', Test.it(function () { - return contract.getString(42) - .then((str) => { - assert.equal(str, 'secret') - }) - })) - - it('It catches a revert with the revert string', - Test.it(function () { - return contract.getString(1) - .then((str) => { - throw new Error('Did not catch revert error') - }).catch((err) => { - assert.equal(err.code, 'ERR_EXECUTION_REVERT') - assert.equal(err.message, 'Did not pass correct key') - }) - }) - ) -}) diff --git a/js/test/REVERT2/index.js b/js/test/REVERT2/index.js deleted file mode 100644 index d9578fafb..000000000 --- a/js/test/REVERT2/index.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('REVERT non-constant', function () { - this.timeout(10 * 1000) - let contract - - before(Test.before(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract c { - string s = "secret"; - uint n = 0; - function getString(uint key) public returns (string){ - if (key != 42){ - revert("Did not pass correct key"); - } else { - n = n + 1; - return s; - } - } - } - ` - - const {abi, bytecode} = test.compile(source, ':c') - return burrow.contracts.deploy(abi, bytecode).then((c) => { - contract = c - }) - })) - - after(Test.after()) - - it('gets the string when revert not called', Test.it(function () { - return contract.getString(42) - .then((str) => { - assert.equal(str, 'secret') - }) - })) - - it('It catches a revert with the revert string', - Test.it(function () { - return contract.getString(1) - .then((str) => { - throw new Error('Did not catch revert error') - }).catch((err) => { - assert.equal(err.code, 'ERR_EXECUTION_REVERT') - assert.equal(err.message, 'Did not pass correct key') - }) - }) - ) -}) diff --git a/js/test/REVERT3/index.js b/js/test/REVERT3/index.js deleted file mode 100644 index 764bc2311..000000000 --- a/js/test/REVERT3/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('REVERT non-constant', function () { - this.timeout(100 * 1000) - let contract - - before(Test.before(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract c { - string s = "secret"; - uint n = 0; - function getString(uint key) public returns (string){ - if (key != 42){ - revert(); - } else { - n = n + 1; - return s; - } - } - } - ` - - const {abi, bytecode} = test.compile(source, ':c') - return burrow.contracts.deploy(abi, bytecode).then((c) => { - contract = c - }) - })) - - after(Test.after()) - - it('It catches a revert with the revert string', - Test.it(function () { - return contract.getString(1) - .then((str) => { - throw new Error('Did not catch revert error') - }).catch((err) => { - assert.equal(err.code, 'ERR_EXECUTION_REVERT') - }) - }) - ) -}) diff --git a/js/test/event/index.js b/js/test/event/index.js deleted file mode 100644 index 7723dd663..000000000 --- a/js/test/event/index.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict' - -const assert = require('assert') -const test = require('../../lib/test') - -const Test = test.Test() - -describe('event', function () { - before(Test.before()) - after(Test.after()) - - this.timeout(10 * 1000) - - it('listens to an event from a contract', Test.it(function (burrow) { - const source = ` - pragma solidity ^0.4.21; - contract Contract { - event Event( - address from - ); - - function emit() public { - emit Event(msg.sender); - } - } - ` - const {abi, bytecode} = test.compile(source, ':Contract') - return burrow.contracts.deploy(abi, bytecode) - .then((contract) => { - let count = 0 - - return new Promise((resolve, reject) => { - contract.Event( - (error, event) => { - if (error) { - reject(error) - } else { - try { - assert.equal(event.args.from.length, 40) - } catch (exception) { - reject(exception) - } - - count++ - - if (count === 2) { - resolve() - } - } - }) - - contract.emit() - contract.emit() - }) - }) - })) -}) diff --git a/js/test/get_set_smoke_test/GetSet.sol b/js/test/get_set_smoke_test/GetSet.sol deleted file mode 100644 index a6d2e12d6..000000000 --- a/js/test/get_set_smoke_test/GetSet.sol +++ /dev/null @@ -1,54 +0,0 @@ -pragma solidity ^0.4.21; - -contract GetSet { - - uint uintfield; - bytes32 bytesfield; - string stringfield; - bool boolfield; - - function testExist() public pure returns (uint output){ - return 1; - } - - function setUint(uint input) public { - uintfield = input; - return; - } - - function getUint() public constant returns (uint output){ - output = uintfield; - return; - } - - function setBytes(bytes32 input) public { - bytesfield = input; - return; - } - - function getBytes() public constant returns (bytes32 output){ - output = bytesfield; - return; - } - - function setString(string input) public { - stringfield = input; - return; - } - - function getString() public constant returns (string output){ - output = stringfield; - return; - } - - function setBool(bool input) public { - boolfield = input; - return; - } - - function getBool() public constant returns (bool output){ - output = boolfield; - return; - } - -} \ No newline at end of file diff --git a/js/test/get_set_smoke_test/index.js b/js/test/get_set_smoke_test/index.js deleted file mode 100644 index 43f7da329..000000000 --- a/js/test/get_set_smoke_test/index.js +++ /dev/null @@ -1,92 +0,0 @@ -const path = require('path') -const assert = require('assert') -const fs = require('fs-extra') - -const test = require('../../lib/test') - -const Test = test.Test() - -const sourcePath = './GetSet.sol' - -const source = fs.readFileSync(path.join(__dirname, sourcePath)).toString() -const {abi, bytecode} = test.compile(source, ':GetSet') - -const testUint = 42 -const testBytes = 'DEADBEEF00000000000000000000000000000000000000000000000000000000' -const testString = 'Hello World!' -const testBool = true - -let TestContract - -// Create a factory for the contract with the JSON interface 'myAbi'. - -describe('Setting and Getting Values:', function () { - this.timeout(10 * 1000) - - before(Test.before((burrow) => { - return burrow.contracts.deploy(abi, bytecode).then((contract) => { - TestContract = contract - }) - })) - after(Test.after()) - - it('Uint', Test.it(function (burrow) { - return new Promise((resolve, reject) => { - TestContract.setUint(testUint, function (err) { - if (err) { reject(err) } - - TestContract.getUint(function (err, output) { - if (err) { reject(err) } - - assert.equal(output[0], testUint) - resolve() - }) - }) - }) - })) - - it('Bool', Test.it(function (burrow) { - return new Promise((resolve, reject) => { - TestContract.setBool(testBool, function (err) { - if (err) { reject(err) } - - TestContract.getBool(function (err, output) { - if (err) { reject(err) } - - assert.equal(output[0], testBool) - resolve() - }) - }) - }) - })) - - it('Bytes', Test.it(function (burrow) { - return new Promise((resolve, reject) => { - TestContract.setBytes(testBytes, function (err) { - if (err) { reject(err) } - - TestContract.getBytes(function (err, output) { - if (err) { reject(err) } - - assert.equal(output[0], testBytes) - resolve() - }) - }) - }) - })) - - it('String', Test.it(function (burrow) { - return new Promise((resolve, reject) => { - TestContract.setString(testString, function (err) { - if (err) { reject(err) } - - TestContract.getString(function (err, output) { - if (err) { reject(err) } - - assert.equal(output[0], testString) - resolve() - }) - }) - }) - })) -}) diff --git a/js/tsconfig.json b/js/tsconfig.json new file mode 100644 index 000000000..a62723570 --- /dev/null +++ b/js/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "preserveSymlinks": true, + "esModuleInterop": true, + "sourceMap": true, + "declaration": true, + "typeRoots": [ "./types", "./node_modules/@types"] + }, + "exclude": [ + "node_modules", + "dist", + "types", + "src/test/" + ] +} diff --git a/js/types/solc/index.d.ts b/js/types/solc/index.d.ts new file mode 100644 index 000000000..516d05c37 --- /dev/null +++ b/js/types/solc/index.d.ts @@ -0,0 +1,84 @@ +declare module 'solc' { + export type Function = { + type: 'function' | 'constructor' | 'fallback' + name: string + inputs: Array + outputs?: Array + stateMutability?: 'pure' | 'view' | 'nonpayable' | 'payable' + payable?: boolean + constant?: boolean + }; + + export type Event = { + type: 'event' + name: string + inputs: Array + anonymous: boolean + }; + + export type FunctionInput = { + name: string + type: string + components?: FunctionInput[] + internalType?: string + }; + + export type FunctionOutput = FunctionInput; + export type EventInput = FunctionInput & {indexed?: boolean}; + + type Bytecode = { + linkReferences: any + object: string + opcodes: string + sourceMap: string + } + + type Contract = { + assembly: any + evm: { + bytecode: Bytecode + deployedBytecode: Bytecode + } + functionHashes: any + gasEstimates: any + abi: (Function | Event)[] + opcodes: string + runtimeBytecode: string + srcmap: string + srcmapRuntime: string + } + + type Source = { + AST: any + } + + export type InputDescription = { + language: string + sources?: Record + settings?: { + outputSelection: Record>> + } + } + + type Error = { + sourceLocation?: { + file: string, + start: number, + end: number + } + type: string + component: string, + severity: "error" | "warning" + message: string + formattedMessage?: string + } + + export type OutputDescription = { + contracts: Record> + errors: Array + sourceList: Array + sources: Record + } + + export function compile(input: string): string; +} diff --git a/js/yarn.lock b/js/yarn.lock new file mode 100644 index 000000000..f9628c1bc --- /dev/null +++ b/js/yarn.lock @@ -0,0 +1,2886 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@grpc/grpc-js@^1.2.10": + version "1.2.10" + resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.2.10.tgz#f316d29a45fcc324e923d593cb849d292b1ed598" + integrity sha512-wj6GkNiorWYaPiIZ767xImmw7avMMVUweTvPFg4mJWOxz2180DKwfuxhJJZ7rpc1+7D3mX/v8vJdxTuIo71Ieg== + dependencies: + "@types/node" ">=12.12.47" + google-auth-library "^6.1.1" + semver "^6.2.0" + +"@types/bn.js@^4.11.3": + version "4.11.6" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" + integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== + dependencies: + "@types/node" "*" + +"@types/ethereumjs-abi@^0.6.3": + version "0.6.3" + resolved "https://registry.yarnpkg.com/@types/ethereumjs-abi/-/ethereumjs-abi-0.6.3.tgz#eb5ed09fd86b9e2b1c0eb75d1e9bc29c50715c86" + integrity sha512-DnHvqPkrJS5w4yZexTa5bdPNb8IyKPYciou0+zZCIg5fpzvGtyptTvshy0uZKzti2/k/markwjlxWRBWt7Mjuw== + dependencies: + "@types/node" "*" + +"@types/mocha@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.2.0.tgz#3eb56d13a1de1d347ecb1957c6860c911704bc44" + integrity sha512-/Sge3BymXo4lKc31C8OINJgXLaw+7vL1/L1pGiBNpGrBiT8FQiaFpSYV0uhTaG4y78vcMBTMFsWaHDvuD+xGzQ== + +"@types/node@*": + version "13.13.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.2.tgz#160d82623610db590a64e8ca81784e11117e5a54" + integrity sha512-LB2R1Oyhpg8gu4SON/mfforE525+Hi/M1ineICEDftqNVTyFg1aRIeGuTvXAoWHc4nbrFncWtJgMmoyRvuGh7A== + +"@types/node@>=12.12.47": + version "14.14.33" + resolved "https://registry.npmjs.org/@types/node/-/node-14.14.33.tgz#9e4f8c64345522e4e8ce77b334a8aaa64e2b6c78" + integrity sha512-oJqcTrgPUF29oUP8AsUqbXGJNuPutsetaa9kTQAQce5Lx5dTYWV02ScBiT/k1BX/Z7pKeqedmvp39Wu4zR7N7g== + +"@ungap/promise-all-settled@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" + integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +ansi-bgblack@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgblack/-/ansi-bgblack-0.1.1.tgz#a68ba5007887701b6aafbe3fa0dadfdfa8ee3ca2" + integrity sha1-poulAHiHcBtqr74/oNrf36juPKI= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgblue@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgblue/-/ansi-bgblue-0.1.1.tgz#67bdc04edc9b9b5278969da196dea3d75c8c3613" + integrity sha1-Z73ATtybm1J4lp2hlt6j11yMNhM= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgcyan@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgcyan/-/ansi-bgcyan-0.1.1.tgz#58489425600bde9f5507068dd969ebfdb50fe768" + integrity sha1-WEiUJWAL3p9VBwaN2Wnr/bUP52g= + dependencies: + ansi-wrap "0.1.0" + +ansi-bggreen@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bggreen/-/ansi-bggreen-0.1.1.tgz#4e3191248529943f4321e96bf131d1c13816af49" + integrity sha1-TjGRJIUplD9DIelr8THRwTgWr0k= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgmagenta@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgmagenta/-/ansi-bgmagenta-0.1.1.tgz#9b28432c076eaa999418672a3efbe19391c2c7a1" + integrity sha1-myhDLAduqpmUGGcqPvvhk5HCx6E= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgred@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgred/-/ansi-bgred-0.1.1.tgz#a76f92838382ba43290a6c1778424f984d6f1041" + integrity sha1-p2+Sg4OCukMpCmwXeEJPmE1vEEE= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgwhite@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgwhite/-/ansi-bgwhite-0.1.1.tgz#6504651377a58a6ececd0331994e480258e11ba8" + integrity sha1-ZQRlE3elim7OzQMxmU5IAljhG6g= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgyellow@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgyellow/-/ansi-bgyellow-0.1.1.tgz#c3fe2eb08cd476648029e6874d15a0b38f61d44f" + integrity sha1-w/4usIzUdmSAKeaHTRWgs49h1E8= + dependencies: + ansi-wrap "0.1.0" + +ansi-black@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-black/-/ansi-black-0.1.1.tgz#f6185e889360b2545a1ec50c0bf063fc43032453" + integrity sha1-9hheiJNgslRaHsUMC/Bj/EMDJFM= + dependencies: + ansi-wrap "0.1.0" + +ansi-blue@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-blue/-/ansi-blue-0.1.1.tgz#15b804990e92fc9ca8c5476ce8f699777c21edbf" + integrity sha1-FbgEmQ6S/JyoxUds6PaZd3wh7b8= + dependencies: + ansi-wrap "0.1.0" + +ansi-bold@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bold/-/ansi-bold-0.1.1.tgz#3e63950af5acc2ae2e670e6f67deb115d1a5f505" + integrity sha1-PmOVCvWswq4uZw5vZ96xFdGl9QU= + dependencies: + ansi-wrap "0.1.0" + +ansi-colors@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + +ansi-colors@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-0.2.0.tgz#72c31de2a0d9a2ccd0cac30cc9823eeb2f6434b5" + integrity sha1-csMd4qDZoszQysMMyYI+6y9kNLU= + dependencies: + ansi-bgblack "^0.1.1" + ansi-bgblue "^0.1.1" + ansi-bgcyan "^0.1.1" + ansi-bggreen "^0.1.1" + ansi-bgmagenta "^0.1.1" + ansi-bgred "^0.1.1" + ansi-bgwhite "^0.1.1" + ansi-bgyellow "^0.1.1" + ansi-black "^0.1.1" + ansi-blue "^0.1.1" + ansi-bold "^0.1.1" + ansi-cyan "^0.1.1" + ansi-dim "^0.1.1" + ansi-gray "^0.1.1" + ansi-green "^0.1.1" + ansi-grey "^0.1.1" + ansi-hidden "^0.1.1" + ansi-inverse "^0.1.1" + ansi-italic "^0.1.1" + ansi-magenta "^0.1.1" + ansi-red "^0.1.1" + ansi-reset "^0.1.1" + ansi-strikethrough "^0.1.1" + ansi-underline "^0.1.1" + ansi-white "^0.1.1" + ansi-yellow "^0.1.1" + lazy-cache "^2.0.1" + +ansi-cyan@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" + integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM= + dependencies: + ansi-wrap "0.1.0" + +ansi-dim@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-dim/-/ansi-dim-0.1.1.tgz#40de4c603aa8086d8e7a86b8ff998d5c36eefd6c" + integrity sha1-QN5MYDqoCG2Oeoa4/5mNXDbu/Ww= + dependencies: + ansi-wrap "0.1.0" + +ansi-gray@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" + integrity sha1-KWLPVOyXksSFEKPetSRDaGHvclE= + dependencies: + ansi-wrap "0.1.0" + +ansi-green@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-green/-/ansi-green-0.1.1.tgz#8a5d9a979e458d57c40e33580b37390b8e10d0f7" + integrity sha1-il2al55FjVfEDjNYCzc5C44Q0Pc= + dependencies: + ansi-wrap "0.1.0" + +ansi-grey@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-grey/-/ansi-grey-0.1.1.tgz#59d98b6ac2ba19f8a51798e9853fba78339a33c1" + integrity sha1-WdmLasK6GfilF5jphT+6eDOaM8E= + dependencies: + ansi-wrap "0.1.0" + +ansi-hidden@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-hidden/-/ansi-hidden-0.1.1.tgz#ed6a4c498d2bb7cbb289dbf2a8d1dcc8567fae0f" + integrity sha1-7WpMSY0rt8uyidvyqNHcyFZ/rg8= + dependencies: + ansi-wrap "0.1.0" + +ansi-inverse@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-inverse/-/ansi-inverse-0.1.1.tgz#b6af45826fe826bfb528a6c79885794355ccd269" + integrity sha1-tq9Fgm/oJr+1KKbHmIV5Q1XM0mk= + dependencies: + ansi-wrap "0.1.0" + +ansi-italic@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-italic/-/ansi-italic-0.1.1.tgz#104743463f625c142a036739cf85eda688986f23" + integrity sha1-EEdDRj9iXBQqA2c5z4XtpoiYbyM= + dependencies: + ansi-wrap "0.1.0" + +ansi-magenta@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-magenta/-/ansi-magenta-0.1.1.tgz#063b5ba16fb3f23e1cfda2b07c0a89de11e430ae" + integrity sha1-BjtboW+z8j4c/aKwfAqJ3hHkMK4= + dependencies: + ansi-wrap "0.1.0" + +ansi-red@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" + integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw= + dependencies: + ansi-wrap "0.1.0" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-reset@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-reset/-/ansi-reset-0.1.1.tgz#e7e71292c3c7ddcd4d62ef4a6c7c05980911c3b7" + integrity sha1-5+cSksPH3c1NYu9KbHwFmAkRw7c= + dependencies: + ansi-wrap "0.1.0" + +ansi-strikethrough@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-strikethrough/-/ansi-strikethrough-0.1.1.tgz#d84877140b2cff07d1c93ebce69904f68885e568" + integrity sha1-2Eh3FAss/wfRyT685pkE9oiF5Wg= + dependencies: + ansi-wrap "0.1.0" + +ansi-styles@^3.2.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-underline@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-underline/-/ansi-underline-0.1.1.tgz#dfc920f4c97b5977ea162df8ffb988308aaa71a4" + integrity sha1-38kg9Ml7WXfqFi34/7mIMIqqcaQ= + dependencies: + ansi-wrap "0.1.0" + +ansi-white@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-white/-/ansi-white-0.1.1.tgz#9c77b7c193c5ee992e6011d36ec4c921b4578944" + integrity sha1-nHe3wZPF7pkuYBHTbsTJIbRXiUQ= + dependencies: + ansi-wrap "0.1.0" + +ansi-wrap@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" + integrity sha1-qCJQ3bABXponyoLoLqYDu/pF768= + +ansi-yellow@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-yellow/-/ansi-yellow-0.1.1.tgz#cb9356f2f46c732f0e3199e6102955a77da83c1d" + integrity sha1-y5NW8vRscy8OMZnmEClVp32oPB0= + dependencies: + ansi-wrap "0.1.0" + +anymatch@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" + integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +argparse@^1.0.10, argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-sort@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/array-sort/-/array-sort-0.1.4.tgz#662855eaeb671b4188df4451b2f24a0753992b23" + integrity sha512-BNcM+RXxndPxiZ2rd76k6nyQLRZr2/B/sdi8pQ+Joafr5AH279L40dfokSUTp8O+AaqYjXWhblBWa2st2nc4fQ== + dependencies: + default-compare "^1.0.0" + get-value "^2.0.6" + kind-of "^5.0.2" + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +arrify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +atob@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +autolinker@~0.28.0: + version "0.28.1" + resolved "https://registry.yarnpkg.com/autolinker/-/autolinker-0.28.1.tgz#0652b491881879f0775dace0cdca3233942a4e47" + integrity sha1-BlK0kYgYefB3XazgzcoyM5QqTkc= + dependencies: + gulp-header "^1.7.1" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base64-js@^1.0.2: + version "1.3.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" + integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== + +base64-js@^1.3.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +bignumber.js@^9.0.0: + version "9.0.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5" + integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA== + +binary-extensions@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" + integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== + +bindings@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +bip66@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/bip66/-/bip66-1.1.5.tgz#01fa8748785ca70955d5011217d1b3139969ca22" + integrity sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI= + dependencies: + safe-buffer "^5.0.1" + +bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.8, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +bn.js@^5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b" + integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +browserify-aes@^1.0.6: + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + dependencies: + buffer-xor "^1.0.3" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.3" + inherits "^2.0.1" + safe-buffer "^5.0.1" + +buffer-equal-constant-time@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +buffer-xor@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= + +buffer@5.6.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786" + integrity sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw== + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" + integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== + +chalk@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chokidar@3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" + integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.5.0" + optionalDependencies: + fsevents "~2.1.2" + +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + +cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +command-exists@^1.2.8: + version "1.2.9" + resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" + integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== + +commander@3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" + integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== + +commander@~2.20.3: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +concat-with-sourcemaps@*: + version "1.1.0" + resolved "https://registry.yarnpkg.com/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz#d4ea93f05ae25790951b99e7b3b09e3908a4082e" + integrity sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg== + dependencies: + source-map "^0.6.1" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +create-frame@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/create-frame/-/create-frame-1.0.0.tgz#8b95f2691e3249b6080443e33d0bad9f8f6975aa" + integrity sha1-i5XyaR4ySbYIBEPjPQutn49pdao= + dependencies: + define-property "^0.2.5" + extend-shallow "^2.0.1" + isobject "^3.0.0" + lazy-cache "^2.0.2" + +create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@^1.1.4: + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +date.js@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/date.js/-/date.js-0.3.3.tgz#ef1e92332f507a638795dbb985e951882e50bbda" + integrity sha512-HgigOS3h3k6HnW011nAb43c5xx5rBXk8P2v/WIT9Zv4koIaVXiH2BURguI78VVp+5Qc076T7OR378JViCnZtBw== + dependencies: + debug "~3.1.0" + +debug@4: + version "4.3.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== + dependencies: + ms "2.1.2" + +debug@4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.2.0.tgz#7f150f93920e94c58f5574c2fd01a3110effe7f1" + integrity sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg== + dependencies: + ms "2.1.2" + +debug@^2.2.0, debug@^2.3.3: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +debug@~3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +default-compare@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-compare/-/default-compare-1.0.0.tgz#cb61131844ad84d84788fb68fd01681ca7781a2f" + integrity sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ== + dependencies: + kind-of "^5.0.2" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +diff@4.0.2, diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +drbg.js@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b" + integrity sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs= + dependencies: + browserify-aes "^1.0.6" + create-hash "^1.1.2" + create-hmac "^1.1.4" + +ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + +elliptic@^6.5.2: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +ent@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.0.tgz#e964219325a21d05f44466a2f686ed6ce5f5dd1d" + integrity sha1-6WQhkyWiHQX0RGai9obtbOX13R0= + +error-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/error-symbol/-/error-symbol-0.1.0.tgz#0a4dae37d600d15a29ba453d8ef920f1844333f6" + integrity sha1-Ck2uN9YA0VopukU9jvkg8YRDM/Y= + +escape-string-regexp@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +ethereumjs-abi@^0.6.8: + version "0.6.8" + resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz#71bc152db099f70e62f108b7cdfca1b362c6fcae" + integrity sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA== + dependencies: + bn.js "^4.11.8" + ethereumjs-util "^6.0.0" + +ethereumjs-util@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.2.0.tgz#23ec79b2488a7d041242f01e25f24e5ad0357960" + integrity sha512-vb0XN9J2QGdZGIEKG2vXM+kUdEivUfU6Wmi5y0cg+LRhDYKnXIZ/Lz7XjFbHRR9VIKq2lVGLzGBkA++y2nOdOQ== + dependencies: + "@types/bn.js" "^4.11.3" + bn.js "^4.11.0" + create-hash "^1.1.2" + ethjs-util "0.1.6" + keccak "^2.0.0" + rlp "^2.2.3" + secp256k1 "^3.0.1" + +ethjs-util@0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" + integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== + dependencies: + is-hex-prefixed "1.0.0" + strip-hex-prefix "1.0.0" + +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +evp_bytestokey@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== + dependencies: + md5.js "^1.3.4" + safe-buffer "^5.1.1" + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +extend@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +"falsey@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/falsey/-/falsey-0.3.2.tgz#b21c90c5c34660fc192bf909575db95b6880d597" + integrity sha512-lxEuefF5MBIVDmE6XeqCdM4BWk1+vYmGZtkbKZ/VFcg6uBBw6fXNEbWmxCjDdQlFc9hy450nkiWwM3VAW6G1qg== + dependencies: + kind-of "^5.0.2" + +fast-text-encoding@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz#ec02ac8e01ab8a319af182dae2681213cfe9ce53" + integrity sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig== + +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-up@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + +for-in@^1.0.1, for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-1.0.0.tgz#c63332f415cedc4b04dbfe70cf836494c53cb44b" + integrity sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs= + dependencies: + for-in "^1.0.1" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + dependencies: + map-cache "^0.2.2" + +fs-exists-sync@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add" + integrity sha1-mC1ok6+RjnLQjeyehnP/K1qNat0= + +fs-extra@^0.30.0: + version "0.30.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0" + integrity sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A= + dependencies: + graceful-fs "^4.1.2" + jsonfile "^2.1.0" + klaw "^1.0.0" + path-is-absolute "^1.0.0" + rimraf "^2.2.8" + +fs-minipass@^1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== + dependencies: + minipass "^2.6.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@~2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" + integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +gaxios@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-4.1.0.tgz#e8ad466db5a4383c70b9d63bfd14dfaa87eb0099" + integrity sha512-vb0to8xzGnA2qcgywAjtshOKKVDf2eQhJoiL6fHhgW5tVN7wNk7egnYIO9zotfn3lQ3De1VPdf7V5/BWfCtCmg== + dependencies: + abort-controller "^3.0.0" + extend "^3.0.2" + https-proxy-agent "^5.0.0" + is-stream "^2.0.0" + node-fetch "^2.3.0" + +gcp-metadata@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-4.2.1.tgz#31849fbcf9025ef34c2297c32a89a1e7e9f2cd62" + integrity sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw== + dependencies: + gaxios "^4.0.0" + json-bigint "^1.0.0" + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-object@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/get-object/-/get-object-0.2.0.tgz#d92ff7d5190c64530cda0543dac63a3d47fe8c0c" + integrity sha1-2S/31RkMZFMM2gVD2sY6PUf+jAw= + dependencies: + is-number "^2.0.2" + isobject "^0.2.0" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + +glob-parent@~5.1.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" + integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== + dependencies: + is-glob "^4.0.1" + +glob@7.1.6, glob@^7.1.3: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +google-auth-library@^6.1.1: + version "6.1.4" + resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-6.1.4.tgz#bc70c4f3b6681ae5273343466bcef37577b7ee44" + integrity sha512-q0kYtGWnDd9XquwiQGAZeI2Jnglk7NDi0cChE4tWp6Kpo/kbqnt9scJb0HP+/xqt03Beqw/xQah1OPrci+pOxw== + dependencies: + arrify "^2.0.0" + base64-js "^1.3.0" + ecdsa-sig-formatter "^1.0.11" + fast-text-encoding "^1.0.0" + gaxios "^4.0.0" + gcp-metadata "^4.2.0" + gtoken "^5.0.4" + jws "^4.0.0" + lru-cache "^6.0.0" + +google-p12-pem@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-3.0.3.tgz#673ac3a75d3903a87f05878f3c75e06fc151669e" + integrity sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA== + dependencies: + node-forge "^0.10.0" + +google-protobuf@3.12.4: + version "3.12.4" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.12.4.tgz#fd89b7e5052cdb35a80f9b455612851d542a5c9f" + integrity sha512-ItTn8YepDQMHEMHloUPH+FDaTPiHTnbsMvP50aXfbI65IK3AA5+wXlHSygJH8xz+h1g4gu7V+CK5X1/SaGITsA== + +google-protobuf@^3.14.0: + version "3.14.0" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.14.0.tgz#20373d22046e63831a5110e11a84f713cc43651e" + integrity sha512-bwa8dBuMpOxg7COyqkW6muQuvNnWgVN8TX/epDRGW5m0jcrmq2QJyCyiV8ZE2/6LaIIqJtiv9bYokFhfpy/o6w== + +graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + +grpc-tools@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/grpc-tools/-/grpc-tools-1.10.0.tgz#687c0599715fc8c02e93496f8f37f89bc9840ef7" + integrity sha512-tEbO16TuXV+aJPTMK4FCd4Jw6uzR/wm4h3u27MmZQlWLETp3bL/6KQdVM6xujNx8N1Mbj0/Be2f/0SedzGm0dQ== + dependencies: + node-pre-gyp "^0.15.0" + +grpc_tools_node_protoc_ts@^5.1.3: + version "5.1.3" + resolved "https://registry.npmjs.org/grpc_tools_node_protoc_ts/-/grpc_tools_node_protoc_ts-5.1.3.tgz#c24d6470b6f0204a7ec920cee0f057fcb11eea66" + integrity sha512-BiElSWEmRgrhWFV/+yFtRiqxC3D/nrk1g0GezJ/9ZrJxUvu/0sBVeqe4rTmkFFqQVZTRX1+MNOVeOJKDmQ41Xg== + dependencies: + google-protobuf "3.12.4" + handlebars "4.7.6" + handlebars-helpers "0.10.0" + +gtoken@^5.0.4: + version "5.2.0" + resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-5.2.0.tgz#7f1e029f9472bb8899d6911c03c66f7ad985c849" + integrity sha512-qbf6JWEYFMj3WMAluvYXl8GAiji6w8d9OmAGCbBg0xF4xD/yu6ZaO6BhoXNddRjKcOUpZD81iea1H5B45gAo1g== + dependencies: + gaxios "^4.0.0" + google-p12-pem "^3.0.3" + jws "^4.0.0" + mime "^2.2.0" + +gulp-header@^1.7.1: + version "1.8.12" + resolved "https://registry.yarnpkg.com/gulp-header/-/gulp-header-1.8.12.tgz#ad306be0066599127281c4f8786660e705080a84" + integrity sha512-lh9HLdb53sC7XIZOYzTXM4lFuXElv3EVkSDhsd7DoJBj7hm+Ni7D3qYbb+Rr8DuM8nRanBvkVO9d7askreXGnQ== + dependencies: + concat-with-sourcemaps "*" + lodash.template "^4.4.0" + through2 "^2.0.0" + +handlebars-helper-create-frame@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/handlebars-helper-create-frame/-/handlebars-helper-create-frame-0.1.0.tgz#8aa51d10aeb6408fcc6605d40d77356288487a03" + integrity sha1-iqUdEK62QI/MZgXUDXc1YohIegM= + dependencies: + create-frame "^1.0.0" + isobject "^3.0.0" + +handlebars-helpers@0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/handlebars-helpers/-/handlebars-helpers-0.10.0.tgz#663d49e718928eafbead1473419ed7bc24bcd45a" + integrity sha512-QiyhQz58u/DbuV41VnfpE0nhy6YCH4vB514ajysV8SoKmP+DxU+pR+fahVyNECHj+jiwEN2VrvxD/34/yHaLUg== + dependencies: + arr-flatten "^1.1.0" + array-sort "^0.1.4" + create-frame "^1.0.0" + define-property "^1.0.0" + "falsey" "^0.3.2" + for-in "^1.0.2" + for-own "^1.0.0" + get-object "^0.2.0" + get-value "^2.0.6" + handlebars "^4.0.11" + handlebars-helper-create-frame "^0.1.0" + handlebars-utils "^1.0.6" + has-value "^1.0.0" + helper-date "^1.0.1" + helper-markdown "^1.0.0" + helper-md "^0.2.2" + html-tag "^2.0.0" + is-even "^1.0.0" + is-glob "^4.0.0" + is-number "^4.0.0" + kind-of "^6.0.0" + lazy-cache "^2.0.2" + logging-helpers "^1.0.0" + micromatch "^3.1.4" + relative "^3.0.2" + striptags "^3.1.0" + to-gfm-code-block "^0.1.1" + year "^0.2.1" + +handlebars-utils@^1.0.2, handlebars-utils@^1.0.4, handlebars-utils@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/handlebars-utils/-/handlebars-utils-1.0.6.tgz#cb9db43362479054782d86ffe10f47abc76357f9" + integrity sha512-d5mmoQXdeEqSKMtQQZ9WkiUcO1E3tPbWxluCK9hVgIDPzQa9WsKo3Lbe/sGflTe7TomHEeZaOgwIkyIr1kfzkw== + dependencies: + kind-of "^6.0.0" + typeof-article "^0.1.1" + +handlebars@4.7.6, handlebars@^4.0.11: + version "4.7.6" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.6.tgz#d4c05c1baf90e9945f77aa68a7a219aa4a7df74e" + integrity sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA== + dependencies: + minimist "^1.2.5" + neo-async "^2.6.0" + source-map "^0.6.1" + wordwrap "^1.0.0" + optionalDependencies: + uglify-js "^3.1.4" + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +hash-base@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" + integrity sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +hash.js@^1.0.0, hash.js@^1.0.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +he@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +helper-date@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/helper-date/-/helper-date-1.0.1.tgz#12fedea3ad8e44a7ca4c4efb0ff4104a5120cffb" + integrity sha512-wU3VOwwTJvGr/w5rZr3cprPHO+hIhlblTJHD6aFBrKLuNbf4lAmkawd2iK3c6NbJEvY7HAmDpqjOFSI5/+Ey2w== + dependencies: + date.js "^0.3.1" + handlebars-utils "^1.0.4" + moment "^2.18.1" + +helper-markdown@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/helper-markdown/-/helper-markdown-1.0.0.tgz#ee7e9fc554675007d37eb90f7853b13ce74f3e10" + integrity sha512-AnDqMS4ejkQK0MXze7pA9TM3pu01ZY+XXsES6gEE0RmCGk5/NIfvTn0NmItfyDOjRAzyo9z6X7YHbHX4PzIvOA== + dependencies: + handlebars-utils "^1.0.2" + highlight.js "^9.12.0" + remarkable "^1.7.1" + +helper-md@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/helper-md/-/helper-md-0.2.2.tgz#c1f59d7e55bbae23362fd8a0e971607aec69d41f" + integrity sha1-wfWdflW7riM2L9ig6XFgeuxp1B8= + dependencies: + ent "^2.2.0" + extend-shallow "^2.0.1" + fs-exists-sync "^0.1.0" + remarkable "^1.6.2" + +highlight.js@^9.12.0: + version "9.18.5" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.18.5.tgz#d18a359867f378c138d6819edfc2a8acd5f29825" + integrity sha512-a5bFyofd/BHCX52/8i8uJkjr9DYwXIPnM/plwI6W7ezItLGqzt7X2G2nXuYSfsIJdkwwj/g9DG1LkcGJI/dDoA== + +hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +html-tag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/html-tag/-/html-tag-2.0.0.tgz#36c3bc8d816fd30b570d5764a497a641640c2fed" + integrity sha512-XxzooSo6oBoxBEUazgjdXj7VwTn/iSTSZzTYKzYY6I916tkaYzypHxy+pbVU1h+0UQ9JlVf5XkNQyxOAiiQO1g== + dependencies: + is-self-closing "^1.0.1" + kind-of "^6.0.0" + +https-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" + integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== + dependencies: + agent-base "6" + debug "4" + +iconv-lite@^0.4.4: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ieee754@^1.1.4: + version "1.1.13" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" + integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== + +ignore-walk@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + dependencies: + minimatch "^3.0.4" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +info-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/info-symbol/-/info-symbol-0.1.0.tgz#27841d72867ddb4242cd612d79c10633881c6a78" + integrity sha1-J4QdcoZ920JCzWEtecEGM4gcang= + +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@~1.3.0: + version "1.3.8" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-even@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-even/-/is-even-1.0.0.tgz#76b5055fbad8d294a86b6a949015e1c97b717c06" + integrity sha1-drUFX7rY0pSoa2qUkBXhyXtxfAY= + dependencies: + is-odd "^0.1.2" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-hex-prefixed@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" + integrity sha1-fY035q135dEnFIkTxXPggtd39VQ= + +is-number@^2.0.2: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-number@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-odd@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-0.1.2.tgz#bc573b5ce371ef2aad6e6f49799b72bef13978a7" + integrity sha1-vFc7XONx7yqtbm9JeZtyvvE5eKc= + dependencies: + is-number "^3.0.0" + +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + +is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-self-closing@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-self-closing/-/is-self-closing-1.0.1.tgz#5f406b527c7b12610176320338af0fa3896416e4" + integrity sha512-E+60FomW7Blv5GXTlYee2KDrnG6srxF7Xt1SjrhWUGUEsTFIqY/nq2y3DaftCsgUMdh89V07IVfhY9KIJhLezg== + dependencies: + self-closing-tags "^1.0.1" + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +isarray@1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-0.2.0.tgz#a3432192f39b910b5f02cc989487836ec70aa85e" + integrity sha1-o0MhkvObkQtfAsyYlIeDbscKqF4= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +js-sha3@0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + +js-yaml@3.14.0: + version "3.14.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +json-bigint@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" + integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== + dependencies: + bignumber.js "^9.0.0" + +jsonfile@^2.1.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" + integrity sha1-NzaitCi4e72gzIO1P6PWM6NcKug= + optionalDependencies: + graceful-fs "^4.1.6" + +jwa@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.0.tgz#a7e9c3f29dae94027ebcaf49975c9345593410fc" + integrity sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4" + integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg== + dependencies: + jwa "^2.0.0" + safe-buffer "^5.0.1" + +keccak@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-2.1.0.tgz#734ea53f2edcfd0f42cdb8d5f4c358fef052752b" + integrity sha512-m1wbJRTo+gWbctZWay9i26v5fFnYkOn7D5PCxJ3fZUGUEb49dE1Pm4BREUYCt/aoO6di7jeoGmhvqN9Nzylm3Q== + dependencies: + bindings "^1.5.0" + inherits "^2.0.4" + nan "^2.14.0" + safe-buffer "^5.2.0" + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.1.0, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0, kind-of@^5.0.2: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + +klaw@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" + integrity sha1-QIhDO0azsbolnXh4XY6W9zugJDk= + optionalDependencies: + graceful-fs "^4.1.9" + +lazy-cache@^2.0.1, lazy-cache@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" + integrity sha1-uRkKT5EzVGlIQIWfio9whNiCImQ= + dependencies: + set-getter "^0.1.0" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash._reinterpolate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" + integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= + +lodash.template@^4.4.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" + integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== + dependencies: + lodash._reinterpolate "^3.0.0" + lodash.templatesettings "^4.0.0" + +lodash.templatesettings@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33" + integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ== + dependencies: + lodash._reinterpolate "^3.0.0" + +log-ok@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/log-ok/-/log-ok-0.1.1.tgz#bea3dd36acd0b8a7240d78736b5b97c65444a334" + integrity sha1-vqPdNqzQuKckDXhza1uXxlREozQ= + dependencies: + ansi-green "^0.1.1" + success-symbol "^0.1.0" + +log-symbols@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" + integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== + dependencies: + chalk "^4.0.0" + +log-utils@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/log-utils/-/log-utils-0.2.1.tgz#a4c217a0dd9a50515d9b920206091ab3d4e031cf" + integrity sha1-pMIXoN2aUFFdm5ICBgkas9TgMc8= + dependencies: + ansi-colors "^0.2.0" + error-symbol "^0.1.0" + info-symbol "^0.1.0" + log-ok "^0.1.1" + success-symbol "^0.1.0" + time-stamp "^1.0.1" + warning-symbol "^0.1.0" + +logging-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/logging-helpers/-/logging-helpers-1.0.0.tgz#b5a37b32ad53eb0137c58c7898a47b175ddb7c36" + integrity sha512-qyIh2goLt1sOgQQrrIWuwkRjUx4NUcEqEGAcYqD8VOnOC6ItwkrVE8/tA4smGpjzyp4Svhc6RodDp9IO5ghpyA== + dependencies: + isobject "^3.0.0" + log-utils "^0.2.1" + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +memorystream@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= + +micromatch@^3.1.4: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +mime@^2.2.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.5.0.tgz#2b4af934401779806ee98026bb42e8c1ae1876b1" + integrity sha512-ft3WayFSFUVBuJj7BMLKAQcSlItKtfjsKDDsii3rqFDAZ7t11zRe8ASw/GlmivGwVUYtwkQrxiGGpL6gFvB0ag== + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= + +minimatch@3.0.4, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@^1.2.0, minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + +minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + +minizlib@^1.2.1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== + dependencies: + minipass "^2.9.0" + +mixin-deep@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@^0.5.0, mkdirp@^0.5.3: + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== + dependencies: + minimist "^1.2.5" + +mocha@^8.2.1: + version "8.2.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.2.1.tgz#f2fa68817ed0e53343d989df65ccd358bc3a4b39" + integrity sha512-cuLBVfyFfFqbNR0uUKbDGXKGk+UDFe6aR4os78XIrMQpZl/nv7JYHcvP5MFIAb374b2zFXsdgEGwmzMtP0Xg8w== + dependencies: + "@ungap/promise-all-settled" "1.1.2" + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.4.3" + debug "4.2.0" + diff "4.0.2" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.1.6" + growl "1.10.5" + he "1.2.0" + js-yaml "3.14.0" + log-symbols "4.0.0" + minimatch "3.0.4" + ms "2.1.2" + nanoid "3.1.12" + serialize-javascript "5.0.1" + strip-json-comments "3.1.1" + supports-color "7.2.0" + which "2.0.2" + wide-align "1.1.3" + workerpool "6.0.2" + yargs "13.3.2" + yargs-parser "13.1.2" + yargs-unparser "2.0.0" + +moment@^2.18.1: + version "2.24.0" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" + integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@2.1.2, ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +nan@^2.14.0: + version "2.14.1" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01" + integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw== + +nanoid@3.1.12: + version "3.1.12" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.12.tgz#6f7736c62e8d39421601e4a0c77623a97ea69654" + integrity sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A== + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +needle@^2.5.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.6.0.tgz#24dbb55f2509e2324b4a99d61f413982013ccdbe" + integrity sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg== + dependencies: + debug "^3.2.6" + iconv-lite "^0.4.4" + sax "^1.2.4" + +neo-async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== + +node-fetch@^2.3.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + +node-forge@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" + integrity sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA== + +node-pre-gyp@^0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.15.0.tgz#c2fc383276b74c7ffa842925241553e8b40f1087" + integrity sha512-7QcZa8/fpaU/BKenjcaeFF9hLz2+7S9AqyXFhlH/rilsQ/hPZKK32RtR5EQHJElgu+q5RfbJ34KriI79UWaorA== + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.3" + needle "^2.5.0" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4.4.2" + +nopt@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" + integrity sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== + dependencies: + abbrev "1" + osenv "^0.1.4" + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-bundled@^1.0.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" + integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== + dependencies: + npm-normalize-package-bin "^1.0.1" + +npm-normalize-package-bin@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" + integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== + +npm-packlist@^1.1.6: + version "1.4.8" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.8.tgz#56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e" + integrity sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + npm-normalize-package-bin "^1.0.1" + +npmlog@^4.0.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + dependencies: + isobject "^3.0.1" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +osenv@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +p-limit@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +picomatch@^2.0.4, picomatch@^2.2.1: + version "2.2.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" + integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +readable-stream@^2.0.6, readable-stream@~2.3.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readdirp@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" + integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== + dependencies: + picomatch "^2.2.1" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +relative@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/relative/-/relative-3.0.2.tgz#0dcd8ec54a5d35a3c15e104503d65375b5a5367f" + integrity sha1-Dc2OxUpdNaPBXhBFA9ZTdbWlNn8= + dependencies: + isobject "^2.0.0" + +remarkable@^1.6.2, remarkable@^1.7.1: + version "1.7.4" + resolved "https://registry.yarnpkg.com/remarkable/-/remarkable-1.7.4.tgz#19073cb960398c87a7d6546eaa5e50d2022fcd00" + integrity sha512-e6NKUXgX95whv7IgddywbeN/ItCkWbISmc2DiqHJb0wTrqZIexqdco5b8Z3XZoo/48IdNVKM9ZCvTPJ4F5uvhg== + dependencies: + argparse "^1.0.10" + autolinker "~0.28.0" + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-from-string@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + +rimraf@^2.2.8, rimraf@^2.6.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rlp@^2.2.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.4.tgz#d6b0e1659e9285fc509a5d169a9bd06f704951c1" + integrity sha512-fdq2yYCWpAQBhwkZv+Z8o/Z4sPmYm1CUq6P7n6lVTOdb949CnqA0sndXal5C1NleSVSZm6q5F3iEbauyVln/iw== + dependencies: + bn.js "^4.11.1" + +safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-buffer@^5.1.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + dependencies: + ret "~0.1.10" + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sax@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + +secp256k1@^3.0.1: + version "3.8.0" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.8.0.tgz#28f59f4b01dbee9575f56a47034b7d2e3b3b352d" + integrity sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw== + dependencies: + bindings "^1.5.0" + bip66 "^1.1.5" + bn.js "^4.11.8" + create-hash "^1.2.0" + drbg.js "^1.0.1" + elliptic "^6.5.2" + nan "^2.14.0" + safe-buffer "^5.1.2" + +self-closing-tags@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/self-closing-tags/-/self-closing-tags-1.0.1.tgz#6c5fa497994bb826b484216916371accee490a5d" + integrity sha512-7t6hNbYMxM+VHXTgJmxwgZgLGktuXtVVD5AivWzNTdJBM4DBjnDKDzkf2SrNjihaArpeJYNjxkELBu1evI4lQA== + +semver@^5.3.0, semver@^5.5.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@^6.2.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +serialize-javascript@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== + dependencies: + randombytes "^2.1.0" + +set-blocking@^2.0.0, set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +set-getter@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" + integrity sha1-12nBgsnVpR9AkUXy+6guXoboA3Y= + dependencies: + to-object-path "^0.3.0" + +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +sha.js@^2.4.0, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +sha3@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/sha3/-/sha3-2.1.3.tgz#ab05b841b2bce347765db31f57fe2a3134b9fb48" + integrity sha512-Io53D4o9qOmf3Ow9p/DoGLQiQHhtuR0ulbyambvRSG+OX5yXExk2yYfvjHtb7AtOyk6K6+sPeK/qaowWc/E/GA== + dependencies: + buffer "5.6.0" + +signal-exit@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" + integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +solc@^0.6.1: + version "0.6.6" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.6.6.tgz#0d4b9c2e7105dd6015583f5e1c5ba6a35861ea71" + integrity sha512-p0IO/1fRaHWKN+qR+mUivpwnBpFYD8EoFAzT8VL4lmllNwsyEO7TJJAc2QK0XUeWOYOT92NWKhDNNNLTVbHShA== + dependencies: + command-exists "^1.2.8" + commander "3.0.2" + fs-extra "^0.30.0" + js-sha3 "0.8.0" + memorystream "^0.3.1" + require-from-string "^2.0.0" + semver "^5.5.0" + tmp "0.0.33" + +source-map-resolve@^0.5.0: + version "0.5.3" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" + integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw== + dependencies: + atob "^2.1.2" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-support@^0.5.17: + version "0.5.19" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" + integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= + +source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +source-map@^0.6.0, source-map@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2": + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-hex-prefix@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" + integrity sha1-DF8VX+8RUTczd96du1iNoFUA428= + dependencies: + is-hex-prefixed "1.0.0" + +strip-json-comments@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +striptags@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.1.1.tgz#c8c3e7fdd6fb4bb3a32a3b752e5b5e3e38093ebd" + integrity sha1-yMPn/db7S7OjKjt1LltePjgJPr0= + +success-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/success-symbol/-/success-symbol-0.1.0.tgz#24022e486f3bf1cdca094283b769c472d3b72897" + integrity sha1-JAIuSG878c3KCUKDt2nEctO3KJc= + +supports-color@7.2.0, supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +tar@^4.4.2: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + dependencies: + chownr "^1.1.1" + fs-minipass "^1.2.5" + minipass "^2.8.6" + minizlib "^1.2.1" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.3" + +through2@^2.0.0: + version "2.0.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + dependencies: + readable-stream "~2.3.6" + xtend "~4.0.1" + +time-stamp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" + integrity sha1-dkpaEa9QVhkhsTPztE5hhofg9cM= + +tmp@0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +to-gfm-code-block@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/to-gfm-code-block/-/to-gfm-code-block-0.1.1.tgz#25d045a5fae553189e9637b590900da732d8aa82" + integrity sha1-JdBFpfrlUxielje1kJANpzLYqoI= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +ts-node@^9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" + integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== + dependencies: + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.17" + yn "3.1.1" + +typeof-article@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/typeof-article/-/typeof-article-0.1.1.tgz#9f07e733c3fbb646ffa9e61c08debacd460e06af" + integrity sha1-nwfnM8P7tkb/qeYcCN66zUYOBq8= + dependencies: + kind-of "^3.1.0" + +typescript@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" + integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== + +uglify-js@^3.1.4: + version "3.9.1" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.9.1.tgz#a56a71c8caa2d36b5556cc1fd57df01ae3491539" + integrity sha512-JUPoL1jHsc9fOjVFHdQIhqEEJsQvfKDjlubcCilu8U26uZ73qOg8VsN8O1jbuei44ZPlwL7kmbAdM4tzaUvqnA== + dependencies: + commander "~2.20.3" + +union-value@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^2.0.1" + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +warning-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/warning-symbol/-/warning-symbol-0.1.0.tgz#bb31dd11b7a0f9d67ab2ed95f457b65825bbad21" + integrity sha1-uzHdEbeg+dZ6su2V9Fe2WCW7rSE= + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wide-align@1.1.3, wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + +wordwrap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + +workerpool@6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.0.2.tgz#e241b43d8d033f1beb52c7851069456039d1d438" + integrity sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q== + +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + +yallist@^3.0.0, yallist@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yargs-parser@13.1.2, yargs-parser@^13.1.2: + version "13.1.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" + integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + +yargs@13.3.2: + version "13.3.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.2" + +year@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/year/-/year-0.2.1.tgz#4083ae520a318b23ec86037f3000cb892bdf9bb0" + integrity sha1-QIOuUgoxiyPshgN/MADLiSvfm7A= + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== diff --git a/keys/filesystem_key_store.go b/keys/filesystem_key_store.go new file mode 100644 index 000000000..6af7c7907 --- /dev/null +++ b/keys/filesystem_key_store.go @@ -0,0 +1,307 @@ +package keys + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/rand" + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path" + "strings" + "sync" + + "github.com/hyperledger/burrow/crypto" + "github.com/tmthrgd/go-hex" + "golang.org/x/crypto/scrypt" +) + +type FilesystemKeyStore struct { + sync.Mutex + UnimplementedKeysServer + AllowBadFilePermissions bool + keysDirPath string +} + +var _ KeyStore = &FilesystemKeyStore{} +var _ KeysServer = &FilesystemKeyStore{} + +func NewFilesystemKeyStore(dir string, AllowBadFilePermissions bool) *FilesystemKeyStore { + return &FilesystemKeyStore{ + keysDirPath: dir, + AllowBadFilePermissions: AllowBadFilePermissions, + } +} + +func (ks *FilesystemKeyStore) Gen(passphrase string, curveType crypto.CurveType) (key *Key, err error) { + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("GenerateNewKey error: %v", r) + } + }() + key, err = NewKey(curveType) + if err != nil { + return nil, err + } + err = ks.StoreKey(passphrase, key) + return key, err +} + +func (ks *FilesystemKeyStore) GetKey(passphrase string, keyAddr []byte) (*Key, error) { + ks.Lock() + defer ks.Unlock() + dataDirPath, err := returnDataDir(ks.keysDirPath) + if err != nil { + return nil, err + } + fileContent, err := ks.GetKeyFile(dataDirPath, keyAddr) + if err != nil { + return nil, err + } + key := new(keyJSON) + if err = json.Unmarshal(fileContent, key); err != nil { + return nil, err + } + + if len(key.PrivateKey.CipherText) > 0 { + return DecryptKey(passphrase, key) + } else { + key := new(Key) + err = key.UnmarshalJSON(fileContent) + return key, err + } +} + +func (ks *FilesystemKeyStore) AllKeys() ([]*Key, error) { + dataDirPath, err := returnDataDir(ks.keysDirPath) + if err != nil { + return nil, err + } + addrs, err := getAllAddresses(dataDirPath) + if err != nil { + return nil, err + } + + var list []*Key + + for _, addr := range addrs { + addrB, err := crypto.AddressFromHexString(addr) + if err != nil { + return nil, err + } + k, err := ks.GetKey("", addrB[:]) + if err != nil { + return nil, err + } + list = append(list, k) + } + + return list, nil +} + +func DecryptKey(passphrase string, keyProtected *keyJSON) (*Key, error) { + salt := keyProtected.PrivateKey.Salt + nonce := keyProtected.PrivateKey.Nonce + cipherText := keyProtected.PrivateKey.CipherText + + curveType, err := crypto.CurveTypeFromString(keyProtected.CurveType) + if err != nil { + return nil, err + } + authArray := []byte(passphrase) + derivedKey, err := scrypt.Key(authArray, salt, scryptN, scryptr, scryptp, scryptdkLen) + if err != nil { + return nil, err + } + aesBlock, err := aes.NewCipher(derivedKey) + if err != nil { + return nil, err + } + gcm, err := cipher.NewGCM(aesBlock) + if err != nil { + return nil, err + } + pubKey, err := hex.DecodeString(keyProtected.PublicKey) + if err != nil { + return nil, err + } + plainText, err := gcm.Open(nil, nonce, cipherText, nil) + if err != nil { + pkey, _ := NewKeyFromPub(curveType, pubKey) + return pkey, err + } + address, err := crypto.AddressFromHexString(keyProtected.Address) + if err != nil { + return nil, err + } + k, err := NewKeyFromPriv(curveType, plainText) + if err != nil { + return nil, err + } + if address != k.Address { + return nil, fmt.Errorf("address does not match") + } + return k, nil +} + +func (ks *FilesystemKeyStore) GetAllAddresses() (addresses []string, err error) { + ks.Lock() + defer ks.Unlock() + + dir, err := returnDataDir(ks.keysDirPath) + if err != nil { + return nil, err + } + return getAllAddresses(dir) +} + +func (ks *FilesystemKeyStore) StoreKey(passphrase string, key *Key) error { + ks.Lock() + defer ks.Unlock() + if passphrase != "" { + return ks.StoreKeyEncrypted(passphrase, key) + } else { + return ks.StoreKeyPlain(key) + } +} + +func (ks *FilesystemKeyStore) StoreKeyPlain(key *Key) (err error) { + keyJSON, err := json.Marshal(key) + if err != nil { + return err + } + dataDirPath, err := returnDataDir(ks.keysDirPath) + if err != nil { + return err + } + err = WriteKeyFile(key.Address[:], dataDirPath, keyJSON) + return err +} + +func (ks *FilesystemKeyStore) StoreKeyEncrypted(passphrase string, key *Key) error { + authArray := []byte(passphrase) + salt := make([]byte, 32) + _, err := rand.Read(salt) + if err != nil { + return err + } + + derivedKey, err := scrypt.Key(authArray, salt, scryptN, scryptr, scryptp, scryptdkLen) + if err != nil { + return err + } + + toEncrypt := key.PrivateKey.RawBytes() + + AES256Block, err := aes.NewCipher(derivedKey) + if err != nil { + return err + } + + gcm, err := cipher.NewGCM(AES256Block) + if err != nil { + return err + } + + // XXX: a GCM nonce may only be used once per key ever! + nonce := make([]byte, gcm.NonceSize()) + _, err = rand.Read(nonce) + if err != nil { + return err + } + + // (dst, nonce, plaintext, extradata) + cipherText := gcm.Seal(nil, nonce, toEncrypt, nil) + + cipherStruct := privateKeyJSON{ + Crypto: CryptoAESGCM, Salt: salt, Nonce: nonce, CipherText: cipherText, + } + keyStruct := keyJSON{ + CurveType: key.CurveType.String(), + Address: hex.EncodeUpperToString(key.Address[:]), + PublicKey: hex.EncodeUpperToString(key.Pubkey()), + AddressHash: key.PublicKey.AddressHashType(), + PrivateKey: cipherStruct, + } + keyJSON, err := json.Marshal(keyStruct) + if err != nil { + return err + } + dataDirPath, err := returnDataDir(ks.keysDirPath) + if err != nil { + return err + } + + return WriteKeyFile(key.Address[:], dataDirPath, keyJSON) +} + +func (ks *FilesystemKeyStore) DeleteKey(passphrase string, keyAddr []byte) (err error) { + dataDirPath, err := returnDataDir(ks.keysDirPath) + if err != nil { + return err + } + keyDirPath := path.Join(dataDirPath, strings.ToUpper(hex.EncodeToString(keyAddr))+".json") + return os.Remove(keyDirPath) +} + +func (ks *FilesystemKeyStore) GetKeyFile(dataDirPath string, keyAddr []byte) (fileContent []byte, err error) { + filename := path.Join(dataDirPath, strings.ToUpper(hex.EncodeToString(keyAddr))+".json") + fileInfo, err := os.Stat(filename) + if err != nil { + return nil, err + } + if (uint32(fileInfo.Mode()) & 0077) != 0 { + if !ks.AllowBadFilePermissions { + return nil, fmt.Errorf("file %s should be accessible by user only", filename) + } + } + return ioutil.ReadFile(filename) +} + +func WriteKeyFile(addr []byte, dataDirPath string, content []byte) (err error) { + addrHex := strings.ToUpper(hex.EncodeToString(addr)) + keyFilePath := path.Join(dataDirPath, addrHex+".json") + err = os.MkdirAll(dataDirPath, 0700) // read, write and dir search for user + if err != nil { + return err + } + return ioutil.WriteFile(keyFilePath, content, 0600) // read, write for user +} + +func (ks *FilesystemKeyStore) GetAddressForKeyName(name string) (crypto.Address, error) { + const errHeader = "GetAddressForKeyName" + nameAddressLookup, err := coreNameList(ks.keysDirPath) + if err != nil { + return crypto.Address{}, fmt.Errorf("%s: could not get names list from filesysetm: %w", + errHeader, err) + } + + addressHex, ok := nameAddressLookup[name] + if !ok { + return crypto.Address{}, fmt.Errorf("%s: could not find key named '%s'", errHeader, name) + } + + address, err := crypto.AddressFromHexString(addressHex) + if err != nil { + return crypto.Address{}, fmt.Errorf("%s: could not parse key address: %v", errHeader, err) + } + return address, nil +} + +func (ks *FilesystemKeyStore) GetAllNames() (map[string]string, error) { + return coreNameList(ks.keysDirPath) +} + +func getAllAddresses(dataDirPath string) (addresses []string, err error) { + fileInfos, err := ioutil.ReadDir(dataDirPath) + if err != nil { + return nil, err + } + addresses = make([]string, len(fileInfos)) + for i, fileInfo := range fileInfos { + addr := strings.TrimSuffix(fileInfo.Name(), ".json") + addresses[i] = addr + } + return addresses, err +} diff --git a/keys/key.go b/keys/key.go new file mode 100644 index 000000000..bd67629fe --- /dev/null +++ b/keys/key.go @@ -0,0 +1,134 @@ +package keys + +import ( + "encoding/json" + "fmt" + + "github.com/hyperledger/burrow/crypto" + "github.com/tmthrgd/go-hex" +) + +type Key struct { + CurveType crypto.CurveType + Address crypto.Address + PublicKey crypto.PublicKey + PrivateKey crypto.PrivateKey +} + +// json encodings - addresses should be hex encoded +type keyJSON struct { + CurveType string + Address string + PublicKey string + AddressHash string + PrivateKey privateKeyJSON +} + +type privateKeyJSON struct { + Crypto string + Plain string `json:",omitempty"` + Salt []byte `json:",omitempty"` + Nonce []byte `json:",omitempty"` + CipherText []byte `json:",omitempty"` +} + +func NewKey(typ crypto.CurveType) (*Key, error) { + privKey, err := crypto.GeneratePrivateKey(nil, typ) + if err != nil { + return nil, err + } + pubKey := privKey.GetPublicKey() + return &Key{ + CurveType: typ, + PublicKey: *pubKey, + Address: pubKey.GetAddress(), + PrivateKey: privKey, + }, nil +} + +func NewKeyFromPub(curveType crypto.CurveType, PubKeyBytes []byte) (*Key, error) { + pubKey, err := crypto.PublicKeyFromBytes(PubKeyBytes, curveType) + if err != nil { + return nil, err + } + + return &Key{ + CurveType: curveType, + PublicKey: *pubKey, + Address: pubKey.GetAddress(), + }, nil +} + +func NewKeyFromPriv(curveType crypto.CurveType, PrivKeyBytes []byte) (*Key, error) { + privKey, err := crypto.PrivateKeyFromRawBytes(PrivKeyBytes, curveType) + + if err != nil { + return nil, err + } + + pubKey := privKey.GetPublicKey() + + return &Key{ + CurveType: curveType, + Address: pubKey.GetAddress(), + PublicKey: *pubKey, + PrivateKey: privKey, + }, nil +} + +func (k *Key) Pubkey() []byte { + return k.PublicKey.PublicKey +} + +func (k *Key) MarshalJSON() (j []byte, err error) { + jStruct := keyJSON{ + CurveType: k.CurveType.String(), + Address: hex.EncodeUpperToString(k.Address[:]), + PublicKey: hex.EncodeUpperToString(k.Pubkey()), + AddressHash: k.PublicKey.AddressHashType(), + PrivateKey: privateKeyJSON{Crypto: CryptoNone, Plain: hex.EncodeUpperToString(k.PrivateKey.RawBytes())}, + } + j, err = json.Marshal(jStruct) + return j, err +} + +func (k *Key) UnmarshalJSON(j []byte) (err error) { + keyJ := new(keyJSON) + err = json.Unmarshal(j, &keyJ) + if err != nil { + return err + } + if len(keyJ.PrivateKey.Plain) == 0 { + return fmt.Errorf("no private key") + } + curveType, err := crypto.CurveTypeFromString(keyJ.CurveType) + if err != nil { + curveType = crypto.CurveTypeEd25519 + } + privKey, err := hex.DecodeString(keyJ.PrivateKey.Plain) + if err != nil { + return err + } + k2, err := NewKeyFromPriv(curveType, privKey) + if err != nil { + return err + } + + k.Address = k2.Address + k.CurveType = curveType + k.PublicKey = *k2.PrivateKey.GetPublicKey() + k.PrivateKey = k2.PrivateKey + + return nil +} + +// returns the address if valid, nil otherwise +func isValidKeyJson(j []byte) []byte { + j1 := new(keyJSON) + e1 := json.Unmarshal(j, &j1) + if e1 == nil { + addr, _ := hex.DecodeString(j1.Address) + return addr + } + return nil +} diff --git a/keys/key_client.go b/keys/key_client.go index 2414cf4e7..715f4b952 100644 --- a/keys/key_client.go +++ b/keys/key_client.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package keys @@ -19,9 +8,10 @@ import ( "fmt" "time" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/logging" - "google.golang.org/grpc" ) type KeyClient interface { @@ -29,7 +19,7 @@ type KeyClient interface { Sign(signAddress crypto.Address, message []byte) (*crypto.Signature, error) // PublicKey returns the public key associated with a given address - PublicKey(address crypto.Address) (publicKey crypto.PublicKey, err error) + PublicKey(address crypto.Address) (publicKey *crypto.PublicKey, err error) // Generate requests that a key be generate within the keys instance and returns the address Generate(keyName string, keyType crypto.CurveType) (keyAddress crypto.Address, err error) @@ -45,7 +35,7 @@ var _ KeyClient = (*localKeyClient)(nil) var _ KeyClient = (*remoteKeyClient)(nil) type localKeyClient struct { - ks *KeyStore + ks KeyStore logger *logging.Logger } @@ -63,14 +53,14 @@ func (l *localKeyClient) Sign(signAddress crypto.Address, message []byte) (*cryp return resp.GetSignature(), nil } -func (l *localKeyClient) PublicKey(address crypto.Address) (publicKey crypto.PublicKey, err error) { +func (l *localKeyClient) PublicKey(address crypto.Address) (publicKey *crypto.PublicKey, err error) { resp, err := l.ks.PublicKey(context.Background(), &PubRequest{Address: address.String()}) if err != nil { - return crypto.PublicKey{}, err + return nil, err } curveType, err := crypto.CurveTypeFromString(resp.GetCurveType()) if err != nil { - return crypto.PublicKey{}, err + return nil, err } return crypto.PublicKeyFromBytes(resp.GetPublicKey(), curveType) } @@ -90,17 +80,7 @@ func (l *localKeyClient) GetAddressForKeyName(keyName string) (keyAddress crypto return } - all, err := l.ks.GetAllNames() - - if err != nil { - return crypto.Address{}, err - } - - if addr, ok := all[keyName]; ok { - return crypto.AddressFromHexString(addr) - } - - return crypto.Address{}, fmt.Errorf("`%s` is neither an address or a known key name", keyName) + return l.ks.GetAddressForKeyName(keyName) } // Returns nil if the keys instance is healthy, error otherwise @@ -121,7 +101,7 @@ func (l *remoteKeyClient) Sign(signAddress crypto.Address, message []byte) (*cry return resp.GetSignature(), nil } -func (l *remoteKeyClient) PublicKey(address crypto.Address) (publicKey crypto.PublicKey, err error) { +func (l *remoteKeyClient) PublicKey(address crypto.Address) (publicKey *crypto.PublicKey, err error) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() req := PubRequest{Address: address.String()} @@ -129,11 +109,11 @@ func (l *remoteKeyClient) PublicKey(address crypto.Address) (publicKey crypto.Pu resp, err := l.kc.PublicKey(ctx, &req) if err != nil { l.logger.TraceMsg("Received PublicKey error response: ", err) - return crypto.PublicKey{}, err + return nil, err } curveType, err := crypto.CurveTypeFromString(resp.GetCurveType()) if err != nil { - return crypto.PublicKey{}, err + return nil, err } l.logger.TraceMsg("Received PublicKey response to remote key server: ", fmt.Sprintf("%v", resp)) return crypto.PublicKeyFromBytes(resp.GetPublicKey(), curveType) @@ -184,9 +164,7 @@ func (l *remoteKeyClient) HealthCheck() error { // NewRemoteKeyClient returns a new keys client for provided rpc location func NewRemoteKeyClient(rpcAddress string, logger *logging.Logger) (KeyClient, error) { logger = logger.WithScope("RemoteKeyClient") - var opts []grpc.DialOption - opts = append(opts, grpc.WithInsecure()) - conn, err := grpc.Dial(rpcAddress, opts...) + conn, err := encoding.GRPCDial(rpcAddress) if err != nil { return nil, err } @@ -196,7 +174,7 @@ func NewRemoteKeyClient(rpcAddress string, logger *logging.Logger) (KeyClient, e } // NewLocalKeyClient returns a new keys client, backed by the local filesystem -func NewLocalKeyClient(ks *KeyStore, logger *logging.Logger) KeyClient { +func NewLocalKeyClient(ks KeyStore, logger *logging.Logger) KeyClient { logger = logger.WithScope("LocalKeyClient") return &localKeyClient{ks: ks, logger: logger} } @@ -204,7 +182,7 @@ func NewLocalKeyClient(ks *KeyStore, logger *logging.Logger) KeyClient { type Signer struct { keyClient KeyClient address crypto.Address - publicKey crypto.PublicKey + publicKey *crypto.PublicKey } // AddressableSigner creates a signer that assumes the address holds an Ed25519 key @@ -225,10 +203,10 @@ func (ms *Signer) GetAddress() crypto.Address { return ms.address } -func (ms *Signer) GetPublicKey() crypto.PublicKey { +func (ms *Signer) GetPublicKey() *crypto.PublicKey { return ms.publicKey } -func (ms *Signer) Sign(messsage []byte) (*crypto.Signature, error) { - return ms.keyClient.Sign(ms.address, messsage) +func (ms *Signer) Sign(message []byte) (*crypto.Signature, error) { + return ms.keyClient.Sign(ms.address, message) } diff --git a/keys/key_store.go b/keys/key_store.go index e782bd8d7..4dd6a16f5 100644 --- a/keys/key_store.go +++ b/keys/key_store.go @@ -1,20 +1,9 @@ package keys import ( - "crypto/aes" - "crypto/cipher" - "crypto/rand" - "encoding/json" - "fmt" - "io/ioutil" - "os" - "path" - "strings" - "sync" + "context" "github.com/hyperledger/burrow/crypto" - "github.com/tmthrgd/go-hex" - "golang.org/x/crypto/scrypt" ) const ( @@ -28,392 +17,9 @@ const ( HashSecp256k1 = "btc" ) -//----------------------------------------------------------------------------- -// json encodings - -// addresses should be hex encoded - -type keyJSON struct { - CurveType string - Address string - PublicKey string - AddressHash string - PrivateKey privateKeyJSON -} - -type privateKeyJSON struct { - Crypto string - Plain string `json:",omitempty"` - Salt []byte `json:",omitempty"` - Nonce []byte `json:",omitempty"` - CipherText []byte `json:",omitempty"` -} - -func (k *Key) MarshalJSON() (j []byte, err error) { - jStruct := keyJSON{ - CurveType: k.CurveType.String(), - Address: hex.EncodeUpperToString(k.Address[:]), - PublicKey: hex.EncodeUpperToString(k.Pubkey()), - AddressHash: k.PublicKey.AddressHashType(), - PrivateKey: privateKeyJSON{Crypto: CryptoNone, Plain: hex.EncodeUpperToString(k.PrivateKey.RawBytes())}, - } - j, err = json.Marshal(jStruct) - return j, err -} - -func (k *Key) UnmarshalJSON(j []byte) (err error) { - keyJ := new(keyJSON) - err = json.Unmarshal(j, &keyJ) - if err != nil { - return err - } - if len(keyJ.PrivateKey.Plain) == 0 { - return fmt.Errorf("no private key") - } - curveType, err := crypto.CurveTypeFromString(keyJ.CurveType) - if err != nil { - curveType = crypto.CurveTypeEd25519 - } - privKey, err := hex.DecodeString(keyJ.PrivateKey.Plain) - if err != nil { - return err - } - k2, err := NewKeyFromPriv(curveType, privKey) - if err != nil { - return err - } - - k.Address = k2.Address - k.CurveType = curveType - k.PublicKey = k2.PrivateKey.GetPublicKey() - k.PrivateKey = k2.PrivateKey - - return nil -} - -// returns the address if valid, nil otherwise -func IsValidKeyJson(j []byte) []byte { - j1 := new(keyJSON) - e1 := json.Unmarshal(j, &j1) - if e1 == nil { - addr, _ := hex.DecodeString(j1.Address) - return addr - } - return nil -} - -func NewKeyStore(dir string, AllowBadFilePermissions bool) *KeyStore { - return &KeyStore{ - keysDirPath: dir, - AllowBadFilePermissions: AllowBadFilePermissions, - } -} - -type KeyStore struct { - sync.Mutex - AllowBadFilePermissions bool - keysDirPath string -} - -func (ks *KeyStore) Gen(passphrase string, curveType crypto.CurveType) (key *Key, err error) { - defer func() { - if r := recover(); r != nil { - err = fmt.Errorf("GenerateNewKey error: %v", r) - } - }() - key, err = NewKey(curveType) - if err != nil { - return nil, err - } - err = ks.StoreKey(passphrase, key) - return key, err -} - -func (ks *KeyStore) GetKey(passphrase string, keyAddr []byte) (*Key, error) { - ks.Lock() - defer ks.Unlock() - dataDirPath, err := returnDataDir(ks.keysDirPath) - if err != nil { - return nil, err - } - fileContent, err := ks.GetKeyFile(dataDirPath, keyAddr) - if err != nil { - return nil, err - } - key := new(keyJSON) - if err = json.Unmarshal(fileContent, key); err != nil { - return nil, err - } - - if len(key.PrivateKey.CipherText) > 0 { - return DecryptKey(passphrase, key) - } else { - key := new(Key) - err = key.UnmarshalJSON(fileContent) - return key, err - } -} - -func (ks *KeyStore) AllKeys() ([]*Key, error) { - - dataDirPath, err := returnDataDir(ks.keysDirPath) - if err != nil { - return nil, err - } - addrs, err := GetAllAddresses(dataDirPath) - if err != nil { - return nil, err - } - - var list []*Key - - for _, addr := range addrs { - addrB, err := crypto.AddressFromHexString(addr) - if err != nil { - return nil, err - } - k, err := ks.GetKey("", addrB[:]) - if err != nil { - return nil, err - } - list = append(list, k) - } - - return list, nil -} - -func DecryptKey(passphrase string, keyProtected *keyJSON) (*Key, error) { - salt := keyProtected.PrivateKey.Salt - nonce := keyProtected.PrivateKey.Nonce - cipherText := keyProtected.PrivateKey.CipherText - - curveType, err := crypto.CurveTypeFromString(keyProtected.CurveType) - if err != nil { - return nil, err - } - authArray := []byte(passphrase) - derivedKey, err := scrypt.Key(authArray, salt, scryptN, scryptr, scryptp, scryptdkLen) - if err != nil { - return nil, err - } - aesBlock, err := aes.NewCipher(derivedKey) - if err != nil { - return nil, err - } - gcm, err := cipher.NewGCM(aesBlock) - if err != nil { - return nil, err - } - pubKey, err := hex.DecodeString(keyProtected.PublicKey) - if err != nil { - return nil, err - } - plainText, err := gcm.Open(nil, nonce, cipherText, nil) - if err != nil { - pkey, _ := NewKeyFromPub(curveType, pubKey) - return pkey, err - } - address, err := crypto.AddressFromHexString(keyProtected.Address) - if err != nil { - return nil, err - } - k, err := NewKeyFromPriv(curveType, plainText) - if err != nil { - return nil, err - } - if address != k.Address { - return nil, fmt.Errorf("address does not match") - } - return k, nil -} - -func (ks *KeyStore) GetAllAddresses() (addresses []string, err error) { - ks.Lock() - defer ks.Unlock() - return GetAllAddresses(ks.keysDirPath) -} - -func (ks *KeyStore) StoreKey(passphrase string, key *Key) error { - ks.Lock() - defer ks.Unlock() - if passphrase != "" { - return ks.StoreKeyEncrypted(passphrase, key) - } else { - return ks.StoreKeyPlain(key) - } -} - -func (ks *KeyStore) StoreKeyPlain(key *Key) (err error) { - keyJSON, err := json.Marshal(key) - if err != nil { - return err - } - dataDirPath, err := returnDataDir(ks.keysDirPath) - if err != nil { - return err - } - err = WriteKeyFile(key.Address[:], dataDirPath, keyJSON) - return err -} - -func (ks *KeyStore) StoreKeyEncrypted(passphrase string, key *Key) error { - authArray := []byte(passphrase) - salt := make([]byte, 32) - _, err := rand.Read(salt) - if err != nil { - return err - } - - derivedKey, err := scrypt.Key(authArray, salt, scryptN, scryptr, scryptp, scryptdkLen) - if err != nil { - return err - } - - toEncrypt := key.PrivateKey.RawBytes() - - AES256Block, err := aes.NewCipher(derivedKey) - if err != nil { - return err - } - - gcm, err := cipher.NewGCM(AES256Block) - if err != nil { - return err - } - - // XXX: a GCM nonce may only be used once per key ever! - nonce := make([]byte, gcm.NonceSize()) - _, err = rand.Read(nonce) - if err != nil { - return err - } - - // (dst, nonce, plaintext, extradata) - cipherText := gcm.Seal(nil, nonce, toEncrypt, nil) - - cipherStruct := privateKeyJSON{ - Crypto: CryptoAESGCM, Salt: salt, Nonce: nonce, CipherText: cipherText, - } - keyStruct := keyJSON{ - CurveType: key.CurveType.String(), - Address: hex.EncodeUpperToString(key.Address[:]), - PublicKey: hex.EncodeUpperToString(key.Pubkey()), - AddressHash: key.PublicKey.AddressHashType(), - PrivateKey: cipherStruct, - } - keyJSON, err := json.Marshal(keyStruct) - if err != nil { - return err - } - dataDirPath, err := returnDataDir(ks.keysDirPath) - if err != nil { - return err - } - - return WriteKeyFile(key.Address[:], dataDirPath, keyJSON) -} - -func (ks *KeyStore) DeleteKey(passphrase string, keyAddr []byte) (err error) { - dataDirPath, err := returnDataDir(ks.keysDirPath) - if err != nil { - return err - } - keyDirPath := path.Join(dataDirPath, strings.ToUpper(hex.EncodeToString(keyAddr))+".json") - return os.Remove(keyDirPath) -} - -func (ks *KeyStore) GetKeyFile(dataDirPath string, keyAddr []byte) (fileContent []byte, err error) { - filename := path.Join(dataDirPath, strings.ToUpper(hex.EncodeToString(keyAddr))+".json") - fileInfo, err := os.Stat(filename) - if err != nil { - return nil, err - } - if (uint32(fileInfo.Mode()) & 0077) != 0 { - if !ks.AllowBadFilePermissions { - return nil, fmt.Errorf("file %s should be accessible by user only", filename) - } - } - return ioutil.ReadFile(filename) -} - -func WriteKeyFile(addr []byte, dataDirPath string, content []byte) (err error) { - addrHex := strings.ToUpper(hex.EncodeToString(addr)) - keyFilePath := path.Join(dataDirPath, addrHex+".json") - err = os.MkdirAll(dataDirPath, 0700) // read, write and dir search for user - if err != nil { - return err - } - return ioutil.WriteFile(keyFilePath, content, 0600) // read, write for user -} - -func (ks *KeyStore) GetAllNames() (map[string]string, error) { - return coreNameList(ks.keysDirPath) -} - -func GetAllAddresses(dataDirPath string) (addresses []string, err error) { - fileInfos, err := ioutil.ReadDir(dataDirPath) - if err != nil { - return nil, err - } - addresses = make([]string, len(fileInfos)) - for i, fileInfo := range fileInfos { - addr := strings.TrimSuffix(fileInfo.Name(), ".json") - addresses[i] = addr - } - return addresses, err -} - -type Key struct { - CurveType crypto.CurveType - Address crypto.Address - PublicKey crypto.PublicKey - PrivateKey crypto.PrivateKey -} - -func NewKey(typ crypto.CurveType) (*Key, error) { - privKey, err := crypto.GeneratePrivateKey(nil, typ) - if err != nil { - return nil, err - } - pubKey := privKey.GetPublicKey() - return &Key{ - CurveType: typ, - PublicKey: pubKey, - Address: pubKey.GetAddress(), - PrivateKey: privKey, - }, nil -} - -func (k *Key) Pubkey() []byte { - return k.PublicKey.PublicKey -} - -func NewKeyFromPub(curveType crypto.CurveType, PubKeyBytes []byte) (*Key, error) { - pubKey, err := crypto.PublicKeyFromBytes(PubKeyBytes, curveType) - if err != nil { - return nil, err - } - - return &Key{ - CurveType: curveType, - PublicKey: pubKey, - Address: pubKey.GetAddress(), - }, nil -} - -func NewKeyFromPriv(curveType crypto.CurveType, PrivKeyBytes []byte) (*Key, error) { - privKey, err := crypto.PrivateKeyFromRawBytes(PrivKeyBytes, curveType) - - if err != nil { - return nil, err - } - - pubKey := privKey.GetPublicKey() - - return &Key{ - CurveType: curveType, - Address: pubKey.GetAddress(), - PublicKey: pubKey, - PrivateKey: privKey, - }, nil +type KeyStore interface { + GetAddressForKeyName(keyName string) (keyAddress crypto.Address, err error) + GenerateKey(ctx context.Context, in *GenRequest) (*GenResponse, error) + PublicKey(ctx context.Context, in *PubRequest) (*PubResponse, error) + Sign(ctx context.Context, in *SignRequest) (*SignResponse, error) } diff --git a/keys/keys.pb.go b/keys/keys.pb.go index e0ae261fb..273559683 100644 --- a/keys/keys.pb.go +++ b/keys/keys.pb.go @@ -4,15 +4,15 @@ package keys import ( - context "context" fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" golang_proto "github.com/golang/protobuf/proto" crypto "github.com/hyperledger/burrow/crypto" - grpc "google.golang.org/grpc" ) // Reference imports to suppress errors if they are not otherwise used. @@ -25,7 +25,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 type ListRequest struct { KeyName string `protobuf:"bytes,1,opt,name=KeyName,proto3" json:"KeyName,omitempty"` @@ -41,16 +41,21 @@ func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{0} } func (m *ListRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ListRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_ListRequest.Merge(m, src) } func (m *ListRequest) XXX_Size() int { - return xxx_messageInfo_ListRequest.Size(m) + return m.Size() } func (m *ListRequest) XXX_DiscardUnknown() { xxx_messageInfo_ListRequest.DiscardUnknown(m) @@ -82,16 +87,21 @@ func (*VerifyResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{1} } func (m *VerifyResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_VerifyResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *VerifyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_VerifyResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *VerifyResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_VerifyResponse.Merge(m, src) } func (m *VerifyResponse) XXX_Size() int { - return xxx_messageInfo_VerifyResponse.Size(m) + return m.Size() } func (m *VerifyResponse) XXX_DiscardUnknown() { xxx_messageInfo_VerifyResponse.DiscardUnknown(m) @@ -116,16 +126,21 @@ func (*RemoveNameResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{2} } func (m *RemoveNameResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RemoveNameResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *RemoveNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RemoveNameResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *RemoveNameResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_RemoveNameResponse.Merge(m, src) } func (m *RemoveNameResponse) XXX_Size() int { - return xxx_messageInfo_RemoveNameResponse.Size(m) + return m.Size() } func (m *RemoveNameResponse) XXX_DiscardUnknown() { xxx_messageInfo_RemoveNameResponse.DiscardUnknown(m) @@ -150,16 +165,21 @@ func (*AddNameResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{3} } func (m *AddNameResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AddNameResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *AddNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AddNameResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *AddNameResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_AddNameResponse.Merge(m, src) } func (m *AddNameResponse) XXX_Size() int { - return xxx_messageInfo_AddNameResponse.Size(m) + return m.Size() } func (m *AddNameResponse) XXX_DiscardUnknown() { xxx_messageInfo_AddNameResponse.DiscardUnknown(m) @@ -185,16 +205,21 @@ func (*RemoveNameRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{4} } func (m *RemoveNameRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RemoveNameRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *RemoveNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RemoveNameRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *RemoveNameRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_RemoveNameRequest.Merge(m, src) } func (m *RemoveNameRequest) XXX_Size() int { - return xxx_messageInfo_RemoveNameRequest.Size(m) + return m.Size() } func (m *RemoveNameRequest) XXX_DiscardUnknown() { xxx_messageInfo_RemoveNameRequest.DiscardUnknown(m) @@ -229,16 +254,21 @@ func (*GenRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{5} } func (m *GenRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GenRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GenRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GenRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GenRequest.Merge(m, src) } func (m *GenRequest) XXX_Size() int { - return xxx_messageInfo_GenRequest.Size(m) + return m.Size() } func (m *GenRequest) XXX_DiscardUnknown() { xxx_messageInfo_GenRequest.DiscardUnknown(m) @@ -285,16 +315,21 @@ func (*GenResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{6} } func (m *GenResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GenResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GenResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GenResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_GenResponse.Merge(m, src) } func (m *GenResponse) XXX_Size() int { - return xxx_messageInfo_GenResponse.Size(m) + return m.Size() } func (m *GenResponse) XXX_DiscardUnknown() { xxx_messageInfo_GenResponse.DiscardUnknown(m) @@ -328,16 +363,21 @@ func (*PubRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{7} } func (m *PubRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PubRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *PubRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PubRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *PubRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_PubRequest.Merge(m, src) } func (m *PubRequest) XXX_Size() int { - return xxx_messageInfo_PubRequest.Size(m) + return m.Size() } func (m *PubRequest) XXX_DiscardUnknown() { xxx_messageInfo_PubRequest.DiscardUnknown(m) @@ -378,16 +418,21 @@ func (*PubResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{8} } func (m *PubResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PubResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *PubResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PubResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *PubResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_PubResponse.Merge(m, src) } func (m *PubResponse) XXX_Size() int { - return xxx_messageInfo_PubResponse.Size(m) + return m.Size() } func (m *PubResponse) XXX_DiscardUnknown() { xxx_messageInfo_PubResponse.DiscardUnknown(m) @@ -428,16 +473,21 @@ func (*ImportJSONRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{9} } func (m *ImportJSONRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ImportJSONRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ImportJSONRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ImportJSONRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ImportJSONRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_ImportJSONRequest.Merge(m, src) } func (m *ImportJSONRequest) XXX_Size() int { - return xxx_messageInfo_ImportJSONRequest.Size(m) + return m.Size() } func (m *ImportJSONRequest) XXX_DiscardUnknown() { xxx_messageInfo_ImportJSONRequest.DiscardUnknown(m) @@ -477,16 +527,21 @@ func (*ImportResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{10} } func (m *ImportResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ImportResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ImportResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ImportResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ImportResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_ImportResponse.Merge(m, src) } func (m *ImportResponse) XXX_Size() int { - return xxx_messageInfo_ImportResponse.Size(m) + return m.Size() } func (m *ImportResponse) XXX_DiscardUnknown() { xxx_messageInfo_ImportResponse.DiscardUnknown(m) @@ -522,16 +577,21 @@ func (*ImportRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{11} } func (m *ImportRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ImportRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ImportRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ImportRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ImportRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_ImportRequest.Merge(m, src) } func (m *ImportRequest) XXX_Size() int { - return xxx_messageInfo_ImportRequest.Size(m) + return m.Size() } func (m *ImportRequest) XXX_DiscardUnknown() { xxx_messageInfo_ImportRequest.DiscardUnknown(m) @@ -587,16 +647,21 @@ func (*ExportRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{12} } func (m *ExportRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExportRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ExportRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExportRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ExportRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_ExportRequest.Merge(m, src) } func (m *ExportRequest) XXX_Size() int { - return xxx_messageInfo_ExportRequest.Size(m) + return m.Size() } func (m *ExportRequest) XXX_DiscardUnknown() { xxx_messageInfo_ExportRequest.DiscardUnknown(m) @@ -646,16 +711,21 @@ func (*ExportResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{13} } func (m *ExportResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExportResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ExportResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExportResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ExportResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_ExportResponse.Merge(m, src) } func (m *ExportResponse) XXX_Size() int { - return xxx_messageInfo_ExportResponse.Size(m) + return m.Size() } func (m *ExportResponse) XXX_DiscardUnknown() { xxx_messageInfo_ExportResponse.DiscardUnknown(m) @@ -712,16 +782,21 @@ func (*SignRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{14} } func (m *SignRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SignRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *SignRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SignRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *SignRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_SignRequest.Merge(m, src) } func (m *SignRequest) XXX_Size() int { - return xxx_messageInfo_SignRequest.Size(m) + return m.Size() } func (m *SignRequest) XXX_DiscardUnknown() { xxx_messageInfo_SignRequest.DiscardUnknown(m) @@ -775,16 +850,21 @@ func (*SignResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{15} } func (m *SignResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SignResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *SignResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SignResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *SignResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_SignResponse.Merge(m, src) } func (m *SignResponse) XXX_Size() int { - return xxx_messageInfo_SignResponse.Size(m) + return m.Size() } func (m *SignResponse) XXX_DiscardUnknown() { xxx_messageInfo_SignResponse.DiscardUnknown(m) @@ -819,16 +899,21 @@ func (*VerifyRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{16} } func (m *VerifyRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_VerifyRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *VerifyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_VerifyRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *VerifyRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_VerifyRequest.Merge(m, src) } func (m *VerifyRequest) XXX_Size() int { - return xxx_messageInfo_VerifyRequest.Size(m) + return m.Size() } func (m *VerifyRequest) XXX_DiscardUnknown() { xxx_messageInfo_VerifyRequest.DiscardUnknown(m) @@ -876,16 +961,21 @@ func (*HashRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{17} } func (m *HashRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HashRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *HashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HashRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *HashRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_HashRequest.Merge(m, src) } func (m *HashRequest) XXX_Size() int { - return xxx_messageInfo_HashRequest.Size(m) + return m.Size() } func (m *HashRequest) XXX_DiscardUnknown() { xxx_messageInfo_HashRequest.DiscardUnknown(m) @@ -925,16 +1015,21 @@ func (*HashResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{18} } func (m *HashResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HashResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *HashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HashResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *HashResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_HashResponse.Merge(m, src) } func (m *HashResponse) XXX_Size() int { - return xxx_messageInfo_HashResponse.Size(m) + return m.Size() } func (m *HashResponse) XXX_DiscardUnknown() { xxx_messageInfo_HashResponse.DiscardUnknown(m) @@ -968,16 +1063,21 @@ func (*KeyID) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{19} } func (m *KeyID) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KeyID.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *KeyID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KeyID.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *KeyID) XXX_Merge(src proto.Message) { xxx_messageInfo_KeyID.Merge(m, src) } func (m *KeyID) XXX_Size() int { - return xxx_messageInfo_KeyID.Size(m) + return m.Size() } func (m *KeyID) XXX_DiscardUnknown() { xxx_messageInfo_KeyID.DiscardUnknown(m) @@ -1017,16 +1117,21 @@ func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{20} } func (m *ListResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ListResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_ListResponse.Merge(m, src) } func (m *ListResponse) XXX_Size() int { - return xxx_messageInfo_ListResponse.Size(m) + return m.Size() } func (m *ListResponse) XXX_DiscardUnknown() { xxx_messageInfo_ListResponse.DiscardUnknown(m) @@ -1060,16 +1165,21 @@ func (*AddNameRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9084e97af2346a26, []int{21} } func (m *AddNameRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AddNameRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *AddNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AddNameRequest.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *AddNameRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_AddNameRequest.Merge(m, src) } func (m *AddNameRequest) XXX_Size() int { - return xxx_messageInfo_AddNameRequest.Size(m) + return m.Size() } func (m *AddNameRequest) XXX_DiscardUnknown() { xxx_messageInfo_AddNameRequest.DiscardUnknown(m) @@ -1145,459 +1255,961 @@ func init() { proto.RegisterFile("keys.proto", fileDescriptor_9084e97af2346a26) func init() { golang_proto.RegisterFile("keys.proto", fileDescriptor_9084e97af2346a26) } var fileDescriptor_9084e97af2346a26 = []byte{ - // 763 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x4f, 0x13, 0x41, - 0x14, 0x4e, 0xbb, 0x0b, 0xd2, 0xb7, 0xa5, 0xd2, 0x15, 0x63, 0xb3, 0xc1, 0x86, 0xcc, 0x05, 0x62, - 0xd2, 0xd6, 0x14, 0xe3, 0x41, 0x0e, 0x84, 0x1f, 0x06, 0xb1, 0x8a, 0xa4, 0x18, 0x0f, 0x26, 0x1e, - 0xb6, 0xf4, 0xd1, 0x36, 0xd0, 0xee, 0x3a, 0xb3, 0x8b, 0xec, 0xc1, 0xab, 0x7f, 0x97, 0x47, 0x4f, - 0x9e, 0x3d, 0x1a, 0xf8, 0x47, 0xcc, 0xcc, 0xec, 0x74, 0x67, 0x16, 0xc4, 0x26, 0xde, 0xe6, 0xfd, - 0x9a, 0xef, 0xbd, 0x37, 0x5f, 0xbf, 0x2d, 0xc0, 0x19, 0x26, 0xac, 0x19, 0xd2, 0x20, 0x0a, 0x5c, - 0x9b, 0x9f, 0xbd, 0xc6, 0x60, 0x14, 0x0d, 0xe3, 0x5e, 0xf3, 0x24, 0x18, 0xb7, 0x06, 0xc1, 0x20, - 0x68, 0x89, 0x60, 0x2f, 0x3e, 0x15, 0x96, 0x30, 0xc4, 0x49, 0x16, 0x79, 0xe5, 0x13, 0x9a, 0x84, - 0x51, 0x6a, 0x91, 0x35, 0x70, 0xde, 0x8c, 0x58, 0xd4, 0xc5, 0xcf, 0x31, 0xb2, 0xc8, 0xad, 0xc1, - 0xbd, 0x0e, 0x26, 0x87, 0xfe, 0x18, 0x6b, 0x85, 0xd5, 0xc2, 0x7a, 0xa9, 0xab, 0x4c, 0xb2, 0x04, - 0x95, 0x0f, 0x48, 0x47, 0xa7, 0x49, 0x17, 0x59, 0x18, 0x4c, 0x18, 0x92, 0x65, 0x70, 0xbb, 0x38, - 0x0e, 0x2e, 0x90, 0xc7, 0xa7, 0xde, 0x2a, 0xdc, 0xdf, 0xee, 0xf7, 0x0d, 0x57, 0x03, 0xaa, 0x7a, - 0xe2, 0xbf, 0x90, 0xfa, 0x00, 0xfb, 0x38, 0x51, 0x79, 0x75, 0x80, 0x23, 0x9f, 0xb1, 0x70, 0x48, - 0x7d, 0xa6, 0x52, 0x35, 0x8f, 0xbb, 0x02, 0xa5, 0xdd, 0x98, 0x5e, 0xe0, 0xfb, 0x24, 0xc4, 0x5a, - 0x51, 0x84, 0x33, 0x87, 0x8e, 0x62, 0x99, 0x28, 0x6b, 0xe0, 0x08, 0x14, 0xd9, 0x23, 0x4f, 0xdc, - 0xee, 0xf7, 0x29, 0x32, 0xa6, 0xda, 0x49, 0x4d, 0xf2, 0x02, 0xe0, 0x28, 0xee, 0x69, 0x6d, 0xdf, - 0x9e, 0xe7, 0xba, 0x60, 0x0b, 0x1c, 0xd9, 0x83, 0x38, 0x93, 0x03, 0x70, 0x44, 0x6d, 0x0a, 0xb2, - 0x02, 0xa5, 0xa3, 0xb8, 0x77, 0x3e, 0x3a, 0xe9, 0x60, 0x22, 0xca, 0xcb, 0xdd, 0xcc, 0x71, 0xf7, - 0x24, 0x64, 0x1f, 0xaa, 0x07, 0xe3, 0x30, 0xa0, 0xd1, 0xeb, 0xe3, 0x77, 0x87, 0xb3, 0x2e, 0xc7, - 0x05, 0x9b, 0xa7, 0xab, 0x9e, 0xf8, 0x99, 0x3c, 0x81, 0x8a, 0xbc, 0x68, 0x86, 0xd9, 0xbf, 0xc2, - 0xa2, 0xca, 0x9d, 0x19, 0x30, 0xbf, 0x04, 0x73, 0x2e, 0x2b, 0xff, 0x42, 0x1e, 0x2c, 0x74, 0x30, - 0xd9, 0x49, 0x22, 0x64, 0x35, 0x5b, 0xac, 0x64, 0x6a, 0x93, 0x4f, 0xb0, 0xf8, 0xf2, 0xf2, 0x7f, - 0xe1, 0xb5, 0xe9, 0x2c, 0x73, 0xba, 0x6f, 0x05, 0xa8, 0xa8, 0xfb, 0xf3, 0x2f, 0x74, 0x96, 0x7f, - 0xa1, 0x33, 0x4c, 0x04, 0x3c, 0x1d, 0x5d, 0xf8, 0x11, 0xf2, 0x70, 0x51, 0x84, 0x35, 0x4f, 0x1e, - 0xaa, 0x9c, 0x91, 0xc3, 0xd8, 0x81, 0x9d, 0x7f, 0xdb, 0x18, 0x9c, 0xe3, 0xd1, 0x60, 0x66, 0xca, - 0x6b, 0x30, 0xc5, 0xdb, 0x39, 0x68, 0x99, 0xf3, 0xbf, 0x45, 0xc6, 0xfc, 0x01, 0xa6, 0xfb, 0x55, - 0x26, 0xd9, 0x82, 0xb2, 0x84, 0x4d, 0x87, 0x6f, 0x41, 0x89, 0xdb, 0x7e, 0x14, 0x53, 0x79, 0x85, - 0xd3, 0xae, 0x36, 0x53, 0xb5, 0x98, 0x06, 0xba, 0x59, 0x0e, 0xb9, 0x84, 0x45, 0xa5, 0x09, 0xb2, - 0x73, 0x83, 0xe0, 0xc5, 0x3c, 0xc1, 0xb5, 0x4e, 0x2c, 0xa3, 0x13, 0x13, 0x79, 0x6e, 0x06, 0xe4, - 0x5d, 0x70, 0x5e, 0xf9, 0x6c, 0xa8, 0x70, 0x3d, 0x58, 0xe0, 0x66, 0xc4, 0xb7, 0x2b, 0xf7, 0x35, - 0xb5, 0x75, 0xd4, 0xa2, 0x39, 0x3f, 0x81, 0xb2, 0xbc, 0x24, 0x9d, 0xdf, 0x05, 0x9b, 0xdb, 0xe9, - 0x0d, 0xe2, 0x4c, 0x36, 0x61, 0xae, 0x83, 0xc9, 0xc1, 0xde, 0x1d, 0x3f, 0x7c, 0x4d, 0x63, 0x8a, - 0xab, 0x96, 0xae, 0x31, 0x0d, 0x28, 0x4b, 0x71, 0x4d, 0x01, 0x1e, 0x83, 0x25, 0x79, 0x65, 0xad, - 0x3b, 0x6d, 0xa7, 0x29, 0x94, 0x5c, 0xdc, 0xde, 0xe5, 0x7e, 0xb2, 0x07, 0x95, 0xa9, 0x74, 0xea, - 0x22, 0x39, 0x31, 0x45, 0x72, 0x92, 0x63, 0xb5, 0xc9, 0x81, 0xf6, 0x4f, 0x1b, 0xec, 0x0e, 0x26, - 0xcc, 0x6d, 0x0b, 0x85, 0x43, 0xea, 0x47, 0xc8, 0xb7, 0xbf, 0x24, 0xf1, 0x32, 0x69, 0xf5, 0xaa, - 0x9a, 0x27, 0xed, 0xf0, 0xa9, 0xf6, 0x80, 0xaa, 0x22, 0x53, 0x3f, 0x55, 0xa1, 0x6b, 0x5a, 0x03, - 0x6c, 0xfe, 0x2c, 0x6e, 0x1a, 0xd2, 0x78, 0xec, 0xb9, 0xba, 0x2b, 0x4d, 0xdf, 0x80, 0x79, 0x49, - 0x19, 0xf7, 0x81, 0x8c, 0x1a, 0x04, 0xf2, 0x96, 0x4d, 0x67, 0x56, 0x24, 0x65, 0x48, 0x15, 0x19, - 0xa2, 0xa4, 0x8a, 0x72, 0xaa, 0xb6, 0x09, 0x90, 0x09, 0xa6, 0xfb, 0x48, 0xcf, 0xd1, 0x24, 0xf4, - 0x2f, 0xc5, 0x1b, 0x30, 0x2f, 0x95, 0x41, 0x21, 0x1a, 0x3a, 0xa4, 0x8a, 0x72, 0xe2, 0xd1, 0x90, - 0xfc, 0x51, 0xab, 0xd0, 0x08, 0xaa, 0x56, 0x61, 0xd0, 0x6d, 0x0b, 0x20, 0xfb, 0x2c, 0xaa, 0x06, - 0x6f, 0x7c, 0x28, 0xbd, 0xda, 0xcd, 0x40, 0x86, 0xc7, 0xe9, 0xa5, 0xf0, 0xb4, 0xef, 0xb8, 0xc2, - 0x33, 0xd8, 0xf7, 0x5c, 0x50, 0x46, 0x80, 0xa5, 0xfd, 0x9b, 0x6c, 0xf3, 0x1e, 0xe6, 0xbc, 0xb2, - 0x6e, 0xe7, 0xd9, 0xaf, 0xab, 0x7a, 0xe1, 0xf7, 0x55, 0xbd, 0xf0, 0xfd, 0xba, 0x5e, 0xf8, 0x71, - 0x5d, 0x2f, 0x7c, 0x24, 0xda, 0x3f, 0x8e, 0x61, 0x12, 0x22, 0x3d, 0xc7, 0xfe, 0x00, 0x69, 0xab, - 0x17, 0x53, 0x1a, 0x7c, 0x69, 0xf1, 0x5b, 0x7a, 0xf3, 0xe2, 0xff, 0xc5, 0xc6, 0x9f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x32, 0xe4, 0x71, 0xd8, 0xb0, 0x08, 0x00, 0x00, + // 766 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4d, 0x6f, 0xd3, 0x4a, + 0x14, 0x95, 0x63, 0xb7, 0xaf, 0xb9, 0x4e, 0xf3, 0x1a, 0xbf, 0x3e, 0xbd, 0xc8, 0xea, 0x8b, 0xaa, + 0xd9, 0xb4, 0x42, 0x4a, 0x82, 0x52, 0x89, 0x05, 0x45, 0xaa, 0xfa, 0x81, 0x4a, 0x09, 0x94, 0x2a, + 0x45, 0x2c, 0x90, 0x58, 0x38, 0xcd, 0x25, 0x89, 0xda, 0xc4, 0x61, 0xc6, 0x2e, 0xf5, 0x82, 0x2d, + 0xbf, 0x8b, 0x65, 0x57, 0x88, 0x25, 0x4b, 0x94, 0xfe, 0x11, 0x34, 0x33, 0x9e, 0x78, 0xc6, 0x2d, + 0x25, 0x12, 0xbb, 0xb9, 0x5f, 0x73, 0xee, 0xbd, 0x73, 0x72, 0x1c, 0x80, 0x73, 0x4c, 0x58, 0x63, + 0x42, 0xc3, 0x28, 0xf4, 0x1c, 0x7e, 0xf6, 0x57, 0xfb, 0x61, 0x3f, 0x14, 0x8e, 0x26, 0x3f, 0xc9, + 0x98, 0x5f, 0x3a, 0xa3, 0xc9, 0x24, 0x4a, 0x2d, 0xb2, 0x01, 0xee, 0x8b, 0x21, 0x8b, 0x3a, 0xf8, + 0x21, 0x46, 0x16, 0x79, 0x55, 0xf8, 0xab, 0x8d, 0xc9, 0x71, 0x30, 0xc2, 0xaa, 0xb5, 0x6e, 0x6d, + 0x16, 0x3b, 0xca, 0x24, 0x2b, 0x50, 0x7e, 0x83, 0x74, 0xf8, 0x3e, 0xe9, 0x20, 0x9b, 0x84, 0x63, + 0x86, 0x64, 0x15, 0xbc, 0x0e, 0x8e, 0xc2, 0x4b, 0xe4, 0xf1, 0x99, 0xb7, 0x02, 0x7f, 0xef, 0xf6, + 0x7a, 0x86, 0xab, 0x0e, 0x15, 0x3d, 0xf1, 0x77, 0x48, 0x3d, 0x80, 0x43, 0x1c, 0xab, 0xbc, 0x1a, + 0xc0, 0x49, 0xc0, 0xd8, 0x64, 0x40, 0x03, 0xa6, 0x52, 0x35, 0x8f, 0xb7, 0x06, 0xc5, 0xfd, 0x98, + 0x5e, 0xe2, 0xeb, 0x64, 0x82, 0xd5, 0x82, 0x08, 0x67, 0x0e, 0x1d, 0xc5, 0x36, 0x51, 0x36, 0xc0, + 0x15, 0x28, 0xb2, 0x47, 0x9e, 0xb8, 0xdb, 0xeb, 0x51, 0x64, 0x4c, 0xb5, 0x93, 0x9a, 0xe4, 0x31, + 0xc0, 0x49, 0xdc, 0xd5, 0xda, 0xbe, 0x3b, 0xcf, 0xf3, 0xc0, 0x11, 0x38, 0xb2, 0x07, 0x71, 0x26, + 0x47, 0xe0, 0x8a, 0xda, 0x14, 0x64, 0x0d, 0x8a, 0x27, 0x71, 0xf7, 0x62, 0x78, 0xd6, 0xc6, 0x44, + 0x94, 0x97, 0x3a, 0x99, 0xe3, 0xfe, 0x49, 0xc8, 0x21, 0x54, 0x8e, 0x46, 0x93, 0x90, 0x46, 0xcf, + 0x4f, 0x5f, 0x1d, 0xcf, 0xbb, 0x1c, 0x0f, 0x1c, 0x9e, 0xae, 0x7a, 0xe2, 0x67, 0xf2, 0x00, 0xca, + 0xf2, 0xa2, 0x39, 0x66, 0xff, 0x04, 0xcb, 0x2a, 0x77, 0x6e, 0xc0, 0xfc, 0x12, 0xcc, 0xb9, 0xec, + 0xfc, 0x0b, 0xf9, 0xb0, 0xd4, 0xc6, 0x64, 0x2f, 0x89, 0x90, 0x55, 0x1d, 0xb1, 0x92, 0x99, 0x4d, + 0xde, 0xc1, 0xf2, 0xd3, 0xab, 0x3f, 0x85, 0xd7, 0xa6, 0xb3, 0xcd, 0xe9, 0x3e, 0x5b, 0x50, 0x56, + 0xf7, 0xe7, 0x5f, 0xe8, 0x3c, 0xff, 0x42, 0xe7, 0x98, 0x08, 0x78, 0x3a, 0xbc, 0x0c, 0x22, 0xe4, + 0xe1, 0x82, 0x08, 0x6b, 0x9e, 0x3c, 0x54, 0x29, 0x23, 0x87, 0xb1, 0x03, 0x27, 0xff, 0xb6, 0x31, + 0xb8, 0xa7, 0xc3, 0xfe, 0xdc, 0x94, 0xd7, 0x60, 0x0a, 0x77, 0x73, 0xd0, 0x36, 0xe7, 0x7f, 0x89, + 0x8c, 0x05, 0x7d, 0x4c, 0xf7, 0xab, 0x4c, 0xb2, 0x03, 0x25, 0x09, 0x9b, 0x0e, 0xdf, 0x84, 0x22, + 0xb7, 0x83, 0x28, 0xa6, 0xf2, 0x0a, 0xb7, 0x55, 0x69, 0xa4, 0x6a, 0x31, 0x0b, 0x74, 0xb2, 0x1c, + 0x72, 0x05, 0xcb, 0x4a, 0x13, 0x64, 0xe7, 0x06, 0xc1, 0x0b, 0x79, 0x82, 0x6b, 0x9d, 0xd8, 0x46, + 0x27, 0x26, 0xf2, 0xc2, 0x1c, 0xc8, 0xfb, 0xe0, 0x3e, 0x0b, 0xd8, 0x40, 0xe1, 0xfa, 0xb0, 0xc4, + 0xcd, 0x88, 0x6f, 0x57, 0xee, 0x6b, 0x66, 0xeb, 0xa8, 0x05, 0x73, 0x7e, 0x02, 0x25, 0x79, 0x49, + 0x3a, 0xbf, 0x07, 0x0e, 0xb7, 0xd3, 0x1b, 0xc4, 0x99, 0x6c, 0xc3, 0x42, 0x1b, 0x93, 0xa3, 0x83, + 0x7b, 0x7e, 0xf8, 0x9a, 0xc6, 0x14, 0xd6, 0x6d, 0x5d, 0x63, 0xea, 0x50, 0x92, 0xe2, 0x9a, 0x02, + 0xfc, 0x0f, 0xb6, 0xe4, 0x95, 0xbd, 0xe9, 0xb6, 0xdc, 0x86, 0x10, 0x6c, 0x71, 0x7b, 0x87, 0xfb, + 0xc9, 0x01, 0x94, 0x67, 0xd2, 0xa9, 0x8b, 0xe4, 0xd8, 0x14, 0xc9, 0x71, 0x8e, 0xd5, 0x26, 0x07, + 0x5a, 0x5f, 0x1d, 0x70, 0xda, 0x98, 0x30, 0xaf, 0x25, 0x14, 0x0e, 0x69, 0x10, 0x21, 0xdf, 0xfe, + 0x8a, 0xc4, 0xcb, 0xa4, 0xd5, 0xaf, 0x68, 0x9e, 0xb4, 0xc3, 0x87, 0xda, 0x03, 0xaa, 0x8a, 0x4c, + 0xfd, 0x54, 0x85, 0xae, 0x69, 0x75, 0x70, 0xf8, 0xb3, 0x78, 0x69, 0x48, 0xe3, 0xb1, 0xef, 0xe9, + 0xae, 0x34, 0x7d, 0x0b, 0x16, 0x25, 0x65, 0xbc, 0x7f, 0x64, 0xd4, 0x20, 0x90, 0xbf, 0x6a, 0x3a, + 0xb3, 0x22, 0x29, 0x43, 0xaa, 0xc8, 0x10, 0x25, 0x55, 0x94, 0x53, 0xb5, 0x6d, 0x80, 0x4c, 0x30, + 0xbd, 0xff, 0xf4, 0x1c, 0x4d, 0x42, 0x7f, 0x51, 0xbc, 0x05, 0x8b, 0x52, 0x19, 0x14, 0xa2, 0xa1, + 0x43, 0xaa, 0x28, 0x27, 0x1e, 0x75, 0xc9, 0x1f, 0xb5, 0x0a, 0x8d, 0xa0, 0x6a, 0x15, 0x06, 0xdd, + 0x76, 0x00, 0xb2, 0xcf, 0xa2, 0x6a, 0xf0, 0xd6, 0x87, 0xd2, 0xaf, 0xde, 0x0e, 0x64, 0x78, 0x9c, + 0x5e, 0x0a, 0x4f, 0xfb, 0x8e, 0x2b, 0x3c, 0x83, 0x7d, 0x8f, 0x04, 0x65, 0x04, 0x58, 0xda, 0xbf, + 0xc9, 0x36, 0xff, 0xdf, 0x9c, 0x57, 0xd6, 0xed, 0x3d, 0xb9, 0x9e, 0xd6, 0xac, 0x6f, 0xd3, 0x9a, + 0xf5, 0x7d, 0x5a, 0xb3, 0x7e, 0x4c, 0x6b, 0xd6, 0x97, 0x9b, 0x9a, 0x75, 0x7d, 0x53, 0xb3, 0xde, + 0x92, 0xfe, 0x30, 0x1a, 0xc4, 0xdd, 0xc6, 0x59, 0x38, 0x6a, 0x0e, 0x92, 0x09, 0xd2, 0x0b, 0xec, + 0xf5, 0x91, 0x36, 0xbb, 0x31, 0xa5, 0xe1, 0xc7, 0x26, 0xbf, 0xad, 0xbb, 0x28, 0xfe, 0x67, 0x6c, + 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x02, 0xda, 0xb5, 0x9f, 0x08, 0x00, 0x00, +} + +func (m *ListRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +func (m *ListRequest) 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.KeyName) > 0 { + i -= len(m.KeyName) + copy(dAtA[i:], m.KeyName) + i = encodeVarintKeys(dAtA, i, uint64(len(m.KeyName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} -// KeysClient is the client API for Keys service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type KeysClient interface { - GenerateKey(ctx context.Context, in *GenRequest, opts ...grpc.CallOption) (*GenResponse, error) - PublicKey(ctx context.Context, in *PubRequest, opts ...grpc.CallOption) (*PubResponse, error) - Sign(ctx context.Context, in *SignRequest, opts ...grpc.CallOption) (*SignResponse, error) - Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) - Import(ctx context.Context, in *ImportRequest, opts ...grpc.CallOption) (*ImportResponse, error) - ImportJSON(ctx context.Context, in *ImportJSONRequest, opts ...grpc.CallOption) (*ImportResponse, error) - Export(ctx context.Context, in *ExportRequest, opts ...grpc.CallOption) (*ExportResponse, error) - Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) - RemoveName(ctx context.Context, in *RemoveNameRequest, opts ...grpc.CallOption) (*RemoveNameResponse, error) - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) - AddName(ctx context.Context, in *AddNameRequest, opts ...grpc.CallOption) (*AddNameResponse, error) +func (m *VerifyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -type keysClient struct { - cc *grpc.ClientConn +func (m *VerifyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func NewKeysClient(cc *grpc.ClientConn) KeysClient { - return &keysClient{cc} +func (m *VerifyResponse) 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) + } + return len(dAtA) - i, nil } -func (c *keysClient) GenerateKey(ctx context.Context, in *GenRequest, opts ...grpc.CallOption) (*GenResponse, error) { - out := new(GenResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/GenerateKey", in, out, opts...) +func (m *RemoveNameResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *keysClient) PublicKey(ctx context.Context, in *PubRequest, opts ...grpc.CallOption) (*PubResponse, error) { - out := new(PubResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/PublicKey", in, out, opts...) - if err != nil { - return nil, err +func (m *RemoveNameResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RemoveNameResponse) 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) } - return out, nil + return len(dAtA) - i, nil } -func (c *keysClient) Sign(ctx context.Context, in *SignRequest, opts ...grpc.CallOption) (*SignResponse, error) { - out := new(SignResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/Sign", in, out, opts...) +func (m *AddNameResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *keysClient) Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) { - out := new(VerifyResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/Verify", in, out, opts...) - if err != nil { - return nil, err +func (m *AddNameResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AddNameResponse) 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) } - return out, nil + return len(dAtA) - i, nil } -func (c *keysClient) Import(ctx context.Context, in *ImportRequest, opts ...grpc.CallOption) (*ImportResponse, error) { - out := new(ImportResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/Import", in, out, opts...) +func (m *RemoveNameRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *keysClient) ImportJSON(ctx context.Context, in *ImportJSONRequest, opts ...grpc.CallOption) (*ImportResponse, error) { - out := new(ImportResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/ImportJSON", in, out, opts...) - if err != nil { - return nil, err +func (m *RemoveNameRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RemoveNameRequest) 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.KeyName) > 0 { + i -= len(m.KeyName) + copy(dAtA[i:], m.KeyName) + i = encodeVarintKeys(dAtA, i, uint64(len(m.KeyName))) + i-- + dAtA[i] = 0xa } - return out, nil + return len(dAtA) - i, nil } -func (c *keysClient) Export(ctx context.Context, in *ExportRequest, opts ...grpc.CallOption) (*ExportResponse, error) { - out := new(ExportResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/Export", in, out, opts...) +func (m *GenRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *keysClient) Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) { - out := new(HashResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/Hash", in, out, opts...) +func (m *GenRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenRequest) 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.KeyName) > 0 { + i -= len(m.KeyName) + copy(dAtA[i:], m.KeyName) + i = encodeVarintKeys(dAtA, i, uint64(len(m.KeyName))) + i-- + dAtA[i] = 0x1a + } + if len(m.CurveType) > 0 { + i -= len(m.CurveType) + copy(dAtA[i:], m.CurveType) + i = encodeVarintKeys(dAtA, i, uint64(len(m.CurveType))) + i-- + dAtA[i] = 0x12 + } + if len(m.Passphrase) > 0 { + i -= len(m.Passphrase) + copy(dAtA[i:], m.Passphrase) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Passphrase))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GenResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *keysClient) RemoveName(ctx context.Context, in *RemoveNameRequest, opts ...grpc.CallOption) (*RemoveNameResponse, error) { - out := new(RemoveNameResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/RemoveName", in, out, opts...) - if err != nil { - return nil, err +func (m *GenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenResponse) 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) } - return out, nil + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (c *keysClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { - out := new(ListResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/List", in, out, opts...) +func (m *PubRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil +} + +func (m *PubRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *keysClient) AddName(ctx context.Context, in *AddNameRequest, opts ...grpc.CallOption) (*AddNameResponse, error) { - out := new(AddNameResponse) - err := c.cc.Invoke(ctx, "/keys.Keys/AddName", in, out, opts...) +func (m *PubRequest) 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.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PubResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil +} + +func (m *PubResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -// KeysServer is the server API for Keys service. -type KeysServer interface { - GenerateKey(context.Context, *GenRequest) (*GenResponse, error) - PublicKey(context.Context, *PubRequest) (*PubResponse, error) - Sign(context.Context, *SignRequest) (*SignResponse, error) - Verify(context.Context, *VerifyRequest) (*VerifyResponse, error) - Import(context.Context, *ImportRequest) (*ImportResponse, error) - ImportJSON(context.Context, *ImportJSONRequest) (*ImportResponse, error) - Export(context.Context, *ExportRequest) (*ExportResponse, error) - Hash(context.Context, *HashRequest) (*HashResponse, error) - RemoveName(context.Context, *RemoveNameRequest) (*RemoveNameResponse, error) - List(context.Context, *ListRequest) (*ListResponse, error) - AddName(context.Context, *AddNameRequest) (*AddNameResponse, error) +func (m *PubResponse) 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.CurveType) > 0 { + i -= len(m.CurveType) + copy(dAtA[i:], m.CurveType) + i = encodeVarintKeys(dAtA, i, uint64(len(m.CurveType))) + i-- + dAtA[i] = 0x12 + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintKeys(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImportJSONRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -func RegisterKeysServer(s *grpc.Server, srv KeysServer) { - s.RegisterService(&_Keys_serviceDesc, srv) +func (m *ImportJSONRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Keys_GenerateKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GenRequest) - if err := dec(in); err != nil { +func (m *ImportJSONRequest) 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.JSON) > 0 { + i -= len(m.JSON) + copy(dAtA[i:], m.JSON) + i = encodeVarintKeys(dAtA, i, uint64(len(m.JSON))) + i-- + dAtA[i] = 0x12 + } + if len(m.Passphrase) > 0 { + i -= len(m.Passphrase) + copy(dAtA[i:], m.Passphrase) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Passphrase))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImportResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).GenerateKey(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/GenerateKey", + return dAtA[:n], nil +} + +func (m *ImportResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImportResponse) 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) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).GenerateKey(ctx, req.(*GenRequest)) + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Keys_PublicKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PubRequest) - if err := dec(in); err != nil { +func (m *ImportRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).PublicKey(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/PublicKey", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).PublicKey(ctx, req.(*PubRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Keys_Sign_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SignRequest) - if err := dec(in); err != nil { +func (m *ImportRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImportRequest) 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.KeyBytes) > 0 { + i -= len(m.KeyBytes) + copy(dAtA[i:], m.KeyBytes) + i = encodeVarintKeys(dAtA, i, uint64(len(m.KeyBytes))) + i-- + dAtA[i] = 0x22 + } + if len(m.CurveType) > 0 { + i -= len(m.CurveType) + copy(dAtA[i:], m.CurveType) + i = encodeVarintKeys(dAtA, i, uint64(len(m.CurveType))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Passphrase) > 0 { + i -= len(m.Passphrase) + copy(dAtA[i:], m.Passphrase) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Passphrase))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ExportRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).Sign(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/Sign", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).Sign(ctx, req.(*SignRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil +} + +func (m *ExportRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Keys_Verify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(VerifyRequest) - if err := dec(in); err != nil { +func (m *ExportRequest) 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.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Passphrase) > 0 { + i -= len(m.Passphrase) + copy(dAtA[i:], m.Passphrase) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Passphrase))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ExportResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).Verify(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/Verify", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).Verify(ctx, req.(*VerifyRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Keys_Import_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportRequest) - if err := dec(in); err != nil { +func (m *ExportResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExportResponse) 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.CurveType) > 0 { + i -= len(m.CurveType) + copy(dAtA[i:], m.CurveType) + i = encodeVarintKeys(dAtA, i, uint64(len(m.CurveType))) + i-- + dAtA[i] = 0x22 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x1a + } + if len(m.Privatekey) > 0 { + i -= len(m.Privatekey) + copy(dAtA[i:], m.Privatekey) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Privatekey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Publickey) > 0 { + i -= len(m.Publickey) + copy(dAtA[i:], m.Publickey) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Publickey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SignRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).Import(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/Import", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).Import(ctx, req.(*ImportRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil +} + +func (m *SignRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Keys_ImportJSON_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportJSONRequest) - if err := dec(in); err != nil { +func (m *SignRequest) 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.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x22 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if len(m.Passphrase) > 0 { + i -= len(m.Passphrase) + copy(dAtA[i:], m.Passphrase) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Passphrase))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SignResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).ImportJSON(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/ImportJSON", + return dAtA[:n], nil +} + +func (m *SignResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SignResponse) 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) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).ImportJSON(ctx, req.(*ImportJSONRequest)) + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintKeys(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Keys_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExportRequest) - if err := dec(in); err != nil { +func (m *VerifyRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).Export(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/Export", + return dAtA[:n], nil +} + +func (m *VerifyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VerifyRequest) 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) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).Export(ctx, req.(*ExportRequest)) + if m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintKeys(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x1a + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintKeys(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + +func (m *HashRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil +} + +func (m *HashRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Keys_Hash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HashRequest) - if err := dec(in); err != nil { +func (m *HashRequest) 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.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x12 + } + if len(m.Hashtype) > 0 { + i -= len(m.Hashtype) + copy(dAtA[i:], m.Hashtype) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Hashtype))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *HashResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).Hash(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/Hash", + return dAtA[:n], nil +} + +func (m *HashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HashResponse) 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) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).Hash(ctx, req.(*HashRequest)) + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Keys_RemoveName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveNameRequest) - if err := dec(in); err != nil { +func (m *KeyID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).RemoveName(ctx, in) + return dAtA[:n], nil +} + +func (m *KeyID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyID) 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) } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/RemoveName", + if len(m.KeyName) > 0 { + for iNdEx := len(m.KeyName) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.KeyName[iNdEx]) + copy(dAtA[i:], m.KeyName[iNdEx]) + i = encodeVarintKeys(dAtA, i, uint64(len(m.KeyName[iNdEx]))) + i-- + dAtA[i] = 0x12 + } } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).RemoveName(ctx, req.(*RemoveNameRequest)) + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Keys_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) - if err := dec(in); err != nil { +func (m *ListResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).List(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/List", + return dAtA[:n], nil +} + +func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListResponse) 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) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).List(ctx, req.(*ListRequest)) + if len(m.Key) > 0 { + for iNdEx := len(m.Key) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Key[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintKeys(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Keys_AddName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddNameRequest) - if err := dec(in); err != nil { +func (m *AddNameRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(KeysServer).AddName(ctx, in) + return dAtA[:n], nil +} + +func (m *AddNameRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AddNameRequest) 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) } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/keys.Keys/AddName", + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeysServer).AddName(ctx, req.(*AddNameRequest)) + if len(m.Keyname) > 0 { + i -= len(m.Keyname) + copy(dAtA[i:], m.Keyname) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Keyname))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -var _Keys_serviceDesc = grpc.ServiceDesc{ - ServiceName: "keys.Keys", - HandlerType: (*KeysServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GenerateKey", - Handler: _Keys_GenerateKey_Handler, - }, - { - MethodName: "PublicKey", - Handler: _Keys_PublicKey_Handler, - }, - { - MethodName: "Sign", - Handler: _Keys_Sign_Handler, - }, - { - MethodName: "Verify", - Handler: _Keys_Verify_Handler, - }, - { - MethodName: "Import", - Handler: _Keys_Import_Handler, - }, - { - MethodName: "ImportJSON", - Handler: _Keys_ImportJSON_Handler, - }, - { - MethodName: "Export", - Handler: _Keys_Export_Handler, - }, - { - MethodName: "Hash", - Handler: _Keys_Hash_Handler, - }, - { - MethodName: "RemoveName", - Handler: _Keys_RemoveName_Handler, - }, - { - MethodName: "List", - Handler: _Keys_List_Handler, - }, - { - MethodName: "AddName", - Handler: _Keys_AddName_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "keys.proto", +func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { + offset -= sovKeys(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base } - func (m *ListRequest) Size() (n int) { if m == nil { return 0 @@ -2027,15 +2639,2522 @@ func (m *AddNameRequest) Size() (n int) { } func sovKeys(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozKeys(x uint64) (n int) { return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *ListRequest) 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 ErrIntOverflowKeys + } + 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: ListRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *VerifyResponse) 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 ErrIntOverflowKeys + } + 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: VerifyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *RemoveNameResponse) 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 ErrIntOverflowKeys + } + 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: RemoveNameResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RemoveNameResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *AddNameResponse) 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 ErrIntOverflowKeys + } + 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: AddNameResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddNameResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *RemoveNameRequest) 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 ErrIntOverflowKeys + } + 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: RemoveNameRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RemoveNameRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *GenRequest) 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 ErrIntOverflowKeys + } + 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: GenRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Passphrase", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Passphrase = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurveType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurveType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *GenResponse) 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 ErrIntOverflowKeys + } + 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: GenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *PubRequest) 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 ErrIntOverflowKeys + } + 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: PubRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PubRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *PubResponse) 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 ErrIntOverflowKeys + } + 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: PubResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PubResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKey == nil { + m.PublicKey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurveType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurveType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *ImportJSONRequest) 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 ErrIntOverflowKeys + } + 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: ImportJSONRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImportJSONRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Passphrase", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Passphrase = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JSON", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.JSON = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *ImportResponse) 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 ErrIntOverflowKeys + } + 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: ImportResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImportResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *ImportRequest) 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 ErrIntOverflowKeys + } + 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: ImportRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImportRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Passphrase", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Passphrase = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurveType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurveType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyBytes = append(m.KeyBytes[:0], dAtA[iNdEx:postIndex]...) + if m.KeyBytes == nil { + m.KeyBytes = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *ExportRequest) 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 ErrIntOverflowKeys + } + 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: ExportRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExportRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Passphrase", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Passphrase = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *ExportResponse) 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 ErrIntOverflowKeys + } + 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: ExportResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExportResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Publickey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Publickey = append(m.Publickey[:0], dAtA[iNdEx:postIndex]...) + if m.Publickey == nil { + m.Publickey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Privatekey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Privatekey = append(m.Privatekey[:0], dAtA[iNdEx:postIndex]...) + if m.Privatekey == nil { + m.Privatekey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurveType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurveType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *SignRequest) 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 ErrIntOverflowKeys + } + 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: SignRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SignRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Passphrase", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Passphrase = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...) + if m.Message == nil { + m.Message = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *SignResponse) 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 ErrIntOverflowKeys + } + 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: SignResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SignResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &crypto.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *VerifyRequest) 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 ErrIntOverflowKeys + } + 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: VerifyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKey == nil { + m.PublicKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...) + if m.Message == nil { + m.Message = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &crypto.Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *HashRequest) 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 ErrIntOverflowKeys + } + 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: HashRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HashRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hashtype", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hashtype = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...) + if m.Message == nil { + m.Message = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *HashResponse) 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 ErrIntOverflowKeys + } + 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: HashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *KeyID) 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 ErrIntOverflowKeys + } + 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: KeyID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyName = append(m.KeyName, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *ListResponse) 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 ErrIntOverflowKeys + } + 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: ListResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key, &KeyID{}) + if err := m.Key[len(m.Key)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 *AddNameRequest) 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 ErrIntOverflowKeys + } + 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: AddNameRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddNameRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keyname", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keyname = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + 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 ErrInvalidLengthKeys + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + 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 skipKeys(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKeys + } + 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, ErrIntOverflowKeys + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKeys + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthKeys + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupKeys + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthKeys + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") +) diff --git a/keys/keys_grpc.pb.go b/keys/keys_grpc.pb.go new file mode 100644 index 000000000..00f2d1450 --- /dev/null +++ b/keys/keys_grpc.pb.go @@ -0,0 +1,462 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package keys + +import ( + context "context" + + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// KeysClient is the client API for Keys service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type KeysClient interface { + GenerateKey(ctx context.Context, in *GenRequest, opts ...grpc.CallOption) (*GenResponse, error) + PublicKey(ctx context.Context, in *PubRequest, opts ...grpc.CallOption) (*PubResponse, error) + Sign(ctx context.Context, in *SignRequest, opts ...grpc.CallOption) (*SignResponse, error) + Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) + Import(ctx context.Context, in *ImportRequest, opts ...grpc.CallOption) (*ImportResponse, error) + ImportJSON(ctx context.Context, in *ImportJSONRequest, opts ...grpc.CallOption) (*ImportResponse, error) + Export(ctx context.Context, in *ExportRequest, opts ...grpc.CallOption) (*ExportResponse, error) + Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) + RemoveName(ctx context.Context, in *RemoveNameRequest, opts ...grpc.CallOption) (*RemoveNameResponse, error) + List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + AddName(ctx context.Context, in *AddNameRequest, opts ...grpc.CallOption) (*AddNameResponse, error) +} + +type keysClient struct { + cc grpc.ClientConnInterface +} + +func NewKeysClient(cc grpc.ClientConnInterface) KeysClient { + return &keysClient{cc} +} + +func (c *keysClient) GenerateKey(ctx context.Context, in *GenRequest, opts ...grpc.CallOption) (*GenResponse, error) { + out := new(GenResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/GenerateKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) PublicKey(ctx context.Context, in *PubRequest, opts ...grpc.CallOption) (*PubResponse, error) { + out := new(PubResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/PublicKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) Sign(ctx context.Context, in *SignRequest, opts ...grpc.CallOption) (*SignResponse, error) { + out := new(SignResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/Sign", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) { + out := new(VerifyResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/Verify", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) Import(ctx context.Context, in *ImportRequest, opts ...grpc.CallOption) (*ImportResponse, error) { + out := new(ImportResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/Import", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) ImportJSON(ctx context.Context, in *ImportJSONRequest, opts ...grpc.CallOption) (*ImportResponse, error) { + out := new(ImportResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/ImportJSON", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) Export(ctx context.Context, in *ExportRequest, opts ...grpc.CallOption) (*ExportResponse, error) { + out := new(ExportResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/Export", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) { + out := new(HashResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/Hash", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) RemoveName(ctx context.Context, in *RemoveNameRequest, opts ...grpc.CallOption) (*RemoveNameResponse, error) { + out := new(RemoveNameResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/RemoveName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { + out := new(ListResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keysClient) AddName(ctx context.Context, in *AddNameRequest, opts ...grpc.CallOption) (*AddNameResponse, error) { + out := new(AddNameResponse) + err := c.cc.Invoke(ctx, "/keys.Keys/AddName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// KeysServer is the server API for Keys service. +// All implementations must embed UnimplementedKeysServer +// for forward compatibility +type KeysServer interface { + GenerateKey(context.Context, *GenRequest) (*GenResponse, error) + PublicKey(context.Context, *PubRequest) (*PubResponse, error) + Sign(context.Context, *SignRequest) (*SignResponse, error) + Verify(context.Context, *VerifyRequest) (*VerifyResponse, error) + Import(context.Context, *ImportRequest) (*ImportResponse, error) + ImportJSON(context.Context, *ImportJSONRequest) (*ImportResponse, error) + Export(context.Context, *ExportRequest) (*ExportResponse, error) + Hash(context.Context, *HashRequest) (*HashResponse, error) + RemoveName(context.Context, *RemoveNameRequest) (*RemoveNameResponse, error) + List(context.Context, *ListRequest) (*ListResponse, error) + AddName(context.Context, *AddNameRequest) (*AddNameResponse, error) + mustEmbedUnimplementedKeysServer() +} + +// UnimplementedKeysServer must be embedded to have forward compatible implementations. +type UnimplementedKeysServer struct { +} + +func (UnimplementedKeysServer) GenerateKey(context.Context, *GenRequest) (*GenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateKey not implemented") +} +func (UnimplementedKeysServer) PublicKey(context.Context, *PubRequest) (*PubResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PublicKey not implemented") +} +func (UnimplementedKeysServer) Sign(context.Context, *SignRequest) (*SignResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sign not implemented") +} +func (UnimplementedKeysServer) Verify(context.Context, *VerifyRequest) (*VerifyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Verify not implemented") +} +func (UnimplementedKeysServer) Import(context.Context, *ImportRequest) (*ImportResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Import not implemented") +} +func (UnimplementedKeysServer) ImportJSON(context.Context, *ImportJSONRequest) (*ImportResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportJSON not implemented") +} +func (UnimplementedKeysServer) Export(context.Context, *ExportRequest) (*ExportResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Export not implemented") +} +func (UnimplementedKeysServer) Hash(context.Context, *HashRequest) (*HashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Hash not implemented") +} +func (UnimplementedKeysServer) RemoveName(context.Context, *RemoveNameRequest) (*RemoveNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveName not implemented") +} +func (UnimplementedKeysServer) List(context.Context, *ListRequest) (*ListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (UnimplementedKeysServer) AddName(context.Context, *AddNameRequest) (*AddNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddName not implemented") +} +func (UnimplementedKeysServer) mustEmbedUnimplementedKeysServer() {} + +// UnsafeKeysServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to KeysServer will +// result in compilation errors. +type UnsafeKeysServer interface { + mustEmbedUnimplementedKeysServer() +} + +func RegisterKeysServer(s grpc.ServiceRegistrar, srv KeysServer) { + s.RegisterService(&Keys_ServiceDesc, srv) +} + +func _Keys_GenerateKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).GenerateKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/GenerateKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).GenerateKey(ctx, req.(*GenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_PublicKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PubRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).PublicKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/PublicKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).PublicKey(ctx, req.(*PubRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_Sign_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SignRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).Sign(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/Sign", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).Sign(ctx, req.(*SignRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_Verify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).Verify(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/Verify", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).Verify(ctx, req.(*VerifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_Import_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).Import(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/Import", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).Import(ctx, req.(*ImportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_ImportJSON_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportJSONRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).ImportJSON(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/ImportJSON", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).ImportJSON(ctx, req.(*ImportJSONRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).Export(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/Export", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).Export(ctx, req.(*ExportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_Hash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).Hash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/Hash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).Hash(ctx, req.(*HashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_RemoveName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).RemoveName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/RemoveName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).RemoveName(ctx, req.(*RemoveNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).List(ctx, req.(*ListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Keys_AddName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeysServer).AddName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keys.Keys/AddName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeysServer).AddName(ctx, req.(*AddNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Keys_ServiceDesc is the grpc.ServiceDesc for Keys service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Keys_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "keys.Keys", + HandlerType: (*KeysServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GenerateKey", + Handler: _Keys_GenerateKey_Handler, + }, + { + MethodName: "PublicKey", + Handler: _Keys_PublicKey_Handler, + }, + { + MethodName: "Sign", + Handler: _Keys_Sign_Handler, + }, + { + MethodName: "Verify", + Handler: _Keys_Verify_Handler, + }, + { + MethodName: "Import", + Handler: _Keys_Import_Handler, + }, + { + MethodName: "ImportJSON", + Handler: _Keys_ImportJSON_Handler, + }, + { + MethodName: "Export", + Handler: _Keys_Export_Handler, + }, + { + MethodName: "Hash", + Handler: _Keys_Hash_Handler, + }, + { + MethodName: "RemoveName", + Handler: _Keys_RemoveName_Handler, + }, + { + MethodName: "List", + Handler: _Keys_List_Handler, + }, + { + MethodName: "AddName", + Handler: _Keys_AddName_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "keys.proto", +} diff --git a/keys/memory_key_store.go b/keys/memory_key_store.go new file mode 100644 index 000000000..e2861204e --- /dev/null +++ b/keys/memory_key_store.go @@ -0,0 +1,96 @@ +package keys + +import ( + "context" + "crypto/rand" + "fmt" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/crypto" +) + +type MemoryKeyStore struct { + keyByAddress map[crypto.Address]crypto.PrivateKey + keyByName map[string]crypto.PrivateKey +} + +func NewMemoryKeyStore(privateAccounts ...*acm.PrivateAccount) *MemoryKeyStore { + mks := &MemoryKeyStore{ + keyByAddress: make(map[crypto.Address]crypto.PrivateKey), + keyByName: make(map[string]crypto.PrivateKey), + } + for _, pa := range privateAccounts { + mks.keyByAddress[pa.GetAddress()] = pa.PrivateKey() + } + return mks +} + +func (mks *MemoryKeyStore) GetAddressForKeyName(keyName string) (crypto.Address, error) { + key, ok := mks.keyByName[keyName] + if !ok { + return crypto.Address{}, fmt.Errorf("could not find key with name %s", keyName) + } + return key.GetPublicKey().GetAddress(), nil +} + +func (mks *MemoryKeyStore) GenerateKey(ctx context.Context, in *GenRequest) (*GenResponse, error) { + curveType, err := crypto.CurveTypeFromString(in.CurveType) + if err != nil { + return nil, fmt.Errorf("unknown curve type '%s'", in.CurveType) + } + key, err := crypto.GeneratePrivateKey(rand.Reader, curveType) + if err != nil { + return nil, fmt.Errorf("could not generate key: %w", err) + } + + address := key.GetPublicKey().GetAddress() + mks.keyByAddress[address] = key + if in.KeyName != "" { + mks.keyByName[in.KeyName] = key + } + + return &GenResponse{ + Address: address.String(), + }, nil +} + +func (mks *MemoryKeyStore) PublicKey(ctx context.Context, in *PubRequest) (*PubResponse, error) { + key, err := mks.getKey(in.Name, in.Address) + if err != nil { + return nil, err + } + return &PubResponse{ + CurveType: key.CurveType.String(), + PublicKey: key.PublicKey, + }, nil +} + +func (mks *MemoryKeyStore) Sign(ctx context.Context, in *SignRequest) (*SignResponse, error) { + key, err := mks.getKey(in.Name, in.Address) + if err != nil { + return nil, err + } + signature, err := key.Sign(in.Message) + if err != nil { + return nil, fmt.Errorf("could not sign message: %w", err) + } + return &SignResponse{ + Signature: signature, + }, nil +} + +// Get a stringly referenced key first by name, then by address +func (mks *MemoryKeyStore) getKey(name string, addressHex string) (*crypto.PrivateKey, error) { + key, ok := mks.keyByName[name] + if !ok { + address, err := crypto.AddressFromHexString(addressHex) + if err != nil { + return nil, fmt.Errorf("could not get PublicKey: %w", err) + } + key, ok = mks.keyByAddress[address] + if !ok { + return nil, fmt.Errorf("could not find key with address %v: %w", address, err) + } + } + return &key, nil +} diff --git a/keys/mock/key.go b/keys/mock/key.go deleted file mode 100644 index 9f44e6ebe..000000000 --- a/keys/mock/key.go +++ /dev/null @@ -1,98 +0,0 @@ -package mock - -import ( - "crypto/rand" - "encoding/json" - "fmt" - - "github.com/hyperledger/burrow/acm" - "github.com/hyperledger/burrow/crypto" - - "github.com/pkg/errors" - "golang.org/x/crypto/ed25519" -) - -// Mock ed25510 key for mock keys client -// Simple ed25519 key structure for mock purposes with ripemd160 address -type Key struct { - Name string - Address crypto.Address - PublicKey []byte - PrivateKey []byte -} - -func newKey(name string) (*Key, error) { - key := &Key{ - Name: name, - PublicKey: make([]byte, ed25519.PublicKeySize), - PrivateKey: make([]byte, ed25519.PrivateKeySize), - } - // this is a mock key, so the entropy of the source is purely - // for testing - publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader) - if err != nil { - return nil, err - } - copy(key.PrivateKey[:], privateKey[:]) - copy(key.PublicKey[:], publicKey[:]) - - pk, err := crypto.PublicKeyFromBytes(publicKey, crypto.CurveTypeEd25519) - if err != nil { - return nil, err - } - - key.Address, err = crypto.AddressFromBytes(pk.GetAddress().Bytes()) - if err != nil { - return nil, err - } - - if err != nil { - return nil, err - } - if key.Name == "" { - key.Name = key.Address.String() - } - return key, nil -} - -func mockKeyFromPrivateAccount(privateAccount *acm.PrivateAccount) *Key { - if privateAccount.PrivateKey().CurveType != crypto.CurveTypeEd25519 { - panic(fmt.Errorf("mock key client only supports ed25519 private keys at present")) - } - key := &Key{ - Name: privateAccount.GetAddress().String(), - Address: privateAccount.GetAddress(), - PublicKey: privateAccount.GetPublicKey().PublicKey, - PrivateKey: privateAccount.PrivateKey().PrivateKey, - } - return key -} - -func (key *Key) Sign(message []byte) (*crypto.Signature, error) { - return crypto.SignatureFromBytes(ed25519.Sign(key.PrivateKey, message), crypto.CurveTypeEd25519) -} - -type PrivateKeyplainKeyJSON struct { - Plain []byte -} - -// TODO: remove after merging keys taken from there to match serialisation -type plainKeyJSON struct { - Type string - Address string - PrivateKey PrivateKeyplainKeyJSON -} - -// Returns JSON string compatible with that stored by monax-keys -func (key *Key) MonaxKeysJSON() string { - jsonKey := plainKeyJSON{ - Address: key.Address.String(), - Type: "ed25519", - PrivateKey: PrivateKeyplainKeyJSON{Plain: key.PrivateKey}, - } - bs, err := json.Marshal(jsonKey) - if err != nil { - return errors.Wrap(err, "could not create monax key json").Error() - } - return string(bs) -} diff --git a/keys/mock/key_client.go b/keys/mock/key_client.go deleted file mode 100644 index 34be8f2ed..000000000 --- a/keys/mock/key_client.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package mock - -import ( - "fmt" - - "github.com/hyperledger/burrow/acm" - "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/keys" -) - -//--------------------------------------------------------------------- -// Mock client for replacing signing done by monax-keys - -// Implementation assertion -var _ keys.KeyClient = (*KeyClient)(nil) - -type KeyClient struct { - knownKeys map[crypto.Address]*Key -} - -func NewKeyClient(privateAccounts ...*acm.PrivateAccount) *KeyClient { - client := &KeyClient{ - knownKeys: make(map[crypto.Address]*Key), - } - for _, pa := range privateAccounts { - client.knownKeys[pa.GetAddress()] = mockKeyFromPrivateAccount(pa) - } - return client -} - -func (mkc *KeyClient) NewKey(name string) crypto.Address { - // Only tests ED25519 curve and ripemd160. - key, err := newKey(name) - if err != nil { - panic(fmt.Sprintf("Mocked key client failed on key generation: %s", err)) - } - mkc.knownKeys[key.Address] = key - return key.Address -} - -func (mkc *KeyClient) Sign(signAddress crypto.Address, message []byte) (*crypto.Signature, error) { - key := mkc.knownKeys[signAddress] - if key == nil { - return nil, fmt.Errorf("unknown address (%s)", signAddress) - } - return key.Sign(message) -} - -func (mkc *KeyClient) PublicKey(address crypto.Address) (crypto.PublicKey, error) { - key := mkc.knownKeys[address] - if key == nil { - return crypto.PublicKey{}, fmt.Errorf("unknown address (%s)", address) - } - return crypto.PublicKeyFromBytes(key.PublicKey, crypto.CurveTypeEd25519) -} - -func (mkc *KeyClient) Generate(keyName string, curve crypto.CurveType) (crypto.Address, error) { - return mkc.NewKey(keyName), nil -} - -func (mkc *KeyClient) GetAddressForKeyName(keyName string) (crypto.Address, error) { - for _, m := range mkc.knownKeys { - if m.Name == keyName { - return m.Address, nil - } - } - - return crypto.Address{}, nil -} - -func (mkc *KeyClient) HealthCheck() error { - return nil -} - -func (mkc *KeyClient) Keys() []*Key { - var knownKeys []*Key - for _, key := range mkc.knownKeys { - knownKeys = append(knownKeys, key) - } - return knownKeys -} diff --git a/keys/mock/key_client_test.go b/keys/mock/key_client_test.go deleted file mode 100644 index 72dc557e7..000000000 --- a/keys/mock/key_client_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package mock - -import ( - "testing" - - "encoding/json" - - "github.com/hyperledger/burrow/crypto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestMockKey_MonaxKeyJSON(t *testing.T) { - key, err := newKey("monax-key-test") - require.NoError(t, err) - monaxKey := key.MonaxKeysJSON() - t.Logf("key is: %v", monaxKey) - keyJSON := &plainKeyJSON{} - err = json.Unmarshal([]byte(monaxKey), keyJSON) - require.NoError(t, err) - // byte length of UUID string = 16 * 2 + 4 = 36 - assert.Equal(t, key.Address.String(), keyJSON.Address) - assert.Equal(t, key.PrivateKey, keyJSON.PrivateKey.Plain) - assert.Equal(t, string(crypto.CurveTypeEd25519.String()), keyJSON.Type) -} diff --git a/keys/server.go b/keys/server.go index 975d58244..a731b51c9 100644 --- a/keys/server.go +++ b/keys/server.go @@ -20,14 +20,14 @@ import ( func StandAloneServer(keysDir string, AllowBadFilePermissions bool) *grpc.Server { grpcServer := grpc.NewServer() - RegisterKeysServer(grpcServer, NewKeyStore(keysDir, AllowBadFilePermissions)) + RegisterKeysServer(grpcServer, NewFilesystemKeyStore(keysDir, AllowBadFilePermissions)) return grpcServer } //------------------------------------------------------------------------ // handlers -func (k *KeyStore) GenerateKey(ctx context.Context, in *GenRequest) (*GenResponse, error) { +func (k *FilesystemKeyStore) GenerateKey(ctx context.Context, in *GenRequest) (*GenResponse, error) { curveT, err := crypto.CurveTypeFromString(in.CurveType) if err != nil { return nil, err @@ -49,7 +49,7 @@ func (k *KeyStore) GenerateKey(ctx context.Context, in *GenRequest) (*GenRespons return &GenResponse{Address: addrH}, nil } -func (k *KeyStore) Export(ctx context.Context, in *ExportRequest) (*ExportResponse, error) { +func (k *FilesystemKeyStore) Export(ctx context.Context, in *ExportRequest) (*ExportResponse, error) { addr, err := getNameAddr(k.keysDirPath, in.GetName(), in.GetAddress()) if err != nil { @@ -75,7 +75,7 @@ func (k *KeyStore) Export(ctx context.Context, in *ExportRequest) (*ExportRespon }, nil } -func (k *KeyStore) PublicKey(ctx context.Context, in *PubRequest) (*PubResponse, error) { +func (k *FilesystemKeyStore) PublicKey(ctx context.Context, in *PubRequest) (*PubResponse, error) { addr, err := getNameAddr(k.keysDirPath, in.GetName(), in.GetAddress()) if err != nil { return nil, err @@ -95,7 +95,7 @@ func (k *KeyStore) PublicKey(ctx context.Context, in *PubRequest) (*PubResponse, return &PubResponse{CurveType: key.CurveType.String(), PublicKey: key.Pubkey()}, nil } -func (k *KeyStore) Sign(ctx context.Context, in *SignRequest) (*SignResponse, error) { +func (k *FilesystemKeyStore) Sign(ctx context.Context, in *SignRequest) (*SignResponse, error) { addr, err := getNameAddr(k.keysDirPath, in.GetName(), in.GetAddress()) if err != nil { return nil, err @@ -118,7 +118,7 @@ func (k *KeyStore) Sign(ctx context.Context, in *SignRequest) (*SignResponse, er return &SignResponse{Signature: sig}, err } -func (k *KeyStore) Verify(ctx context.Context, in *VerifyRequest) (*VerifyResponse, error) { +func (k *FilesystemKeyStore) Verify(ctx context.Context, in *VerifyRequest) (*VerifyResponse, error) { if in.GetPublicKey() == nil { return nil, fmt.Errorf("must provide a pubkey") } @@ -142,7 +142,7 @@ func (k *KeyStore) Verify(ctx context.Context, in *VerifyRequest) (*VerifyRespon return &VerifyResponse{}, nil } -func (k *KeyStore) Hash(ctx context.Context, in *HashRequest) (*HashResponse, error) { +func (k *FilesystemKeyStore) Hash(ctx context.Context, in *HashRequest) (*HashResponse, error) { var hasher hash.Hash switch in.GetHashtype() { case "ripemd160": @@ -159,9 +159,9 @@ func (k *KeyStore) Hash(ctx context.Context, in *HashRequest) (*HashResponse, er return &HashResponse{Hash: hex.EncodeUpperToString(hasher.Sum(nil))}, nil } -func (k *KeyStore) ImportJSON(ctx context.Context, in *ImportJSONRequest) (*ImportResponse, error) { +func (k *FilesystemKeyStore) ImportJSON(ctx context.Context, in *ImportJSONRequest) (*ImportResponse, error) { keyJSON := []byte(in.GetJSON()) - addr := IsValidKeyJson(keyJSON) + addr := isValidKeyJson(keyJSON) if addr != nil { _, err := writeKey(k.keysDirPath, addr, keyJSON) if err != nil { @@ -209,7 +209,7 @@ func (k *KeyStore) ImportJSON(ctx context.Context, in *ImportJSONRequest) (*Impo return &ImportResponse{Address: hex.EncodeUpperToString(addr)}, nil } -func (k *KeyStore) Import(ctx context.Context, in *ImportRequest) (*ImportResponse, error) { +func (k *FilesystemKeyStore) Import(ctx context.Context, in *ImportRequest) (*ImportResponse, error) { curveT, err := crypto.CurveTypeFromString(in.GetCurveType()) if err != nil { return nil, err @@ -232,7 +232,7 @@ func (k *KeyStore) Import(ctx context.Context, in *ImportRequest) (*ImportRespon return &ImportResponse{Address: hex.EncodeUpperToString(key.Address[:])}, nil } -func (k *KeyStore) List(ctx context.Context, in *ListRequest) (*ListResponse, error) { +func (k *FilesystemKeyStore) List(ctx context.Context, in *ListRequest) (*ListResponse, error) { byname, err := coreNameList(k.keysDirPath) if err != nil { return nil, err @@ -259,7 +259,7 @@ func (k *KeyStore) List(ctx context.Context, in *ListRequest) (*ListResponse, er if err != nil { return nil, err } - addrs, err := GetAllAddresses(datadir) + addrs, err := getAllAddresses(datadir) if err != nil { return nil, err } @@ -284,7 +284,7 @@ func getAddressNames(address string, byname map[string]string) []string { return names } -func (k *KeyStore) RemoveName(ctx context.Context, in *RemoveNameRequest) (*RemoveNameResponse, error) { +func (k *FilesystemKeyStore) RemoveName(ctx context.Context, in *RemoveNameRequest) (*RemoveNameResponse, error) { if in.GetKeyName() == "" { return nil, fmt.Errorf("please specify a name") } @@ -292,7 +292,7 @@ func (k *KeyStore) RemoveName(ctx context.Context, in *RemoveNameRequest) (*Remo return &RemoveNameResponse{}, coreNameRm(k.keysDirPath, in.GetKeyName()) } -func (k *KeyStore) AddName(ctx context.Context, in *AddNameRequest) (*AddNameResponse, error) { +func (k *FilesystemKeyStore) AddName(ctx context.Context, in *AddNameRequest) (*AddNameResponse, error) { if in.GetKeyname() == "" { return nil, fmt.Errorf("please specify a name") } diff --git a/logging/logconfig/config.go b/logging/logconfig/config.go index 49341b6ef..e4aa239ab 100644 --- a/logging/logconfig/config.go +++ b/logging/logconfig/config.go @@ -43,6 +43,16 @@ func New() *LoggingConfig { } } +func (lc *LoggingConfig) WithTrace() *LoggingConfig { + lc.Trace = true + return lc +} + +func (lc *LoggingConfig) None() *LoggingConfig { + lc.RootSink = nil + return lc +} + func (lc *LoggingConfig) Root(configure func(sink *SinkConfig) *SinkConfig) *LoggingConfig { lc.RootSink = configure(Sink()) return lc @@ -65,8 +75,16 @@ func (lc *LoggingConfig) JSONString() string { return JSONString(lc) } +func (lc *LoggingConfig) MustLogger() *logging.Logger { + logger, err := lc.Logger() + if err != nil { + panic(err) + } + return logger +} + // Obtain a logger from this LoggingConfig -func (lc *LoggingConfig) NewLogger() (*logging.Logger, error) { +func (lc *LoggingConfig) Logger() (*logging.Logger, error) { outputLogger, errCh, err := newLogger(lc) if err != nil { return nil, err @@ -101,7 +119,7 @@ func newLogger(loggingConfig *LoggingConfig) (log.Logger, channels.Channel, erro return nil, nil, err } var errCh channels.Channel = channels.NewDeadChannel() - var logger log.Logger = loggers.BurrowFormatLogger(outputLogger) + var logger log.Logger = loggers.NewBurrowFormatLogger(outputLogger) if loggingConfig.NonBlocking { logger, errCh = loggers.NonBlockingLogger(logger) return logger, errCh, nil diff --git a/logging/logconfig/sinks.go b/logging/logconfig/sinks.go index 2d7de7c91..08561a871 100644 --- a/logging/logconfig/sinks.go +++ b/logging/logconfig/sinks.go @@ -6,6 +6,7 @@ import ( "github.com/eapache/channels" "github.com/go-kit/kit/log" + "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/loggers" "github.com/hyperledger/burrow/logging/structure" ) @@ -159,19 +160,42 @@ func Sink() *SinkConfig { return &SinkConfig{} } -func (sinkConfig *SinkConfig) AddSinks(sinks ...*SinkConfig) *SinkConfig { - sinkConfig.Sinks = append(sinkConfig.Sinks, sinks...) - return sinkConfig +func (sc *SinkConfig) MustLogger() *logging.Logger { + return sc.LoggingConfig().MustLogger() } -func (sinkConfig *SinkConfig) SetTransform(transform *TransformConfig) *SinkConfig { - sinkConfig.Transform = transform - return sinkConfig +func (sc *SinkConfig) Logger() (*logging.Logger, error) { + return sc.LoggingConfig().Logger() } -func (sinkConfig *SinkConfig) SetOutput(output *OutputConfig) *SinkConfig { - sinkConfig.Output = output - return sinkConfig +// Wrap this sink as RootSink of LoggingCOnfig +func (sc *SinkConfig) LoggingConfig() *LoggingConfig { + lc := New() + lc.RootSink = sc + return lc +} + +func (sc *SinkConfig) AddSinks(sinks ...*SinkConfig) *SinkConfig { + sc.Sinks = append(sc.Sinks, sinks...) + return sc +} + +func (sc *SinkConfig) SetTransform(transform *TransformConfig) *SinkConfig { + sc.Transform = transform + return sc +} + +func (sc *SinkConfig) FilterScope(scope string) *SinkConfig { + return sc.SetTransform(FilterTransform(IncludeWhenAllMatch, structure.ScopeKey, scope)) +} + +func (sc *SinkConfig) Terminal() *SinkConfig { + return sc.SetOutput(StderrOutput().SetFormat(TerminalFormat)) +} + +func (sc *SinkConfig) SetOutput(output *OutputConfig) *SinkConfig { + sc.Output = output + return sc } func (outputConfig *OutputConfig) SetFormat(format string) *OutputConfig { @@ -298,8 +322,11 @@ func VectoriseTransform() *TransformConfig { } // Logger formation -func (sinkConfig *SinkConfig) BuildLogger() (log.Logger, map[string]*loggers.CaptureLogger, error) { - return BuildLoggerFromSinkConfig(sinkConfig, make(map[string]*loggers.CaptureLogger)) +func (sc *SinkConfig) BuildLogger() (log.Logger, map[string]*loggers.CaptureLogger, error) { + if sc == nil { + return log.NewNopLogger(), nil, nil + } + return BuildLoggerFromSinkConfig(sc, make(map[string]*loggers.CaptureLogger)) } func BuildLoggerFromSinkConfig(sinkConfig *SinkConfig, captures map[string]*loggers.CaptureLogger) (log.Logger, diff --git a/logging/logger.go b/logging/logger.go index 024aa17b4..4e697a6e1 100644 --- a/logging/logger.go +++ b/logging/logger.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package logging @@ -70,6 +59,9 @@ func NewNoopLogger() *Logger { // Handle signals func (l *Logger) Sync() error { + if l == nil { + return nil + } // Send over input channels (to pass through any capture loggers) err := structure.Sync(l.Info) if err != nil { @@ -79,6 +71,9 @@ func (l *Logger) Sync() error { } func (l *Logger) Reload() error { + if l == nil { + return nil + } // Send directly to output logger return structure.Reload(l.Output) } @@ -92,6 +87,9 @@ func (l *Logger) Reload() error { // assumption about the name or signature of the logging method(s). // See InfoTraceLogger func (l *Logger) With(keyvals ...interface{}) *Logger { + if l == nil { + return nil + } return &Logger{ Output: l.Output, Info: log.With(l.Info, keyvals...), @@ -101,6 +99,9 @@ func (l *Logger) With(keyvals ...interface{}) *Logger { // Establish a context on the Info channel keeping Trace the same func (l *Logger) WithInfo(keyvals ...interface{}) *Logger { + if l == nil { + return nil + } return &Logger{ Output: l.Output, Info: log.With(l.Info, keyvals...), @@ -110,6 +111,9 @@ func (l *Logger) WithInfo(keyvals ...interface{}) *Logger { // Establish a context on the Trace channel keeping Info the same func (l *Logger) WithTrace(keyvals ...interface{}) *Logger { + if l == nil { + return nil + } return &Logger{ Output: l.Output, Info: l.Info, @@ -118,6 +122,9 @@ func (l *Logger) WithTrace(keyvals ...interface{}) *Logger { } func (l *Logger) WithPrefix(keyvals ...interface{}) *Logger { + if l == nil { + return nil + } return &Logger{ Output: l.Output, Info: log.WithPrefix(l.Info, keyvals...), @@ -127,19 +134,44 @@ func (l *Logger) WithPrefix(keyvals ...interface{}) *Logger { // Hot swap the underlying outputLogger with another one to re-route messages func (l *Logger) SwapOutput(infoLogger log.Logger) { + if l == nil { + return + } l.Output.Swap(infoLogger) } // Record structured Info log line with a message func (l *Logger) InfoMsg(message string, keyvals ...interface{}) error { + if l == nil { + return nil + } return Msg(l.Info, message, keyvals...) } // Record structured Trace log line with a message func (l *Logger) TraceMsg(message string, keyvals ...interface{}) error { + if l == nil { + return nil + } return Msg(l.Trace, message, keyvals...) } +// Record structured Info log line +func (l *Logger) InfoLog(keyvals ...interface{}) error { + if l == nil { + return nil + } + return l.Info.Log(keyvals...) +} + +// Record structured Trace log line +func (l *Logger) TraceLog(keyvals ...interface{}) error { + if l == nil { + return nil + } + return l.Trace.Log(keyvals...) +} + // Establish or extend the scope of this logger by appending scopeName to the Scope vector. // Like With the logging scope is append only but can be used to provide parenthetical scopes by hanging on to the // parent scope and using once the scope has been exited. The scope mechanism does is agnostic to the type of scope diff --git a/logging/logger_test.go b/logging/logger_test.go index cde075ff4..1f427d7a4 100644 --- a/logging/logger_test.go +++ b/logging/logger_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package logging diff --git a/logging/loggers/burrow_format_logger.go b/logging/loggers/burrow_format_logger.go index c4ccfb497..d89b304e5 100644 --- a/logging/loggers/burrow_format_logger.go +++ b/logging/loggers/burrow_format_logger.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package loggers @@ -33,7 +22,27 @@ import ( // we control and generic output loggers are unlikely to know about. type burrowFormatLogger struct { sync.Mutex - logger log.Logger + logger log.Logger + options opt +} + +type opt byte + +func (o opt) enabled(q opt) bool { + return o&q > 0 +} + +const ( + DefaultOptions opt = iota + StringifyValues +) + +func NewBurrowFormatLogger(logger log.Logger, options ...opt) *burrowFormatLogger { + bfl := &burrowFormatLogger{logger: logger} + for _, option := range options { + bfl.options |= option + } + return bfl } var _ log.Logger = &burrowFormatLogger{} @@ -53,7 +62,10 @@ func (bfl *burrowFormatLogger) Log(keyvals ...interface{}) error { case []byte: value = hex.EncodeUpperToString(v) } - return structure.StringifyKey(key), value + if bfl.options.enabled(StringifyValues) { + value = structure.Stringify(value) + } + return structure.Stringify(key), value }) if err != nil { return err @@ -62,7 +74,3 @@ func (bfl *burrowFormatLogger) Log(keyvals ...interface{}) error { defer bfl.Unlock() return bfl.logger.Log(keyvals...) } - -func BurrowFormatLogger(logger log.Logger) *burrowFormatLogger { - return &burrowFormatLogger{logger: logger} -} diff --git a/logging/loggers/channel_logger.go b/logging/loggers/channel_logger.go index 26c9145b9..c3363b07d 100644 --- a/logging/loggers/channel_logger.go +++ b/logging/loggers/channel_logger.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package loggers diff --git a/logging/loggers/channel_logger_test.go b/logging/loggers/channel_logger_test.go index ee8a105e9..41ecef8a8 100644 --- a/logging/loggers/channel_logger_test.go +++ b/logging/loggers/channel_logger_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package loggers diff --git a/logging/loggers/multiple_output_logger.go b/logging/loggers/multiple_output_logger.go index 7fe692486..0d621d9a2 100644 --- a/logging/loggers/multiple_output_logger.go +++ b/logging/loggers/multiple_output_logger.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package loggers diff --git a/logging/loggers/multiple_output_logger_test.go b/logging/loggers/multiple_output_logger_test.go index ad41b3ca5..fbf1ebf8f 100644 --- a/logging/loggers/multiple_output_logger_test.go +++ b/logging/loggers/multiple_output_logger_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package loggers diff --git a/logging/loggers/stream_logger.go b/logging/loggers/stream_logger.go index 7e3c3fad7..98a485b1c 100644 --- a/logging/loggers/stream_logger.go +++ b/logging/loggers/stream_logger.go @@ -15,56 +15,66 @@ type Syncable interface { } func NewStreamLogger(writer io.Writer, format string) (log.Logger, error) { - var logger log.Logger - var err error switch format { case "": return NewStreamLogger(writer, DefaultFormat) case JSONFormat: - logger = log.NewJSONLogger(writer) + return NewJSONLogger(writer), nil case LogfmtFormat: - logger = log.NewLogfmtLogger(writer) + return NewLogfmtLogger(writer), nil case TerminalFormat: - logger = term.NewLogger(writer, log.NewLogfmtLogger, func(keyvals ...interface{}) term.FgBgColor { - switch structure.Value(keyvals, structure.ChannelKey) { - case structure.TraceChannelName: - return term.FgBgColor{Fg: term.DarkGreen} - default: - return term.FgBgColor{Fg: term.Yellow} - } - }) + return NewTerminalLogger(writer), nil default: - logger, err = NewTemplateLogger(writer, format, []byte{}) - if err != nil { - return nil, fmt.Errorf("did not recognise format '%s' as named format and could not parse as "+ - "template: %v", format, err) - } + return NewTemplateLogger(writer, format, []byte{}) } - return log.LoggerFunc(func(keyvals ...interface{}) error { - switch structure.Signal(keyvals) { - case structure.SyncSignal: - if s, ok := writer.(Syncable); ok { - return s.Sync() - } - // Don't log signals - return nil +} + +func NewJSONLogger(writer io.Writer) log.Logger { + return interceptSync(writer, log.NewJSONLogger(writer)) +} + +func NewLogfmtLogger(writer io.Writer) log.Logger { + return interceptSync(writer, log.NewLogfmtLogger(writer)) +} + +func NewTerminalLogger(writer io.Writer) log.Logger { + logger := term.NewLogger(writer, log.NewLogfmtLogger, func(keyvals ...interface{}) term.FgBgColor { + switch structure.Value(keyvals, structure.ChannelKey) { + case structure.TraceChannelName: + return term.FgBgColor{Fg: term.DarkGreen} default: - return logger.Log(keyvals...) + return term.FgBgColor{Fg: term.Yellow} } - }), nil + }) + return interceptSync(writer, NewBurrowFormatLogger(logger, StringifyValues)) } func NewTemplateLogger(writer io.Writer, textTemplate string, recordSeparator []byte) (log.Logger, error) { tmpl, err := template.New("template-logger").Parse(textTemplate) if err != nil { - return nil, err + return nil, fmt.Errorf("could not parse '%s' as a text template: %v", textTemplate, err) } - return log.LoggerFunc(func(keyvals ...interface{}) error { + logger := log.LoggerFunc(func(keyvals ...interface{}) error { err := tmpl.Execute(writer, structure.KeyValuesMap(keyvals)) if err == nil { _, err = writer.Write(recordSeparator) } return err - }), nil + }) + return interceptSync(writer, logger), nil +} +func interceptSync(writer io.Writer, logger log.Logger) log.Logger { + return log.LoggerFunc(func(keyvals ...interface{}) error { + switch structure.Signal(keyvals) { + case structure.SyncSignal: + if s, ok := writer.(Syncable); ok { + return s.Sync() + } + // Don't log signals + return nil + default: + return logger.Log(keyvals...) + } + }) } diff --git a/logging/loggers/vector_valued_logger.go b/logging/loggers/vector_valued_logger.go index 26f61c1ff..bfea8da78 100644 --- a/logging/loggers/vector_valued_logger.go +++ b/logging/loggers/vector_valued_logger.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package loggers diff --git a/logging/loggers/vector_valued_logger_test.go b/logging/loggers/vector_valued_logger_test.go index 8b60e3596..22221a2c4 100644 --- a/logging/loggers/vector_valued_logger_test.go +++ b/logging/loggers/vector_valued_logger_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package loggers diff --git a/logging/structure/structure.go b/logging/structure/structure.go index a4d5e2461..6a1e3d02e 100644 --- a/logging/structure/structure.go +++ b/logging/structure/structure.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package structure @@ -76,7 +65,7 @@ func ValuesAndContext(keyvals []interface{}, for k := 0; k < len(keys); k++ { if keyvals[i] == keys[k] { // Pull the matching key-value pair into vals to return - vals[StringifyKey(keys[k])] = keyvals[i+1] + vals[Stringify(keys[k])] = keyvals[i+1] // Delete the key once it's found keys = DeleteAt(keys, k) // And remove the key-value pair from context @@ -96,7 +85,7 @@ func KeyValuesMap(keyvals []interface{}) map[string]interface{} { length := len(keyvals) / 2 vals := make(map[string]interface{}, length) for i := 0; i < 2*length; i += 2 { - vals[StringifyKey(keyvals[i])] = keyvals[i+1] + vals[Stringify(keyvals[i])] = keyvals[i+1] } return vals } @@ -251,19 +240,19 @@ func DeleteAt(slice []interface{}, i int) []interface{} { } // Provides a canonical way to stringify keys -func StringifyKey(key interface{}) string { - switch key { +func Stringify(v interface{}) string { + switch v { // For named keys we want to handle explicitly default: // Stringify keys - switch k := key.(type) { + switch k := v.(type) { case string: return k case fmt.Stringer: return k.String() default: - return fmt.Sprint(key) + return fmt.Sprint(v) } } } diff --git a/logging/structure/structure_test.go b/logging/structure/structure_test.go index e8064908b..34414e1de 100644 --- a/logging/structure/structure_test.go +++ b/logging/structure/structure_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package structure diff --git a/logging/terminal.go b/logging/terminal.go index 156f602d7..1229287c5 100644 --- a/logging/terminal.go +++ b/logging/terminal.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package logging diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 8aee4a50e..000000000 --- a/package-lock.json +++ /dev/null @@ -1,3761 +0,0 @@ -{ - "name": "@monax/burrow", - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "@babel/code-frame": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", - "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", - "dev": true, - "requires": { - "@babel/highlight": "^7.0.0" - } - }, - "@babel/highlight": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", - "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", - "dev": true, - "requires": { - "chalk": "^2.0.0", - "esutils": "^2.0.2", - "js-tokens": "^4.0.0" - } - }, - "@grpc/proto-loader": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.4.0.tgz", - "integrity": "sha512-Jm6o+75uWT7E6+lt8edg4J1F/9+BedOjaMgwE14pxS/AO43/0ZqK+rCLVVrXLoExwSAZvgvOD2B0ivy3Spsspw==", - "requires": { - "lodash.camelcase": "^4.3.0", - "protobufjs": "^6.8.6" - } - }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" - }, - "@types/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz", - "integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==" - }, - "@types/node": { - "version": "10.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.2.tgz", - "integrity": "sha512-m9zXmifkZsMHZBOyxZWilMwmTlpC8x5Ty360JKTiXvlXZfBWYpsg9ZZvP/Ye+iZUh+Q+MxDLjItVTWIsfwz+8Q==" - }, - "acorn": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", - "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", - "dev": true - }, - "acorn-jsx": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz", - "integrity": "sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg==", - "dev": true - }, - "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", - "dev": true - }, - "ansi-escapes": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.2.1.tgz", - "integrity": "sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q==", - "dev": true, - "requires": { - "type-fest": "^0.5.2" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "array-includes": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", - "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.7.0" - } - }, - "ascli": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", - "integrity": "sha1-vPpZdKYvGOgcq660lzKrSoj5Brw=", - "requires": { - "colour": "~0.7.1", - "optjs": "~3.2.2" - } - }, - "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "bindings": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.1.tgz", - "integrity": "sha512-i47mqjF9UbjxJhxGf+pZ6kSxrnI3wBLlnGI2ArWJ4r0VrvDS7ZYXkprq/pLaBWYq4GM0r4zdHY+NNRqEMU7uew==" - }, - "bip66": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", - "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-sha3": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.4.tgz", - "integrity": "sha1-CGxHuMgjFsnUcCLCYYWVRXbdjiY=", - "requires": { - "js-sha3": "^0.6.1", - "safe-buffer": "^5.1.1" - } - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "bytebuffer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz", - "integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=", - "requires": { - "long": "~3" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "dependencies": { - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "colour": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/colour/-/colour-0.7.1.tgz", - "integrity": "sha1-nLFpkX7F0SwHNtPoaFdG3xyt93g=" - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", - "dev": true - }, - "create-hash": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "crypto-js": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.4.tgz", - "integrity": "sha1-IWTxbeLykVELZS10a84302SYMK0=" - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "debug-log": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", - "integrity": "sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8=", - "dev": true - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "define-properties": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", - "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", - "dev": true, - "requires": { - "foreach": "^2.0.5", - "object-keys": "^1.0.8" - } - }, - "deglob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/deglob/-/deglob-3.1.0.tgz", - "integrity": "sha512-al10l5QAYaM/PeuXkAr1Y9AQz0LCtWsnJG23pIgh44hDxHFOj36l6qvhfjnIWBYwZOqM1fXUFV9tkjL7JPdGvw==", - "dev": true, - "requires": { - "find-root": "^1.0.0", - "glob": "^7.0.5", - "ignore": "^5.0.0", - "pkg-config": "^1.1.0", - "run-parallel": "^1.1.2", - "uniq": "^1.0.1" - }, - "dependencies": { - "ignore": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", - "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", - "dev": true - } - } - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "drbg.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", - "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", - "requires": { - "browserify-aes": "^1.0.6", - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4" - } - }, - "elliptic": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", - "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", - "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", - "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", - "dev": true, - "requires": { - "is-callable": "^1.1.1", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.1" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.1.0.tgz", - "integrity": "sha512-QhrbdRD7ofuV09IuE2ySWBz0FyXCq0rriLTZXZqaWSI79CVtHVRdkFuFTViiqzZhkCgfOh9USpriuGN2gIpZDQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^1.3.1", - "eslint-visitor-keys": "^1.0.0", - "espree": "^6.0.0", - "esquery": "^1.0.1", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^11.7.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "inquirer": "^6.4.1", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.2", - "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", - "dev": true - } - } - }, - "eslint-config-standard": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-13.0.1.tgz", - "integrity": "sha512-zLKp4QOgq6JFgRm1dDCVv1Iu0P5uZ4v5Wa4DTOkg2RFMxdCX/9Qf7lz9ezRj2dBRa955cWQF/O/LWEiYWAHbTw==", - "dev": true - }, - "eslint-config-standard-jsx": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-7.0.0.tgz", - "integrity": "sha512-OiKOF3MFVmWOCVfsi8GHlVorOEiBsPzAnUhM3c6HML94O2krbdQ/eMABySHgHHOIBYRls9sR9I3lo6O0vXhVEg==", - "dev": true - }, - "eslint-import-resolver-node": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", - "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", - "dev": true, - "requires": { - "debug": "^2.6.9", - "resolve": "^1.5.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-module-utils": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.4.1.tgz", - "integrity": "sha512-H6DOj+ejw7Tesdgbfs4jeS4YMFrT8uI8xwd1gtQqXssaR0EQ26L+2O/w6wkYFy2MymON0fTwHmXBvvfLNZVZEw==", - "dev": true, - "requires": { - "debug": "^2.6.8", - "pkg-dir": "^2.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-es": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-1.4.0.tgz", - "integrity": "sha512-XfFmgFdIUDgvaRAlaXUkxrRg5JSADoRC8IkKLc/cISeR3yHVMefFHQZpcyXXEUUPHfy5DwviBcrfqlyqEwlQVw==", - "dev": true, - "requires": { - "eslint-utils": "^1.3.0", - "regexpp": "^2.0.1" - } - }, - "eslint-plugin-import": { - "version": "2.18.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz", - "integrity": "sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ==", - "dev": true, - "requires": { - "array-includes": "^3.0.3", - "contains-path": "^0.1.0", - "debug": "^2.6.9", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.2", - "eslint-module-utils": "^2.4.0", - "has": "^1.0.3", - "minimatch": "^3.0.4", - "object.values": "^1.1.0", - "read-pkg-up": "^2.0.0", - "resolve": "^1.11.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "^2.0.0" - } - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - } - } - } - }, - "eslint-plugin-node": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-9.1.0.tgz", - "integrity": "sha512-ZwQYGm6EoV2cfLpE1wxJWsfnKUIXfM/KM09/TlorkukgCAwmkgajEJnPCmyzoFPQQkmvo5DrW/nyKutNIw36Mw==", - "dev": true, - "requires": { - "eslint-plugin-es": "^1.4.0", - "eslint-utils": "^1.3.1", - "ignore": "^5.1.1", - "minimatch": "^3.0.4", - "resolve": "^1.10.1", - "semver": "^6.1.0" - }, - "dependencies": { - "ignore": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", - "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "eslint-plugin-promise": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", - "integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==", - "dev": true - }, - "eslint-plugin-react": { - "version": "7.14.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz", - "integrity": "sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==", - "dev": true, - "requires": { - "array-includes": "^3.0.3", - "doctrine": "^2.1.0", - "has": "^1.0.3", - "jsx-ast-utils": "^2.1.0", - "object.entries": "^1.1.0", - "object.fromentries": "^2.0.0", - "object.values": "^1.1.0", - "prop-types": "^15.7.2", - "resolve": "^1.10.1" - }, - "dependencies": { - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - } - } - }, - "eslint-plugin-standard": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.0.tgz", - "integrity": "sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA==", - "dev": true - }, - "eslint-scope": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", - "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz", - "integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.0.0" - } - }, - "eslint-visitor-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", - "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", - "dev": true - }, - "espree": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.0.0.tgz", - "integrity": "sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q==", - "dev": true, - "requires": { - "acorn": "^6.0.7", - "acorn-jsx": "^5.0.0", - "eslint-visitor-keys": "^1.0.0" - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", - "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", - "dev": true, - "requires": { - "estraverse": "^4.0.0" - } - }, - "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", - "dev": true, - "requires": { - "estraverse": "^4.1.0" - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "ethereumjs-abi": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/ethereumjs-abi/-/ethereumjs-abi-0.6.5.tgz", - "integrity": "sha1-WmN+8Wq0NHP6cqKa2QhxQFs/UkE=", - "requires": { - "bn.js": "^4.10.0", - "ethereumjs-util": "^4.3.0" - } - }, - "ethereumjs-util": { - "version": "4.5.0", - "resolved": "http://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz", - "integrity": "sha1-PpQosxfuvaPXJg2FT93alUsfG8Y=", - "requires": { - "bn.js": "^4.8.0", - "create-hash": "^1.1.2", - "keccakjs": "^0.2.0", - "rlp": "^2.0.0", - "secp256k1": "^3.0.1" - } - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "figures": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.0.0.tgz", - "integrity": "sha512-HKri+WoWoUgr83pehn/SIgLOMZ9nAWC6dcGj26RY2R4F50u4+RTUz0RCrUlOV3nKRAICW1UGzyb+kcX2qK1S/g==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", - "dev": true, - "requires": { - "flat-cache": "^2.0.1" - } - }, - "find-root": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", - "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", - "dev": true - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", - "dev": true, - "requires": { - "is-buffer": "~2.0.3" - } - }, - "flat-cache": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", - "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", - "dev": true, - "requires": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" - }, - "dependencies": { - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, - "flatted": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", - "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", - "dev": true - }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "get-stdin": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", - "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", - "dev": true - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.0.0.tgz", - "integrity": "sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "grpc": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.18.0.tgz", - "integrity": "sha512-M0K67Zhv2ZzCjrTbQvjWgYFPB929L+qAVnbNgXepbfO5kJxUYc30dP8m8vb+o8QdahLHAeYfIqRoIzZRcCB98Q==", - "requires": { - "lodash.camelcase": "^4.3.0", - "lodash.clone": "^4.5.0", - "nan": "^2.0.0", - "node-pre-gyp": "^0.12.0", - "protobufjs": "^5.0.3" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.1.1", - "bundled": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.6.0", - "bundled": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true - }, - "fs-minipass": { - "version": "1.2.5", - "bundled": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true - }, - "iconv-lite": { - "version": "0.4.23", - "bundled": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-walk": { - "version": "3.0.1", - "bundled": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true - }, - "ini": { - "version": "1.3.5", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.0", - "bundled": true - }, - "minipass": { - "version": "2.3.5", - "bundled": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.1.1", - "bundled": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "bundled": true - } - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - }, - "needle": { - "version": "2.2.4", - "bundled": true, - "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.12.0", - "bundled": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.5", - "bundled": true - }, - "npm-packlist": { - "version": "1.1.12", - "bundled": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true - }, - "protobufjs": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz", - "integrity": "sha512-55Kcx1MhPZX0zTbVosMQEO5R6/rikNXd9b6RQK4KSPcrSIIwoXTtebIczUrXlwaSrbz4x8XUVThGPob1n8I4QA==", - "requires": { - "ascli": "~1", - "bytebuffer": "~5", - "glob": "^7.0.5", - "yargs": "^3.10.0" - } - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - } - }, - "readable-stream": { - "version": "2.3.6", - "bundled": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.2", - "bundled": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true - }, - "sax": { - "version": "1.2.4", - "bundled": true - }, - "semver": { - "version": "5.6.0", - "bundled": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true - }, - "tar": { - "version": "4.4.8", - "bundled": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true - }, - "yallist": { - "version": "3.0.3", - "bundled": true - } - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true - }, - "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "hosted-git-info": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", - "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, - "import-fresh": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", - "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "inquirer": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.1.tgz", - "integrity": "sha512-uxNHBeQhRXIoHWTSNYUFhQVrHYFThIt6IVo2fFmSe8aBwdR3/w6b58hJpiL/fMukFkvGzjg+hSxFtwvVmKZmXw==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^2.4.2", - "cli-cursor": "^3.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.15", - "mute-stream": "0.0.8", - "run-async": "^2.2.0", - "rxjs": "^6.4.0", - "string-width": "^4.1.0", - "strip-ansi": "^5.1.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.1.0.tgz", - "integrity": "sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^5.2.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true - }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, - "requires": { - "has": "^1.0.1" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-symbol": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", - "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "js-sha3": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz", - "integrity": "sha1-W4n3enR3Z5h39YxKB1JAk0sflcA=" - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsx-ast-utils": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz", - "integrity": "sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ==", - "dev": true, - "requires": { - "array-includes": "^3.0.3", - "object.assign": "^4.1.0" - } - }, - "keccakjs": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz", - "integrity": "sha512-BjLkNDcfaZ6l8HBG9tH0tpmDv3sS2mA7FNQxFHpCdzP3Gb2MVruXBSuoM66SnVxKJpAr5dKGdkHD+bDokt8fTg==", - "requires": { - "browserify-sha3": "^0.0.4", - "sha3": "^1.2.2" - } - }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "requires": { - "invert-kv": "^1.0.0" - } - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - }, - "lodash.assign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", - "dev": true - }, - "lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" - }, - "lodash.clone": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.5.0.tgz", - "integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=" - }, - "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", - "dev": true, - "requires": { - "chalk": "^2.0.1" - } - }, - "long": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=" - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "map-age-cleaner": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", - "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", - "dev": true, - "requires": { - "p-defer": "^1.0.0" - } - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "mem": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", - "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", - "dev": true, - "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - } - }, - "memorystream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", - "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", - "dev": true - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, - "mocha": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz", - "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==", - "dev": true, - "requires": { - "ansi-colors": "3.2.3", - "browser-stdout": "1.3.1", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "2.2.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "ms": "2.1.1", - "node-environment-flags": "1.0.5", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.2.2", - "yargs-parser": "13.0.0", - "yargs-unparser": "1.5.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - }, - "dependencies": { - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - } - } - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "dev": true, - "requires": { - "invert-kv": "^2.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" - } - }, - "p-limit": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", - "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, - "yargs": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", - "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "os-locale": "^3.1.0", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.0.0" - } - }, - "yargs-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", - "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, - "nan": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", - "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==" - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "node-environment-flags": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", - "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", - "dev": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - }, - "dependencies": { - "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", - "dev": true - } - } - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.entries": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.0.tgz", - "integrity": "sha512-l+H6EQ8qzGRxbkHOd5I/aHRhHDKoQXQ8g0BYt4uSweQU1/J6dZUOyWh9a2Vky35YCKjzmgxOzta2hH6kf9HuXA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.12.0", - "function-bind": "^1.1.1", - "has": "^1.0.3" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - } - } - }, - "object.fromentries": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.0.tgz", - "integrity": "sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.11.0", - "function-bind": "^1.1.1", - "has": "^1.0.1" - } - }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" - } - }, - "object.values": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.0.tgz", - "integrity": "sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.12.0", - "function-bind": "^1.1.1", - "has": "^1.0.3" - }, - "dependencies": { - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - } - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", - "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - } - }, - "optjs": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/optjs/-/optjs-3.2.2.tgz", - "integrity": "sha1-aabOicRCpEQDFBrS+bNwvVu29O4=" - }, - "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", - "requires": { - "lcid": "^1.0.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-defer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", - "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", - "dev": true - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pkg-conf": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-3.1.0.tgz", - "integrity": "sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ==", - "dev": true, - "requires": { - "find-up": "^3.0.0", - "load-json-file": "^5.2.0" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "graceful-fs": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", - "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==", - "dev": true - }, - "load-json-file": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.15", - "parse-json": "^4.0.0", - "pify": "^4.0.1", - "strip-bom": "^3.0.0", - "type-fest": "^0.3.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", - "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - }, - "type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", - "dev": true - } - } - }, - "pkg-config": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pkg-config/-/pkg-config-1.1.1.tgz", - "integrity": "sha1-VX7yLXPaPIg3EHdmxS6tq94pj+Q=", - "dev": true, - "requires": { - "debug-log": "^1.0.0", - "find-root": "^1.0.0", - "xtend": "^4.0.1" - } - }, - "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - } - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "dev": true, - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - }, - "protobufjs": { - "version": "6.8.8", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", - "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.0", - "@types/node": "^10.1.0", - "long": "^4.0.0" - }, - "dependencies": { - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - } - } - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "react-is": { - "version": "16.9.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.9.0.tgz", - "integrity": "sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw==", - "dev": true - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - }, - "dependencies": { - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - } - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - } - } - }, - "regexpp": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-from-string": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz", - "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "resolve": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - }, - "dependencies": { - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "rlp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.1.tgz", - "integrity": "sha512-nqB/qy+YjXdp/zj1CjCiDwfLMBPv/XFDol0ir/7O/+Ix90++rvi+QoK1CDJcn8JoqCu2WrPPeRucu4qyIDzALg==", - "requires": { - "safe-buffer": "^5.1.1" - } - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "^2.1.0" - } - }, - "run-parallel": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", - "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", - "dev": true - }, - "rxjs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz", - "integrity": "sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "secp256k1": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.5.2.tgz", - "integrity": "sha512-iin3kojdybY6NArd+UFsoTuapOF7bnJNf2UbcWXaY3z+E1sJDipl60vtzB5hbO/uquBu7z0fd4VC4Irp+xoFVQ==", - "requires": { - "bindings": "^1.2.1", - "bip66": "^1.1.3", - "bn.js": "^4.11.3", - "create-hash": "^1.1.2", - "drbg.js": "^1.0.1", - "elliptic": "^6.2.3", - "nan": "^2.2.1", - "safe-buffer": "^5.1.0" - } - }, - "semver": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", - "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "sha.js": { - "version": "2.4.11", - "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "sha3": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", - "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", - "requires": { - "nan": "2.10.0" - }, - "dependencies": { - "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" - } - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slice-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", - "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - } - } - }, - "solc": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.4.24.tgz", - "integrity": "sha512-2xd7Cf1HeVwrIb6Bu1cwY2/TaLRodrppCq3l7rhLimFQgmxptXhTC3+/wesVLpB09F1A2kZgvbMOgH7wvhFnBQ==", - "dev": true, - "requires": { - "fs-extra": "^0.30.0", - "memorystream": "^0.3.1", - "require-from-string": "^1.1.0", - "semver": "^5.3.0", - "yargs": "^4.7.1" - }, - "dependencies": { - "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "window-size": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", - "integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=", - "dev": true - }, - "yargs": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", - "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", - "dev": true, - "requires": { - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "lodash.assign": "^4.0.3", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.1", - "which-module": "^1.0.0", - "window-size": "^0.2.0", - "y18n": "^3.2.1", - "yargs-parser": "^2.4.1" - } - } - } - }, - "spdx-correct": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", - "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", - "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "standard": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/standard/-/standard-13.1.0.tgz", - "integrity": "sha512-h3NaMzsa88+/xtjXCMvdn6EWWdlodsI/HvtsQF+EGwrF9kVNwNha9TkFABU6bSBoNfC79YDyIAq9ekxOMBFkuw==", - "dev": true, - "requires": { - "eslint": "~6.1.0", - "eslint-config-standard": "13.0.1", - "eslint-config-standard-jsx": "7.0.0", - "eslint-plugin-import": "~2.18.0", - "eslint-plugin-node": "~9.1.0", - "eslint-plugin-promise": "~4.2.1", - "eslint-plugin-react": "~7.14.2", - "eslint-plugin-standard": "~4.0.0", - "standard-engine": "~11.0.1" - } - }, - "standard-engine": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-11.0.1.tgz", - "integrity": "sha512-WZQ5PpEDfRzPFk+H9xvKVQPQIxKnAQB2cb2Au4NyTCtdw5R0pyMBUZLbPXyFjnlhe8Ae+zfNrWU4m6H5b7cEAg==", - "dev": true, - "requires": { - "deglob": "^3.0.0", - "get-stdin": "^7.0.0", - "minimist": "^1.1.0", - "pkg-conf": "^3.1.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "table": { - "version": "5.4.6", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", - "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", - "dev": true, - "requires": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, - "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "type-fest": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.5.2.tgz", - "integrity": "sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==", - "dev": true - }, - "uniq": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", - "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "v8-compile-cache": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", - "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", - "dev": true - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "window-size": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", - "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=" - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", - "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", - "dev": true, - "requires": { - "mkdirp": "^0.5.1" - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" - }, - "yargs": { - "version": "3.32.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", - "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", - "requires": { - "camelcase": "^2.0.1", - "cliui": "^3.0.3", - "decamelize": "^1.1.1", - "os-locale": "^1.4.0", - "string-width": "^1.0.1", - "window-size": "^0.1.4", - "y18n": "^3.2.0" - } - }, - "yargs-parser": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", - "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", - "dev": true, - "requires": { - "camelcase": "^3.0.0", - "lodash.assign": "^4.0.6" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - } - } - }, - "yargs-unparser": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", - "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", - "dev": true, - "requires": { - "flat": "^4.1.0", - "lodash": "^4.17.11", - "yargs": "^12.0.5" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "dev": true, - "requires": { - "invert-kv": "^2.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" - } - }, - "p-limit": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", - "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" - } - }, - "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index f052c2723..000000000 --- a/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@hyperledger/burrow", - "description": "Javascript library that calls a Hyperledger Burrow server over rpc.", - "main": "./index.js", - "author": { - "name": "Dennis Mckinnon" - }, - "files": [ - "js", - "protobuf" - ], - "bugs": { - "url": "https://github.com/hyperledger/burrow/issues" - }, - "dependencies": { - "@grpc/proto-loader": "^0.4.0", - "crypto-js": "3.1.4", - "ethereumjs-abi": "^0.6.5", - "grpc": "^1.18.0", - "protobufjs": "^6.8.6" - }, - "devDependencies": { - "fs-extra": "^7.0.1", - "mocha": "6.2.0", - "solc": "0.4.24", - "standard": "13.1.0" - }, - "engines": { - "node": ">=6" - }, - "homepage": "https://github.com/hyperledger/burrow/", - "keywords": [ - "Burrow", - "Hyperledger", - "Monax" - ], - "license": "Apache-2.0", - "maintainers": [ - { - "name": "Silas Davis", - "email": "silas@monax.io" - }, - { - "name": "Sean Young", - "email": "sean.young@monax.io" - }, - { - "name": "Greg Hill", - "email": "greg.hill@monax.io" - } - ], - "repository": { - "type": "git", - "url": "git+https://github.com/hyperledger/burrow.git" - }, - "scripts": { - "precommit": "standard --fix js/**/*.js", - "pretest": "standard --fix js/**/*.js", - "test": "./tests/js/js.sh" - }, - "standard": { - "globals": [ - "after", - "afterEach", - "before", - "beforeEach", - "describe", - "it", - "run" - ] - } -} diff --git a/permission/base_permissions.go b/permission/base_permissions.go index 8aa80cd47..bc07f39e1 100644 --- a/permission/base_permissions.go +++ b/permission/base_permissions.go @@ -6,8 +6,8 @@ import "fmt" // ErrValueNotSet is returned if the permission's set bits are not all on, // and should be caught by caller so the global permission can be fetched func (bp BasePermissions) Get(ty PermFlag) (bool, error) { - if ty == 0 { - return false, ErrInvalidPermission(ty) + if ty == None { + return true, nil } if !bp.IsSet(ty) { return false, ErrValueNotSet(ty) @@ -17,8 +17,8 @@ func (bp BasePermissions) Get(ty PermFlag) (bool, error) { // Set a permission bit. Will set the permission's set bit to true. func (bp *BasePermissions) Set(ty PermFlag, value bool) error { - if ty == 0 { - return ErrInvalidPermission(ty) + if ty == None { + return nil } bp.SetBit |= ty if value { @@ -31,8 +31,8 @@ func (bp *BasePermissions) Set(ty PermFlag, value bool) error { // Set the permission's set bits to false func (bp *BasePermissions) Unset(ty PermFlag) error { - if ty == 0 { - return ErrInvalidPermission(ty) + if ty == None { + return nil } bp.SetBit &= ^ty return nil @@ -40,7 +40,7 @@ func (bp *BasePermissions) Unset(ty PermFlag) error { // Check if the permission is set func (bp BasePermissions) IsSet(ty PermFlag) bool { - if ty == 0 { + if ty == None { return false } return bp.SetBit&ty == ty @@ -63,5 +63,5 @@ func (bp BasePermissions) Compose(bpFallthrough BasePermissions) BasePermissions } func (bp BasePermissions) String() string { - return fmt.Sprintf("Base: %b; Set: %b", bp.Perms, bp.SetBit) + return fmt.Sprintf("Base: %v; Set: %v", PermFlagToStringList(bp.Perms), PermFlagToStringList(bp.SetBit)) } diff --git a/permission/errors.go b/permission/errors.go index 316ee913d..0bcdc47d9 100644 --- a/permission/errors.go +++ b/permission/errors.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package permission diff --git a/permission/perm_flag.go b/permission/perm_flag.go index dedc52825..b255b73cb 100644 --- a/permission/perm_flag.go +++ b/permission/perm_flag.go @@ -38,11 +38,13 @@ const ( Input // 256 // Permission to execute batch transactins Batch // 512 + // Allows account to associate new blockchain nodes + Identify // 1028 // Moderator permissions. // These permissions concern the alteration of the chain permissions listed above. Each permission relates to a // particular canonical permission mutation or query function. When an account is granted a moderation permission - // it is permitted to call that function. See snative.go for a marked-up description of what each function does. + // it is permitted to call that function. See contract.go for a marked-up description of what each function does. HasBase SetBase UnsetBase @@ -51,7 +53,10 @@ const ( AddRole RemoveRole - NumPermissions uint = 17 // NOTE Adjust this too. We can support upto 64 + NumPermissions uint = 18 // NOTE Adjust this too. We can support upto 64 + + // To allow an operation with no permission flags set at all + None PermFlag = 0 TopPermFlag PermFlag = 1 << (NumPermissions - 1) AllPermFlags PermFlag = TopPermFlag | (TopPermFlag - 1) @@ -64,6 +69,7 @@ const ( CreateContractString = "createContract" CreateAccountString = "createAccount" BondString = "bond" + IdentifyString = "identify" NameString = "name" ProposalString = "proposal" InputString = "input" @@ -85,7 +91,7 @@ const ( // A particular permission type PermFlag uint64 -// Checks if a permission flag is valid (a known base chain or snative permission) +// Checks if a permission flag is valid (a known base chain or native contract permission) func (pf PermFlag) IsValid() bool { return pf <= AllPermFlags } @@ -108,6 +114,8 @@ func (pf PermFlag) String() string { return CreateAccountString case Bond: return BondString + case Identify: + return IdentifyString case Name: return NameString case Proposal: @@ -153,6 +161,8 @@ func PermStringToFlag(perm string) (PermFlag, error) { return CreateAccount, nil case BondString: return Bond, nil + case IdentifyString: + return Identify, nil case NameString: return Name, nil case ProposalString: diff --git a/permission/perm_flag_test.go b/permission/perm_flag_test.go index 8ad4d848e..8314dca9e 100644 --- a/permission/perm_flag_test.go +++ b/permission/perm_flag_test.go @@ -1,11 +1,20 @@ package permission import ( + "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestAllPermissions(t *testing.T) { - assert.Equal(t, AllPermFlags, DefaultPermFlags|AddRole|RemoveRole|SetBase|UnsetBase|Root|SetGlobal|Proposal) + assert.Equal(t, AllPermFlags, DefaultPermFlags|AddRole|RemoveRole|SetBase|UnsetBase|Root|SetGlobal|Proposal|Identify) +} + +func TestName(t *testing.T) { + fmt.Println(PermFlagToStringList(PermFlag(59007))) + fmt.Println(PermFlagToStringList(PermFlag(8262))) + fmt.Println(PermFlagToStringList(PermFlag(8263))) + fmt.Println(PermFlagToStringList(DefaultPermFlags)) + fmt.Printf("%d\n", DefaultPermFlags) } diff --git a/permission/permission.pb.go b/permission/permission.pb.go index b91f0d764..257e88f4b 100644 --- a/permission/permission.pb.go +++ b/permission/permission.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -24,7 +25,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 type AccountPermissions struct { Base BasePermissions `protobuf:"bytes,1,opt,name=Base" json:"Base"` @@ -42,16 +43,12 @@ func (m *AccountPermissions) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *AccountPermissions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AccountPermissions.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *AccountPermissions) XXX_Merge(src proto.Message) { xxx_messageInfo_AccountPermissions.Merge(m, src) @@ -98,16 +95,12 @@ func (m *BasePermissions) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *BasePermissions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BasePermissions.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *BasePermissions) XXX_Merge(src proto.Message) { xxx_messageInfo_BasePermissions.Merge(m, src) @@ -161,16 +154,12 @@ func (m *PermArgs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *PermArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PermArgs.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *PermArgs) XXX_Merge(src proto.Message) { xxx_messageInfo_PermArgs.Merge(m, src) @@ -228,36 +217,36 @@ func init() { proto.RegisterFile("permission.proto", fileDescriptor_c837ef01cbda func init() { golang_proto.RegisterFile("permission.proto", fileDescriptor_c837ef01cbda0ad8) } var fileDescriptor_c837ef01cbda0ad8 = []byte{ - // 367 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x31, 0x4f, 0xc2, 0x40, - 0x14, 0xc7, 0x7b, 0x50, 0x48, 0x39, 0x49, 0x24, 0x17, 0x87, 0x46, 0x93, 0xb6, 0x61, 0x30, 0x1d, - 0xb0, 0x35, 0x26, 0x2e, 0x0c, 0x26, 0xed, 0x60, 0x1c, 0x4d, 0x35, 0x0e, 0x6e, 0xa5, 0x9c, 0xa5, - 0xb1, 0x70, 0xf5, 0xee, 0x1a, 0xc3, 0xb7, 0x70, 0x64, 0x54, 0x3e, 0x89, 0x23, 0x23, 0xb3, 0x03, - 0x21, 0xf0, 0x2d, 0x9c, 0xcc, 0x5d, 0x09, 0x54, 0x13, 0xdc, 0xee, 0xff, 0xfe, 0xff, 0xf7, 0x7e, - 0x7d, 0xaf, 0xb0, 0x95, 0x61, 0x3a, 0x4c, 0x18, 0x4b, 0xc8, 0xc8, 0xc9, 0x28, 0xe1, 0x04, 0xc1, - 0x5d, 0xe5, 0xf8, 0x2c, 0x4e, 0xf8, 0x20, 0xef, 0x39, 0x11, 0x19, 0xba, 0x31, 0x89, 0x89, 0x2b, - 0x23, 0xbd, 0xfc, 0x49, 0x2a, 0x29, 0xe4, 0xab, 0x68, 0x6d, 0x3f, 0x43, 0xe4, 0x45, 0x11, 0xc9, - 0x47, 0xfc, 0x76, 0x3b, 0x83, 0xa1, 0x4b, 0xa8, 0xfa, 0x21, 0xc3, 0x3a, 0xb0, 0x80, 0x7d, 0x70, - 0x71, 0xe2, 0x94, 0x88, 0xa2, 0x5e, 0x8a, 0xfa, 0xea, 0x6c, 0x61, 0x2a, 0x81, 0x8c, 0xa3, 0x23, - 0x58, 0x0b, 0x48, 0x8a, 0x99, 0x5e, 0xb1, 0xaa, 0x76, 0x23, 0x28, 0x44, 0x57, 0x7b, 0x9b, 0x9a, - 0xca, 0x64, 0x6a, 0x2a, 0xed, 0x17, 0x78, 0xf8, 0xa7, 0x1d, 0x9d, 0xc2, 0x9a, 0x90, 0x4c, 0xa2, - 0x54, 0xbf, 0x25, 0xa6, 0x7d, 0x2f, 0x4c, 0x4d, 0x14, 0xaf, 0xd3, 0x30, 0x0e, 0x0a, 0x1b, 0xd9, - 0xb0, 0x7e, 0x87, 0xb9, 0x9f, 0x70, 0xbd, 0xb2, 0x27, 0xb8, 0xf1, 0xbb, 0xcd, 0xc9, 0xbb, 0xa9, - 0x6c, 0x91, 0x4b, 0x00, 0x65, 0xc4, 0xa3, 0xb1, 0x1c, 0xe2, 0x45, 0x3c, 0x21, 0xa3, 0xbd, 0xb4, - 0x8d, 0x8f, 0x6e, 0x60, 0xfd, 0x3e, 0xa4, 0x31, 0x2e, 0x70, 0x4d, 0xff, 0xfc, 0x6b, 0x61, 0x76, - 0x4a, 0x97, 0x1d, 0x8c, 0x33, 0x4c, 0x53, 0xdc, 0x8f, 0x31, 0x75, 0x7b, 0x39, 0xa5, 0xe4, 0xd5, - 0x8d, 0xe8, 0x38, 0xe3, 0xc4, 0xf1, 0xfa, 0x7d, 0x8a, 0x19, 0x0b, 0x36, 0xfd, 0xa8, 0x03, 0xe1, - 0x6e, 0x5f, 0xbd, 0x2a, 0xb9, 0xcd, 0x5f, 0xcc, 0x92, 0x8f, 0x10, 0x54, 0xc5, 0xd1, 0x74, 0xd5, - 0x02, 0x76, 0x23, 0x90, 0x6f, 0x71, 0xd5, 0x87, 0x30, 0xcd, 0xb1, 0x5e, 0xb3, 0x80, 0xad, 0x05, - 0x85, 0xe8, 0x6a, 0x62, 0xcd, 0xf9, 0x87, 0xa9, 0xf8, 0x57, 0xb3, 0x95, 0x01, 0xe6, 0x2b, 0x03, - 0x2c, 0x57, 0x06, 0xf8, 0x5c, 0x1b, 0x60, 0xb6, 0x36, 0xc0, 0xa3, 0xfd, 0xff, 0xd7, 0xee, 0xfe, - 0xe8, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb6, 0xa6, 0x3c, 0xf5, 0x50, 0x02, 0x00, 0x00, + // 363 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0xb1, 0x6e, 0xea, 0x30, + 0x14, 0x8d, 0x21, 0xa0, 0xe0, 0x87, 0xf4, 0x90, 0xc5, 0x10, 0xbd, 0x27, 0x25, 0x11, 0xc3, 0x53, + 0x06, 0x94, 0x3c, 0x55, 0xea, 0xc2, 0x96, 0x0c, 0x55, 0xc7, 0x2a, 0xad, 0x3a, 0x74, 0x0b, 0xc1, + 0x32, 0x51, 0x03, 0x4e, 0x6d, 0x47, 0x15, 0x7f, 0xd1, 0x91, 0xb1, 0xe5, 0x4b, 0x3a, 0x32, 0x32, + 0x56, 0x1d, 0x10, 0x0a, 0x7f, 0xd1, 0xa9, 0xb2, 0x83, 0x80, 0x56, 0xa2, 0xdb, 0xbd, 0xe7, 0x9c, + 0x7b, 0x8e, 0xef, 0x35, 0xec, 0xe4, 0x98, 0x4d, 0x52, 0xce, 0x53, 0x3a, 0xf5, 0x72, 0x46, 0x05, + 0x45, 0xf0, 0x80, 0xfc, 0xe9, 0x12, 0x4a, 0xa8, 0x82, 0x7d, 0x59, 0x55, 0x8a, 0xde, 0x3d, 0x44, + 0x41, 0x92, 0xd0, 0x62, 0x2a, 0xae, 0xf6, 0x52, 0x8e, 0xce, 0xa1, 0x1e, 0xc6, 0x1c, 0x9b, 0xc0, + 0x01, 0xee, 0xaf, 0xb3, 0xbf, 0xde, 0x91, 0xb1, 0xc4, 0x8f, 0xa4, 0xa1, 0xbe, 0x5c, 0xdb, 0x5a, + 0xa4, 0xe4, 0xa8, 0x0b, 0x1b, 0x11, 0xcd, 0x30, 0x37, 0x6b, 0x4e, 0xdd, 0x6d, 0x45, 0x55, 0x33, + 0x30, 0x9e, 0x16, 0xb6, 0x36, 0x5f, 0xd8, 0x5a, 0xef, 0x01, 0xfe, 0xfe, 0x36, 0x8e, 0xfe, 0xc1, + 0x86, 0x6c, 0xb9, 0x8a, 0xd2, 0xc3, 0x8e, 0x74, 0xfb, 0x58, 0xdb, 0x86, 0x04, 0x2f, 0xb2, 0x98, + 0x44, 0x15, 0x8d, 0x5c, 0xd8, 0xbc, 0xc6, 0x22, 0x4c, 0x85, 0x59, 0x3b, 0x21, 0xdc, 0xf1, 0x83, + 0xf6, 0xfc, 0xd9, 0xd6, 0xf6, 0x91, 0x1b, 0x00, 0x95, 0x24, 0x60, 0x44, 0x99, 0x04, 0x89, 0x48, + 0xe9, 0xf4, 0x64, 0xda, 0x8e, 0x47, 0x97, 0xb0, 0x79, 0x13, 0x33, 0x82, 0xab, 0xb8, 0x76, 0xf8, + 0xff, 0x7d, 0x6d, 0xf7, 0x49, 0x2a, 0xc6, 0xc5, 0xd0, 0x4b, 0xe8, 0xc4, 0x1f, 0xcf, 0x72, 0xcc, + 0x32, 0x3c, 0x22, 0x98, 0xf9, 0xc3, 0x82, 0x31, 0xfa, 0xe8, 0x27, 0x6c, 0x96, 0x0b, 0xea, 0x05, + 0xa3, 0x11, 0xc3, 0x9c, 0x47, 0xbb, 0x79, 0xd4, 0x87, 0xf0, 0xb0, 0xaf, 0x59, 0x57, 0xb9, 0xed, + 0x2f, 0x99, 0x47, 0x3c, 0x42, 0x50, 0x97, 0x47, 0x33, 0x75, 0x07, 0xb8, 0xad, 0x48, 0xd5, 0xf2, + 0xaa, 0xb7, 0x71, 0x56, 0x60, 0xb3, 0xe1, 0x00, 0xd7, 0x88, 0xaa, 0x66, 0x60, 0xc8, 0x35, 0x57, + 0x2f, 0xb6, 0x16, 0x86, 0xcb, 0xd2, 0x02, 0xab, 0xd2, 0x02, 0x6f, 0xa5, 0x05, 0x36, 0xa5, 0x05, + 0x5e, 0xb7, 0x16, 0x58, 0x6e, 0x2d, 0x70, 0xe7, 0xfe, 0xfc, 0xe2, 0xc3, 0xaf, 0x7e, 0x06, 0x00, + 0x00, 0xff, 0xff, 0x7e, 0x9f, 0xab, 0xe6, 0x3b, 0x02, 0x00, 0x00, } func (m *AccountPermissions) 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 } @@ -265,43 +254,45 @@ func (m *AccountPermissions) Marshal() (dAtA []byte, err error) { } func (m *AccountPermissions) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountPermissions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintPermission(dAtA, i, uint64(m.Base.Size())) - n1, err := m.Base.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 += n1 if len(m.Roles) > 0 { - for _, s := range m.Roles { + for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Roles[iNdEx]) + copy(dAtA[i:], m.Roles[iNdEx]) + i = encodeVarintPermission(dAtA, i, uint64(len(m.Roles[iNdEx]))) + i-- dAtA[i] = 0x12 - 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) + { + size, err := m.Base.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPermission(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *BasePermissions) 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 } @@ -309,26 +300,32 @@ func (m *BasePermissions) Marshal() (dAtA []byte, err error) { } func (m *BasePermissions) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BasePermissions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintPermission(dAtA, i, uint64(m.Perms)) - dAtA[i] = 0x10 - i++ - i = encodeVarintPermission(dAtA, i, uint64(m.SetBit)) 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 + i = encodeVarintPermission(dAtA, i, uint64(m.SetBit)) + i-- + dAtA[i] = 0x10 + i = encodeVarintPermission(dAtA, i, uint64(m.Perms)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func (m *PermArgs) 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 } @@ -336,55 +333,65 @@ func (m *PermArgs) Marshal() (dAtA []byte, err error) { } func (m *PermArgs) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PermArgs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintPermission(dAtA, i, uint64(m.Action)) - if m.Target != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintPermission(dAtA, i, uint64(m.Target.Size())) - n2, err := m.Target.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Permission != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintPermission(dAtA, i, uint64(*m.Permission)) - } - if m.Role != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintPermission(dAtA, i, uint64(len(*m.Role))) - i += copy(dAtA[i:], *m.Role) - } if m.Value != nil { - dAtA[i] = 0x28 - i++ + i-- if *m.Value { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x28 + } + if m.Role != nil { + i -= len(*m.Role) + copy(dAtA[i:], *m.Role) + i = encodeVarintPermission(dAtA, i, uint64(len(*m.Role))) + i-- + dAtA[i] = 0x22 } - return i, nil + if m.Permission != nil { + i = encodeVarintPermission(dAtA, i, uint64(*m.Permission)) + i-- + dAtA[i] = 0x18 + } + if m.Target != nil { + { + size := m.Target.Size() + i -= size + if _, err := m.Target.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPermission(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i = encodeVarintPermission(dAtA, i, uint64(m.Action)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func encodeVarintPermission(dAtA []byte, offset int, v uint64) int { + offset -= sovPermission(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 (m *AccountPermissions) Size() (n int) { if m == nil { @@ -445,14 +452,7 @@ func (m *PermArgs) Size() (n int) { } func sovPermission(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozPermission(x uint64) (n int) { return sovPermission(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -557,10 +557,7 @@ func (m *AccountPermissions) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPermission - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPermission } if (iNdEx + skippy) > l { @@ -649,10 +646,7 @@ func (m *BasePermissions) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPermission - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPermission } if (iNdEx + skippy) > l { @@ -831,10 +825,7 @@ func (m *PermArgs) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPermission - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPermission } if (iNdEx + skippy) > l { @@ -852,6 +843,7 @@ func (m *PermArgs) Unmarshal(dAtA []byte) error { func skipPermission(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -883,10 +875,8 @@ func skipPermission(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -907,55 +897,30 @@ func skipPermission(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthPermission } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthPermission - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPermission - } - 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 := skipPermission(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthPermission - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPermission + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthPermission + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthPermission = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPermission = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthPermission = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPermission = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPermission = fmt.Errorf("proto: unexpected end of group") ) diff --git a/permission/permissions.go b/permission/permissions.go index 3cac17d4e..b06df982e 100644 --- a/permission/permissions.go +++ b/permission/permissions.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package permission diff --git a/permission/snatives.go b/permission/snatives.go index 649fcc111..4e8b37fd6 100644 --- a/permission/snatives.go +++ b/permission/snatives.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package permission diff --git a/permission/util.go b/permission/util.go index fc81e510d..a27edb2dd 100644 --- a/permission/util.go +++ b/permission/util.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package permission diff --git a/permission/util_test.go b/permission/util_test.go index b0057b3ec..b2cd11497 100644 --- a/permission/util_test.go +++ b/permission/util_test.go @@ -29,7 +29,7 @@ func TestBasePermissionsToStringList(t *testing.T) { assert.Equal(t, []string{"root", "call", "setBase", "hasRole"}, permStrings) permStrings = BasePermissionsToStringList(allSetBasePermission(AllPermFlags)) - assert.Equal(t, []string{"root", "send", "call", "createContract", "createAccount", "bond", "name", "proposal", "input", "batch", "hasBase", + assert.Equal(t, []string{"root", "send", "call", "createContract", "createAccount", "bond", "name", "proposal", "input", "batch", "identify", "hasBase", "setBase", "unsetBase", "setGlobal", "hasRole", "addRole", "removeRole"}, permStrings) permStrings = BasePermissionsToStringList(allSetBasePermission(AllPermFlags + 1)) @@ -38,7 +38,7 @@ func TestBasePermissionsToStringList(t *testing.T) { func TestBasePermissionsString(t *testing.T) { permissionString := BasePermissionsString(allSetBasePermission(AllPermFlags &^ Root)) - assert.Equal(t, "send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | "+ + assert.Equal(t, "send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | "+ "setBase | unsetBase | setGlobal | hasRole | addRole | removeRole", permissionString) } diff --git a/project/history.go b/project/history.go index fc05bf741..6186a0d2a 100644 --- a/project/history.go +++ b/project/history.go @@ -48,9 +48,174 @@ func FullVersion() string { // release tagging script: ./scripts/tag_release.sh var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "https://github.com/hyperledger/burrow"). MustDeclareReleases( + "0.31.3 - 2020-03-25", + `### Fixed +- [Dump] Make load from dump set tx index so BlockAccumulator continuity conditions are met +- [Dump] Improve error messages +`, + "0.31.2 - 2020-03-24", + `### Fixed +- [Dump] Stop TxStack EventStream consumer from rejecting events from dump/restored chain because they lack tx Envelopes (as they are intended to to keep dump format minimal) +- [Genesis] Fix hash instability introduced by accidentally removing omitempty from AppHash in genesis + +### Added +- [Vent] Implement throttling on Ethereum Vent consumer via --max-request-rate= flag to 'vent start' +`, + + "0.31.1 - 2020-03-19", + `### Changed +- [Repo] main branch replaces master as per Hyperledger TSC guidelines + +### Fixed +- [Docker] Make sure default testnet mode works when running docker images +- [Vent] Use appropriately sized database integral types for EVM integer types (i.e. numeric for uint64 and bigger) +- [Vent] Ethereum block consumer now correctly reads to an _inclusive_ block batch end height +- [Web3] Handle integer ChainID for web3 consistently; return hex-encoded numeric value from web3 RPC, also allow overriding of genesis-hash derived ChainID so Burrow can be connected with from metamask + +### Added +- [Build] Build dev docker and JS releases by force pushing to prerelease branch +- [Vent] Expose BlockConsumerConfig to adjust backoff and read characteristics +- [Vent] Add vent-side continuity test over blocks (to double-check exactly once delivery of events) +`, + "0.31.0 - 2020-03-10", + `### Changed +- [Tendermint] Upgraded to Tendermint 0.34.3 +- [Docker] Image will now start testnet by default + +### Added +- [Vent] Added support for building Vent SQL tables from Ethereum web3 JSONRPC chains (useful for oracles/state channels with layer 1) +- [Vent] Added Status to healthcheck endpoint on Vent +- [Natives] Implemented ecrecover using btcec (revised key handling) +- [Engine] Implement cross-engine dispatch +- [WASM] Implement cross-engine calls and calls to precompiles +- [WASM] Significantly extend eWASM support and implement functions +- [WASM] Add printing debug functions +- [WASM] Implement CREATE, GETTXGASPRICE, GETBLOCKDIFFICULTY, SELFDESTRUCT eWASM functions (thanks Yoongbok Lee!) +- [WASM/JS] JS library supports deploying WASM code +- [Deploy] Can specify WASM in playbook +- [EVM] Implement CHAINID and DIFFICULTY opcodes +- [Query] PEG query grammar now supports Not ("NOT") and NotEqual ("!=") operators + +### Fixed +- [Deploy] Fix flaky parallel tests +- [EVM] Use correct opcode for create2 (thanks Vitali Grabovski!) +- [ABI] Check length of input before decoding (thanks Tri-stone!) +- [WASM] Constructor argument handling +- [RLP] Incorrect use of offsets for longer bytes strings +- [RLP] Use minimal encoding for length prefixes (no leading zeros) +- [Web3] Generate correct encoding hash for RawTx (ChainID in hash digest but not payload) +- [Web3] Generate canonical weird Ethereum hex +- [State] Fix read concurrency in RWTree (on which state is based) removing need for CallSim lock workaround + +### Security +- Updated elliptic JS dep to 6.5.3 +- Updated lodash to 4.17.19 +`, + "0.30.5 - 2020-07-09", + `### Added +- [Vent] Add BytesToHex flag on projection field mappings that causes bytes fields (e.g. bytes32) solidity fields to be hex-encoded and mapped to varchar(64) rather than bytea/blob columns in postgres/sqlite +`, + "0.30.4 - 2020-04-05", + `### Added +- [Build] Added Helm chart +- [State] Account now has EVMOpcodeBitset field to support upcoming EVM fixes + +### Fixed +- [JS] Github actions release of JS lib +`, + "0.30.3 - 2020-04-05", + `### Added +- [CLI] Made previously internal Solidity Go fixtures compilation available through 'burrow compile' +- [TS] Default ts client interface implementation +`, + "0.30.2 - 2020-03-13", + `### Fixed +- [RPC] add mutex to callSim and callCode +`, + "0.30.1 - 2020-03-06", + `### Fixed +- [CLI/Tx] Unbond formulation now specifies amount +`, + + "0.30.0 - 2020-03-05", + `### Changed +- [JS] Partial rewrite of client API in typescript + +### Fixed +- [State] Blockchain now commits initial AppHash to avoid IAVL panic +`, + "0.29.8 - 2020-02-11", + `### Fixed +- [ABI] Fix failure to convert crypto.Address to EVMAddress (https://github.com/hyperledger/burrow/issues/1326) +`, + "0.29.7 - 2020-01-27", + `### Fixed +- [Build] Updates to CI build process +`, + "0.29.6 - 2020-01-22", + `### Changed +- [CLI] Burrow dump can now stream to STDOUT + +### Fixed +- [NPM] Burrow-js is now published via an auth token +`, + "0.29.5 - 2019-12-09", + `### Security +- [Tendermint] Upgraded to v0.32.8, checkTxAsync now includes node ID + +### Changed +- [Vent] Sync every block height to DB and send height notification from _vent_chain table so downstream can check DB sync without --blocks +- [RPC/Query] GetName now returns GRPC NotFound status (rather than unknown) when a requested key is not set. + +### Fixed +- [Execution] Simulated calls (e.g. query contracts) now returns the height of the state on which the query was run. Useful for downstream sync. +`, + "0.29.4 - 2019-11-22", + `### Changed +- [Build] Move to solidity 0.5.12 +`, + + "0.29.3 - 2019-10-16", + `### Changed +- [NPM] Point package.json to index.js +`, + + "0.29.2 - 2019-10-15", + `### Changed +- [NPM] Publish with index.js in TLD +`, + "0.29.1 - 2019-10-10", + `### Changed +- [State] Split metadata and account state to be kinder to downstream EVM integrators +`, + "0.29.0 - 2019-10-08", + `### Changed +- [Config] Reverted rename of ValidatorAddress to Address in config (each Burrow node has a specific validator key it uses for signing whether or not it is running as a validator right now) + +### Fixed +- [EVM] Return integer overflow error code (not stack overflow) for integer overflow errors +- [Docs] Fix broken examples +- [Deploy] Set input on QueryContract jobs correctly +- [EVM] Fix byte-printing for DebugOpcodes run mode +- [Crypto] Use Tendermint-compatible secp256k1 addressing +- [Natives] Make natives first class contracts and establish Dispatcher and Callable as a common calling convention for natives, EVM, and WASM (pending for WASM). +- [Natives] Fix Ethereum precompile addresses (addresses were padded on right instead of the left) + + +### Added +- [Web3] Implemented Ethereum web3 JSON RPC including sendRawTransaction! +- [Docs] Much docs (see also: https://www.hyperledger.org/blog/2019/10/08/burrow-the-boring-blockchain) +- [Docs] Generate github pages docs index with docsify: https://hyperledger.github.io/burrow/ +- [JS] Publish burrow.js to @hyperledger/burrow +- [State] Store EVM ABI and contract metadata on-chain see [GetMetadata](https://github.com/hyperledger/burrow/blob/e80aad5d8fac1f67dbfec61ea75670f9a38c61a1/protobuf/rpcquery.proto#L25) +- [Tendermint] Upgrade to v0.32.3 +- [Execution] Added IdentifyTx for introducing nodes (binding their NodeID to ValidatorAddress) +- [Natives] Implement Ethereum precompile number 5 - modular exponentiation + +`, "0.28.2 - 2019-08-21", `### Fixed -- [Vent] The new decode event ABI _before_ filter provides more keys but means vent must have access to all possible LogEvent ABIs when it is started. This is not practical in general so we now will will only err if an event matches but we have no ABI. This means we might not notice we have forgot to include an ABI since an event that _would_ have matched on an ABI spec field (prefixed 'Event') will not just not match, and so fail silently. +- [Vent] The new decode event ABI _before_ filter provides more keys but means vent must have access to all possible LogEvent ABIs when it is started. This is not practical in general so we now will will only err if an event matches but we have no ABI. This means we might not notice we have forgot to include an ABI since an event that _would_ have matched on an ABI spec field (prefixed 'Event') will not just not match, and so fail silently. `, "0.28.1 - 2019-08-21", `### Fixed @@ -110,7 +275,7 @@ var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "htt - [Consensus] Tendermint config CreateEmptyBlocks, CreateEmptyBlocksInterval now work as intended and prevent empty blocks being produced (except when needed for proof purposes) or when the interval expires (when set) ### Added -- [Dump] burrow dump now has local variant that produces a dump directly from a compatible burrow directory rather than over GRPC. If dumping/restoring between state-incompatible versions use burrow dump remote. +- [Dump] burrow dump now has local variant that produces a dump directly from a compatible burrow directory rather than over GRPC. If dumping/restoring between state-incompatible versions use burrow dump remote. `, "0.26.0 - 2019-06-14", `### Changed @@ -148,7 +313,7 @@ var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "htt ### Added - [CLI] Introduced burrow configure --pool for generation of multiple validator configs suitable for running on a single (or many) machines - [CLI] Burrow deploy can now run multiple burrow deploy files (aka playbooks) and run them in parallel -- [Consensus] Now possible to run Burrow without Tendermint in 'NoConsensus' mode by setting Tendermint.Enabled = false for faster local testing. Execution.TimeoutFactor can be used to control how regularly Burrow commits (and is used +- [Consensus] Now possible to run Burrow without Tendermint in 'NoConsensus' mode by setting Tendermint.Enabled = false for faster local testing. Execution.TimeoutFactor can be used to control how regularly Burrow commits (and is used ### Fixed - [Execution] Fixed uint64 underflow (when subtracting fee from balance) not protected against in CallContext @@ -163,7 +328,7 @@ var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "htt - [CLI] Introduced burrow configure --pool for generation of multiple validator configs suitable for running on a single (or many) machines ### Fixed -- [Metrics] Fix histogram statistics by making counts cumulative +- [Metrics] Fix histogram statistics by making counts cumulative `, "0.24.5 - 2019-03-14", `### Changed @@ -247,7 +412,7 @@ var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "htt - [Deploy] burrow deploy can use key names where addresses are used - [Governance] Added threshold-based governance via Proposal mechanism which allows entities with Root permission to propose and vote on batches of transactions to be executed on a running network with no single entity being able to do so. - [Governance] Added command line and query introspection of proposals as well as burrow deploy support -- [Vent] Merged Vent our SQL projection and mapping layer into the Burrow repository and binary via 'burrow vent'. See [Vent Readme](./vent/README.md) +- [Vent] Merged Vent our SQL projection and mapping layer into the Burrow repository and binary via 'burrow vent'. See [Vent Readme](./vent/vent.md) - [State] Improved read-write separation with RWTree and ImmutableForest data structures - [State] Implemented dump/restore to port state between different version of Burrow or to compress the execution of a chain (with a proof) onto a fresh chain diff --git a/protobuf/acm.proto b/protobuf/acm.proto index 8df8ef6fa..869db69f0 100644 --- a/protobuf/acm.proto +++ b/protobuf/acm.proto @@ -4,7 +4,7 @@ package acm; option go_package = "github.com/hyperledger/burrow/acm"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "permission.proto"; import "crypto.proto"; @@ -19,16 +19,28 @@ option (gogoproto.messagename_all) = true; message Account { option (gogoproto.goproto_stringer) = false; bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false]; - crypto.PublicKey PublicKey = 2 [(gogoproto.nullable) = false]; + crypto.PublicKey PublicKey = 2; + // Sequence counts the number of transactions that have been accepted from this account uint64 Sequence = 3; + // The account's current native token balance uint64 Balance = 4; + // We expect exactly one of EVMCode, WASMCode, and NativeName to be non-empty + // EVM bytecode bytes EVMCode = 5 [(gogoproto.customtype) = "Bytecode", (gogoproto.nullable) = false]; permission.AccountPermissions Permissions = 6 [(gogoproto.nullable) = false]; + // WASM bytecode bytes WASMCode = 7 [(gogoproto.customtype) = "Bytecode", (gogoproto.jsontag) = ",omitempty", (gogoproto.nullable) = false]; + // Fully qualified (`.`) name of native contract this for which this account object + // is a sentinel value. Which is to say this account object is a pointer to compiled code and does not contain + // the contract logic in its entirety + string NativeName = 11 [(gogoproto.jsontag) = ",omitempty"]; + // The sha3 hash of the code associated with the account bytes CodeHash = 8 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false, (gogoproto.jsontag) = "-"]; + // Pointer to the Metadata associated with this account repeated ContractMeta ContractMeta = 9; - // The metadata is stored in the deployed account. When the deployed account creates new account (from Solidity/EVM), they point to the original deployed - // account where the metadata is stored. This original account is called the forebear. + // The metadata is stored in the deployed account. When the deployed account creates new account + // (from Solidity/EVM), they point to the original deployed account where the metadata is stored. + // This original account is called the forebear. bytes Forebear = 10 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address"]; } diff --git a/protobuf/balance.proto b/protobuf/balance.proto index eefaf786c..565469357 100644 --- a/protobuf/balance.proto +++ b/protobuf/balance.proto @@ -2,7 +2,7 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/acm/balance"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; package balance; diff --git a/protobuf/bcm.proto b/protobuf/bcm.proto index 7c81bfb8b..1e28eac47 100644 --- a/protobuf/bcm.proto +++ b/protobuf/bcm.proto @@ -3,7 +3,7 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/bcm"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; @@ -17,7 +17,7 @@ option (gogoproto.goproto_registration) = true; option (gogoproto.messagename_all) = true; message SyncInfo { - uint64 LatestBlockHeight = 1 [(gogoproto.jsontag) = ""]; + uint64 LatestBlockHeight = 1; bytes LatestBlockHash = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false]; bytes LatestAppHash = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false]; // Timestamp of block as set by the block proposer diff --git a/protobuf/crypto.proto b/protobuf/crypto.proto index 5fb24c09c..fd041789b 100644 --- a/protobuf/crypto.proto +++ b/protobuf/crypto.proto @@ -4,7 +4,7 @@ package crypto; option go_package = "github.com/hyperledger/burrow/crypto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; option (gogoproto.marshaler_all) = true; diff --git a/protobuf/dump.proto b/protobuf/dump.proto index a0de7df67..e9a69306b 100644 --- a/protobuf/dump.proto +++ b/protobuf/dump.proto @@ -2,7 +2,7 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/dump"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; import "acm.proto"; diff --git a/protobuf/encoding.proto b/protobuf/encoding.proto index be0d97090..48dff985f 100644 --- a/protobuf/encoding.proto +++ b/protobuf/encoding.proto @@ -2,7 +2,7 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/encoding"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; package encoding; diff --git a/protobuf/errors.proto b/protobuf/errors.proto index d3ac4cd20..8a699c6c4 100644 --- a/protobuf/errors.proto +++ b/protobuf/errors.proto @@ -4,7 +4,7 @@ package errors; option go_package = "github.com/hyperledger/burrow/execution/errors"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; // Enable custom Marshal method. @@ -20,6 +20,6 @@ option (gogoproto.messagename_all) = true; message Exception { option (gogoproto.goproto_stringer) = false; - uint32 Code = 1 [(gogoproto.casttype) = "Code"]; + uint32 Code = 1 [(gogoproto.customname) = "CodeNumber"]; string Exception = 2; } diff --git a/protobuf/exec.proto b/protobuf/exec.proto index 53180130e..7d9106b6b 100644 --- a/protobuf/exec.proto +++ b/protobuf/exec.proto @@ -4,8 +4,8 @@ package exec; option go_package = "github.com/hyperledger/burrow/execution/exec"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/tendermint/tendermint/abci/types/types.proto"; +import "gogoproto/gogo.proto"; +import "tendermint/types/types.proto"; import "google/protobuf/timestamp.proto"; import "errors.proto"; @@ -39,7 +39,11 @@ message StreamEvent { message BeginBlock { // The height of this block uint64 Height = 1; - types.Header Header = 2; + // The number of transactions in the block (used as a checksum when consuming StreamEvents) + uint64 NumTxs = 3; + // The height of the most recent block we stored in state (which is the last non-empty block in current implementation) + uint64 PredecessorHeight = 4; + tendermint.types.Header Header = 2; } message EndBlock { @@ -48,6 +52,8 @@ message EndBlock { message BeginTx { TxHeader TxHeader = 1; + // The number of events generated by this transaction execution (used as a checksum when consuming StreamEvents) + uint64 NumEvents = 5; // Result of tx execution Result Result = 2; // If tx execution was an exception @@ -64,7 +70,7 @@ message TxHeader { uint32 TxType = 1 [(gogoproto.casttype) = "github.com/hyperledger/burrow/txs/payload.Type"]; // The hash of the transaction that caused this event to be generated bytes TxHash = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false]; - // The block height at which this Tx was included + // The block height at which this transaction was included uint64 Height = 3; // The index of this transaction within the block uint64 Index = 4; @@ -75,7 +81,9 @@ message TxHeader { message BlockExecution { // The height of this block uint64 Height = 1; - types.Header Header = 2; + // The height of the most recent block we stored in state (which is the last non-empty block in current implementation) + uint64 PredecessorHeight = 4; + tendermint.types.Header Header = 2; repeated TxExecution TxExecutions = 3; } @@ -140,6 +148,7 @@ message Event { CallEvent Call = 4; LogEvent Log = 5; GovernAccountEvent GovernAccount = 6; + PrintEvent Print = 7; } // Could structure this further if needed - sum type of various results relevant to different transaction types @@ -168,6 +177,11 @@ message CallEvent { bytes Return = 4 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false]; } +message PrintEvent { + bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false]; + bytes Data = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false]; +} + message GovernAccountEvent { spec.TemplateAccount AccountUpdate = 1; } @@ -184,6 +198,7 @@ message CallData { bytes Caller = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false]; bytes Callee = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false]; bytes Data = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false]; - uint64 Value = 4; - uint64 Gas = 5; + // Bytes of a big integer value + bytes Value = 4; + bytes Gas = 5; } diff --git a/protobuf/github.com/tendermint/tendermint/abci/types/types.proto b/protobuf/github.com/tendermint/tendermint/abci/types/types.proto deleted file mode 100644 index daf2cc914..000000000 --- a/protobuf/github.com/tendermint/tendermint/abci/types/types.proto +++ /dev/null @@ -1,317 +0,0 @@ -syntax = "proto3"; -package types; - -// For more information on gogo.proto, see: -// https://github.com/gogo/protobuf/blob/master/extensions.md -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "github.com/tendermint/tendermint/libs/common/types.proto"; - -// This file is copied from http://github.com/tendermint/abci -// NOTE: When using custom types, mind the warnings. -// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues - -option (gogoproto.stable_marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.goproto_registration) = true; -// Generate tests -option (gogoproto.populate_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.testgen_all) = true; - -//---------------------------------------- -// Request types - -message Request { - oneof value { - RequestEcho echo = 2; - RequestFlush flush = 3; - RequestInfo info = 4; - RequestSetOption set_option = 5; - RequestInitChain init_chain = 6; - RequestQuery query = 7; - RequestBeginBlock begin_block = 8; - RequestCheckTx check_tx = 9; - RequestDeliverTx deliver_tx = 19; - RequestEndBlock end_block = 11; - RequestCommit commit = 12; - } -} - -message RequestEcho { - string message = 1; -} - -message RequestFlush { -} - -message RequestInfo { - string version = 1; -} - -// nondeterministic -message RequestSetOption { - string key = 1; - string value = 2; -} - -message RequestInitChain { - google.protobuf.Timestamp time = 1 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; - string chain_id = 2; - ConsensusParams consensus_params = 3; - repeated ValidatorUpdate validators = 4 [(gogoproto.nullable)=false]; - bytes app_state_bytes = 5; -} - -message RequestQuery { - bytes data = 1; - string path = 2; - int64 height = 3; - bool prove = 4; -} - -// NOTE: validators here have empty pubkeys. -message RequestBeginBlock { - bytes hash = 1; - Header header = 2 [(gogoproto.nullable)=false]; - LastCommitInfo last_commit_info = 3 [(gogoproto.nullable)=false]; - repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false]; -} - -message RequestCheckTx { - bytes tx = 1; -} - -message RequestDeliverTx { - bytes tx = 1; -} - -message RequestEndBlock { - int64 height = 1; -} - -message RequestCommit { -} - -//---------------------------------------- -// Response types - -message Response { - oneof value { - ResponseException exception = 1; - ResponseEcho echo = 2; - ResponseFlush flush = 3; - ResponseInfo info = 4; - ResponseSetOption set_option = 5; - ResponseInitChain init_chain = 6; - ResponseQuery query = 7; - ResponseBeginBlock begin_block = 8; - ResponseCheckTx check_tx = 9; - ResponseDeliverTx deliver_tx = 10; - ResponseEndBlock end_block = 11; - ResponseCommit commit = 12; - } -} - -// nondeterministic -message ResponseException { - string error = 1; -} - -message ResponseEcho { - string message = 1; -} - -message ResponseFlush { -} - -message ResponseInfo { - string data = 1; - string version = 2; - int64 last_block_height = 3; - bytes last_block_app_hash = 4; -} - -// nondeterministic -message ResponseSetOption { - uint32 code = 1; - // bytes data = 2; - string log = 3; - string info = 4; -} - -message ResponseInitChain { - ConsensusParams consensus_params = 1; - repeated ValidatorUpdate validators = 2 [(gogoproto.nullable)=false]; -} - -message ResponseQuery { - uint32 code = 1; - // bytes data = 2; // use "value" instead. - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 index = 5; - bytes key = 6; - bytes value = 7; - bytes proof = 8; - int64 height = 9; -} - -message ResponseBeginBlock { - repeated common.KVPair tags = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"]; -} - -message ResponseCheckTx { - uint32 code = 1; - bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 gas_wanted = 5; - int64 gas_used = 6; - repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"]; -} - -message ResponseDeliverTx { - uint32 code = 1; - bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 gas_wanted = 5; - int64 gas_used = 6; - repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"]; -} - -message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable)=false]; - ConsensusParams consensus_param_updates = 2; - repeated common.KVPair tags = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"]; -} - -message ResponseCommit { - // reserve 1 - bytes data = 2; -} - -//---------------------------------------- -// Misc. - -// ConsensusParams contains all consensus-relevant parameters -// that can be adjusted by the abci app -message ConsensusParams { - BlockSize block_size = 1; - TxSize tx_size = 2; - BlockGossip block_gossip = 3; -} - -// BlockSize contains limits on the block size. -message BlockSize { - int32 max_bytes = 1; - int64 max_gas = 2; -} - -// TxSize contains limits on the tx size. -message TxSize { - int32 max_bytes = 1; - int64 max_gas = 2; -} - -// BlockGossip determine consensus critical -// elements of how blocks are gossiped -message BlockGossip { - // Note: must not be 0 - int32 block_part_size_bytes = 1; -} - -message LastCommitInfo { - int32 round = 1; - repeated VoteInfo votes = 2 [(gogoproto.nullable)=false]; -} - -//---------------------------------------- -// Blockchain Types - -message Header { - // basic block info - string chain_id = 1 [(gogoproto.customname)="ChainID"]; - int64 height = 2; - google.protobuf.Timestamp time = 3 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; - int64 num_txs = 4; - int64 total_txs = 5; - - // prev block info - BlockID last_block_id = 6 [(gogoproto.nullable)=false]; - - // hashes of block data - bytes last_commit_hash = 7; // commit from validators from the last block - bytes data_hash = 8; // transactions - - // hashes from the app output from the prev block - bytes validators_hash = 9; // validators for the current block - bytes next_validators_hash = 10; // validators for the next block - bytes consensus_hash = 11; // consensus params for current block - bytes app_hash = 12; // state after txs from the previous block - bytes last_results_hash = 13;// root hash of all results from the txs from the previous block - - // consensus info - bytes evidence_hash = 14; // evidence included in the block - bytes proposer_address = 15; // original proposer of the block -} - -message BlockID { - bytes hash = 1; - PartSetHeader parts_header = 2 [(gogoproto.nullable)=false]; -} - -message PartSetHeader { - int32 total = 1; - bytes hash = 2; -} - -// Validator -message Validator { - bytes address = 1; - //PubKey pub_key = 2 [(gogoproto.nullable)=false]; - int64 power = 3; -} - -// ValidatorUpdate -message ValidatorUpdate { - PubKey pub_key = 1 [(gogoproto.nullable)=false]; - int64 power = 2; -} - -// VoteInfo -message VoteInfo { - Validator validator = 1 [(gogoproto.nullable)=false]; - bool signed_last_block = 2; -} - -message PubKey { - string type = 1; - bytes data = 2; -} - -message Evidence { - string type = 1; - Validator validator = 2 [(gogoproto.nullable)=false]; - int64 height = 3; - google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; - int64 total_voting_power = 5; -} - -//---------------------------------------- -// Service Definition - -service ABCIApplication { - rpc Echo(RequestEcho) returns (ResponseEcho) ; - rpc Flush(RequestFlush) returns (ResponseFlush); - rpc Info(RequestInfo) returns (ResponseInfo); - rpc SetOption(RequestSetOption) returns (ResponseSetOption); - rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); - rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); - rpc Query(RequestQuery) returns (ResponseQuery); - rpc Commit(RequestCommit) returns (ResponseCommit); - rpc InitChain(RequestInitChain) returns (ResponseInitChain); - rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); - rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); -} diff --git a/protobuf/github.com/tendermint/tendermint/libs/common/types.proto b/protobuf/github.com/tendermint/tendermint/libs/common/types.proto deleted file mode 100644 index a8583bc9b..000000000 --- a/protobuf/github.com/tendermint/tendermint/libs/common/types.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; -package common; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.goproto_registration) = true; -// Generate tests -option (gogoproto.populate_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.testgen_all) = true; - -//---------------------------------------- -// Abstract types - -// Define these here for compatibility but use tmlibs/common.KVPair. -message KVPair { - bytes key = 1; - bytes value = 2; -} - -// Define these here for compatibility but use tmlibs/common.KI64Pair. -message KI64Pair { - bytes key = 1; - int64 value = 2; -} diff --git a/protobuf/github.com/gogo/protobuf/gogoproto/gogo.proto b/protobuf/gogoproto/gogo.proto similarity index 100% rename from protobuf/github.com/gogo/protobuf/gogoproto/gogo.proto rename to protobuf/gogoproto/gogo.proto diff --git a/protobuf/keys.proto b/protobuf/keys.proto index 0e0af5f53..0c5585002 100644 --- a/protobuf/keys.proto +++ b/protobuf/keys.proto @@ -4,9 +4,11 @@ option go_package = "github.com/hyperledger/burrow/keys"; package keys; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "crypto.proto"; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; option (gogoproto.stable_marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.goproto_registration) = true; diff --git a/protobuf/names.proto b/protobuf/names.proto index 5607d4d7a..4fa43381e 100644 --- a/protobuf/names.proto +++ b/protobuf/names.proto @@ -4,7 +4,7 @@ package names; option go_package = "github.com/hyperledger/burrow/execution/names"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; // Enable custom Marshal method. diff --git a/protobuf/payload.proto b/protobuf/payload.proto index 413efcfd2..041159cc5 100644 --- a/protobuf/payload.proto +++ b/protobuf/payload.proto @@ -2,13 +2,15 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/txs/payload"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "permission.proto"; +import "registry.proto"; import "spec.proto"; package payload; +option (gogoproto.stable_marshaler_all) = true; // Enable custom Marshal method. option (gogoproto.marshaler_all) = true; // Enable custom Unmarshal method. @@ -20,6 +22,7 @@ option (gogoproto.goproto_registration) = true; // Enable generation of XXX_MessageName methods for grpc-go/status. option (gogoproto.messagename_all) = true; +// Any encodes a sum type for which only one should be set message Any { option (gogoproto.onlyone) = true; @@ -32,6 +35,7 @@ message Any { UnbondTx UnbondTx = 7; BatchTx BatchTx = 8; ProposalTx ProposalTx = 9; + IdentifyTx IdentifyTx = 10; } // An input to a transaction that may carry an Amount as a charge and whose sequence number must be one greater than @@ -72,6 +76,8 @@ message CallTx { bytes WASM = 6 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false, (gogoproto.jsontag)="tags,omitempty"]; // Set of contracts this code will deploy repeated ContractMeta ContractMeta = 7; + // The upper bound on the price per unit of gas + uint64 GasPrice = 8; } message ContractMeta { @@ -146,6 +152,16 @@ message ProposalTx { Proposal Proposal = 4; } +message IdentifyTx { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; + + // Senders + repeated TxInput Inputs = 1; + // Node to register + registry.NodeIdentity Node = 2; +} + message BatchTx { option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_getters) = false; diff --git a/protobuf/permission.proto b/protobuf/permission.proto index cdac58d38..38533c194 100644 --- a/protobuf/permission.proto +++ b/protobuf/permission.proto @@ -4,8 +4,9 @@ package permission; option go_package = "github.com/hyperledger/burrow/permission"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; +option (gogoproto.stable_marshaler_all) = true; // Enable custom Marshal method. option (gogoproto.marshaler_all) = true; // Enable custom Unmarshal method. diff --git a/protobuf/registry.proto b/protobuf/registry.proto new file mode 100644 index 000000000..124ab2900 --- /dev/null +++ b/protobuf/registry.proto @@ -0,0 +1,35 @@ +syntax = 'proto3'; + +package registry; + +option go_package = "github.com/hyperledger/burrow/execution/registry"; + +import "gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; +// Enable custom Marshal method. +option (gogoproto.marshaler_all) = true; +// Enable custom Unmarshal method. +option (gogoproto.unmarshaler_all) = true; +// Enable custom Size method (Required by Marshal and Unmarshal). +option (gogoproto.sizer_all) = true; +// Enable registration with golang/protobuf for the grpc-gateway. +option (gogoproto.goproto_registration) = true; +// Enable generation of XXX_MessageName methods for grpc-go/status. +option (gogoproto.messagename_all) = true; + +// NodeIdentity stores and establishes a binding between 4 different types of identifiers, a human readable name, +// a advertised network address, a p2p station-to-station key, and a validator key. Updates must be signed +// by the node key and the validator key to prove the update is consensual. +message NodeIdentity { + option (gogoproto.goproto_stringer) = false; + // Peer moniker name + string Moniker = 1; + // Peer network address + string NetworkAddress = 2; + // The Tendermint p2p node ID + bytes TendermintNodeID = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false]; + // The public key that this node will validate with if it becomes a validator + // (use this to create a binding between p2p node ID and validator) + bytes ValidatorPublicKey = 4 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.PublicKey"]; +} diff --git a/protobuf/rpc.proto b/protobuf/rpc.proto index 229754b36..a51a4ef4e 100644 --- a/protobuf/rpc.proto +++ b/protobuf/rpc.proto @@ -3,13 +3,15 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/rpc"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "tendermint.proto"; import "validator.proto"; import "bcm.proto"; package rpc; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; option (gogoproto.stable_marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.goproto_registration) = true; diff --git a/protobuf/rpcdump.proto b/protobuf/rpcdump.proto index d832cf062..c365c5476 100644 --- a/protobuf/rpcdump.proto +++ b/protobuf/rpcdump.proto @@ -4,10 +4,12 @@ package rpcdump; option go_package = "github.com/hyperledger/burrow/rpc/rpcdump"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "dump.proto"; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; option (gogoproto.stable_marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.goproto_registration) = true; diff --git a/protobuf/rpcevents.proto b/protobuf/rpcevents.proto index 673693752..c5e2fd612 100644 --- a/protobuf/rpcevents.proto +++ b/protobuf/rpcevents.proto @@ -2,16 +2,14 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/rpc/rpcevents"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "exec.proto"; package rpcevents; -// Enable custom Marshal method. option (gogoproto.marshaler_all) = true; -// Enable custom Unmarshal method. option (gogoproto.unmarshaler_all) = true; -// Enable custom Size method (Required by Marshal and Unmarshal). +option (gogoproto.stable_marshaler_all) = true; option (gogoproto.sizer_all) = true; // Enable registration with golang/protobuf for the grpc-gateway. option (gogoproto.goproto_registration) = true; diff --git a/protobuf/rpcquery.proto b/protobuf/rpcquery.proto index f92e1931e..e38cb6252 100644 --- a/protobuf/rpcquery.proto +++ b/protobuf/rpcquery.proto @@ -4,15 +4,18 @@ package rpcquery; option go_package = "github.com/hyperledger/burrow/rpc/rpcquery"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/tendermint/tendermint/abci/types/types.proto"; +import "gogoproto/gogo.proto"; +import "tendermint/types/types.proto"; import "names.proto"; import "acm.proto"; import "validator.proto"; +import "registry.proto"; import "rpc.proto"; import "payload.proto"; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; option (gogoproto.stable_marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.goproto_registration) = true; @@ -29,6 +32,8 @@ service Query { rpc GetName (GetNameParam) returns (names.Entry); rpc ListNames (ListNamesParam) returns (stream names.Entry); + // GetNetworkRegistry returns for each validator address, the list of their identified node at the current state + rpc GetNetworkRegistry (GetNetworkRegistryParam) returns (NetworkRegistry); rpc GetValidatorSet (GetValidatorSetParam) returns (ValidatorSet); rpc GetValidatorSetHistory (GetValidatorSetHistoryParam) returns (ValidatorSetHistory); @@ -37,7 +42,7 @@ service Query { rpc GetStats(GetStatsParam) returns (Stats); - rpc GetBlockHeader(GetBlockParam) returns (types.Header); + rpc GetBlockHeader(GetBlockParam) returns (tendermint.types.Header); } message StatusParam { @@ -79,6 +84,10 @@ message ListNamesParam { string Query = 1; } +message GetNetworkRegistryParam { + +} + message GetValidatorSetParam { } @@ -88,6 +97,15 @@ message GetValidatorSetHistoryParam { int64 IncludePrevious = 1; } +message NetworkRegistry { + repeated RegisteredValidator Set = 1; +} + +message RegisteredValidator { + bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false]; + registry.NodeIdentity Node = 2; +} + message ValidatorSetHistory { repeated ValidatorSet History = 1; } diff --git a/protobuf/rpctransact.proto b/protobuf/rpctransact.proto index 454c76e1d..33931a2e3 100644 --- a/protobuf/rpctransact.proto +++ b/protobuf/rpctransact.proto @@ -4,17 +4,16 @@ package rpctransact; option go_package = "github.com/hyperledger/burrow/rpc/rpctransact"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "google/protobuf/duration.proto"; import "exec.proto"; import "payload.proto"; import "txs.proto"; -// Enable custom Marshal method. option (gogoproto.marshaler_all) = true; -// Enable custom Unmarshal method. option (gogoproto.unmarshaler_all) = true; +option (gogoproto.stable_marshaler_all) = true; // Enable custom Size method (Required by Marshal and Unmarshal). option (gogoproto.sizer_all) = true; // Enable registration with golang/protobuf for the grpc-gateway. @@ -50,7 +49,7 @@ service Transact { // Formulate and SendTx transaction signed server-side rpc SendTxAsync (payload.SendTx) returns (txs.Receipt); - // Formualte a NameTx signed server-side and wait for it to be included in a block returning the registered name + // Formulate a NameTx signed server-side and wait for it to be included in a block returning the registered name rpc NameTxSync (payload.NameTx) returns (exec.TxExecution); // Formulate a NameTx signed server-side rpc NameTxAsync (payload.NameTx) returns (txs.Receipt); diff --git a/protobuf/spec.proto b/protobuf/spec.proto index 770f8183c..93f884e5c 100644 --- a/protobuf/spec.proto +++ b/protobuf/spec.proto @@ -2,7 +2,7 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/genesis/spec"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "crypto.proto"; import "balance.proto"; diff --git a/protobuf/storage.proto b/protobuf/storage.proto index f462b55b7..8328131f0 100644 --- a/protobuf/storage.proto +++ b/protobuf/storage.proto @@ -2,7 +2,7 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/storage"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; package storage; diff --git a/protobuf/tendermint.proto b/protobuf/tendermint.proto index 751cddde2..f0ae6a249 100644 --- a/protobuf/tendermint.proto +++ b/protobuf/tendermint.proto @@ -3,11 +3,13 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/consensus/tendermint"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; package tendermint; option (gogoproto.stable_marshaler_all) = true; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.goproto_registration) = true; option (gogoproto.messagename_all) = true; diff --git a/protobuf/txs.proto b/protobuf/txs.proto index 719116603..ebeda6bf5 100644 --- a/protobuf/txs.proto +++ b/protobuf/txs.proto @@ -2,15 +2,14 @@ syntax = 'proto3'; option go_package = "github.com/hyperledger/burrow/txs"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "crypto.proto"; package txs; -// Enable custom Marshal method. +option (gogoproto.stable_marshaler_all) = true; option (gogoproto.marshaler_all) = true; -// Enable custom Unmarshal method. option (gogoproto.unmarshaler_all) = true; // Enable custom Size method (Required by Marshal and Unmarshal). option (gogoproto.sizer_all) = true; @@ -25,6 +24,12 @@ message Envelope { repeated Signatory Signatories = 1 [(gogoproto.nullable) = false]; // Canonical bytes of the Tx ready to be signed bytes Tx = 2 [(gogoproto.customtype) = "Tx"]; + enum EncodingType { + JSON = 0; + RLP = 1; + } + EncodingType Encoding = 3; + } // Signatory contains signature and one or both of Address and PublicKey to identify the signer diff --git a/protobuf/validator.proto b/protobuf/validator.proto index 531a380a5..28e383c93 100644 --- a/protobuf/validator.proto +++ b/protobuf/validator.proto @@ -4,10 +4,12 @@ package validator; option go_package = "github.com/hyperledger/burrow/acm/validator"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "gogoproto/gogo.proto"; import "crypto.proto"; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; option (gogoproto.stable_marshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.goproto_registration) = true; @@ -16,6 +18,6 @@ option (gogoproto.messagename_all) = true; message Validator { option (gogoproto.goproto_stringer) = false; bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address"]; - crypto.PublicKey PublicKey = 2 [(gogoproto.nullable) = false]; + crypto.PublicKey PublicKey = 2; uint64 Power = 3; } diff --git a/repolint.json b/repolint.json new file mode 100644 index 000000000..1043c6f4e --- /dev/null +++ b/repolint.json @@ -0,0 +1,147 @@ +{ + "axioms": { + "linguist": "language", + "licensee": "license", + "packagers": "packager" + }, + "rules": { + "all": { + "apache-license-file:file-contents": [ + "error", + { + "files": ["LICENSE*"], + "content": "Apache License.*Version 2.0", + "fail-on-non-existent": true + } + ], + "code-of-conduct-file:file-contents": [ + "error", + { + "files": ["CODE_OF_CONDUCT*"], + "content": "https://wiki.hyperledger.org/community/hyperledger-project-code-of-conduct", + "fail-on-non-existent": true + } + ], + "security-file-matches:file-contents": [ + "error", + { + "files": ["SECURITY.md"], + "content": "https://wiki.hyperledger.org/display/SEC/Defect.Response", + "fail-on-non-existent": true + } + ], + "readme-file-exists:file-existence": [ + "error", + { + "files": ["README.md", "README"] + } + ], + "readme-references-license:file-contents": [ + "error", + { + "files": ["README.md", "README"], + "content": "license", + "flags": "i" + } + ], + "maintainers-file-exists:file-existence": [ + "error", + { + "files": ["MAINTAINERS.md", "MAINTAINERS.rst"] + } + ], + "contributing-file-exists:file-existence": [ + "error", + { + "files": ["CONTRIBUTING.md"] + } + ], + "changelog-file-exists:file-existence": [ + "error", + { + "files": ["CHANGELOG.md"] + } + ], + "integrates-with-ci:file-existence": [ + "error", + { + "files": [ + "circle.yml", + ".circleci/config.yml", + "ci/azure-pipelines.yml", + ".ci/azure-pipelines.yml", + "Jenkinsfile", + "Jenkinsfile.ci", + "Jenkinsfile.cd", + ".github/workflows/*.yml" + ] + } + ], + "notice-file-exists:file-existence": [ + "warning", + { + "files": ["NOTICE*"] + } + ], + "source-license-headers-exist:file-starts-with": [ + "warning", + { + "files": ["**/*.js", "!node_modules/**"], + "lineCount": 5, + "patterns": ["Copyright", "License"], + "flags": "i" + } + ], + "test-directory-exists:directory-existence": [ + "warning", + { + "directories": ["**/test*", "**/specs", "**/**_test.go"], + "nocase": true + } + ], + "binaries-not-present:file-type-exclusion": [ + "error", + { + "type": ["**/*.exe", "**/*.dll", "!node_modules/**"] + } + ] + }, + "language=javascript": { + "package-metadata-exists:file-existence": [ + "warning", + { + "files": ["package.json"] + } + ] + }, + "language=ruby": { + "package-metadata-exists:file-existence": [ + "warning", + { + "files": ["Gemfile"] + } + ] + }, + "language=java": { + "package-metadata-exists:file-existence": [ + "warning", + { + "files": ["pom.xml", "build.xml", "build.gradle"] + } + ] + }, + "license=*": { + "license-detectable-by-licensee": [ + "warning" + ] + }, + "language=python": { + "package-metadata-exists:file-existence": [ + "warning", + { + "files": ["setup.py", "requirements.txt"] + } + ] + } + } +} diff --git a/rpc/client.go b/rpc/client.go new file mode 100644 index 000000000..02c3c2fe9 --- /dev/null +++ b/rpc/client.go @@ -0,0 +1,5 @@ +package rpc + +type Client interface { + Call(method string, params interface{}, result interface{}) error +} diff --git a/rpc/codec.go b/rpc/codec.go index bbf0ba604..2449a4492 100644 --- a/rpc/codec.go +++ b/rpc/codec.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpc diff --git a/rpc/config.go b/rpc/config.go index d77d3f2d7..72a8d5efb 100644 --- a/rpc/config.go +++ b/rpc/config.go @@ -1,5 +1,9 @@ package rpc +import ( + "net" +) + // 'LocalHost' gets interpreted as ipv6 // TODO: revisit this const LocalHost = "127.0.0.1" @@ -10,6 +14,7 @@ type RPCConfig struct { Profiler *ServerConfig `json:",omitempty" toml:",omitempty"` GRPC *ServerConfig `json:",omitempty" toml:",omitempty"` Metrics *MetricsConfig `json:",omitempty" toml:",omitempty"` + Web3 *ServerConfig `json:",omitempty" toml:",omitempty"` } type ServerConfig struct { @@ -18,6 +23,10 @@ type ServerConfig struct { ListenPort string } +func (sc *ServerConfig) ListenAddress() string { + return net.JoinHostPort(sc.ListenHost, sc.ListenPort) +} + type MetricsConfig struct { ServerConfig MetricsPath string @@ -30,6 +39,7 @@ func DefaultRPCConfig() *RPCConfig { Profiler: DefaultProfilerConfig(), GRPC: DefaultGRPCConfig(), Metrics: DefaultMetricsConfig(), + Web3: DefaultWeb3Config(), } } @@ -68,3 +78,11 @@ func DefaultMetricsConfig() *MetricsConfig { BlockSampleSize: 100, } } + +func DefaultWeb3Config() *ServerConfig { + return &ServerConfig{ + Enabled: true, + ListenHost: AnyLocal, + ListenPort: "26660", + } +} diff --git a/rpc/grpc.go b/rpc/grpc.go index c1a17233c..156306d04 100644 --- a/rpc/grpc.go +++ b/rpc/grpc.go @@ -4,6 +4,8 @@ import ( "fmt" "runtime/debug" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" "golang.org/x/net/context" @@ -12,7 +14,8 @@ import ( func NewGRPCServer(logger *logging.Logger) *grpc.Server { return grpc.NewServer(grpc.UnaryInterceptor(unaryInterceptor(logger)), - grpc.StreamInterceptor(streamInterceptor(logger.WithScope("NewGRPCServer")))) + grpc.StreamInterceptor(streamInterceptor(logger.WithScope("NewGRPCServer"))), + grpc.CustomCodec(&encoding.GRPCCodec{})) } func unaryInterceptor(logger *logging.Logger) grpc.UnaryServerInterceptor { diff --git a/rpc/jsonrpc.go b/rpc/jsonrpc.go index b9b52e910..b2b200f83 100644 --- a/rpc/jsonrpc.go +++ b/rpc/jsonrpc.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpc diff --git a/rpc/lib/client/http_client.go b/rpc/lib/client/http_client.go deleted file mode 100644 index 58aa4f495..000000000 --- a/rpc/lib/client/http_client.go +++ /dev/null @@ -1,195 +0,0 @@ -package client - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "net" - "net/http" - "net/url" - "reflect" - "strings" - - "github.com/hyperledger/burrow/rpc/lib/types" - "github.com/pkg/errors" -) - -// HTTPClient is a common interface for JSONRPCClient and URIClient. -type HTTPClient interface { - Call(method string, params map[string]interface{}, result interface{}) (interface{}, error) -} - -// TODO: Deprecate support for IP:PORT or /path/to/socket -func makeHTTPDialer(remoteAddr string) (string, func(string, string) (net.Conn, error)) { - parts := strings.SplitN(remoteAddr, "://", 2) - var protocol, address string - if len(parts) == 1 { - // default to tcp if nothing specified - protocol, address = "tcp", remoteAddr - } else if len(parts) == 2 { - protocol, address = parts[0], parts[1] - } else { - // return a invalid message - msg := fmt.Sprintf("Invalid addr: %s", remoteAddr) - return msg, func(_ string, _ string) (net.Conn, error) { - return nil, errors.New(msg) - } - } - // accept http as an alias for tcp - if protocol == "http" { - protocol = "tcp" - } - - // replace / with . for http requests (kvstore domain) - trimmedAddress := strings.Replace(address, "/", ".", -1) - return trimmedAddress, func(proto, addr string) (net.Conn, error) { - return net.Dial(protocol, address) - } -} - -// We overwrite the http.Client.Dial so we can do http over tcp or unix. -// remoteAddr should be fully featured (eg. with tcp:// or unix://) -func makeHTTPClient(remoteAddr string) (string, *http.Client) { - address, dialer := makeHTTPDialer(remoteAddr) - return "http://" + address, &http.Client{ - Transport: &http.Transport{ - Dial: dialer, - }, - } -} - -//------------------------------------------------------------------------------------ - -// JSONRPCClient takes params as a slice -type JSONRPCClient struct { - address string - client *http.Client -} - -// NewJSONRPCClient returns a JSONRPCClient pointed at the given address. -func NewJSONRPCClient(remote string) *JSONRPCClient { - address, client := makeHTTPClient(remote) - return &JSONRPCClient{ - address: address, - client: client, - } -} - -func (c *JSONRPCClient) Call(method string, params map[string]interface{}, result interface{}) (interface{}, error) { - request, err := types.MapToRequest("jsonrpc-client", method, params) - if err != nil { - return nil, err - } - requestBytes, err := json.Marshal(request) - if err != nil { - return nil, err - } - // log.Info(string(requestBytes)) - requestBuf := bytes.NewBuffer(requestBytes) - // log.Info(Fmt("RPC request to %v (%v): %v", c.remote, method, string(requestBytes))) - httpResponse, err := c.client.Post(c.address, "text/json", requestBuf) - if err != nil { - return nil, err - } - defer httpResponse.Body.Close() // nolint: errcheck - - responseBytes, err := ioutil.ReadAll(httpResponse.Body) - if err != nil { - return nil, err - } - // log.Info(Fmt("RPC response: %v", string(responseBytes))) - return unmarshalResponseBytes(responseBytes, result) -} - -//------------------------------------------------------------- - -// URI takes params as a map -type URIClient struct { - address string - client *http.Client -} - -func NewURIClient(remote string) *URIClient { - address, client := makeHTTPClient(remote) - return &URIClient{ - address: address, - client: client, - } -} - -func (c *URIClient) Call(method string, params map[string]interface{}, result interface{}) (interface{}, error) { - values, err := argsToURLValues(params) - if err != nil { - return nil, err - } - // log.Info(Fmt("URI request to %v (%v): %v", c.address, method, values)) - resp, err := c.client.PostForm(c.address+"/"+method, values) - if err != nil { - return nil, err - } - defer resp.Body.Close() // nolint: errcheck - - responseBytes, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return unmarshalResponseBytes(responseBytes, result) -} - -//------------------------------------------------ - -func unmarshalResponseBytes(responseBytes []byte, result interface{}) (interface{}, error) { - // Read response. If rpc/core/types is imported, the result will unmarshal - // into the correct type. - // log.Notice("response", "response", string(responseBytes)) - var err error - response := &types.RPCResponse{} - err = json.Unmarshal(responseBytes, response) - if err != nil { - return nil, errors.Errorf("Error unmarshalling rpc response: %v", err) - } - if response.Error != nil { - return nil, errors.Errorf("Response error: %v", response.Error) - } - // Unmarshal the RawMessage into the result. - err = json.Unmarshal(response.Result, result) - if err != nil { - return nil, errors.Errorf("Error unmarshalling rpc response result: %v", err) - } - return result, nil -} - -func argsToURLValues(args map[string]interface{}) (url.Values, error) { - values := make(url.Values) - if len(args) == 0 { - return values, nil - } - err := argsToJSON(args) - if err != nil { - return nil, err - } - for key, val := range args { - values.Set(key, val.(string)) - } - return values, nil -} - -func argsToJSON(args map[string]interface{}) error { - for k, v := range args { - rt := reflect.TypeOf(v) - isByteSlice := rt.Kind() == reflect.Slice && rt.Elem().Kind() == reflect.Uint8 - if isByteSlice { - bs := reflect.ValueOf(v).Bytes() - args[k] = fmt.Sprintf("0x%X", bs) - continue - } - - data, err := json.Marshal(v) - if err != nil { - return err - } - args[k] = string(data) - } - return nil -} diff --git a/rpc/lib/client/ws_client.go b/rpc/lib/client/ws_client.go deleted file mode 100644 index 751de2708..000000000 --- a/rpc/lib/client/ws_client.go +++ /dev/null @@ -1,482 +0,0 @@ -package client - -import ( - "context" - "encoding/json" - "fmt" - "net" - "net/http" - "sync" - "time" - - "github.com/gorilla/websocket" - "github.com/hyperledger/burrow/rpc/lib/types" - "github.com/pkg/errors" - metrics "github.com/rcrowley/go-metrics" - cmn "github.com/tendermint/tendermint/libs/common" -) - -const ( - defaultMaxReconnectAttempts = 25 - defaultWriteWait = 0 - defaultReadWait = 0 - defaultPingPeriod = 0 -) - -// WSClient is a WebSocket client. The methods of WSClient are safe for use by -// multiple goroutines. -type WSClient struct { - cmn.BaseService - - conn *websocket.Conn - - Address string // IP:PORT or /path/to/socket - Endpoint string // /websocket/url/endpoint - Dialer func(string, string) (net.Conn, error) - - // Time between sending a ping and receiving a pong. See - // https://godoc.org/github.com/rcrowley/go-metrics#Timer. - PingPongLatencyTimer metrics.Timer - - // Single user facing channel to read RPCResponses from, closed only when the client is being stopped. - ResponsesCh chan types.RPCResponse - - // Callback, which will be called each time after successful reconnect. - onReconnect func() - - // internal channels - send chan types.RPCRequest // user requests - backlog chan types.RPCRequest // stores a single user request received during a conn failure - reconnectAfter chan error // reconnect requests - readRoutineQuit chan struct{} // a way for readRoutine to close writeRoutine - - wg sync.WaitGroup - - mtx sync.RWMutex - sentLastPingAt time.Time - reconnecting bool - - // Maximum reconnect attempts (0 or greater; default: 25). - maxReconnectAttempts int - - // Time allowed to write a message to the server. 0 means block until operation succeeds. - writeWait time.Duration - - // Time allowed to read the next message from the server. 0 means block until operation succeeds. - readWait time.Duration - - // Send pings to server with this period. Must be less than readWait. If 0, no pings will be sent. - pingPeriod time.Duration -} - -// NewWSClient returns a new client. See the commentary on the func(*WSClient) -// functions for a detailed description of how to configure ping period and -// pong wait time. The endpoint argument must begin with a `/`. -func NewWSClient(remoteAddr, endpoint string, options ...func(*WSClient)) *WSClient { - addr, dialer := makeHTTPDialer(remoteAddr) - c := &WSClient{ - Address: addr, - Dialer: dialer, - Endpoint: endpoint, - PingPongLatencyTimer: metrics.NewTimer(), - - maxReconnectAttempts: defaultMaxReconnectAttempts, - readWait: defaultReadWait, - writeWait: defaultWriteWait, - pingPeriod: defaultPingPeriod, - } - c.BaseService = *cmn.NewBaseService(nil, "WSClient", c) - for _, option := range options { - option(c) - } - return c -} - -// MaxReconnectAttempts sets the maximum number of reconnect attempts before returning an error. -// It should only be used in the constructor and is not Goroutine-safe. -func MaxReconnectAttempts(max int) func(*WSClient) { - return func(c *WSClient) { - c.maxReconnectAttempts = max - } -} - -// ReadWait sets the amount of time to wait before a websocket read times out. -// It should only be used in the constructor and is not Goroutine-safe. -func ReadWait(readWait time.Duration) func(*WSClient) { - return func(c *WSClient) { - c.readWait = readWait - } -} - -// WriteWait sets the amount of time to wait before a websocket write times out. -// It should only be used in the constructor and is not Goroutine-safe. -func WriteWait(writeWait time.Duration) func(*WSClient) { - return func(c *WSClient) { - c.writeWait = writeWait - } -} - -// PingPeriod sets the duration for sending websocket pings. -// It should only be used in the constructor - not Goroutine-safe. -func PingPeriod(pingPeriod time.Duration) func(*WSClient) { - return func(c *WSClient) { - c.pingPeriod = pingPeriod - } -} - -// OnReconnect sets the callback, which will be called every time after -// successful reconnect. -func OnReconnect(cb func()) func(*WSClient) { - return func(c *WSClient) { - c.onReconnect = cb - } -} - -// String returns WS client full address. -func (c *WSClient) String() string { - return fmt.Sprintf("%s (%s)", c.Address, c.Endpoint) -} - -// OnStart implements cmn.Service by dialing a server and creating read and -// write routines. -func (c *WSClient) OnStart() error { - err := c.dial() - if err != nil { - return err - } - - c.ResponsesCh = make(chan types.RPCResponse) - - c.send = make(chan types.RPCRequest) - // 1 additional error may come from the read/write - // goroutine depending on which failed first. - c.reconnectAfter = make(chan error, 1) - // capacity for 1 request. a user won't be able to send more because the send - // channel is unbuffered. - c.backlog = make(chan types.RPCRequest, 1) - - c.startReadWriteRoutines() - go c.reconnectRoutine() - - return nil -} - -// OnStop implements cmn.Service. -func (c *WSClient) OnStop() {} - -// Stop overrides cmn.Service#Stop. There is no other way to wait until Quit -// channel is closed. -func (c *WSClient) Stop() error { - if err := c.BaseService.Stop(); err != nil { - return err - } - // only close user-facing channels when we can't write to them - c.wg.Wait() - close(c.ResponsesCh) - - return nil -} - -// IsReconnecting returns true if the client is reconnecting right now. -func (c *WSClient) IsReconnecting() bool { - c.mtx.RLock() - defer c.mtx.RUnlock() - return c.reconnecting -} - -// IsActive returns true if the client is running and not reconnecting. -func (c *WSClient) IsActive() bool { - return c.IsRunning() && !c.IsReconnecting() -} - -// Send the given RPC request to the server. Results will be available on -// ResponsesCh, errors, if any, on ErrorsCh. Will block until send succeeds or -// ctx.Done is closed. -func (c *WSClient) Send(ctx context.Context, request types.RPCRequest) error { - select { - case c.send <- request: - c.Logger.Info("sent a request", "req", request) - return nil - case <-ctx.Done(): - return ctx.Err() - } -} - -// Call the given method. See Send description. -func (c *WSClient) Call(ctx context.Context, method string, params map[string]interface{}) error { - request, err := types.MapToRequest("ws-client", method, params) - if err != nil { - return err - } - return c.Send(ctx, request) -} - -// CallWithArrayParams the given method with params in a form of array. See -// Send description. -func (c *WSClient) CallWithArrayParams(ctx context.Context, method string, params []interface{}) error { - request, err := types.ArrayToRequest("ws-client", method, params) - if err != nil { - return err - } - return c.Send(ctx, request) -} - -/////////////////////////////////////////////////////////////////////////////// -// Private methods - -func (c *WSClient) dial() error { - dialer := &websocket.Dialer{ - NetDial: c.Dialer, - Proxy: http.ProxyFromEnvironment, - } - rHeader := http.Header{} - conn, _, err := dialer.Dial("ws://"+c.Address+c.Endpoint, rHeader) - if err != nil { - return err - } - c.conn = conn - return nil -} - -// reconnect tries to redial up to maxReconnectAttempts with exponential -// backoff. -func (c *WSClient) reconnect() error { - attempt := 0 - - c.mtx.Lock() - c.reconnecting = true - c.mtx.Unlock() - defer func() { - c.mtx.Lock() - c.reconnecting = false - c.mtx.Unlock() - }() - - for { - jitterSeconds := time.Duration(cmn.RandFloat64() * float64(time.Second)) // 1s == (1e9 ns) - backoffDuration := jitterSeconds + ((1 << uint(attempt)) * time.Second) - - c.Logger.Info("reconnecting", "attempt", attempt+1, "backoff_duration", backoffDuration) - time.Sleep(backoffDuration) - - err := c.dial() - if err != nil { - c.Logger.Error("failed to redial", "err", err) - } else { - c.Logger.Info("reconnected") - if c.onReconnect != nil { - go c.onReconnect() - } - return nil - } - - attempt++ - - if attempt > c.maxReconnectAttempts { - return errors.Wrap(err, "reached maximum reconnect attempts") - } - } -} - -func (c *WSClient) startReadWriteRoutines() { - c.wg.Add(2) - c.readRoutineQuit = make(chan struct{}) - go c.readRoutine() - go c.writeRoutine() -} - -func (c *WSClient) processBacklog() error { - select { - case request := <-c.backlog: - if c.writeWait > 0 { - if err := c.conn.SetWriteDeadline(time.Now().Add(c.writeWait)); err != nil { - c.Logger.Error("failed to set write deadline", "err", err) - } - } - if err := c.conn.WriteJSON(request); err != nil { - c.Logger.Error("failed to resend request", "err", err) - c.reconnectAfter <- err - // requeue request - c.backlog <- request - return err - } - c.Logger.Info("resend a request", "req", request) - default: - } - return nil -} - -func (c *WSClient) reconnectRoutine() { - for { - select { - case originalError := <-c.reconnectAfter: - // wait until writeRoutine and readRoutine finish - c.wg.Wait() - if err := c.reconnect(); err != nil { - c.Logger.Error("failed to reconnect", "err", err, "original_err", originalError) - c.Stop() - return - } - // drain reconnectAfter - LOOP: - for { - select { - case <-c.reconnectAfter: - default: - break LOOP - } - } - err := c.processBacklog() - if err == nil { - c.startReadWriteRoutines() - } - - case <-c.Quit(): - return - } - } -} - -// The client ensures that there is at most one writer to a connection by -// executing all writes from this goroutine. -func (c *WSClient) writeRoutine() { - var ticker *time.Ticker - if c.pingPeriod > 0 { - // ticker with a predefined period - ticker = time.NewTicker(c.pingPeriod) - } else { - // ticker that never fires - ticker = &time.Ticker{C: make(<-chan time.Time)} - } - - defer func() { - ticker.Stop() - if err := c.conn.Close(); err != nil { - // ignore error; it will trigger in tests - // likely because it's closing an already closed connection - } - c.wg.Done() - }() - - for { - select { - case request := <-c.send: - if c.writeWait > 0 { - if err := c.conn.SetWriteDeadline(time.Now().Add(c.writeWait)); err != nil { - c.Logger.Error("failed to set write deadline", "err", err) - } - } - if err := c.conn.WriteJSON(request); err != nil { - c.Logger.Error("failed to send request", "err", err) - c.reconnectAfter <- err - // add request to the backlog, so we don't lose it - c.backlog <- request - return - } - case <-ticker.C: - if c.writeWait > 0 { - if err := c.conn.SetWriteDeadline(time.Now().Add(c.writeWait)); err != nil { - c.Logger.Error("failed to set write deadline", "err", err) - } - } - if err := c.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil { - c.Logger.Error("failed to write ping", "err", err) - c.reconnectAfter <- err - return - } - c.mtx.Lock() - c.sentLastPingAt = time.Now() - c.mtx.Unlock() - c.Logger.Debug("sent ping") - case <-c.readRoutineQuit: - return - case <-c.Quit(): - if err := c.conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")); err != nil { - c.Logger.Error("failed to write message", "err", err) - } - return - } - } -} - -// The client ensures that there is at most one reader to a connection by -// executing all reads from this goroutine. -func (c *WSClient) readRoutine() { - defer func() { - if err := c.conn.Close(); err != nil { - // ignore error; it will trigger in tests - // likely because it's closing an already closed connection - } - c.wg.Done() - }() - - c.conn.SetPongHandler(func(string) error { - // gather latency stats - c.mtx.RLock() - t := c.sentLastPingAt - c.mtx.RUnlock() - c.PingPongLatencyTimer.UpdateSince(t) - - c.Logger.Debug("got pong") - return nil - }) - - for { - // reset deadline for every message type (control or data) - if c.readWait > 0 { - if err := c.conn.SetReadDeadline(time.Now().Add(c.readWait)); err != nil { - c.Logger.Error("failed to set read deadline", "err", err) - } - } - _, data, err := c.conn.ReadMessage() - if err != nil { - if !websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure) { - return - } - - c.Logger.Error("failed to read response", "err", err) - close(c.readRoutineQuit) - c.reconnectAfter <- err - return - } - - var response types.RPCResponse - err = json.Unmarshal(data, &response) - if err != nil { - c.Logger.Error("failed to parse response", "err", err, "data", string(data)) - continue - } - c.Logger.Info("got response", "resp", response.Result) - // Combine a non-blocking read on BaseService.Quit with a non-blocking write on ResponsesCh to avoid blocking - // c.wg.Wait() in c.Stop(). Note we rely on Quit being closed so that it sends unlimited Quit signals to stop - // both readRoutine and writeRoutine - select { - case <-c.Quit(): - case c.ResponsesCh <- response: - } - } -} - -/////////////////////////////////////////////////////////////////////////////// -// Predefined methods - -// Subscribe to a query. Note the server must have a "subscribe" route -// defined. -func (c *WSClient) Subscribe(ctx context.Context, query string) error { - params := map[string]interface{}{"query": query} - return c.Call(ctx, "subscribe", params) -} - -// Unsubscribe from a query. Note the server must have a "unsubscribe" route -// defined. -func (c *WSClient) Unsubscribe(ctx context.Context, query string) error { - params := map[string]interface{}{"query": query} - return c.Call(ctx, "unsubscribe", params) -} - -// UnsubscribeAll from all. Note the server must have a "unsubscribe_all" route -// defined. -func (c *WSClient) UnsubscribeAll(ctx context.Context) error { - params := map[string]interface{}{} - return c.Call(ctx, "unsubscribe_all", params) -} diff --git a/rpc/lib/jsonrpc/client.go b/rpc/lib/jsonrpc/client.go new file mode 100644 index 000000000..dbb8e9d5d --- /dev/null +++ b/rpc/lib/jsonrpc/client.go @@ -0,0 +1,138 @@ +package jsonrpc + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "reflect" + + "github.com/hyperledger/burrow/rpc/lib/types" + "github.com/pkg/errors" +) + +// HTTPClient is a common interface for Client and URIClient. +type HTTPClient interface { + Call(method string, params interface{}, result interface{}) error +} + +// Client takes params as a slice +type Client struct { + address string + client http.Client +} + +// NewClient returns a Client pointed at the given address. +func NewClient(remote string) *Client { + return &Client{ + address: remote, + } +} + +func (c *Client) Call(method string, params interface{}, result interface{}) error { + request, err := types.NewRequest("jsonrpc-client", method, params) + if err != nil { + return err + } + bs, err := json.Marshal(request) + if err != nil { + return err + } + buf := bytes.NewBuffer(bs) + response, err := c.client.Post(c.address, "application/json", buf) + if err != nil { + return err + } + defer response.Body.Close() + + bs, err = ioutil.ReadAll(response.Body) + if err != nil { + return err + } + return unmarshalResponseBytes(bs, result) +} + +// URI takes params as a map +type URIClient struct { + address string + client http.Client +} + +func NewURIClient(remote string) *URIClient { + return &URIClient{ + address: remote, + } +} + +func (c *URIClient) Call(method string, params interface{}, result interface{}) error { + values, err := argsToURLValues(params.(map[string]interface{})) + if err != nil { + return err + } + // log.Info(Fmt("URI request to %v (%v): %v", c.address, method, values)) + resp, err := c.client.PostForm(c.address+"/"+method, values) + if err != nil { + return err + } + defer resp.Body.Close() // nolint: errcheck + + responseBytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + return unmarshalResponseBytes(responseBytes, result) +} + +func unmarshalResponseBytes(responseBytes []byte, result interface{}) error { + var err error + response := &types.RPCResponse{} + err = json.Unmarshal(responseBytes, response) + if err != nil { + return errors.Errorf("Error unmarshalling rpc response: %v", err) + } + if response.Error != nil { + return response.Error + } + // Unmarshal the RawMessage into the result. + err = json.Unmarshal(response.Result, result) + if err != nil { + return errors.Errorf("error unmarshalling rpc response result: %v", err) + } + return nil +} + +func argsToURLValues(args map[string]interface{}) (url.Values, error) { + values := make(url.Values) + if len(args) == 0 { + return values, nil + } + err := argsToJSON(args) + if err != nil { + return nil, err + } + for key, val := range args { + values.Set(key, val.(string)) + } + return values, nil +} + +func argsToJSON(args map[string]interface{}) error { + for k, v := range args { + rt := reflect.TypeOf(v) + isByteSlice := rt.Kind() == reflect.Slice && rt.Elem().Kind() == reflect.Uint8 + if isByteSlice { + bs := reflect.ValueOf(v).Bytes() + args[k] = fmt.Sprintf("0x%X", bs) + continue + } + + data, err := json.Marshal(v) + if err != nil { + return err + } + args[k] = string(data) + } + return nil +} diff --git a/rpc/lib/rpc_test.go b/rpc/lib/rpc_test.go index d66727439..18509579a 100644 --- a/rpc/lib/rpc_test.go +++ b/rpc/lib/rpc_test.go @@ -2,37 +2,32 @@ package lib import ( "bytes" - "context" crand "crypto/rand" "encoding/json" "fmt" "math/rand" "net/http" "os" - "os/exec" "testing" "time" + "github.com/hyperledger/burrow/rpc/lib/jsonrpc" + "github.com/hyperledger/burrow/logging/logconfig" "github.com/hyperledger/burrow/process" - "github.com/hyperledger/burrow/rpc/lib/client" "github.com/hyperledger/burrow/rpc/lib/server" "github.com/hyperledger/burrow/rpc/lib/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - cmn "github.com/tendermint/tendermint/libs/common" - "github.com/tendermint/tendermint/libs/log" + cmn "github.com/tendermint/tendermint/libs/bytes" ) // Client and Server should work over tcp or unix sockets const ( - tcpAddr = "tcp://0.0.0.0:47768" - - unixSocket = "/tmp/rpc_test.sock" - unixAddr = "unix://" + unixSocket - - websocketEndpoint = "/websocket/endpoint" + host = "0.0.0.0:47768" + httpAddress = "http://" + host + tcpAddress = "tcp://" + host ) type ResultEcho struct { @@ -54,7 +49,6 @@ type ResultEchoDataBytes struct { // Define some routes var Routes = map[string]*server.RPCFunc{ "echo": server.NewRPCFunc(EchoResult, "arg"), - "echo_ws": server.NewWSRPCFunc(EchoWSResult, "arg"), "echo_bytes": server.NewRPCFunc(EchoBytesResult, "arg"), "echo_data_bytes": server.NewRPCFunc(EchoDataBytesResult, "arg"), "echo_int": server.NewRPCFunc(EchoIntResult, "arg"), @@ -64,10 +58,6 @@ func EchoResult(v string) (*ResultEcho, error) { return &ResultEcho{v}, nil } -func EchoWSResult(wsCtx types.WSRPCContext, v string) (*ResultEcho, error) { - return &ResultEcho{v}, nil -} - func EchoIntResult(v int) (*ResultEchoInt, error) { return &ResultEchoInt{v}, nil } @@ -88,27 +78,16 @@ func TestMain(m *testing.M) { // launch unix and tcp servers func setup() { - logger, err := logconfig.New().NewLogger() + logger, err := logconfig.New().Logger() if err != nil { panic(err) } - cmd := exec.Command("rm", "-f", unixSocket) - err = cmd.Start() - if err != nil { - panic(err) - } - if err = cmd.Wait(); err != nil { - panic(err) - } - tcpLogger := logger.With("socket", "tcp") mux := http.NewServeMux() server.RegisterRPCFuncs(mux, Routes, tcpLogger) - wm := server.NewWebsocketManager(Routes, logger, server.ReadWait(5*time.Second), server.PingPeriod(1*time.Second)) - mux.HandleFunc(websocketEndpoint, wm.WebsocketHandler) go func() { - l, err := process.ListenerFromAddress(tcpAddr) + l, err := process.ListenerFromAddress(tcpAddress) if err != nil { panic(err) } @@ -118,74 +97,58 @@ func setup() { } }() - unixLogger := logger.With("socket", "unix") - mux2 := http.NewServeMux() - server.RegisterRPCFuncs(mux2, Routes, unixLogger) - wm = server.NewWebsocketManager(Routes, logger) - mux2.HandleFunc(websocketEndpoint, wm.WebsocketHandler) - go func() { - l, err := process.ListenerFromAddress(unixAddr) - if err != nil { - panic(err) - } - _, err = server.StartHTTPServer(l, mux2, unixLogger) - if err != nil { - panic(err) - } - }() - // wait for servers to start time.Sleep(time.Second * 2) } -func echoViaHTTP(cl client.HTTPClient, val string) (string, error) { +func echoViaHTTP(cl jsonrpc.HTTPClient, val string) (string, error) { params := map[string]interface{}{ "arg": val, } result := new(ResultEcho) - if _, err := cl.Call("echo", params, result); err != nil { + if err := cl.Call("echo", params, result); err != nil { return "", err } return result.Value, nil } -func echoIntViaHTTP(cl client.HTTPClient, val int) (int, error) { +func echoIntViaHTTP(cl jsonrpc.HTTPClient, val int) (int, error) { params := map[string]interface{}{ "arg": val, } result := new(ResultEchoInt) - if _, err := cl.Call("echo_int", params, result); err != nil { + if err := cl.Call("echo_int", params, result); err != nil { return 0, err } return result.Value, nil } -func echoBytesViaHTTP(cl client.HTTPClient, bytes []byte) ([]byte, error) { +func echoBytesViaHTTP(cl jsonrpc.HTTPClient, bytes []byte) ([]byte, error) { params := map[string]interface{}{ "arg": bytes, } result := new(ResultEchoBytes) - if _, err := cl.Call("echo_bytes", params, result); err != nil { + if err := cl.Call("echo_bytes", params, result); err != nil { return []byte{}, err } return result.Value, nil } -func echoDataBytesViaHTTP(cl client.HTTPClient, bytes cmn.HexBytes) (cmn.HexBytes, error) { +func echoDataBytesViaHTTP(cl jsonrpc.HTTPClient, bytes cmn.HexBytes) (cmn.HexBytes, error) { params := map[string]interface{}{ "arg": bytes, } result := new(ResultEchoDataBytes) - if _, err := cl.Call("echo_data_bytes", params, result); err != nil { + if err := cl.Call("echo_data_bytes", params, result); err != nil { return []byte{}, err } return result.Value, nil } -func testWithHTTPClient(t *testing.T, cl client.HTTPClient) { +func testWithHTTPClient(t *testing.T, cl jsonrpc.HTTPClient) { val := "acbd" got, err := echoViaHTTP(cl, val) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, val, got) val2 := randBytes(t) @@ -204,87 +167,21 @@ func testWithHTTPClient(t *testing.T, cl client.HTTPClient) { assert.Equal(t, val4, got4) } -func echoViaWS(cl *client.WSClient, val string) (string, error) { - params := map[string]interface{}{ - "arg": val, - } - err := cl.Call(context.Background(), "echo", params) - if err != nil { - return "", err - } - - msg := <-cl.ResponsesCh - if msg.Error != nil { - return "", err - - } - result := new(ResultEcho) - err = json.Unmarshal(msg.Result, result) - if err != nil { - return "", nil - } - return result.Value, nil -} - -func echoBytesViaWS(cl *client.WSClient, bytes []byte) ([]byte, error) { - params := map[string]interface{}{ - "arg": bytes, - } - err := cl.Call(context.Background(), "echo_bytes", params) - if err != nil { - return []byte{}, err - } - - msg := <-cl.ResponsesCh - if msg.Error != nil { - return []byte{}, msg.Error - - } - result := new(ResultEchoBytes) - err = json.Unmarshal(msg.Result, result) - if err != nil { - return []byte{}, nil - } - return result.Value, nil -} - -func testWithWSClient(t *testing.T, cl *client.WSClient) { - val := "acbd" - got, err := echoViaWS(cl, val) - require.Nil(t, err) - assert.Equal(t, got, val) - - val2 := randBytes(t) - got2, err := echoBytesViaWS(cl, val2) - require.Nil(t, err) - assert.Equal(t, got2, val2) -} - -//------------- - func TestServersAndClientsBasic(t *testing.T) { - serverAddrs := [...]string{tcpAddr, unixAddr} + serverAddrs := [...]string{httpAddress} for _, addr := range serverAddrs { - cl1 := client.NewURIClient(addr) + cl1 := jsonrpc.NewURIClient(addr) fmt.Printf("=== testing server on %s using %v client", addr, cl1) testWithHTTPClient(t, cl1) - cl2 := client.NewJSONRPCClient(addr) + cl2 := jsonrpc.NewClient(addr) fmt.Printf("=== testing server on %s using %v client", addr, cl2) testWithHTTPClient(t, cl2) - - cl3 := client.NewWSClient(addr, websocketEndpoint) - cl3.SetLogger(log.TestingLogger()) - err := cl3.Start() - require.Nil(t, err) - fmt.Printf("=== testing server on %s using %v client", addr, cl3) - testWithWSClient(t, cl3) - cl3.Stop() } } func TestHexStringArg(t *testing.T) { - cl := client.NewURIClient(tcpAddr) + cl := jsonrpc.NewURIClient(httpAddress) // should NOT be handled as hex val := "0xabc" got, err := echoViaHTTP(cl, val) @@ -293,7 +190,7 @@ func TestHexStringArg(t *testing.T) { } func TestQuotedStringArg(t *testing.T) { - cl := client.NewURIClient(tcpAddr) + cl := jsonrpc.NewURIClient(httpAddress) // should NOT be unquoted val := "\"abc\"" got, err := echoViaHTTP(cl, val) @@ -301,64 +198,12 @@ func TestQuotedStringArg(t *testing.T) { assert.Equal(t, got, val) } -func TestWSNewWSRPCFunc(t *testing.T) { - cl := client.NewWSClient(tcpAddr, websocketEndpoint) - cl.SetLogger(log.TestingLogger()) - err := cl.Start() - require.Nil(t, err) - defer cl.Stop() - - val := "acbd" - params := map[string]interface{}{ - "arg": val, - } - err = cl.Call(context.Background(), "echo_ws", params) - require.Nil(t, err) - - msg := <-cl.ResponsesCh - if msg.Error != nil { - t.Fatal(err) - } - result := new(ResultEcho) - err = json.Unmarshal(msg.Result, result) - require.Nil(t, err) - got := result.Value - assert.Equal(t, got, val) -} - -func TestWSHandlesArrayParams(t *testing.T) { - cl := client.NewWSClient(tcpAddr, websocketEndpoint) - cl.SetLogger(log.TestingLogger()) - err := cl.Start() - require.Nil(t, err) - defer cl.Stop() - - val := "acbd" - params := []interface{}{val} - err = cl.CallWithArrayParams(context.Background(), "echo_ws", params) - require.Nil(t, err) - - msg := <-cl.ResponsesCh - if msg.Error != nil { - t.Fatalf("%+v", err) - } - result := new(ResultEcho) - err = json.Unmarshal(msg.Result, result) - require.Nil(t, err) - got := result.Value - assert.Equal(t, got, val) -} - -// TestWSClientPingPong checks that a client & server exchange pings -// & pongs so connection stays alive. -func TestWSClientPingPong(t *testing.T) { - cl := client.NewWSClient(tcpAddr, websocketEndpoint) - cl.SetLogger(log.TestingLogger()) - err := cl.Start() - require.Nil(t, err) - defer cl.Stop() +func TestUnmarshalError(t *testing.T) { + respString := `{"id":"jsonrpc-client","jsonrpc":"2.0","error":{"message":"Method status not supported.","code":-32000,"data":{"stack":"Error: Method status not supported.\n at GethApiDouble.handleRequest (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/ganache-core/lib/subproviders/geth_api_double.js:70:1)\n at next (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/index.js:136:1)\n at GethDefaults.handleRequest (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/ganache-core/lib/subproviders/gethdefaults.js:15:1)\n at next (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/index.js:136:1)\n at SubscriptionSubprovider.FilterSubprovider.handleRequest (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/subproviders/filters.js:89:1)\n at SubscriptionSubprovider.handleRequest (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/subproviders/subscriptions.js:137:1)\n at next (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/index.js:136:1)\n at DelayedBlockFilter.handleRequest (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/ganache-core/lib/subproviders/delayedblockfilter.js:32:1)\n at next (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/index.js:136:1)\n at RequestFunnel.handleRequest (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/ganache-core/lib/subproviders/requestfunnel.js:32:1)\n at next (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/index.js:136:1)\n at Web3ProviderEngine._handleAsync (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/index.js:123:1)\n at Timeout._onTimeout (/home/silas/code/go/src/github.com/hyperledger/burrow/tests/vent/eth/node_modules/truffle/build/webpack:/node_modules/web3-provider-engine/index.js:107:1)\n at listOnTimeout (node:internal/timers:557:17)\n at processTimers (node:internal/timers:500:7)","name":"Error"}}}` - time.Sleep(6 * time.Second) + response := &types.RPCResponse{} + err := json.Unmarshal([]byte(respString), response) + require.NoError(t, err) } func randBytes(t *testing.T) []byte { diff --git a/rpc/lib/server/handlers.go b/rpc/lib/server/handlers.go index b26ef5d17..a391c6f21 100644 --- a/rpc/lib/server/handlers.go +++ b/rpc/lib/server/handlers.go @@ -2,25 +2,18 @@ package server import ( "bytes" - "context" "encoding/hex" "encoding/json" "fmt" "io/ioutil" "net/http" "reflect" - "runtime/debug" "sort" "strings" - "time" - "github.com/gorilla/websocket" - "github.com/hyperledger/burrow/consensus/tendermint" "github.com/hyperledger/burrow/logging" - "github.com/hyperledger/burrow/logging/structure" "github.com/hyperledger/burrow/rpc/lib/types" "github.com/pkg/errors" - cmn "github.com/tendermint/tendermint/libs/common" ) // RegisterRPCFuncs adds a route for each function in the funcMap, as well as general jsonrpc and websocket handlers for all functions. @@ -224,19 +217,6 @@ func jsonParamsToArgsRPC(rpcFunc *RPCFunc, params json.RawMessage) ([]reflect.Va return jsonParamsToArgs(rpcFunc, params, 0) } -// Same as above, but with the first param the websocket connection -func jsonParamsToArgsWS(rpcFunc *RPCFunc, params json.RawMessage, wsCtx types.WSRPCContext) ([]reflect.Value, error) { - values, err := jsonParamsToArgs(rpcFunc, params, 1) - if err != nil { - return nil, err - } - return append([]reflect.Value{reflect.ValueOf(wsCtx)}, values...), nil -} - -// rpc.json -//----------------------------------------------------------------------------- -// rpc.http - // convert from a function name to the http handler func makeHTTPHandler(rpcFunc *RPCFunc, logger *logging.Logger) func(http.ResponseWriter, *http.Request) { // Exception for websocket endpoints @@ -350,375 +330,6 @@ func nonJSONToArg(ty reflect.Type, arg string) (reflect.Value, bool, error) { return reflect.ValueOf(nil), false, nil } -// rpc.http -//----------------------------------------------------------------------------- -// rpc.websocket - -const ( - defaultWSWriteChanCapacity = 1000 - defaultWSWriteWait = 10 * time.Second - defaultWSReadWait = 30 * time.Second - defaultWSPingPeriod = (defaultWSReadWait * 9) / 10 -) - -// A single websocket connection contains listener id, underlying ws -// connection, and the event switch for subscribing to events. -// -// In case of an error, the connection is stopped. -type wsConnection struct { - cmn.BaseService - - remoteAddr string - baseConn *websocket.Conn - writeChan chan types.RPCResponse - - funcMap map[string]*RPCFunc - - // write channel capacity - writeChanCapacity int - - // each write times out after this. - writeWait time.Duration - - // Connection times out if we haven't received *anything* in this long, not even pings. - readWait time.Duration - - // Send pings to server with this period. Must be less than readWait, but greater than zero. - pingPeriod time.Duration - - // object that is used to subscribe / unsubscribe from events - eventSub types.EventSubscriber -} - -// NewWSConnection wraps websocket.Conn. -// -// See the commentary on the func(*wsConnection) functions for a detailed -// description of how to configure ping period and pong wait time. NOTE: if the -// write buffer is full, pongs may be dropped, which may cause clients to -// disconnect. see https://github.com/gorilla/websocket/issues/97 -func NewWSConnection(baseConn *websocket.Conn, funcMap map[string]*RPCFunc, - logger *logging.Logger, options ...func(*wsConnection)) *wsConnection { - wsc := &wsConnection{ - remoteAddr: baseConn.RemoteAddr().String(), - baseConn: baseConn, - funcMap: funcMap, - writeWait: defaultWSWriteWait, - writeChanCapacity: defaultWSWriteChanCapacity, - readWait: defaultWSReadWait, - pingPeriod: defaultWSPingPeriod, - } - for _, option := range options { - option(wsc) - } - - wsc.BaseService = *cmn.NewBaseService(tendermint.NewLogger(logger.With("remote", baseConn.RemoteAddr())), - "wsConnection", wsc) - return wsc -} - -// EventSubscriber sets object that is used to subscribe / unsubscribe from -// events - not Goroutine-safe. If none given, default node's eventBus will be -// used. -func EventSubscriber(eventSub types.EventSubscriber) func(*wsConnection) { - return func(wsc *wsConnection) { - wsc.eventSub = eventSub - } -} - -// WriteWait sets the amount of time to wait before a websocket write times out. -// It should only be used in the constructor - not Goroutine-safe. -func WriteWait(writeWait time.Duration) func(*wsConnection) { - return func(wsc *wsConnection) { - wsc.writeWait = writeWait - } -} - -// WriteChanCapacity sets the capacity of the websocket write channel. -// It should only be used in the constructor - not Goroutine-safe. -func WriteChanCapacity(cap int) func(*wsConnection) { - return func(wsc *wsConnection) { - wsc.writeChanCapacity = cap - } -} - -// ReadWait sets the amount of time to wait before a websocket read times out. -// It should only be used in the constructor - not Goroutine-safe. -func ReadWait(readWait time.Duration) func(*wsConnection) { - return func(wsc *wsConnection) { - wsc.readWait = readWait - } -} - -// PingPeriod sets the duration for sending websocket pings. -// It should only be used in the constructor - not Goroutine-safe. -func PingPeriod(pingPeriod time.Duration) func(*wsConnection) { - return func(wsc *wsConnection) { - wsc.pingPeriod = pingPeriod - } -} - -// OnStart implements cmn.Service by starting the read and write routines. It -// blocks until the connection closes. -func (wsc *wsConnection) OnStart() error { - wsc.writeChan = make(chan types.RPCResponse, wsc.writeChanCapacity) - - // Read subscriptions/unsubscriptions to events - go wsc.readRoutine() - // Write responses, BLOCKING. - wsc.writeRoutine() - - return nil -} - -// OnStop implements cmn.Service by unsubscribing remoteAddr from all subscriptions. -func (wsc *wsConnection) OnStop() { - // Both read and write loops close the websocket connection when they exit their loops. - // The writeChan is never closed, to allow WriteRPCResponse() to fail. - if wsc.eventSub != nil { - wsc.eventSub.UnsubscribeAll(context.TODO(), wsc.remoteAddr) - } -} - -// GetRemoteAddr returns the remote address of the underlying connection. -// It implements WSRPCConnection -func (wsc *wsConnection) GetRemoteAddr() string { - return wsc.remoteAddr -} - -// GetEventSubscriber implements WSRPCConnection by returning event subscriber. -func (wsc *wsConnection) GetEventSubscriber() types.EventSubscriber { - return wsc.eventSub -} - -// WriteRPCResponse pushes a response to the writeChan, and blocks until it is accepted. -// It implements WSRPCConnection. It is Goroutine-safe. -func (wsc *wsConnection) WriteRPCResponse(resp types.RPCResponse) { - select { - case <-wsc.Quit(): - return - case wsc.writeChan <- resp: - } -} - -// TryWriteRPCResponse attempts to push a response to the writeChan, but does not block. -// It implements WSRPCConnection. It is Goroutine-safe -func (wsc *wsConnection) TryWriteRPCResponse(resp types.RPCResponse) bool { - select { - case <-wsc.Quit(): - return false - case wsc.writeChan <- resp: - return true - default: - return false - } -} - -// Read from the socket and subscribe to or unsubscribe from events -func (wsc *wsConnection) readRoutine() { - defer func() { - if r := recover(); r != nil { - err, ok := r.(error) - if !ok { - err = fmt.Errorf("WSJSONRPC: %v", r) - } - wsc.Logger.Error("Panic in WSJSONRPC handler", "err", err, "stack", string(debug.Stack())) - wsc.WriteRPCResponse(types.RPCInternalError("unknown", err)) - go wsc.readRoutine() - } else { - wsc.baseConn.Close() // nolint: errcheck - } - }() - - wsc.baseConn.SetPongHandler(func(m string) error { - return wsc.baseConn.SetReadDeadline(time.Now().Add(wsc.readWait)) - }) - - for { - select { - case <-wsc.Quit(): - return - default: - // reset deadline for every type of message (control or data) - if err := wsc.baseConn.SetReadDeadline(time.Now().Add(wsc.readWait)); err != nil { - wsc.Logger.Error("failed to set read deadline", "err", err) - } - var in []byte - _, in, err := wsc.baseConn.ReadMessage() - if err != nil { - if websocket.IsCloseError(err, websocket.CloseNormalClosure) { - wsc.Logger.Info("Client closed the connection") - } else { - wsc.Logger.Error("Failed to read request", "err", err) - } - wsc.Stop() - return - } - - var request types.RPCRequest - err = json.Unmarshal(in, &request) - if err != nil { - wsc.WriteRPCResponse(types.RPCParseError("", errors.Wrap(err, "Error unmarshaling request"))) - continue - } - - // A Notification is a Request object without an "id" member. - // The Server MUST NOT reply to a Notification, including those that are within a batch request. - if request.ID == "" { - wsc.Logger.Debug("WSJSONRPC received a notification, skipping... (please send a non-empty ID if you want to call a method)") - continue - } - - // Now, fetch the RPCFunc and execute it. - - rpcFunc := wsc.funcMap[request.Method] - if rpcFunc == nil { - wsc.WriteRPCResponse(types.RPCMethodNotFoundError(request.ID)) - continue - } - var args []reflect.Value - if rpcFunc.ws { - wsCtx := types.WSRPCContext{Request: request, WSRPCConnection: wsc} - if len(request.Params) > 0 { - args, err = jsonParamsToArgsWS(rpcFunc, request.Params, wsCtx) - } - } else { - if len(request.Params) > 0 { - args, err = jsonParamsToArgsRPC(rpcFunc, request.Params) - } - } - if err != nil { - wsc.WriteRPCResponse(types.RPCInternalError(request.ID, errors.Wrap(err, "Error converting json params to arguments"))) - continue - } - returns := rpcFunc.f.Call(args) - - // TODO: Need to encode args/returns to string if we want to log them - wsc.Logger.Info("WSJSONRPC", "method", request.Method) - - result, err := unreflectResult(returns) - if err != nil { - wsc.WriteRPCResponse(types.RPCInternalError(request.ID, err)) - continue - } else { - wsc.WriteRPCResponse(types.NewRPCSuccessResponse(request.ID, result)) - continue - } - - } - } -} - -// receives on a write channel and writes out on the socket -func (wsc *wsConnection) writeRoutine() { - pingTicker := time.NewTicker(wsc.pingPeriod) - defer func() { - pingTicker.Stop() - if err := wsc.baseConn.Close(); err != nil { - wsc.Logger.Error("Error closing connection", "err", err) - } - }() - - // https://github.com/gorilla/websocket/issues/97 - pongs := make(chan string, 1) - wsc.baseConn.SetPingHandler(func(m string) error { - select { - case pongs <- m: - default: - } - return nil - }) - - for { - select { - case m := <-pongs: - err := wsc.writeMessageWithDeadline(websocket.PongMessage, []byte(m)) - if err != nil { - wsc.Logger.Info("Failed to write pong (client may disconnect)", "err", err) - } - case <-pingTicker.C: - err := wsc.writeMessageWithDeadline(websocket.PingMessage, []byte{}) - if err != nil { - wsc.Logger.Error("Failed to write ping", "err", err) - wsc.Stop() - return - } - case msg := <-wsc.writeChan: - jsonBytes, err := json.MarshalIndent(msg, "", " ") - if err != nil { - wsc.Logger.Error("Failed to marshal RPCResponse to JSON", "err", err) - } else { - if err = wsc.writeMessageWithDeadline(websocket.TextMessage, jsonBytes); err != nil { - wsc.Logger.Error("Failed to write response", "err", err) - wsc.Stop() - return - } - } - case <-wsc.Quit(): - return - } - } -} - -// All writes to the websocket must (re)set the write deadline. -// If some writes don't set it while others do, they may timeout incorrectly (https://github.com/tendermint/tendermint/issues/553) -func (wsc *wsConnection) writeMessageWithDeadline(msgType int, msg []byte) error { - if err := wsc.baseConn.SetWriteDeadline(time.Now().Add(wsc.writeWait)); err != nil { - return err - } - return wsc.baseConn.WriteMessage(msgType, msg) -} - -//---------------------------------------- - -// WebsocketManager is the main manager for all websocket connections. -// It holds the event switch and a map of functions for routing. -// NOTE: The websocket path is defined externally, e.g. in node/node.go -type WebsocketManager struct { - websocket.Upgrader - funcMap map[string]*RPCFunc - logger *logging.Logger - wsConnOptions []func(*wsConnection) -} - -// NewWebsocketManager returns a new WebsocketManager that routes according to -// the given funcMap and connects to the server with the given connection -// options. -func NewWebsocketManager(funcMap map[string]*RPCFunc, logger *logging.Logger, - wsConnOptions ...func(*wsConnection)) *WebsocketManager { - return &WebsocketManager{ - funcMap: funcMap, - Upgrader: websocket.Upgrader{ - CheckOrigin: func(r *http.Request) bool { - // TODO ??? - return true - }, - }, - logger: logger, - wsConnOptions: wsConnOptions, - } -} - -// WebsocketHandler upgrades the request/response (via http.Hijack) and starts the wsConnection. -func (wm *WebsocketManager) WebsocketHandler(w http.ResponseWriter, r *http.Request) { - wsConn, err := wm.Upgrade(w, r, nil) - if err != nil { - // TODO - return http error - wm.logger.TraceMsg("Failed to upgrade to websocket connection", structure.ErrorKey, err) - return - } - - // register connection - con := NewWSConnection(wsConn, wm.funcMap, wm.logger, wm.wsConnOptions...) - wm.logger.InfoMsg("New websocket connection", "remote_address", con.remoteAddr) - err = con.Start() // Blocking - if err != nil { - wm.logger.TraceMsg("Error starting connection", structure.ErrorKey, err) - } -} - -// rpc.websocket -//----------------------------------------------------------------------------- - // NOTE: assume returns is result struct and error. If error is not nil, return it func unreflectResult(returns []reflect.Value) (interface{}, error) { errV := returns[1] diff --git a/rpc/lib/server/handlers_test.go b/rpc/lib/server/handlers_test.go index 1c7ce3857..20e0bb5be 100644 --- a/rpc/lib/server/handlers_test.go +++ b/rpc/lib/server/handlers_test.go @@ -71,7 +71,7 @@ func TestRPCParams(t *testing.T) { } else { assert.True(t, recv.Error.Code < 0, "#%d: not expecting a positive JSONRPC code", i) // The wanted error is either in the message or the data - assert.Contains(t, recv.Error.Message+recv.Error.Data, tt.wantErr, "#%d: expected substring", i) + assert.Contains(t, recv.Error.Message+string(recv.Error.Data), tt.wantErr, "#%d: expected substring", i) } } } diff --git a/rpc/lib/server/parse_test.go b/rpc/lib/server/parse_test.go index 6f3f7dcbe..7b635e4d4 100644 --- a/rpc/lib/server/parse_test.go +++ b/rpc/lib/server/parse_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - cmn "github.com/tendermint/tendermint/libs/common" + "github.com/tendermint/tendermint/libs/bytes" ) func TestParseJSONMap(t *testing.T) { @@ -31,7 +31,7 @@ func TestParseJSONMap(t *testing.T) { // preloading map with values doesn't help tmp := 0 p2 := map[string]interface{}{ - "value": &cmn.HexBytes{}, + "value": &bytes.HexBytes{}, "height": &tmp, } err = json.Unmarshal(input, &p2) @@ -54,7 +54,7 @@ func TestParseJSONMap(t *testing.T) { Height interface{} `json:"height"` }{ Height: &tmp, - Value: &cmn.HexBytes{}, + Value: &bytes.HexBytes{}, } err = json.Unmarshal(input, &p3) if assert.Nil(err) { @@ -62,7 +62,7 @@ func TestParseJSONMap(t *testing.T) { if assert.True(ok, "%#v", p3.Height) { assert.Equal(22, *h) } - v, ok := p3.Value.(*cmn.HexBytes) + v, ok := p3.Value.(*bytes.HexBytes) if assert.True(ok, "%#v", p3.Value) { assert.EqualValues([]byte{0x12, 0x34}, *v) } @@ -70,8 +70,8 @@ func TestParseJSONMap(t *testing.T) { // simplest solution, but hard-coded p4 := struct { - Value cmn.HexBytes `json:"value"` - Height int `json:"height"` + Value bytes.HexBytes `json:"value"` + Height int `json:"height"` }{} err = json.Unmarshal(input, &p4) if assert.Nil(err) { @@ -90,10 +90,10 @@ func TestParseJSONMap(t *testing.T) { assert.Equal(22, h) } - var v cmn.HexBytes + var v bytes.HexBytes err = json.Unmarshal(*p5["value"], &v) if assert.Nil(err) { - assert.Equal(cmn.HexBytes{0x12, 0x34}, v) + assert.Equal(bytes.HexBytes{0x12, 0x34}, v) } } } @@ -119,10 +119,10 @@ func TestParseJSONArray(t *testing.T) { // preloading map with values helps here (unlike map - p2 above) tmp := 0 - p2 := []interface{}{&cmn.HexBytes{}, &tmp} + p2 := []interface{}{&bytes.HexBytes{}, &tmp} err = json.Unmarshal(input, &p2) if assert.Nil(err) { - v, ok := p2[0].(*cmn.HexBytes) + v, ok := p2[0].(*bytes.HexBytes) if assert.True(ok, "%#v", p2[0]) { assert.EqualValues([]byte{0x12, 0x34}, *v) } diff --git a/rpc/lib/types/error_codes.go b/rpc/lib/types/error_codes.go index 4ef91dd26..052919e20 100644 --- a/rpc/lib/types/error_codes.go +++ b/rpc/lib/types/error_codes.go @@ -1,8 +1,8 @@ package types import ( + "fmt" "net/http" - "strconv" ) // From JSONRPC 2.0 spec @@ -14,7 +14,9 @@ const ( RPCErrorCodeMethodNotFound RPCErrorCode = -32601 RPCErrorCodeInvalidParams RPCErrorCode = -32602 RPCErrorCodeInternalError RPCErrorCode = -32603 - RPCErrorCodeServerError RPCErrorCode = -32000 + // Available for custom server-defined errors + RPCErrorCodeServerErrorStart RPCErrorCode = -32000 + RPCErrorCodeServerErrorEnd RPCErrorCode = -32099 ) func (code RPCErrorCode) String() string { @@ -29,13 +31,18 @@ func (code RPCErrorCode) String() string { return "Invalid Params" case RPCErrorCodeInternalError: return "Internal Error" - case RPCErrorCodeServerError: - return "Server Error" default: - return strconv.FormatInt(int64(code), 10) + if code.IsServerError() { + return fmt.Sprintf("Server Error %d", code) + } + return fmt.Sprintf("Unknown Error %d", code) } } +func (code RPCErrorCode) IsServerError() bool { + return code >= RPCErrorCodeServerErrorStart && code <= RPCErrorCodeServerErrorEnd +} + func (code RPCErrorCode) HTTPStatusCode() int { switch code { case RPCErrorCodeInvalidRequest: diff --git a/rpc/lib/types/types.go b/rpc/lib/types/types.go index 8ff3e6c65..4124043d9 100644 --- a/rpc/lib/types/types.go +++ b/rpc/lib/types/types.go @@ -4,15 +4,11 @@ import ( "context" "encoding/json" "fmt" - "strings" "github.com/pkg/errors" tmpubsub "github.com/tendermint/tendermint/libs/pubsub" ) -//---------------------------------------- -// REQUEST - type RPCRequest struct { JSONRPC string `json:"jsonrpc"` ID string `json:"id"` @@ -33,52 +29,32 @@ func (req RPCRequest) String() string { return fmt.Sprintf("[%s %s]", req.ID, req.Method) } -func MapToRequest(id string, method string, params map[string]interface{}) (RPCRequest, error) { - var params_ = make(map[string]json.RawMessage, len(params)) - for name, value := range params { - valueJSON, err := json.Marshal(value) +func NewRequest(id string, method string, params interface{}) (RPCRequest, error) { + var payload json.RawMessage + var err error + if params != nil { + payload, err = json.Marshal(params) if err != nil { return RPCRequest{}, err } - params_[name] = valueJSON - } - payload, err := json.Marshal(params_) // NOTE: Amino doesn't handle maps yet. - if err != nil { - return RPCRequest{}, err } request := NewRPCRequest(id, method, payload) return request, nil } -func ArrayToRequest(id string, method string, params []interface{}) (RPCRequest, error) { - var params_ = make([]json.RawMessage, len(params)) - for i, value := range params { - valueJSON, err := json.Marshal(value) - if err != nil { - return RPCRequest{}, err - } - params_[i] = valueJSON - } - payload, err := json.Marshal(params_) // NOTE: Amino doesn't handle maps yet. - if err != nil { - return RPCRequest{}, err - } - request := NewRPCRequest(id, method, payload) - return request, nil +type RPCError struct { + Code RPCErrorCode `json:"code"` + Message string `json:"message"` + Data json.RawMessage `json:"data,omitempty"` } -//---------------------------------------- -// RESPONSE - -type RPCError struct { - Code RPCErrorCode `json:"code"` - Message string `json:"message"` - Data string `json:"data,omitempty"` +func (err *RPCError) IsServerError() bool { + return err.Code.IsServerError() } -func (err RPCError) Error() string { - const baseFormat = "RPC error %v - %s" - if err.Data != "" { +func (err *RPCError) Error() string { + const baseFormat = "%v - %s" + if len(err.Data) > 0 { return fmt.Sprintf(baseFormat+": %s", err.Code, err.Message, err.Data) } return fmt.Sprintf(baseFormat, err.Code, err.Message) @@ -102,22 +78,29 @@ func NewRPCSuccessResponse(id string, res interface{}) RPCResponse { var rawMsg json.RawMessage if res != nil { - var js []byte - js, err := json.Marshal(res) + var err error + rawMsg, err = json.Marshal(res) if err != nil { return RPCInternalError(id, errors.Wrap(err, "Error marshalling response")) } - rawMsg = json.RawMessage(js) } return RPCResponse{JSONRPC: "2.0", ID: id, Result: rawMsg} } func NewRPCErrorResponse(id string, code RPCErrorCode, data string) RPCResponse { + var bs []byte + if data != "" { + var err error + bs, err = json.Marshal(data) + if err != nil { + panic(fmt.Errorf("unexpected error JSON marshalling string: %w", err)) + } + } return RPCResponse{ JSONRPC: "2.0", ID: id, - Error: &RPCError{Code: code, Message: code.String(), Data: data}, + Error: &RPCError{Code: code, Message: code.String(), Data: bs}, } } @@ -148,43 +131,9 @@ func RPCInternalError(id string, err error) RPCResponse { return NewRPCErrorResponse(id, RPCErrorCodeInternalError, err.Error()) } -func RPCServerError(id string, err error) RPCResponse { - return NewRPCErrorResponse(id, RPCErrorCodeServerError, err.Error()) -} - -//---------------------------------------- - -// *wsConnection implements this interface. -type WSRPCConnection interface { - GetRemoteAddr() string - WriteRPCResponse(resp RPCResponse) - TryWriteRPCResponse(resp RPCResponse) bool - GetEventSubscriber() EventSubscriber -} - // EventSubscriber mirros tendermint/tendermint/types.EventBusSubscriber type EventSubscriber interface { Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, out chan<- interface{}) error Unsubscribe(ctx context.Context, subscriber string, query tmpubsub.Query) error UnsubscribeAll(ctx context.Context, subscriber string) error } - -// websocket-only RPCFuncs take this as the first parameter. -type WSRPCContext struct { - Request RPCRequest - WSRPCConnection -} - -//---------------------------------------- -// SOCKETS -// -// Determine if its a unix or tcp socket. -// If tcp, must specify the port; `0.0.0.0` will return incorrectly as "unix" since there's no port -// TODO: deprecate -func SocketType(listenAddr string) string { - socketType := "unix" - if len(strings.Split(listenAddr, ":")) >= 2 { - socketType = "tcp" - } - return socketType -} diff --git a/rpc/lib/types/types_test.go b/rpc/lib/types/types_test.go index dd0e0316d..8bff93138 100644 --- a/rpc/lib/types/types_test.go +++ b/rpc/lib/types/types_test.go @@ -29,20 +29,28 @@ func TestResponses(t *testing.T) { g := RPCMethodNotFoundError("2") h, _ := json.Marshal(g) i := `{"jsonrpc":"2.0","id":"2","error":{"code":-32601,"message":"Method Not Found"}}` - assert.Equal(string(h), string(i)) + assert.Equal(i, string(h)) } func TestRPCError(t *testing.T) { - assert.Equal(t, "RPC error 12 - Badness: One worse than a code 11", + assert.Equal(t, `Unknown Error 12 - Badness: "One worse than a code 11"`, fmt.Sprintf("%v", &RPCError{ Code: 12, Message: "Badness", - Data: "One worse than a code 11", + Data: raw("One worse than a code 11"), })) - assert.Equal(t, "RPC error 12 - Badness", + assert.Equal(t, "Unknown Error 12 - Badness", fmt.Sprintf("%v", &RPCError{ Code: 12, Message: "Badness", })) } + +func raw(v interface{}) json.RawMessage { + bs, err := json.MarshalIndent(v, "", "\t") + if err != nil { + panic(err) + } + return bs +} diff --git a/rpc/metrics/exporter.go b/rpc/metrics/exporter.go index b6a46c882..963190bdb 100644 --- a/rpc/metrics/exporter.go +++ b/rpc/metrics/exporter.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package metrics import ( @@ -282,7 +271,7 @@ func (e *Exporter) getTxBuckets(blockMetas []*types.BlockMeta) error { // Collect number of txs per block as an array of floats txsPerBlock := make([]float64, len(blockMetas)) for i, block := range blockMetas { - txsPerBlock[i] = float64(block.Header.NumTxs) + txsPerBlock[i] = float64(block.NumTxs) } e.datum.TxPerBlockBuckets, e.datum.TotalTxs = e.txPerBlockHistogramBuilder(txsPerBlock) diff --git a/rpc/metrics/exporter_test.go b/rpc/metrics/exporter_test.go index 573320339..82e585771 100644 --- a/rpc/metrics/exporter_test.go +++ b/rpc/metrics/exporter_test.go @@ -60,7 +60,7 @@ func TestExporter_Collect_Histogram(t *testing.T) { timePerBlock[i-1] = block.Header.Time.Sub(blockTime).Seconds() } blockTime = block.Header.Time - numTxsPerBlock[i] = float64(block.Header.NumTxs) + numTxsPerBlock[i] = float64(block.NumTxs) } // Pull out the histograms and make sure they check out @@ -141,16 +141,16 @@ func genBlocks(n int64) []*types.BlockMeta { for i := int64(0); i < n; i++ { blockDuration := time.Second*2 + time.Millisecond*time.Duration(rnd.Int63()>>48) blockTime = blockTime.Add(blockDuration) - bms[i] = blockMeta(i+1, rnd.Int63()>>56, blockTime) + bms[i] = blockMeta(i+1, rnd.Int()>>56, blockTime) } return bms } -func blockMeta(height, numTxs int64, blockTime time.Time) *types.BlockMeta { +func blockMeta(height int64, numTxs int, blockTime time.Time) *types.BlockMeta { return &types.BlockMeta{ + NumTxs: numTxs, Header: types.Header{ Height: height, - NumTxs: numTxs, Time: blockTime, }, } diff --git a/rpc/metrics/server.go b/rpc/metrics/server.go index ac9ed0658..0bc371efe 100644 --- a/rpc/metrics/server.go +++ b/rpc/metrics/server.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package metrics import ( diff --git a/rpc/result.go b/rpc/result.go index 37abaad82..b9cddda88 100644 --- a/rpc/result.go +++ b/rpc/result.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpc @@ -21,25 +10,15 @@ import ( "github.com/hyperledger/burrow/consensus/tendermint" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/names" + "github.com/hyperledger/burrow/execution/registry" "github.com/hyperledger/burrow/genesis" "github.com/hyperledger/burrow/txs" - amino "github.com/tendermint/go-amino" - "github.com/tendermint/tendermint/consensus" ctypes "github.com/tendermint/tendermint/consensus/types" + tmjson "github.com/tendermint/tendermint/libs/json" core_types "github.com/tendermint/tendermint/rpc/core/types" tmTypes "github.com/tendermint/tendermint/types" ) -// When using Tendermint types like Block and Vote we are forced to wrap the outer object and use amino marshalling -var aminoCodec = NewAminoCodec() - -func NewAminoCodec() *amino.Codec { - aminoCodec := amino.NewCodec() - consensus.RegisterConsensusMessages(aminoCodec) - core_types.RegisterAmino(aminoCodec) - return aminoCodec -} - type ResultStorage struct { Key binary.HexBytes Value binary.HexBytes @@ -74,24 +53,24 @@ type BlockMeta struct { } func (bm BlockMeta) MarshalJSON() ([]byte, error) { - return aminoCodec.MarshalJSON(bm.BlockMeta) + return tmjson.Marshal(bm.BlockMeta) } func (bm *BlockMeta) UnmarshalJSON(data []byte) (err error) { - return aminoCodec.UnmarshalJSON(data, &bm.BlockMeta) + return tmjson.Unmarshal(data, &bm.BlockMeta) } -// Needed for go-amino handling of interface types +// TODO: this wrapper was needed for go-amino handling of interface types, it _might_ not be needed any longer type Block struct { *tmTypes.Block } func (b Block) MarshalJSON() ([]byte, error) { - return aminoCodec.MarshalJSON(b.Block) + return tmjson.Marshal(b.Block) } func (b *Block) UnmarshalJSON(data []byte) (err error) { - return aminoCodec.UnmarshalJSON(data, &b.Block) + return tmjson.Unmarshal(data, &b.Block) } type ResultChainId struct { @@ -114,6 +93,11 @@ type ResultNetwork struct { *core_types.ResultNetInfo } +type ResultNetworkRegistry struct { + Address crypto.Address + registry.NodeIdentity +} + type ResultValidators struct { BlockHeight uint64 BondedValidators []*validator.Validator @@ -130,11 +114,11 @@ type RoundState struct { } func (rs RoundState) MarshalJSON() ([]byte, error) { - return aminoCodec.MarshalJSON(rs.RoundState) + return tmjson.Marshal(rs.RoundState) } func (rs *RoundState) UnmarshalJSON(data []byte) (err error) { - return aminoCodec.UnmarshalJSON(data, &rs.RoundState) + return tmjson.Unmarshal(data, &rs.RoundState) } type ResultPeers struct { @@ -156,7 +140,7 @@ type ResultAccount struct { type AccountHumanReadable struct { Address crypto.Address - PublicKey crypto.PublicKey + PublicKey *crypto.PublicKey Sequence uint64 Balance uint64 Code []string diff --git a/rpc/result_test.go b/rpc/result_test.go index c179e7d12..99989a7eb 100644 --- a/rpc/result_test.go +++ b/rpc/result_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpc @@ -44,7 +33,7 @@ func TestResultGetBlock(t *testing.T) { res := &ResultBlock{ Block: &Block{&tmTypes.Block{ LastCommit: &tmTypes.Commit{ - Precommits: []*tmTypes.CommitSig{ + Signatures: []tmTypes.CommitSig{ { Signature: []byte{1, 2, 3}, }, diff --git a/rpc/rpc.pb.go b/rpc/rpc.pb.go index ab323d8ec..6e1a5e631 100644 --- a/rpc/rpc.pb.go +++ b/rpc/rpc.pb.go @@ -5,7 +5,9 @@ package rpc import ( fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -26,7 +28,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 type ResultStatus struct { ChainID string `protobuf:"bytes,1,opt,name=ChainID,proto3" json:"ChainID,omitempty"` @@ -50,16 +52,21 @@ func (*ResultStatus) Descriptor() ([]byte, []int) { return fileDescriptor_77a6da22d6a3feb1, []int{0} } func (m *ResultStatus) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResultStatus.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ResultStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResultStatus.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ResultStatus) XXX_Merge(src proto.Message) { xxx_messageInfo_ResultStatus.Merge(m, src) } func (m *ResultStatus) XXX_Size() int { - return xxx_messageInfo_ResultStatus.Size(m) + return m.Size() } func (m *ResultStatus) XXX_DiscardUnknown() { xxx_messageInfo_ResultStatus.DiscardUnknown(m) @@ -128,32 +135,147 @@ func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } func init() { golang_proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } var fileDescriptor_77a6da22d6a3feb1 = []byte{ - // 364 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xbd, 0x6e, 0xe2, 0x40, - 0x14, 0x85, 0x19, 0x7e, 0xcd, 0x00, 0xda, 0xd5, 0x88, 0xc2, 0xa2, 0x30, 0xde, 0x15, 0x85, 0xb7, - 0x58, 0x7b, 0xb5, 0x68, 0x9b, 0x2d, 0xcd, 0x4a, 0x0b, 0x4d, 0x8a, 0x41, 0x21, 0x52, 0x3a, 0xff, - 0x0c, 0xf6, 0x48, 0x30, 0x63, 0x8d, 0xc7, 0x49, 0xfc, 0x76, 0x29, 0x79, 0x84, 0x28, 0x05, 0x8a, - 0xa0, 0xcb, 0x33, 0xa4, 0x88, 0x18, 0x30, 0x31, 0x4d, 0xba, 0x7b, 0xbe, 0x73, 0xef, 0x91, 0x7d, - 0x06, 0xb6, 0x45, 0x12, 0xd8, 0x89, 0xe0, 0x92, 0xa3, 0x9a, 0x48, 0x82, 0xc1, 0xcf, 0x88, 0xca, - 0x38, 0xf3, 0xed, 0x80, 0xaf, 0x9d, 0x88, 0x47, 0xdc, 0x51, 0x9e, 0x9f, 0x2d, 0x95, 0x52, 0x42, - 0x4d, 0xc7, 0x9b, 0xc1, 0x57, 0x49, 0x58, 0x48, 0xc4, 0x9a, 0x32, 0x79, 0x22, 0x5f, 0xee, 0xbc, - 0x15, 0x0d, 0x3d, 0xc9, 0xc5, 0x09, 0xb4, 0xfd, 0x60, 0x7d, 0x1c, 0xbf, 0xbf, 0x55, 0x61, 0x17, - 0x93, 0x34, 0x5b, 0xc9, 0xb9, 0xf4, 0x64, 0x96, 0x22, 0x1d, 0xb6, 0x26, 0xb1, 0x47, 0xd9, 0xec, - 0x9f, 0x0e, 0x4c, 0x60, 0xb5, 0x71, 0x21, 0x51, 0x1f, 0x36, 0x70, 0x76, 0xe0, 0x55, 0xc5, 0x8f, - 0x02, 0x8d, 0x60, 0xcf, 0xcd, 0x84, 0xe0, 0xf7, 0x0b, 0x22, 0x52, 0xca, 0x99, 0x5e, 0x53, 0xee, - 0x25, 0x44, 0x37, 0xb0, 0xf3, 0x9f, 0x30, 0x92, 0xd2, 0x74, 0xea, 0xa5, 0xb1, 0x5e, 0x37, 0x81, - 0xd5, 0x75, 0xff, 0x6c, 0xb6, 0xc3, 0xca, 0xf3, 0x76, 0x58, 0xfe, 0xc1, 0x38, 0x4f, 0x88, 0x58, - 0x91, 0x30, 0x22, 0xc2, 0xf1, 0x55, 0x84, 0xe3, 0x53, 0xe6, 0x89, 0xdc, 0x9e, 0x92, 0x07, 0x37, - 0x97, 0x24, 0xc5, 0xe5, 0x24, 0xf4, 0x0b, 0x6a, 0x57, 0x3c, 0x24, 0x33, 0xb6, 0xe4, 0x7a, 0xc3, - 0x04, 0x56, 0xe7, 0x77, 0xdf, 0x2e, 0x15, 0x50, 0x78, 0xf8, 0xbc, 0x85, 0x7e, 0x40, 0x6d, 0x9e, - 0xb3, 0x40, 0x5d, 0x34, 0xd5, 0x45, 0xcf, 0x3e, 0xf4, 0x51, 0x40, 0x7c, 0xb6, 0xd1, 0x08, 0xc2, - 0x89, 0x27, 0x83, 0x98, 0xb2, 0xe8, 0x3a, 0xd1, 0x35, 0x13, 0x58, 0x9a, 0x5b, 0x7f, 0xdd, 0x0e, - 0x2b, 0xb8, 0xc4, 0xd1, 0x5f, 0xd8, 0x5b, 0x14, 0x05, 0xab, 0xd4, 0xd6, 0xe9, 0x3b, 0x3e, 0x6a, - 0x3f, 0xfb, 0xf8, 0x72, 0xd5, 0x1d, 0x3f, 0xed, 0x0c, 0xf0, 0xb2, 0x33, 0xc0, 0xe3, 0xde, 0x00, - 0x9b, 0xbd, 0x01, 0x6e, 0xbf, 0x7d, 0x5e, 0x86, 0x48, 0x02, 0xbf, 0xa9, 0x9e, 0x6e, 0xfc, 0x1e, - 0x00, 0x00, 0xff, 0xff, 0xd7, 0x87, 0x65, 0xef, 0x29, 0x02, 0x00, 0x00, + // 365 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x3f, 0x6f, 0xe2, 0x30, + 0x18, 0xc6, 0x31, 0x7f, 0x83, 0x01, 0xdd, 0xc9, 0x62, 0x88, 0x18, 0x42, 0xee, 0xc4, 0x90, 0x1b, + 0x2e, 0x39, 0xdd, 0xe9, 0x96, 0xbb, 0x2d, 0x54, 0x2a, 0x2c, 0x1d, 0x8c, 0x4a, 0xa5, 0x6e, 0xf9, + 0xe3, 0x26, 0x96, 0xc0, 0x8e, 0x1c, 0xa7, 0x6d, 0xbe, 0x5d, 0x47, 0xc6, 0x8e, 0x55, 0x07, 0x54, + 0x85, 0xad, 0x9f, 0xa1, 0x43, 0x85, 0x21, 0x14, 0x96, 0x6e, 0xef, 0xf3, 0x7b, 0xde, 0xf7, 0x91, + 0xf5, 0x18, 0xb6, 0x45, 0x12, 0xd8, 0x89, 0xe0, 0x92, 0xa3, 0x9a, 0x48, 0x82, 0x41, 0x3f, 0xe2, + 0x11, 0x57, 0xda, 0xd9, 0x4e, 0x3b, 0x6b, 0xf0, 0x55, 0x12, 0x16, 0x12, 0xb1, 0xa4, 0x4c, 0xee, + 0xc9, 0x97, 0x5b, 0x6f, 0x41, 0x43, 0x4f, 0x72, 0xb1, 0x07, 0x6d, 0x3f, 0x58, 0xee, 0xc6, 0xef, + 0x6f, 0x55, 0xd8, 0xc5, 0x24, 0xcd, 0x16, 0x72, 0x26, 0x3d, 0x99, 0xa5, 0x48, 0x87, 0xad, 0x71, + 0xec, 0x51, 0x36, 0x3d, 0xd3, 0x81, 0x09, 0xac, 0x36, 0x2e, 0x25, 0xea, 0xc3, 0x06, 0xce, 0xb6, + 0xbc, 0xaa, 0xf8, 0x4e, 0xa0, 0x11, 0xec, 0xb9, 0x99, 0x10, 0xfc, 0x6e, 0x4e, 0x44, 0x4a, 0x39, + 0xd3, 0x6b, 0xca, 0x3d, 0x85, 0xe8, 0x0a, 0x76, 0xce, 0x09, 0x23, 0x29, 0x4d, 0x27, 0x5e, 0x1a, + 0xeb, 0x75, 0x13, 0x58, 0x5d, 0xf7, 0xef, 0x6a, 0x3d, 0xac, 0x3c, 0xaf, 0x87, 0x3f, 0x23, 0x2a, + 0xe3, 0xcc, 0xb7, 0x03, 0xbe, 0x74, 0xe2, 0x3c, 0x21, 0x62, 0x41, 0xc2, 0x88, 0x08, 0xc7, 0x57, + 0x11, 0x8e, 0x4f, 0x99, 0x27, 0x72, 0x7b, 0x42, 0xee, 0xdd, 0x5c, 0x92, 0x14, 0x1f, 0x27, 0xa1, + 0x5f, 0x50, 0xbb, 0xe0, 0x21, 0x99, 0xb2, 0x1b, 0xae, 0x37, 0x4c, 0x60, 0x75, 0x7e, 0xf7, 0xed, + 0xa3, 0x02, 0x4a, 0x0f, 0x1f, 0xb6, 0xd0, 0x0f, 0xa8, 0xcd, 0x72, 0x16, 0xa8, 0x8b, 0xa6, 0xba, + 0xe8, 0xd9, 0xdb, 0x3e, 0x4a, 0x88, 0x0f, 0x36, 0x1a, 0x41, 0x38, 0xf6, 0x64, 0x10, 0x53, 0x16, + 0x5d, 0x26, 0xba, 0x66, 0x02, 0x4b, 0x73, 0xeb, 0xaf, 0xeb, 0x61, 0x05, 0x1f, 0x71, 0xf4, 0x0f, + 0xf6, 0xe6, 0x65, 0xc1, 0x2a, 0xb5, 0xb5, 0x7f, 0xc7, 0x47, 0xed, 0x07, 0x1f, 0x9f, 0xae, 0xba, + 0xff, 0x57, 0x85, 0x01, 0x1e, 0x0b, 0x03, 0x3c, 0x15, 0x06, 0x78, 0x29, 0x0c, 0xf0, 0xb0, 0x31, + 0xc0, 0x6a, 0x63, 0x80, 0xeb, 0x6f, 0x9f, 0x97, 0x22, 0x92, 0xc0, 0x6f, 0xaa, 0x2f, 0xfc, 0xf3, + 0x1e, 0x00, 0x00, 0xff, 0xff, 0x07, 0x50, 0x46, 0x5b, 0x18, 0x02, 0x00, 0x00, +} + +func (m *ResultStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResultStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResultStatus) 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 m.CatchingUp { + i-- + if m.CatchingUp { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.ValidatorInfo != nil { + { + size, err := m.ValidatorInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if m.SyncInfo != nil { + { + size, err := m.SyncInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.NodeInfo != nil { + { + size, err := m.NodeInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + { + size := m.GenesisHash.Size() + i -= size + if _, err := m.GenesisHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.BurrowVersion) > 0 { + i -= len(m.BurrowVersion) + copy(dAtA[i:], m.BurrowVersion) + i = encodeVarintRpc(dAtA, i, uint64(len(m.BurrowVersion))) + i-- + dAtA[i] = 0x1a + } + if len(m.RunID) > 0 { + i -= len(m.RunID) + copy(dAtA[i:], m.RunID) + i = encodeVarintRpc(dAtA, i, uint64(len(m.RunID))) + i-- + dAtA[i] = 0x12 + } + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintRpc(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } +func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { + offset -= sovRpc(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} func (m *ResultStatus) Size() (n int) { if m == nil { return 0 @@ -182,13 +304,13 @@ func (m *ResultStatus) Size() (n int) { l = m.SyncInfo.Size() n += 1 + l + sovRpc(uint64(l)) } - if m.CatchingUp { - n += 2 - } if m.ValidatorInfo != nil { l = m.ValidatorInfo.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.CatchingUp { + n += 2 + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -196,15 +318,400 @@ func (m *ResultStatus) Size() (n int) { } func sovRpc(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRpc(x uint64) (n int) { return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *ResultStatus) 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 ErrIntOverflowRpc + } + 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 ChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + 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 ErrInvalidLengthRpc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RunID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + 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 ErrInvalidLengthRpc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RunID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BurrowVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + 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 ErrInvalidLengthRpc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BurrowVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GenesisHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + 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 ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NodeInfo == nil { + m.NodeInfo = &tendermint.NodeInfo{} + } + if err := m.NodeInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SyncInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SyncInfo == nil { + m.SyncInfo = &bcm.SyncInfo{} + } + if err := m.SyncInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValidatorInfo == nil { + m.ValidatorInfo = &validator.Validator{} + } + if err := m.ValidatorInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CatchingUp", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CatchingUp = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRpc(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpc + } + 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 skipRpc(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRpc + } + 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, ErrIntOverflowRpc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRpc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRpc + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRpc + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRpc + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRpc = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRpc = fmt.Errorf("proto: unexpected end of group") +) diff --git a/rpc/rpcdump/dump_server.go b/rpc/rpcdump/dump_server.go index d72172c62..140afc02c 100644 --- a/rpc/rpcdump/dump_server.go +++ b/rpc/rpcdump/dump_server.go @@ -8,6 +8,7 @@ import ( ) type dumpServer struct { + UnimplementedDumpServer dumper *dump.Dumper } diff --git a/rpc/rpcdump/rpcdump.pb.go b/rpc/rpcdump/rpcdump.pb.go index 7173c173b..fef839284 100644 --- a/rpc/rpcdump/rpcdump.pb.go +++ b/rpc/rpcdump/rpcdump.pb.go @@ -4,15 +4,15 @@ package rpcdump import ( - context "context" fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" golang_proto "github.com/golang/protobuf/proto" - dump "github.com/hyperledger/burrow/dump" - grpc "google.golang.org/grpc" + _ "github.com/hyperledger/burrow/dump" ) // Reference imports to suppress errors if they are not otherwise used. @@ -25,7 +25,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 type GetDumpParam struct { Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` @@ -41,16 +41,21 @@ func (*GetDumpParam) Descriptor() ([]byte, []int) { return fileDescriptor_80c0fd6a8168e015, []int{0} } func (m *GetDumpParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetDumpParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetDumpParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetDumpParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetDumpParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetDumpParam.Merge(m, src) } func (m *GetDumpParam) XXX_Size() int { - return xxx_messageInfo_GetDumpParam.Size(m) + return m.Size() } func (m *GetDumpParam) XXX_DiscardUnknown() { xxx_messageInfo_GetDumpParam.DiscardUnknown(m) @@ -77,121 +82,65 @@ func init() { proto.RegisterFile("rpcdump.proto", fileDescriptor_80c0fd6a8168e01 func init() { golang_proto.RegisterFile("rpcdump.proto", fileDescriptor_80c0fd6a8168e015) } var fileDescriptor_80c0fd6a8168e015 = []byte{ - // 194 bytes of a gzipped FileDescriptorProto + // 193 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2d, 0x2a, 0x48, 0x4e, - 0x29, 0xcd, 0x2d, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0xa5, 0x74, 0xd3, - 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, - 0xf2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xf4, 0x49, 0x71, 0x21, 0xcc, 0x50, - 0x52, 0xe3, 0xe2, 0x71, 0x4f, 0x2d, 0x71, 0x29, 0xcd, 0x2d, 0x08, 0x48, 0x2c, 0x4a, 0xcc, 0x15, - 0x12, 0xe3, 0x62, 0xcb, 0x48, 0xcd, 0x4c, 0xcf, 0x28, 0x91, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x09, - 0x82, 0xf2, 0x8c, 0xcc, 0xb8, 0x58, 0x40, 0x8a, 0x84, 0xf4, 0xb8, 0xd8, 0xa1, 0xea, 0x85, 0x44, - 0xf5, 0x60, 0xce, 0x41, 0x36, 0x41, 0x8a, 0x4b, 0x0f, 0x2c, 0x06, 0x12, 0x30, 0x60, 0x74, 0xb2, - 0xbe, 0xf1, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x03, 0x8f, 0xe5, 0x18, 0x4f, 0x3c, 0x96, - 0x63, 0x8c, 0xd2, 0x44, 0x72, 0x6c, 0x46, 0x65, 0x41, 0x6a, 0x51, 0x4e, 0x6a, 0x4a, 0x7a, 0x6a, - 0x91, 0x7e, 0x52, 0x69, 0x51, 0x51, 0x7e, 0xb9, 0x7e, 0x51, 0x41, 0xb2, 0x3e, 0xd4, 0xdc, 0x24, - 0x36, 0xb0, 0x1b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x75, 0xfd, 0xde, 0x63, 0xf8, 0x00, - 0x00, 0x00, + 0x29, 0xcd, 0x2d, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0xa5, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0xc1, 0x62, 0xfa, 0x20, 0x16, 0x44, 0x5a, 0x8a, 0x0b, 0xa1, 0x54, 0x49, 0x8d, + 0x8b, 0xc7, 0x3d, 0xb5, 0xc4, 0xa5, 0x34, 0xb7, 0x20, 0x20, 0xb1, 0x28, 0x31, 0x57, 0x48, 0x8c, + 0x8b, 0x2d, 0x23, 0x35, 0x33, 0x3d, 0xa3, 0x44, 0x82, 0x51, 0x81, 0x51, 0x83, 0x25, 0x08, 0xca, + 0x33, 0x32, 0xe3, 0x62, 0x01, 0x29, 0x12, 0xd2, 0xe3, 0x62, 0x87, 0xaa, 0x17, 0x12, 0xd5, 0x83, + 0xd9, 0x8a, 0x6c, 0x82, 0x14, 0x97, 0x1e, 0x58, 0x0c, 0x24, 0x60, 0xc0, 0xe8, 0xe4, 0x7c, 0xe2, + 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x37, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x78, + 0xe0, 0xb1, 0x1c, 0xe3, 0x89, 0xc7, 0x72, 0x8c, 0x51, 0x9a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, + 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x19, 0x95, 0x05, 0xa9, 0x45, 0x39, 0xa9, 0x29, 0xe9, 0xa9, 0x45, + 0xfa, 0x49, 0xa5, 0x45, 0x45, 0xf9, 0xe5, 0xfa, 0x45, 0x05, 0xc9, 0xfa, 0x50, 0xf3, 0x93, 0xd8, + 0xc0, 0x6e, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x62, 0x82, 0xa1, 0xe7, 0x00, 0x00, + 0x00, } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// DumpClient is the client API for Dump service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type DumpClient interface { - GetDump(ctx context.Context, in *GetDumpParam, opts ...grpc.CallOption) (Dump_GetDumpClient, error) -} - -type dumpClient struct { - cc *grpc.ClientConn -} - -func NewDumpClient(cc *grpc.ClientConn) DumpClient { - return &dumpClient{cc} -} - -func (c *dumpClient) GetDump(ctx context.Context, in *GetDumpParam, opts ...grpc.CallOption) (Dump_GetDumpClient, error) { - stream, err := c.cc.NewStream(ctx, &_Dump_serviceDesc.Streams[0], "/rpcdump.Dump/GetDump", opts...) +func (m *GetDumpParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - x := &dumpGetDumpClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Dump_GetDumpClient interface { - Recv() (*dump.Dump, error) - grpc.ClientStream + return dAtA[:n], nil } -type dumpGetDumpClient struct { - grpc.ClientStream +func (m *GetDumpParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (x *dumpGetDumpClient) Recv() (*dump.Dump, error) { - m := new(dump.Dump) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err +func (m *GetDumpParam) 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) } - return m, nil -} - -// DumpServer is the server API for Dump service. -type DumpServer interface { - GetDump(*GetDumpParam, Dump_GetDumpServer) error -} - -func RegisterDumpServer(s *grpc.Server, srv DumpServer) { - s.RegisterService(&_Dump_serviceDesc, srv) -} - -func _Dump_GetDump_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetDumpParam) - if err := stream.RecvMsg(m); err != nil { - return err + if m.Height != 0 { + i = encodeVarintRpcdump(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return srv.(DumpServer).GetDump(m, &dumpGetDumpServer{stream}) -} - -type Dump_GetDumpServer interface { - Send(*dump.Dump) error - grpc.ServerStream -} - -type dumpGetDumpServer struct { - grpc.ServerStream -} - -func (x *dumpGetDumpServer) Send(m *dump.Dump) error { - return x.ServerStream.SendMsg(m) + return len(dAtA) - i, nil } -var _Dump_serviceDesc = grpc.ServiceDesc{ - ServiceName: "rpcdump.Dump", - HandlerType: (*DumpServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "GetDump", - Handler: _Dump_GetDump_Handler, - ServerStreams: true, - }, - }, - Metadata: "rpcdump.proto", +func encodeVarintRpcdump(dAtA []byte, offset int, v uint64) int { + offset -= sovRpcdump(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base } - func (m *GetDumpParam) Size() (n int) { if m == nil { return 0 @@ -208,15 +157,162 @@ func (m *GetDumpParam) Size() (n int) { } func sovRpcdump(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRpcdump(x uint64) (n int) { return sovRpcdump(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *GetDumpParam) 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 ErrIntOverflowRpcdump + } + 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: GetDumpParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetDumpParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcdump + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRpcdump(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcdump + } + 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 skipRpcdump(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRpcdump + } + 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, ErrIntOverflowRpcdump + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRpcdump + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRpcdump + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRpcdump + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRpcdump + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRpcdump = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRpcdump = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRpcdump = fmt.Errorf("proto: unexpected end of group") +) diff --git a/rpc/rpcdump/rpcdump_grpc.pb.go b/rpc/rpcdump/rpcdump_grpc.pb.go new file mode 100644 index 000000000..a764fc6ea --- /dev/null +++ b/rpc/rpcdump/rpcdump_grpc.pb.go @@ -0,0 +1,130 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package rpcdump + +import ( + context "context" + + dump "github.com/hyperledger/burrow/dump" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// DumpClient is the client API for Dump service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type DumpClient interface { + GetDump(ctx context.Context, in *GetDumpParam, opts ...grpc.CallOption) (Dump_GetDumpClient, error) +} + +type dumpClient struct { + cc grpc.ClientConnInterface +} + +func NewDumpClient(cc grpc.ClientConnInterface) DumpClient { + return &dumpClient{cc} +} + +func (c *dumpClient) GetDump(ctx context.Context, in *GetDumpParam, opts ...grpc.CallOption) (Dump_GetDumpClient, error) { + stream, err := c.cc.NewStream(ctx, &Dump_ServiceDesc.Streams[0], "/rpcdump.Dump/GetDump", opts...) + if err != nil { + return nil, err + } + x := &dumpGetDumpClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Dump_GetDumpClient interface { + Recv() (*dump.Dump, error) + grpc.ClientStream +} + +type dumpGetDumpClient struct { + grpc.ClientStream +} + +func (x *dumpGetDumpClient) Recv() (*dump.Dump, error) { + m := new(dump.Dump) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// DumpServer is the server API for Dump service. +// All implementations must embed UnimplementedDumpServer +// for forward compatibility +type DumpServer interface { + GetDump(*GetDumpParam, Dump_GetDumpServer) error + mustEmbedUnimplementedDumpServer() +} + +// UnimplementedDumpServer must be embedded to have forward compatible implementations. +type UnimplementedDumpServer struct { +} + +func (UnimplementedDumpServer) GetDump(*GetDumpParam, Dump_GetDumpServer) error { + return status.Errorf(codes.Unimplemented, "method GetDump not implemented") +} +func (UnimplementedDumpServer) mustEmbedUnimplementedDumpServer() {} + +// UnsafeDumpServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DumpServer will +// result in compilation errors. +type UnsafeDumpServer interface { + mustEmbedUnimplementedDumpServer() +} + +func RegisterDumpServer(s grpc.ServiceRegistrar, srv DumpServer) { + s.RegisterService(&Dump_ServiceDesc, srv) +} + +func _Dump_GetDump_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetDumpParam) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DumpServer).GetDump(m, &dumpGetDumpServer{stream}) +} + +type Dump_GetDumpServer interface { + Send(*dump.Dump) error + grpc.ServerStream +} + +type dumpGetDumpServer struct { + grpc.ServerStream +} + +func (x *dumpGetDumpServer) Send(m *dump.Dump) error { + return x.ServerStream.SendMsg(m) +} + +// Dump_ServiceDesc is the grpc.ServiceDesc for Dump service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Dump_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "rpcdump.Dump", + HandlerType: (*DumpServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "GetDump", + Handler: _Dump_GetDump_Handler, + ServerStreams: true, + }, + }, + Metadata: "rpcdump.proto", +} diff --git a/rpc/rpcevents/blocks.go b/rpc/rpcevents/blocks.go index 761a63711..29a1c60d3 100644 --- a/rpc/rpcevents/blocks.go +++ b/rpc/rpcevents/blocks.go @@ -72,10 +72,12 @@ func SingleBlock(height uint64) *BlockRange { return AbsoluteRange(height, height+1) } -func ConsumeBlockExecutions(stream ExecutionEvents_StreamClient, consumer func(*exec.BlockExecution) error) error { +func ConsumeBlockExecutions(stream exec.EventStream, consumer func(*exec.BlockExecution) error, + continuityOptions ...exec.ContinuityOpt) error { var be *exec.BlockExecution var err error - for be, err = exec.ConsumeBlockExecution(stream); err == nil; be, err = exec.ConsumeBlockExecution(stream) { + ba := exec.NewBlockAccumulator(continuityOptions...) + for be, err = ba.ConsumeBlockExecution(stream); err == nil; be, err = ba.ConsumeBlockExecution(stream) { err = consumer(be) if err != nil { return err diff --git a/rpc/rpcevents/execution_events_server.go b/rpc/rpcevents/execution_events_server.go index e25ce8273..ceb7b13fa 100644 --- a/rpc/rpcevents/execution_events_server.go +++ b/rpc/rpcevents/execution_events_server.go @@ -10,18 +10,21 @@ import ( "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/storage" ) const SubscribeBufferSize = 100 type Provider interface { // Get transactions - IterateStreamEvents(start, end *uint64, consumer func(*exec.StreamEvent) error) (err error) + IterateStreamEvents(startHeight, endHeight *uint64, sortOrder storage.SortOrder, + consumer func(*exec.StreamEvent) error) (err error) // Get a particular TxExecution by hash TxByHash(txHash []byte) (*exec.TxExecution, error) } type executionEventsServer struct { + UnimplementedExecutionEventsServer eventsProvider Provider emitter *event.Emitter tip bcm.BlockchainInfo @@ -140,8 +143,10 @@ func (ees *executionEventsServer) streamEvents(ctx context.Context, blockRange * // Check if we have missed blocks we need to catch up on if start < block.Height { // We expect start == block.Height when processing consecutive blocks but we may have missed a block by - // dropping an event - if so we can fill in here - catchupEnd := block.Height + // pubsub dropping an event (e.g. under heavy load) - if so we can fill in here. Since we have just + // received block at block.Height it should be guaranteed that we have stored all blocks <= block.Height + // in state (we only publish after successful state update). + catchupEnd := block.Height - 1 if catchupEnd > end { catchupEnd = end } @@ -202,12 +207,12 @@ func (ees *executionEventsServer) iterateStreamEvents(startHeight, endHeight uin // NOTE: this will underflow when start is 0 (as it often will be - and needs to be for restored chains) // however we at most underflow by 1 and we always add 1 back on when returning so we get away with this. lastHeightSeen := startHeight - 1 - err := ees.eventsProvider.IterateStreamEvents(&startHeight, &endHeight, - func(blockEvent *exec.StreamEvent) error { - if blockEvent.EndBlock != nil { - lastHeightSeen = blockEvent.EndBlock.GetHeight() + err := ees.eventsProvider.IterateStreamEvents(&startHeight, &endHeight, storage.AscendingSort, + func(ev *exec.StreamEvent) error { + if ev.EndBlock != nil { + lastHeightSeen = ev.EndBlock.GetHeight() } - return consumer(blockEvent) + return consumer(ev) }) // Returns the appropriate _next_ starting block - the one after the one we have seen - from which to stream next return lastHeightSeen + 1, err diff --git a/rpc/rpcevents/rpcevents.pb.go b/rpc/rpcevents/rpcevents.pb.go index ea0229c54..de8bbe774 100644 --- a/rpc/rpcevents/rpcevents.pb.go +++ b/rpc/rpcevents/rpcevents.pb.go @@ -4,17 +4,16 @@ package rpcevents import ( - context "context" fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" golang_proto "github.com/golang/protobuf/proto" github_com_hyperledger_burrow_binary "github.com/hyperledger/burrow/binary" exec "github.com/hyperledger/burrow/execution/exec" - grpc "google.golang.org/grpc" ) // Reference imports to suppress errors if they are not otherwise used. @@ -27,7 +26,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 type Bound_BoundType int32 @@ -88,16 +87,12 @@ func (m *GetBlockRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetBlockRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *GetBlockRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetBlockRequest.Merge(m, src) @@ -149,16 +144,12 @@ func (m *TxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *TxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *TxRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_TxRequest.Merge(m, src) @@ -236,16 +227,12 @@ func (m *BlocksRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *BlocksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlocksRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *BlocksRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_BlocksRequest.Merge(m, src) @@ -295,16 +282,12 @@ func (m *EventsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *EventsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *EventsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_EventsResponse.Merge(m, src) @@ -355,16 +338,12 @@ func (m *GetTxsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetTxsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetTxsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *GetTxsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetTxsRequest.Merge(m, src) @@ -421,16 +400,12 @@ func (m *GetTxsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetTxsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetTxsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *GetTxsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_GetTxsResponse.Merge(m, src) @@ -480,16 +455,12 @@ func (m *Bound) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Bound) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Bound.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *Bound) XXX_Merge(src proto.Message) { xxx_messageInfo_Bound.Merge(m, src) @@ -545,16 +516,12 @@ func (m *BlockRange) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *BlockRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlockRange.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *BlockRange) XXX_Merge(src proto.Message) { xxx_messageInfo_BlockRange.Merge(m, src) @@ -610,251 +577,50 @@ func init() { proto.RegisterFile("rpcevents.proto", fileDescriptor_580b21d8d2fd6 func init() { golang_proto.RegisterFile("rpcevents.proto", fileDescriptor_580b21d8d2fd68e4) } var fileDescriptor_580b21d8d2fd68e4 = []byte{ - // 583 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xed, 0xe6, 0xc3, 0xaa, 0x27, 0xfd, 0x30, 0xab, 0x82, 0x42, 0x84, 0xd2, 0xc8, 0x48, 0xa8, - 0x12, 0xaa, 0x53, 0x05, 0x55, 0x9c, 0x10, 0x8a, 0x25, 0xd3, 0x16, 0xb5, 0x42, 0xac, 0x97, 0x0f, - 0x21, 0x24, 0xe4, 0x38, 0x8b, 0x13, 0xd1, 0xda, 0xc6, 0x5e, 0x83, 0xf3, 0x53, 0xf8, 0x2b, 0x9c, - 0x38, 0xf6, 0xc8, 0x99, 0x43, 0x85, 0xd2, 0x3f, 0x82, 0xbc, 0x6b, 0x3b, 0x4e, 0x29, 0xe5, 0x12, - 0xed, 0xcc, 0x7b, 0x33, 0xf3, 0xf2, 0x76, 0xd6, 0xb0, 0x19, 0x85, 0x2e, 0xfb, 0xc2, 0x7c, 0x1e, - 0x1b, 0x61, 0x14, 0xf0, 0x00, 0xab, 0x65, 0xa2, 0xb3, 0xeb, 0x4d, 0xf9, 0x24, 0x19, 0x19, 0x6e, - 0x70, 0xd6, 0xf7, 0x02, 0x2f, 0xe8, 0x0b, 0xc6, 0x28, 0xf9, 0x28, 0x22, 0x11, 0x88, 0x93, 0xac, - 0xec, 0x00, 0x4b, 0x99, 0x2b, 0xcf, 0xfa, 0x13, 0xd8, 0x3c, 0x60, 0xdc, 0x3c, 0x0d, 0xdc, 0x4f, - 0x84, 0x7d, 0x4e, 0x58, 0xcc, 0xf1, 0x1d, 0x50, 0x0e, 0xd9, 0xd4, 0x9b, 0xf0, 0x36, 0xea, 0xa1, - 0x9d, 0x06, 0xc9, 0x23, 0x8c, 0xa1, 0xf1, 0xc6, 0x99, 0xf2, 0x76, 0xad, 0x87, 0x76, 0x56, 0x89, - 0x38, 0xeb, 0x3e, 0xa8, 0x34, 0x2d, 0x0a, 0x4f, 0x40, 0xa1, 0xe9, 0xa1, 0x13, 0x4f, 0x44, 0xe1, - 0x9a, 0xb9, 0x7f, 0x7e, 0xb1, 0xbd, 0xf2, 0xeb, 0x62, 0xbb, 0x2a, 0x6f, 0x32, 0x0b, 0x59, 0x74, - 0xca, 0xc6, 0x1e, 0x8b, 0xfa, 0xa3, 0x24, 0x8a, 0x82, 0xaf, 0xfd, 0xd1, 0xd4, 0x77, 0xa2, 0x99, - 0x71, 0xc8, 0x52, 0x73, 0xc6, 0x59, 0x4c, 0xf2, 0x26, 0xd7, 0xce, 0x7b, 0x0f, 0xeb, 0x42, 0x6b, - 0x5c, 0xcc, 0xdc, 0x07, 0x90, 0xe2, 0x1d, 0xdf, 0x63, 0x62, 0x6e, 0x6b, 0x70, 0xdb, 0x58, 0x78, - 0xb5, 0x00, 0x49, 0x85, 0x88, 0xb7, 0xa0, 0xf9, 0x32, 0x61, 0xd1, 0x4c, 0x34, 0x57, 0x89, 0x0c, - 0xf4, 0x13, 0xd8, 0xb0, 0x44, 0x19, 0x61, 0x71, 0x18, 0xf8, 0x31, 0xfb, 0xa7, 0x17, 0xf7, 0x41, - 0x91, 0xcc, 0x76, 0xad, 0x57, 0xdf, 0x69, 0x0d, 0x5a, 0x86, 0xf0, 0x54, 0xe4, 0x48, 0x0e, 0xe9, - 0x0c, 0xd6, 0x0f, 0x18, 0xa7, 0x69, 0x29, 0xb6, 0x07, 0x2d, 0x9b, 0x3b, 0x11, 0x5f, 0x6a, 0x59, - 0x4d, 0xe1, 0x7b, 0xa0, 0x5a, 0xfe, 0x38, 0xc7, 0x6b, 0x02, 0x5f, 0x24, 0x16, 0xaa, 0xeb, 0x55, - 0xd5, 0x1f, 0x60, 0xa3, 0x18, 0xf3, 0x1f, 0xd5, 0xfb, 0xb0, 0x46, 0x53, 0x2b, 0x65, 0x6e, 0xc2, - 0xa7, 0x81, 0x5f, 0x68, 0xbf, 0x25, 0xb5, 0x57, 0x10, 0xb2, 0x44, 0xd3, 0xbf, 0x21, 0x68, 0x9a, - 0x41, 0xe2, 0x8f, 0xb1, 0x01, 0x0d, 0x3a, 0x0b, 0xa5, 0xcf, 0x1b, 0x83, 0x4e, 0xd5, 0xe7, 0x0c, - 0x97, 0xbf, 0x19, 0x83, 0x08, 0x5e, 0x26, 0xf8, 0xc8, 0x1f, 0xb3, 0x34, 0xff, 0x2b, 0x32, 0xd0, - 0x9f, 0x83, 0x5a, 0x12, 0xf1, 0x1a, 0xac, 0x0e, 0x4d, 0xfb, 0xc5, 0xf1, 0x2b, 0x6a, 0x69, 0x2b, - 0x59, 0x44, 0xac, 0xe3, 0x21, 0x3d, 0x7a, 0x6d, 0x69, 0x08, 0xab, 0xd0, 0x7c, 0x76, 0x44, 0x6c, - 0xaa, 0xd5, 0x30, 0x80, 0x72, 0x3c, 0xa4, 0x96, 0x4d, 0xb5, 0x7a, 0x76, 0xb6, 0x29, 0xb1, 0x86, - 0x27, 0x5a, 0x43, 0x7f, 0x5b, 0xbd, 0x7f, 0xfc, 0x00, 0x9a, 0xc2, 0xcd, 0x7c, 0x11, 0xb4, 0xab, - 0x02, 0x89, 0x84, 0xb1, 0x0e, 0x75, 0xcb, 0x1f, 0x0b, 0x55, 0xd7, 0xb1, 0x32, 0x70, 0xf0, 0x1d, - 0xc1, 0x66, 0x69, 0x82, 0xbc, 0x51, 0xfc, 0x18, 0x14, 0x9b, 0x47, 0xcc, 0x39, 0xc3, 0xed, 0xab, - 0x3b, 0x56, 0x5c, 0x72, 0x27, 0xb7, 0x53, 0xf2, 0x44, 0xdd, 0x1e, 0xc2, 0xbb, 0x50, 0xa3, 0x29, - 0xde, 0xaa, 0x14, 0x95, 0xcf, 0xa6, 0xf3, 0xb7, 0xff, 0xf8, 0x69, 0xb1, 0x5e, 0x37, 0xcc, 0xb9, - 0x5b, 0x41, 0x96, 0xb7, 0x76, 0x0f, 0x99, 0xc3, 0xf3, 0x79, 0x17, 0xfd, 0x9c, 0x77, 0xd1, 0xef, - 0x79, 0x17, 0xfd, 0xb8, 0xec, 0xa2, 0xf3, 0xcb, 0x2e, 0x7a, 0xf7, 0xf0, 0xe6, 0x87, 0x18, 0x85, - 0x6e, 0xbf, 0xec, 0x39, 0x52, 0xc4, 0x07, 0xe2, 0xd1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x65, - 0xc9, 0x65, 0x0f, 0x79, 0x04, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ExecutionEventsClient is the client API for ExecutionEvents service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ExecutionEventsClient interface { - // Get StreamEvents (including transactions) for a range of block heights - Stream(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (ExecutionEvents_StreamClient, error) - // Get a particular TxExecution by hash - Tx(ctx context.Context, in *TxRequest, opts ...grpc.CallOption) (*exec.TxExecution, error) - // GetEvents provides events streaming one block at a time - that is all events emitted in a particular block - // are guaranteed to be delivered in each GetEventsResponse - Events(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (ExecutionEvents_EventsClient, error) -} - -type executionEventsClient struct { - cc *grpc.ClientConn -} - -func NewExecutionEventsClient(cc *grpc.ClientConn) ExecutionEventsClient { - return &executionEventsClient{cc} -} - -func (c *executionEventsClient) Stream(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (ExecutionEvents_StreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_ExecutionEvents_serviceDesc.Streams[0], "/rpcevents.ExecutionEvents/Stream", opts...) - if err != nil { - return nil, err - } - x := &executionEventsStreamClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type ExecutionEvents_StreamClient interface { - Recv() (*exec.StreamEvent, error) - grpc.ClientStream -} - -type executionEventsStreamClient struct { - grpc.ClientStream -} - -func (x *executionEventsStreamClient) Recv() (*exec.StreamEvent, error) { - m := new(exec.StreamEvent) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *executionEventsClient) Tx(ctx context.Context, in *TxRequest, opts ...grpc.CallOption) (*exec.TxExecution, error) { - out := new(exec.TxExecution) - err := c.cc.Invoke(ctx, "/rpcevents.ExecutionEvents/Tx", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *executionEventsClient) Events(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (ExecutionEvents_EventsClient, error) { - stream, err := c.cc.NewStream(ctx, &_ExecutionEvents_serviceDesc.Streams[1], "/rpcevents.ExecutionEvents/Events", opts...) - if err != nil { - return nil, err - } - x := &executionEventsEventsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type ExecutionEvents_EventsClient interface { - Recv() (*EventsResponse, error) - grpc.ClientStream -} - -type executionEventsEventsClient struct { - grpc.ClientStream -} - -func (x *executionEventsEventsClient) Recv() (*EventsResponse, error) { - m := new(EventsResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ExecutionEventsServer is the server API for ExecutionEvents service. -type ExecutionEventsServer interface { - // Get StreamEvents (including transactions) for a range of block heights - Stream(*BlocksRequest, ExecutionEvents_StreamServer) error - // Get a particular TxExecution by hash - Tx(context.Context, *TxRequest) (*exec.TxExecution, error) - // GetEvents provides events streaming one block at a time - that is all events emitted in a particular block - // are guaranteed to be delivered in each GetEventsResponse - Events(*BlocksRequest, ExecutionEvents_EventsServer) error -} - -func RegisterExecutionEventsServer(s *grpc.Server, srv ExecutionEventsServer) { - s.RegisterService(&_ExecutionEvents_serviceDesc, srv) -} - -func _ExecutionEvents_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(BlocksRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ExecutionEventsServer).Stream(m, &executionEventsStreamServer{stream}) -} - -type ExecutionEvents_StreamServer interface { - Send(*exec.StreamEvent) error - grpc.ServerStream -} - -type executionEventsStreamServer struct { - grpc.ServerStream -} - -func (x *executionEventsStreamServer) Send(m *exec.StreamEvent) error { - return x.ServerStream.SendMsg(m) -} - -func _ExecutionEvents_Tx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TxRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ExecutionEventsServer).Tx(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcevents.ExecutionEvents/Tx", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ExecutionEventsServer).Tx(ctx, req.(*TxRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ExecutionEvents_Events_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(BlocksRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ExecutionEventsServer).Events(m, &executionEventsEventsServer{stream}) -} - -type ExecutionEvents_EventsServer interface { - Send(*EventsResponse) error - grpc.ServerStream -} - -type executionEventsEventsServer struct { - grpc.ServerStream -} - -func (x *executionEventsEventsServer) Send(m *EventsResponse) error { - return x.ServerStream.SendMsg(m) -} - -var _ExecutionEvents_serviceDesc = grpc.ServiceDesc{ - ServiceName: "rpcevents.ExecutionEvents", - HandlerType: (*ExecutionEventsServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Tx", - Handler: _ExecutionEvents_Tx_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Stream", - Handler: _ExecutionEvents_Stream_Handler, - ServerStreams: true, - }, - { - StreamName: "Events", - Handler: _ExecutionEvents_Events_Handler, - ServerStreams: true, - }, - }, - Metadata: "rpcevents.proto", + // 580 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x5d, 0x6b, 0xd4, 0x40, + 0x14, 0xed, 0xec, 0x17, 0xcd, 0xdd, 0x7e, 0xc4, 0xa1, 0xca, 0xba, 0x48, 0xba, 0x44, 0x90, 0x82, + 0x34, 0x5b, 0x56, 0x8a, 0x4f, 0x22, 0x1b, 0x88, 0x6d, 0xa5, 0x45, 0x9c, 0x8c, 0x1f, 0x88, 0x20, + 0xd9, 0xec, 0x90, 0x5d, 0x6c, 0x93, 0x98, 0x4c, 0x34, 0xfb, 0x53, 0xfc, 0x2b, 0x3e, 0xf9, 0xd8, + 0x47, 0x1f, 0xc5, 0x87, 0x22, 0xdb, 0x3f, 0x22, 0x99, 0x49, 0xb2, 0xd9, 0x5a, 0xeb, 0xcb, 0x32, + 0xf7, 0x9e, 0x73, 0xef, 0x3d, 0x7b, 0xe6, 0x4e, 0x60, 0x33, 0x0a, 0x5d, 0xf6, 0x99, 0xf9, 0x3c, + 0x36, 0xc2, 0x28, 0xe0, 0x01, 0x56, 0xca, 0x44, 0x77, 0xcb, 0x0b, 0xbc, 0x40, 0x64, 0xfb, 0xd9, + 0x49, 0x12, 0xba, 0xc0, 0x52, 0xe6, 0xca, 0xb3, 0xfe, 0x04, 0x36, 0x0f, 0x18, 0x37, 0x4f, 0x03, + 0xf7, 0x23, 0x61, 0x9f, 0x12, 0x16, 0x73, 0x7c, 0x07, 0x5a, 0x87, 0x6c, 0xea, 0x4d, 0x78, 0x07, + 0xf5, 0xd0, 0x4e, 0x83, 0xe4, 0x11, 0xc6, 0xd0, 0x78, 0xe3, 0x4c, 0x79, 0xa7, 0xd6, 0x43, 0x3b, + 0xab, 0x44, 0x9c, 0x75, 0x1f, 0x14, 0x9a, 0x16, 0x85, 0x27, 0xd0, 0xa2, 0xe9, 0xa1, 0x13, 0x4f, + 0x44, 0xe1, 0x9a, 0xb9, 0x7f, 0x7e, 0xb1, 0xbd, 0xf2, 0xeb, 0x62, 0x7b, 0xd7, 0x9b, 0xf2, 0x49, + 0x32, 0x32, 0xdc, 0xe0, 0xac, 0x3f, 0x99, 0x85, 0x2c, 0x3a, 0x65, 0x63, 0x8f, 0x45, 0xfd, 0x51, + 0x12, 0x45, 0xc1, 0x97, 0xfe, 0x68, 0xea, 0x3b, 0xd1, 0xcc, 0x38, 0x64, 0xa9, 0x39, 0xe3, 0x2c, + 0x26, 0x79, 0x93, 0x6b, 0xe7, 0xbd, 0x87, 0x75, 0xa1, 0x35, 0x2e, 0x66, 0xee, 0x03, 0x48, 0xf1, + 0x8e, 0xef, 0x31, 0x31, 0xb7, 0x3d, 0xb8, 0x6d, 0x2c, 0x2c, 0x59, 0x80, 0xa4, 0x42, 0xc4, 0x5b, + 0xd0, 0x7c, 0x99, 0xb0, 0x68, 0x26, 0x9a, 0x2b, 0x44, 0x06, 0xfa, 0x09, 0x6c, 0x58, 0xa2, 0x8c, + 0xb0, 0x38, 0x0c, 0xfc, 0x98, 0xfd, 0xd3, 0x8b, 0xfb, 0xd0, 0x92, 0xcc, 0x4e, 0xad, 0x57, 0xdf, + 0x69, 0x0f, 0xda, 0x86, 0xf0, 0x54, 0xe4, 0x48, 0x0e, 0xe9, 0x0c, 0xd6, 0x0f, 0x18, 0xa7, 0x69, + 0x29, 0xb6, 0x07, 0x6d, 0x9b, 0x3b, 0x11, 0x5f, 0x6a, 0x59, 0x4d, 0xe1, 0x7b, 0xa0, 0x58, 0xfe, + 0x38, 0xc7, 0x6b, 0x02, 0x5f, 0x24, 0x16, 0xaa, 0xeb, 0x55, 0xd5, 0x1f, 0x60, 0xa3, 0x18, 0xf3, + 0x1f, 0xd5, 0xfb, 0xb0, 0x46, 0x53, 0x2b, 0x65, 0x6e, 0xc2, 0xa7, 0x81, 0x5f, 0x68, 0xbf, 0x25, + 0xb5, 0x57, 0x10, 0xb2, 0x44, 0xd3, 0xbf, 0x22, 0x68, 0x9a, 0x41, 0xe2, 0x8f, 0xb1, 0x01, 0x0d, + 0x3a, 0x0b, 0xa5, 0xcf, 0x1b, 0x83, 0x6e, 0xd5, 0xe7, 0x0c, 0x97, 0xbf, 0x19, 0x83, 0x08, 0x5e, + 0x26, 0xf8, 0xc8, 0x1f, 0xb3, 0x34, 0xff, 0x2b, 0x32, 0xd0, 0x9f, 0x83, 0x52, 0x12, 0xf1, 0x1a, + 0xac, 0x0e, 0x4d, 0xfb, 0xc5, 0xf1, 0x2b, 0x6a, 0xa9, 0x2b, 0x59, 0x44, 0xac, 0xe3, 0x21, 0x3d, + 0x7a, 0x6d, 0xa9, 0x08, 0x2b, 0xd0, 0x7c, 0x76, 0x44, 0x6c, 0xaa, 0xd6, 0x30, 0x40, 0xeb, 0x78, + 0x48, 0x2d, 0x9b, 0xaa, 0xf5, 0xec, 0x6c, 0x53, 0x62, 0x0d, 0x4f, 0xd4, 0x86, 0xfe, 0xb6, 0x7a, + 0xff, 0xf8, 0x01, 0x34, 0x85, 0x9b, 0xf9, 0x22, 0xa8, 0x57, 0x05, 0x12, 0x09, 0x63, 0x1d, 0xea, + 0x96, 0x3f, 0x16, 0xaa, 0xae, 0x63, 0x65, 0xe0, 0xe0, 0x1b, 0x82, 0xcd, 0xd2, 0x04, 0x79, 0xa3, + 0xf8, 0x31, 0xb4, 0x6c, 0x1e, 0x31, 0xe7, 0x0c, 0x77, 0xae, 0xee, 0x58, 0x71, 0xc9, 0xdd, 0xdc, + 0x4e, 0xc9, 0x13, 0x75, 0x7b, 0x08, 0xef, 0x42, 0x8d, 0xa6, 0x78, 0xab, 0x52, 0x54, 0x3e, 0x9b, + 0xee, 0xdf, 0xfe, 0xe3, 0xa7, 0xc5, 0x7a, 0xdd, 0x30, 0xe7, 0x6e, 0x05, 0x59, 0xde, 0xda, 0x3d, + 0x64, 0x5a, 0xe7, 0x73, 0x0d, 0xfd, 0x98, 0x6b, 0xe8, 0xe7, 0x5c, 0x43, 0xbf, 0xe7, 0x1a, 0xfa, + 0x7e, 0xa9, 0xa1, 0xf3, 0x4b, 0x0d, 0xbd, 0x7b, 0x78, 0xf3, 0x63, 0x8c, 0x42, 0xb7, 0x5f, 0xf6, + 0x1d, 0xb5, 0xc4, 0x47, 0xe2, 0xd1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x17, 0xe1, 0x08, 0x02, + 0x64, 0x04, 0x00, 0x00, } func (m *GetBlockRequest) 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 } @@ -862,35 +628,41 @@ func (m *GetBlockRequest) Marshal() (dAtA []byte, err error) { } func (m *GetBlockRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetBlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.Height)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Wait { - dAtA[i] = 0x10 - i++ + i-- if m.Wait { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintRpcevents(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *TxRequest) 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 } @@ -898,38 +670,46 @@ func (m *TxRequest) Marshal() (dAtA []byte, err error) { } func (m *TxRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.TxHash.Size())) - n1, err := m.TxHash.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 += n1 if m.Wait { - dAtA[i] = 0x10 - i++ + i-- if m.Wait { 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 := m.TxHash.Size() + i -= size + if _, err := m.TxHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpcevents(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *BlocksRequest) 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 } @@ -937,36 +717,45 @@ func (m *BlocksRequest) Marshal() (dAtA []byte, err error) { } func (m *BlocksRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlocksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.BlockRange != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.BlockRange.Size())) - n2, err := m.BlockRange.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Query) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Query) + copy(dAtA[i:], m.Query) i = encodeVarintRpcevents(dAtA, i, uint64(len(m.Query))) - i += copy(dAtA[i:], m.Query) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.BlockRange != nil { + { + size, err := m.BlockRange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcevents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *EventsResponse) 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 } @@ -974,37 +763,45 @@ func (m *EventsResponse) Marshal() (dAtA []byte, err error) { } func (m *EventsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.Height)) + 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] = 0x12 - i++ - i = encodeVarintRpcevents(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 = encodeVarintRpcevents(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintRpcevents(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *GetTxsRequest) 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 } @@ -1012,36 +809,43 @@ func (m *GetTxsRequest) Marshal() (dAtA []byte, err error) { } func (m *GetTxsRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTxsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.StartHeight != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.StartHeight)) - } - if m.EndHeight != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.EndHeight)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Query) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Query) + copy(dAtA[i:], m.Query) i = encodeVarintRpcevents(dAtA, i, uint64(len(m.Query))) - i += copy(dAtA[i:], m.Query) + i-- + dAtA[i] = 0x1a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.EndHeight != 0 { + i = encodeVarintRpcevents(dAtA, i, uint64(m.EndHeight)) + i-- + dAtA[i] = 0x10 + } + if m.StartHeight != 0 { + i = encodeVarintRpcevents(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *GetTxsResponse) 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 } @@ -1049,37 +853,45 @@ func (m *GetTxsResponse) Marshal() (dAtA []byte, err error) { } func (m *GetTxsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTxsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.Height)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.TxExecutions) > 0 { - for _, msg := range m.TxExecutions { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.TxExecutions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TxExecutions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcevents(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintRpcevents(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Bound) 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 } @@ -1087,30 +899,36 @@ func (m *Bound) Marshal() (dAtA []byte, err error) { } func (m *Bound) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Bound) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Type != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.Type)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Index != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpcevents(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Type != 0 { + i = encodeVarintRpcevents(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *BlockRange) 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 } @@ -1118,44 +936,56 @@ func (m *BlockRange) Marshal() (dAtA []byte, err error) { } func (m *BlockRange) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Start != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.Start.Size())) - n3, err := m.Start.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.End != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpcevents(dAtA, i, uint64(m.End.Size())) - n4, err := m.End.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.End.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcevents(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Start != nil { + { + size, err := m.Start.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcevents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintRpcevents(dAtA []byte, offset int, v uint64) int { + offset -= sovRpcevents(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 (m *GetBlockRequest) Size() (n int) { if m == nil { @@ -1315,14 +1145,7 @@ func (m *BlockRange) Size() (n int) { } func sovRpcevents(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRpcevents(x uint64) (n int) { return sovRpcevents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -1401,10 +1224,7 @@ func (m *GetBlockRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpcevents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpcevents } if (iNdEx + skippy) > l { @@ -1508,10 +1328,7 @@ func (m *TxRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpcevents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpcevents } if (iNdEx + skippy) > l { @@ -1630,10 +1447,7 @@ func (m *BlocksRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpcevents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpcevents } if (iNdEx + skippy) > l { @@ -1737,10 +1551,7 @@ func (m *EventsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpcevents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpcevents } if (iNdEx + skippy) > l { @@ -1861,10 +1672,7 @@ func (m *GetTxsRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpcevents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpcevents } if (iNdEx + skippy) > l { @@ -1968,10 +1776,7 @@ func (m *GetTxsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpcevents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpcevents } if (iNdEx + skippy) > l { @@ -2060,10 +1865,7 @@ func (m *Bound) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpcevents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpcevents } if (iNdEx + skippy) > l { @@ -2186,10 +1988,7 @@ func (m *BlockRange) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpcevents - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpcevents } if (iNdEx + skippy) > l { @@ -2208,6 +2007,7 @@ func (m *BlockRange) Unmarshal(dAtA []byte) error { func skipRpcevents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2239,10 +2039,8 @@ func skipRpcevents(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2263,55 +2061,30 @@ func skipRpcevents(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthRpcevents } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthRpcevents - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpcevents - } - 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 := skipRpcevents(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthRpcevents - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRpcevents + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthRpcevents + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthRpcevents = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRpcevents = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthRpcevents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRpcevents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRpcevents = fmt.Errorf("proto: unexpected end of group") ) diff --git a/rpc/rpcevents/rpcevents_grpc.pb.go b/rpc/rpcevents/rpcevents_grpc.pb.go new file mode 100644 index 000000000..2be3c15e7 --- /dev/null +++ b/rpc/rpcevents/rpcevents_grpc.pb.go @@ -0,0 +1,238 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package rpcevents + +import ( + context "context" + + exec "github.com/hyperledger/burrow/execution/exec" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ExecutionEventsClient is the client API for ExecutionEvents service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ExecutionEventsClient interface { + // Get StreamEvents (including transactions) for a range of block heights + Stream(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (ExecutionEvents_StreamClient, error) + // Get a particular TxExecution by hash + Tx(ctx context.Context, in *TxRequest, opts ...grpc.CallOption) (*exec.TxExecution, error) + // GetEvents provides events streaming one block at a time - that is all events emitted in a particular block + // are guaranteed to be delivered in each GetEventsResponse + Events(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (ExecutionEvents_EventsClient, error) +} + +type executionEventsClient struct { + cc grpc.ClientConnInterface +} + +func NewExecutionEventsClient(cc grpc.ClientConnInterface) ExecutionEventsClient { + return &executionEventsClient{cc} +} + +func (c *executionEventsClient) Stream(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (ExecutionEvents_StreamClient, error) { + stream, err := c.cc.NewStream(ctx, &ExecutionEvents_ServiceDesc.Streams[0], "/rpcevents.ExecutionEvents/Stream", opts...) + if err != nil { + return nil, err + } + x := &executionEventsStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type ExecutionEvents_StreamClient interface { + Recv() (*exec.StreamEvent, error) + grpc.ClientStream +} + +type executionEventsStreamClient struct { + grpc.ClientStream +} + +func (x *executionEventsStreamClient) Recv() (*exec.StreamEvent, error) { + m := new(exec.StreamEvent) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *executionEventsClient) Tx(ctx context.Context, in *TxRequest, opts ...grpc.CallOption) (*exec.TxExecution, error) { + out := new(exec.TxExecution) + err := c.cc.Invoke(ctx, "/rpcevents.ExecutionEvents/Tx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *executionEventsClient) Events(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (ExecutionEvents_EventsClient, error) { + stream, err := c.cc.NewStream(ctx, &ExecutionEvents_ServiceDesc.Streams[1], "/rpcevents.ExecutionEvents/Events", opts...) + if err != nil { + return nil, err + } + x := &executionEventsEventsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type ExecutionEvents_EventsClient interface { + Recv() (*EventsResponse, error) + grpc.ClientStream +} + +type executionEventsEventsClient struct { + grpc.ClientStream +} + +func (x *executionEventsEventsClient) Recv() (*EventsResponse, error) { + m := new(EventsResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// ExecutionEventsServer is the server API for ExecutionEvents service. +// All implementations must embed UnimplementedExecutionEventsServer +// for forward compatibility +type ExecutionEventsServer interface { + // Get StreamEvents (including transactions) for a range of block heights + Stream(*BlocksRequest, ExecutionEvents_StreamServer) error + // Get a particular TxExecution by hash + Tx(context.Context, *TxRequest) (*exec.TxExecution, error) + // GetEvents provides events streaming one block at a time - that is all events emitted in a particular block + // are guaranteed to be delivered in each GetEventsResponse + Events(*BlocksRequest, ExecutionEvents_EventsServer) error + mustEmbedUnimplementedExecutionEventsServer() +} + +// UnimplementedExecutionEventsServer must be embedded to have forward compatible implementations. +type UnimplementedExecutionEventsServer struct { +} + +func (UnimplementedExecutionEventsServer) Stream(*BlocksRequest, ExecutionEvents_StreamServer) error { + return status.Errorf(codes.Unimplemented, "method Stream not implemented") +} +func (UnimplementedExecutionEventsServer) Tx(context.Context, *TxRequest) (*exec.TxExecution, error) { + return nil, status.Errorf(codes.Unimplemented, "method Tx not implemented") +} +func (UnimplementedExecutionEventsServer) Events(*BlocksRequest, ExecutionEvents_EventsServer) error { + return status.Errorf(codes.Unimplemented, "method Events not implemented") +} +func (UnimplementedExecutionEventsServer) mustEmbedUnimplementedExecutionEventsServer() {} + +// UnsafeExecutionEventsServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ExecutionEventsServer will +// result in compilation errors. +type UnsafeExecutionEventsServer interface { + mustEmbedUnimplementedExecutionEventsServer() +} + +func RegisterExecutionEventsServer(s grpc.ServiceRegistrar, srv ExecutionEventsServer) { + s.RegisterService(&ExecutionEvents_ServiceDesc, srv) +} + +func _ExecutionEvents_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(BlocksRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ExecutionEventsServer).Stream(m, &executionEventsStreamServer{stream}) +} + +type ExecutionEvents_StreamServer interface { + Send(*exec.StreamEvent) error + grpc.ServerStream +} + +type executionEventsStreamServer struct { + grpc.ServerStream +} + +func (x *executionEventsStreamServer) Send(m *exec.StreamEvent) error { + return x.ServerStream.SendMsg(m) +} + +func _ExecutionEvents_Tx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExecutionEventsServer).Tx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcevents.ExecutionEvents/Tx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExecutionEventsServer).Tx(ctx, req.(*TxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ExecutionEvents_Events_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(BlocksRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ExecutionEventsServer).Events(m, &executionEventsEventsServer{stream}) +} + +type ExecutionEvents_EventsServer interface { + Send(*EventsResponse) error + grpc.ServerStream +} + +type executionEventsEventsServer struct { + grpc.ServerStream +} + +func (x *executionEventsEventsServer) Send(m *EventsResponse) error { + return x.ServerStream.SendMsg(m) +} + +// ExecutionEvents_ServiceDesc is the grpc.ServiceDesc for ExecutionEvents service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ExecutionEvents_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "rpcevents.ExecutionEvents", + HandlerType: (*ExecutionEventsServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Tx", + Handler: _ExecutionEvents_Tx_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Stream", + Handler: _ExecutionEvents_Stream_Handler, + ServerStreams: true, + }, + { + StreamName: "Events", + Handler: _ExecutionEvents_Events_Handler, + ServerStreams: true, + }, + }, + Metadata: "rpcevents.proto", +} diff --git a/rpc/rpcinfo/info_server.go b/rpc/rpcinfo/info_server.go index 156f9c831..d8edf5a4c 100644 --- a/rpc/rpcinfo/info_server.go +++ b/rpc/rpcinfo/info_server.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpcinfo @@ -28,8 +17,6 @@ func StartServer(service *rpc.Service, pattern string, listener net.Listener, lo logger = logger.With(structure.ComponentKey, "RPC_Info") routes := GetRoutes(service) mux := http.NewServeMux() - wm := server.NewWebsocketManager(routes, logger) - mux.HandleFunc(pattern, wm.WebsocketHandler) server.RegisterRPCFuncs(mux, routes, logger) srv, err := server.StartHTTPServer(listener, mux, logger) if err != nil { diff --git a/rpc/rpcinfo/infoclient/client.go b/rpc/rpcinfo/infoclient/client.go index 292eeb732..38a56e603 100644 --- a/rpc/rpcinfo/infoclient/client.go +++ b/rpc/rpcinfo/infoclient/client.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package infoclient @@ -25,94 +14,90 @@ import ( "github.com/hyperledger/burrow/rpc/rpcinfo" ) -type RPCClient interface { - Call(method string, params map[string]interface{}, result interface{}) (interface{}, error) -} - -func Status(client RPCClient) (*rpc.ResultStatus, error) { +func Status(client rpc.Client) (*rpc.ResultStatus, error) { res := new(rpc.ResultStatus) - _, err := client.Call(rpcinfo.Status, pmap(), res) + err := client.Call(rpcinfo.Status, pmap(), res) if err != nil { return nil, err } return res, nil } -func ChainId(client RPCClient) (*rpc.ResultChainId, error) { +func ChainId(client rpc.Client) (*rpc.ResultChainId, error) { res := new(rpc.ResultChainId) - _, err := client.Call(rpcinfo.ChainID, pmap(), &res) + err := client.Call(rpcinfo.ChainID, pmap(), &res) if err != nil { return nil, err } return res, nil } -func Account(client RPCClient, address crypto.Address) (*acm.Account, error) { +func Account(client rpc.Client, address crypto.Address) (*acm.Account, error) { res := new(rpc.ResultAccount) - _, err := client.Call(rpcinfo.Account, pmap("address", address), res) + err := client.Call(rpcinfo.Account, pmap("address", address), res) if err != nil { return nil, err } return res.Account, nil } -func DumpStorage(client RPCClient, address crypto.Address) (*rpc.ResultDumpStorage, error) { +func DumpStorage(client rpc.Client, address crypto.Address) (*rpc.ResultDumpStorage, error) { res := new(rpc.ResultDumpStorage) - _, err := client.Call(rpcinfo.DumpStorage, pmap("address", address), res) + err := client.Call(rpcinfo.DumpStorage, pmap("address", address), res) if err != nil { return nil, err } return res, nil } -func Storage(client RPCClient, address crypto.Address, key []byte) ([]byte, error) { +func Storage(client rpc.Client, address crypto.Address, key []byte) ([]byte, error) { res := new(rpc.ResultStorage) - _, err := client.Call(rpcinfo.Storage, pmap("address", address, "key", key), res) + err := client.Call(rpcinfo.Storage, pmap("address", address, "key", key), res) if err != nil { return nil, err } return res.Value, nil } -func Name(client RPCClient, name string) (*names.Entry, error) { +func Name(client rpc.Client, name string) (*names.Entry, error) { res := new(rpc.ResultName) - _, err := client.Call(rpcinfo.Name, pmap("name", name), res) + err := client.Call(rpcinfo.Name, pmap("name", name), res) if err != nil { return nil, err } return res.Entry, nil } -func Names(client RPCClient, regex string) ([]*names.Entry, error) { +func Names(client rpc.Client, regex string) ([]*names.Entry, error) { res := new(rpc.ResultNames) - _, err := client.Call(rpcinfo.Names, pmap("regex", regex), res) + err := client.Call(rpcinfo.Names, pmap("regex", regex), res) if err != nil { return nil, err } return res.Names, nil } -func Blocks(client RPCClient, minHeight, maxHeight int) (*rpc.ResultBlocks, error) { +func Blocks(client rpc.Client, minHeight, maxHeight int) (*rpc.ResultBlocks, error) { res := new(rpc.ResultBlocks) - _, err := client.Call(rpcinfo.Blocks, pmap("minHeight", minHeight, "maxHeight", maxHeight), res) + err := client.Call(rpcinfo.Blocks, pmap("minHeight", minHeight, "maxHeight", maxHeight), res) if err != nil { return nil, err } return res, nil } -func Block(client RPCClient, height int) (*rpc.ResultBlock, error) { +func Block(client rpc.Client, height int) (*rpc.ResultBlock, error) { res := new(rpc.ResultBlock) - _, err := client.Call(rpcinfo.Block, pmap("height", height), res) + err := client.Call(rpcinfo.Block, pmap("height", height), res) if err != nil { return nil, err } return res, nil } -func UnconfirmedTxs(client RPCClient, maxTxs int) (*rpc.ResultUnconfirmedTxs, error) { +func UnconfirmedTxs(client rpc.Client, maxTxs int) (*rpc.ResultUnconfirmedTxs, error) { res := new(rpc.ResultUnconfirmedTxs) - _, err := client.Call(rpcinfo.UnconfirmedTxs, pmap("maxTxs", maxTxs), res) + err := client.Call(rpcinfo.UnconfirmedTxs, pmap("maxTxs", maxTxs), res) if err != nil { return nil, err } @@ -120,18 +105,18 @@ func UnconfirmedTxs(client RPCClient, maxTxs int) (*rpc.ResultUnconfirmedTxs, er return resCon, nil } -func Validators(client RPCClient) (*rpc.ResultValidators, error) { +func Validators(client rpc.Client) (*rpc.ResultValidators, error) { res := new(rpc.ResultValidators) - _, err := client.Call(rpcinfo.Validators, pmap(), res) + err := client.Call(rpcinfo.Validators, pmap(), res) if err != nil { return nil, err } return res, nil } -func Consensus(client RPCClient) (*rpc.ResultConsensusState, error) { +func Consensus(client rpc.Client) (*rpc.ResultConsensusState, error) { res := new(rpc.ResultConsensusState) - _, err := client.Call(rpcinfo.Consensus, pmap(), res) + err := client.Call(rpcinfo.Consensus, pmap(), res) if err != nil { return nil, err } @@ -139,14 +124,14 @@ func Consensus(client RPCClient) (*rpc.ResultConsensusState, error) { } func pmap(keyvals ...interface{}) map[string]interface{} { - pm, err := paramsMap(keyvals...) + pm, err := ParamsToMap(keyvals...) if err != nil { panic(err) } return pm } -func paramsMap(orderedKeyVals ...interface{}) (map[string]interface{}, error) { +func ParamsToMap(orderedKeyVals ...interface{}) (map[string]interface{}, error) { if len(orderedKeyVals)%2 != 0 { return nil, fmt.Errorf("mapAndValues requires a even length list of"+ " keys and values but got: %v (length %v)", diff --git a/rpc/rpcinfo/infoclient/client_test.go b/rpc/rpcinfo/infoclient/client_test.go index afcacee00..b15913e86 100644 --- a/rpc/rpcinfo/infoclient/client_test.go +++ b/rpc/rpcinfo/infoclient/client_test.go @@ -10,7 +10,7 @@ func TestParamsMap(t *testing.T) { type aStruct struct { Baz int } - dict, err := paramsMap("Foo", aStruct{5}, + dict, err := ParamsToMap("Foo", aStruct{5}, "Bar", "Nibbles") assert.NoError(t, err, "Should not be a paramsMaperror") assert.Equal(t, map[string]interface{}{ @@ -19,15 +19,15 @@ func TestParamsMap(t *testing.T) { }, dict) // Empty map - dict, err = paramsMap() + dict, err = ParamsToMap() assert.Equal(t, map[string]interface{}{}, dict) assert.NoError(t, err, "Empty mapsAndValues call should be fine") // Invalid maps assert.NoError(t, err, "Empty mapsAndValues call should be fine") - _, err = paramsMap("Foo", 4, "Bar") + _, err = ParamsToMap("Foo", 4, "Bar") assert.Error(t, err, "Should be an error to get an odd number of arguments") - _, err = paramsMap("Foo", 4, 4, "Bar") + _, err = ParamsToMap("Foo", 4, 4, "Bar") assert.Error(t, err, "Should be an error to provide non-string keys") } diff --git a/rpc/rpcinfo/methods.go b/rpc/rpcinfo/methods.go index bea4c66c1..e0086e320 100644 --- a/rpc/rpcinfo/methods.go +++ b/rpc/rpcinfo/methods.go @@ -13,8 +13,9 @@ import ( // Method names const ( // Status and healthcheck - Status = "status" - Network = "network" + Status = "status" + Network = "network" + NetworkRegistry = "network/registry" // Accounts Accounts = "accounts" @@ -60,8 +61,9 @@ func GetRoutes(service *rpc.Service) map[string]*server.RPCFunc { // TODO: overhaul this with gRPC-gateway / swagger return map[string]*server.RPCFunc{ // Status - Status: server.NewRPCFunc(service.StatusWithin, "block_time_within,block_seen_time_within"), - Network: server.NewRPCFunc(service.Network, ""), + Status: server.NewRPCFunc(service.StatusWithin, "block_time_within,block_seen_time_within"), + Network: server.NewRPCFunc(service.Network, ""), + NetworkRegistry: server.NewRPCFunc(service.NetworkRegistry, ""), // Accounts Accounts: server.NewRPCFunc(func() (*rpc.ResultAccounts, error) { diff --git a/rpc/rpcquery/query_server.go b/rpc/rpcquery/query_server.go index 9cc4a8036..0c2bb53b1 100644 --- a/rpc/rpcquery/query_server.go +++ b/rpc/rpcquery/query_server.go @@ -10,51 +10,58 @@ import ( "github.com/hyperledger/burrow/acm/validator" "github.com/hyperledger/burrow/bcm" "github.com/hyperledger/burrow/consensus/tendermint" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/deploy/compile" "github.com/hyperledger/burrow/event/query" "github.com/hyperledger/burrow/execution/names" "github.com/hyperledger/burrow/execution/proposal" + "github.com/hyperledger/burrow/execution/registry" "github.com/hyperledger/burrow/execution/state" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/rpc" "github.com/hyperledger/burrow/txs/payload" - "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) type queryServer struct { - accounts acmstate.IterableStatsReader - nameReg names.IterableReader - proposalReg proposal.IterableReader - blockchain bcm.BlockchainInfo - validators validator.History - nodeView *tendermint.NodeView - logger *logging.Logger + UnimplementedQueryServer + state QueryState + blockchain bcm.BlockchainInfo + nodeView *tendermint.NodeView + logger *logging.Logger } var _ QueryServer = &queryServer{} -func NewQueryServer(state acmstate.IterableStatsReader, nameReg names.IterableReader, proposalReg proposal.IterableReader, - blockchain bcm.BlockchainInfo, validators validator.History, nodeView *tendermint.NodeView, logger *logging.Logger) *queryServer { +type QueryState interface { + acmstate.IterableStatsReader + acmstate.MetadataReader + names.IterableReader + registry.IterableReader + proposal.IterableReader + validator.History +} + +func NewQueryServer(state QueryState, blockchain bcm.BlockchainInfo, nodeView *tendermint.NodeView, logger *logging.Logger) *queryServer { return &queryServer{ - accounts: state, - nameReg: nameReg, - proposalReg: proposalReg, - blockchain: blockchain, - validators: validators, - nodeView: nodeView, - logger: logger, + state: state, + blockchain: blockchain, + nodeView: nodeView, + logger: logger, } } func (qs *queryServer) Status(ctx context.Context, param *StatusParam) (*rpc.ResultStatus, error) { - return rpc.Status(qs.blockchain, qs.validators, qs.nodeView, param.BlockTimeWithin, param.BlockSeenTimeWithin) + return rpc.Status(qs.blockchain, qs.state, qs.nodeView, param.BlockTimeWithin, param.BlockSeenTimeWithin) } // Account state func (qs *queryServer) GetAccount(ctx context.Context, param *GetAccountParam) (*acm.Account, error) { - acc, err := qs.accounts.GetAccount(param.Address) + acc, err := qs.state.GetAccount(param.Address) if acc == nil { acc = &acm.Account{} } @@ -64,51 +71,61 @@ func (qs *queryServer) GetAccount(ctx context.Context, param *GetAccountParam) ( // GetMetadata returns empty metadata string if not found. Metadata can be retrieved by account, or // by metadata hash func (qs *queryServer) GetMetadata(ctx context.Context, param *GetMetadataParam) (*MetadataResult, error) { - metadata := MetadataResult{} - var metahash acmstate.MetadataHash + metadata := &MetadataResult{} + var contractMeta *acm.ContractMeta var err error if param.Address != nil { - acc, err := qs.accounts.GetAccount(*param.Address) + acc, err := qs.state.GetAccount(*param.Address) if err != nil { - return &metadata, err + return metadata, err } if acc != nil && acc.CodeHash != nil { codehash := acc.CodeHash if acc.Forebear != nil { - acc, err = qs.accounts.GetAccount(*acc.Forebear) + acc, err = qs.state.GetAccount(*acc.Forebear) if err != nil { - return &metadata, err + return metadata, err } } - found := false for _, m := range acc.ContractMeta { if bytes.Equal(m.CodeHash, codehash) { - copy(metahash[:], m.MetadataHash) - found = true + contractMeta = m break } } - if !found { + if contractMeta == nil { deployCodehash := compile.GetDeployCodeHash(acc.EVMCode, *param.Address) for _, m := range acc.ContractMeta { if bytes.Equal(m.CodeHash, deployCodehash) { - copy(metahash[:], m.MetadataHash) + contractMeta = m break } } } } } else if param.MetadataHash != nil { - copy(metahash[:], *param.MetadataHash) + contractMeta = &acm.ContractMeta{ + MetadataHash: *param.MetadataHash, + } + } + if contractMeta == nil { + return metadata, nil } - metadata.Metadata, err = qs.accounts.GetMetadata(metahash) - return &metadata, err + if contractMeta.Metadata != "" { + // Looks like the metadata is already memoised - (e.g. by native.State) + metadata.Metadata = contractMeta.Metadata + } else { + var metadataHash acmstate.MetadataHash + copy(metadataHash[:], contractMeta.MetadataHash) + metadata.Metadata, err = qs.state.GetMetadata(metadataHash) + } + return metadata, err } func (qs *queryServer) GetStorage(ctx context.Context, param *GetStorageParam) (*StorageValue, error) { - val, err := qs.accounts.GetStorage(param.Address, param.Key) + val, err := qs.state.GetStorage(param.Address, param.Key) return &StorageValue{Value: val}, err } @@ -118,7 +135,7 @@ func (qs *queryServer) ListAccounts(param *ListAccountsParam, stream Query_ListA return err } var streamErr error - err = qs.accounts.IterateAccounts(func(acc *acm.Account) error { + err = qs.state.IterateAccounts(func(acc *acm.Account) error { if qry.Matches(acc) { return stream.Send(acc) } else { @@ -134,9 +151,9 @@ func (qs *queryServer) ListAccounts(param *ListAccountsParam, stream Query_ListA // Names func (qs *queryServer) GetName(ctx context.Context, param *GetNameParam) (entry *names.Entry, err error) { - entry, err = qs.nameReg.GetName(param.Name) + entry, err = qs.state.GetName(param.Name) if entry == nil && err == nil { - err = fmt.Errorf("name %s not found", param.Name) + err = status.Error(codes.NotFound, fmt.Sprintf("name %s not found", param.Name)) } return } @@ -147,7 +164,7 @@ func (qs *queryServer) ListNames(param *ListNamesParam, stream Query_ListNamesSe return err } var streamErr error - err = qs.nameReg.IterateNames(func(entry *names.Entry) error { + err = qs.state.IterateNames(func(entry *names.Entry) error { if qry.Matches(entry) { return stream.Send(entry) } else { @@ -163,7 +180,7 @@ func (qs *queryServer) ListNames(param *ListNamesParam, stream Query_ListNamesSe // Validators func (qs *queryServer) GetValidatorSet(ctx context.Context, param *GetValidatorSetParam) (*ValidatorSet, error) { - set := validator.Copy(qs.validators.Validators(0)) + set := validator.Copy(qs.state.Validators(0)) return &ValidatorSet{ Set: set.Validators(), }, nil @@ -183,7 +200,7 @@ func (qs *queryServer) GetValidatorSetHistory(ctx context.Context, param *GetVal } history := &ValidatorSetHistory{} for i := 0; i < lookback; i++ { - set := validator.Copy(qs.validators.Validators(i)) + set := validator.Copy(qs.state.Validators(i)) vs := &ValidatorSet{ Height: height - uint64(i), Set: set.Validators(), @@ -193,10 +210,22 @@ func (qs *queryServer) GetValidatorSetHistory(ctx context.Context, param *GetVal return history, nil } -// proposals +func (qs *queryServer) GetNetworkRegistry(ctx context.Context, param *GetNetworkRegistryParam) (*NetworkRegistry, error) { + rv := make([]*RegisteredValidator, 0) + err := qs.state.IterateNodes(func(id crypto.Address, rn *registry.NodeIdentity) error { + rv = append(rv, &RegisteredValidator{ + Address: rn.ValidatorPublicKey.GetAddress(), + Node: rn, + }) + return nil + }) + return &NetworkRegistry{Set: rv}, err +} + +// Proposals func (qs *queryServer) GetProposal(ctx context.Context, param *GetProposalParam) (proposal *payload.Ballot, err error) { - proposal, err = qs.proposalReg.GetProposal(param.Hash) + proposal, err = qs.state.GetProposal(param.Hash) if proposal == nil && err == nil { err = fmt.Errorf("proposal %x not found", param.Hash) } @@ -205,7 +234,7 @@ func (qs *queryServer) GetProposal(ctx context.Context, param *GetProposalParam) func (qs *queryServer) ListProposals(param *ListProposalsParam, stream Query_ListProposalsServer) error { var streamErr error - err := qs.proposalReg.IterateProposals(func(hash []byte, ballot *payload.Ballot) error { + err := qs.state.IterateProposals(func(hash []byte, ballot *payload.Ballot) error { if !param.GetProposed() || ballot.ProposalState == payload.Ballot_PROPOSED { return stream.Send(&ProposalResult{Hash: hash, Ballot: ballot}) } else { @@ -219,7 +248,7 @@ func (qs *queryServer) ListProposals(param *ListProposalsParam, stream Query_Lis } func (qs *queryServer) GetStats(ctx context.Context, param *GetStatsParam) (*Stats, error) { - stats := qs.accounts.GetAccountStats() + stats := qs.state.GetAccountStats() return &Stats{ AccountsWithCode: stats.AccountsWithCode, @@ -229,7 +258,7 @@ func (qs *queryServer) GetStats(ctx context.Context, param *GetStatsParam) (*Sta // Tendermint and blocks -func (qs *queryServer) GetBlockHeader(ctx context.Context, param *GetBlockParam) (*types.Header, error) { +func (qs *queryServer) GetBlockHeader(ctx context.Context, param *GetBlockParam) (*tmproto.Header, error) { header, err := qs.blockchain.GetBlockHeader(param.Height) if err != nil { return nil, err diff --git a/rpc/rpcquery/rpcquery.pb.go b/rpc/rpcquery/rpcquery.pb.go index 8dbcc78c3..c08224b42 100644 --- a/rpc/rpcquery/rpcquery.pb.go +++ b/rpc/rpcquery/rpcquery.pb.go @@ -4,22 +4,23 @@ package rpcquery import ( - context "context" fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" golang_proto "github.com/golang/protobuf/proto" - acm "github.com/hyperledger/burrow/acm" + _ "github.com/hyperledger/burrow/acm" validator "github.com/hyperledger/burrow/acm/validator" github_com_hyperledger_burrow_binary "github.com/hyperledger/burrow/binary" github_com_hyperledger_burrow_crypto "github.com/hyperledger/burrow/crypto" - names "github.com/hyperledger/burrow/execution/names" - rpc "github.com/hyperledger/burrow/rpc" + _ "github.com/hyperledger/burrow/execution/names" + registry "github.com/hyperledger/burrow/execution/registry" + _ "github.com/hyperledger/burrow/rpc" payload "github.com/hyperledger/burrow/txs/payload" - types "github.com/tendermint/tendermint/abci/types" - grpc "google.golang.org/grpc" + _ "github.com/tendermint/tendermint/proto/tendermint/types" ) // Reference imports to suppress errors if they are not otherwise used. @@ -32,7 +33,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 type StatusParam struct { BlockTimeWithin string `protobuf:"bytes,1,opt,name=BlockTimeWithin,proto3" json:"BlockTimeWithin,omitempty"` @@ -49,16 +50,21 @@ func (*StatusParam) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{0} } func (m *StatusParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StatusParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *StatusParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StatusParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *StatusParam) XXX_Merge(src proto.Message) { xxx_messageInfo_StatusParam.Merge(m, src) } func (m *StatusParam) XXX_Size() int { - return xxx_messageInfo_StatusParam.Size(m) + return m.Size() } func (m *StatusParam) XXX_DiscardUnknown() { xxx_messageInfo_StatusParam.DiscardUnknown(m) @@ -98,16 +104,21 @@ func (*GetAccountParam) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{1} } func (m *GetAccountParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAccountParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetAccountParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAccountParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetAccountParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetAccountParam.Merge(m, src) } func (m *GetAccountParam) XXX_Size() int { - return xxx_messageInfo_GetAccountParam.Size(m) + return m.Size() } func (m *GetAccountParam) XXX_DiscardUnknown() { xxx_messageInfo_GetAccountParam.DiscardUnknown(m) @@ -134,16 +145,21 @@ func (*GetMetadataParam) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{2} } func (m *GetMetadataParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetMetadataParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetMetadataParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetMetadataParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetMetadataParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetMetadataParam.Merge(m, src) } func (m *GetMetadataParam) XXX_Size() int { - return xxx_messageInfo_GetMetadataParam.Size(m) + return m.Size() } func (m *GetMetadataParam) XXX_DiscardUnknown() { xxx_messageInfo_GetMetadataParam.DiscardUnknown(m) @@ -169,16 +185,21 @@ func (*MetadataResult) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{3} } func (m *MetadataResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MetadataResult.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *MetadataResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MetadataResult.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *MetadataResult) XXX_Merge(src proto.Message) { xxx_messageInfo_MetadataResult.Merge(m, src) } func (m *MetadataResult) XXX_Size() int { - return xxx_messageInfo_MetadataResult.Size(m) + return m.Size() } func (m *MetadataResult) XXX_DiscardUnknown() { xxx_messageInfo_MetadataResult.DiscardUnknown(m) @@ -212,16 +233,21 @@ func (*GetStorageParam) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{4} } func (m *GetStorageParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetStorageParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetStorageParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetStorageParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetStorageParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetStorageParam.Merge(m, src) } func (m *GetStorageParam) XXX_Size() int { - return xxx_messageInfo_GetStorageParam.Size(m) + return m.Size() } func (m *GetStorageParam) XXX_DiscardUnknown() { xxx_messageInfo_GetStorageParam.DiscardUnknown(m) @@ -247,16 +273,21 @@ func (*StorageValue) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{5} } func (m *StorageValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StorageValue.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *StorageValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StorageValue.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *StorageValue) XXX_Merge(src proto.Message) { xxx_messageInfo_StorageValue.Merge(m, src) } func (m *StorageValue) XXX_Size() int { - return xxx_messageInfo_StorageValue.Size(m) + return m.Size() } func (m *StorageValue) XXX_DiscardUnknown() { xxx_messageInfo_StorageValue.DiscardUnknown(m) @@ -282,16 +313,21 @@ func (*ListAccountsParam) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{6} } func (m *ListAccountsParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListAccountsParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ListAccountsParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListAccountsParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ListAccountsParam) XXX_Merge(src proto.Message) { xxx_messageInfo_ListAccountsParam.Merge(m, src) } func (m *ListAccountsParam) XXX_Size() int { - return xxx_messageInfo_ListAccountsParam.Size(m) + return m.Size() } func (m *ListAccountsParam) XXX_DiscardUnknown() { xxx_messageInfo_ListAccountsParam.DiscardUnknown(m) @@ -324,16 +360,21 @@ func (*GetNameParam) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{7} } func (m *GetNameParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetNameParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetNameParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetNameParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetNameParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetNameParam.Merge(m, src) } func (m *GetNameParam) XXX_Size() int { - return xxx_messageInfo_GetNameParam.Size(m) + return m.Size() } func (m *GetNameParam) XXX_DiscardUnknown() { xxx_messageInfo_GetNameParam.DiscardUnknown(m) @@ -366,16 +407,21 @@ func (*ListNamesParam) Descriptor() ([]byte, []int) { return fileDescriptor_88e25d9b99e39f02, []int{8} } func (m *ListNamesParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListNamesParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ListNamesParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListNamesParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ListNamesParam) XXX_Merge(src proto.Message) { xxx_messageInfo_ListNamesParam.Merge(m, src) } func (m *ListNamesParam) XXX_Size() int { - return xxx_messageInfo_ListNamesParam.Size(m) + return m.Size() } func (m *ListNamesParam) XXX_DiscardUnknown() { xxx_messageInfo_ListNamesParam.DiscardUnknown(m) @@ -394,6 +440,45 @@ func (*ListNamesParam) XXX_MessageName() string { return "rpcquery.ListNamesParam" } +type GetNetworkRegistryParam struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetNetworkRegistryParam) Reset() { *m = GetNetworkRegistryParam{} } +func (m *GetNetworkRegistryParam) String() string { return proto.CompactTextString(m) } +func (*GetNetworkRegistryParam) ProtoMessage() {} +func (*GetNetworkRegistryParam) Descriptor() ([]byte, []int) { + return fileDescriptor_88e25d9b99e39f02, []int{9} +} +func (m *GetNetworkRegistryParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetNetworkRegistryParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *GetNetworkRegistryParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNetworkRegistryParam.Merge(m, src) +} +func (m *GetNetworkRegistryParam) XXX_Size() int { + return m.Size() +} +func (m *GetNetworkRegistryParam) XXX_DiscardUnknown() { + xxx_messageInfo_GetNetworkRegistryParam.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNetworkRegistryParam proto.InternalMessageInfo + +func (*GetNetworkRegistryParam) XXX_MessageName() string { + return "rpcquery.GetNetworkRegistryParam" +} + type GetValidatorSetParam struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -404,19 +489,24 @@ func (m *GetValidatorSetParam) Reset() { *m = GetValidatorSetParam{} } func (m *GetValidatorSetParam) String() string { return proto.CompactTextString(m) } func (*GetValidatorSetParam) ProtoMessage() {} func (*GetValidatorSetParam) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{9} + return fileDescriptor_88e25d9b99e39f02, []int{10} } func (m *GetValidatorSetParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetValidatorSetParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetValidatorSetParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetValidatorSetParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetValidatorSetParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetValidatorSetParam.Merge(m, src) } func (m *GetValidatorSetParam) XXX_Size() int { - return xxx_messageInfo_GetValidatorSetParam.Size(m) + return m.Size() } func (m *GetValidatorSetParam) XXX_DiscardUnknown() { xxx_messageInfo_GetValidatorSetParam.DiscardUnknown(m) @@ -440,19 +530,24 @@ func (m *GetValidatorSetHistoryParam) Reset() { *m = GetValidatorSetHist func (m *GetValidatorSetHistoryParam) String() string { return proto.CompactTextString(m) } func (*GetValidatorSetHistoryParam) ProtoMessage() {} func (*GetValidatorSetHistoryParam) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{10} + return fileDescriptor_88e25d9b99e39f02, []int{11} } func (m *GetValidatorSetHistoryParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetValidatorSetHistoryParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetValidatorSetHistoryParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetValidatorSetHistoryParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetValidatorSetHistoryParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetValidatorSetHistoryParam.Merge(m, src) } func (m *GetValidatorSetHistoryParam) XXX_Size() int { - return xxx_messageInfo_GetValidatorSetHistoryParam.Size(m) + return m.Size() } func (m *GetValidatorSetHistoryParam) XXX_DiscardUnknown() { xxx_messageInfo_GetValidatorSetHistoryParam.DiscardUnknown(m) @@ -471,6 +566,101 @@ func (*GetValidatorSetHistoryParam) XXX_MessageName() string { return "rpcquery.GetValidatorSetHistoryParam" } +type NetworkRegistry struct { + Set []*RegisteredValidator `protobuf:"bytes,1,rep,name=Set,proto3" json:"Set,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetworkRegistry) Reset() { *m = NetworkRegistry{} } +func (m *NetworkRegistry) String() string { return proto.CompactTextString(m) } +func (*NetworkRegistry) ProtoMessage() {} +func (*NetworkRegistry) Descriptor() ([]byte, []int) { + return fileDescriptor_88e25d9b99e39f02, []int{12} +} +func (m *NetworkRegistry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetworkRegistry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *NetworkRegistry) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetworkRegistry.Merge(m, src) +} +func (m *NetworkRegistry) XXX_Size() int { + return m.Size() +} +func (m *NetworkRegistry) XXX_DiscardUnknown() { + xxx_messageInfo_NetworkRegistry.DiscardUnknown(m) +} + +var xxx_messageInfo_NetworkRegistry proto.InternalMessageInfo + +func (m *NetworkRegistry) GetSet() []*RegisteredValidator { + if m != nil { + return m.Set + } + return nil +} + +func (*NetworkRegistry) XXX_MessageName() string { + return "rpcquery.NetworkRegistry" +} + +type RegisteredValidator struct { + Address github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address"` + Node *registry.NodeIdentity `protobuf:"bytes,2,opt,name=Node,proto3" json:"Node,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RegisteredValidator) Reset() { *m = RegisteredValidator{} } +func (m *RegisteredValidator) String() string { return proto.CompactTextString(m) } +func (*RegisteredValidator) ProtoMessage() {} +func (*RegisteredValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_88e25d9b99e39f02, []int{13} +} +func (m *RegisteredValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisteredValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RegisteredValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisteredValidator.Merge(m, src) +} +func (m *RegisteredValidator) XXX_Size() int { + return m.Size() +} +func (m *RegisteredValidator) XXX_DiscardUnknown() { + xxx_messageInfo_RegisteredValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisteredValidator proto.InternalMessageInfo + +func (m *RegisteredValidator) GetNode() *registry.NodeIdentity { + if m != nil { + return m.Node + } + return nil +} + +func (*RegisteredValidator) XXX_MessageName() string { + return "rpcquery.RegisteredValidator" +} + type ValidatorSetHistory struct { History []*ValidatorSet `protobuf:"bytes,1,rep,name=History,proto3" json:"History,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -482,19 +672,24 @@ func (m *ValidatorSetHistory) Reset() { *m = ValidatorSetHistory{} } func (m *ValidatorSetHistory) String() string { return proto.CompactTextString(m) } func (*ValidatorSetHistory) ProtoMessage() {} func (*ValidatorSetHistory) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{11} + return fileDescriptor_88e25d9b99e39f02, []int{14} } func (m *ValidatorSetHistory) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ValidatorSetHistory.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ValidatorSetHistory) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ValidatorSetHistory.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ValidatorSetHistory) XXX_Merge(src proto.Message) { xxx_messageInfo_ValidatorSetHistory.Merge(m, src) } func (m *ValidatorSetHistory) XXX_Size() int { - return xxx_messageInfo_ValidatorSetHistory.Size(m) + return m.Size() } func (m *ValidatorSetHistory) XXX_DiscardUnknown() { xxx_messageInfo_ValidatorSetHistory.DiscardUnknown(m) @@ -525,19 +720,24 @@ func (m *ValidatorSet) Reset() { *m = ValidatorSet{} } func (m *ValidatorSet) String() string { return proto.CompactTextString(m) } func (*ValidatorSet) ProtoMessage() {} func (*ValidatorSet) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{12} + return fileDescriptor_88e25d9b99e39f02, []int{15} } func (m *ValidatorSet) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ValidatorSet.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ValidatorSet.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ValidatorSet) XXX_Merge(src proto.Message) { xxx_messageInfo_ValidatorSet.Merge(m, src) } func (m *ValidatorSet) XXX_Size() int { - return xxx_messageInfo_ValidatorSet.Size(m) + return m.Size() } func (m *ValidatorSet) XXX_DiscardUnknown() { xxx_messageInfo_ValidatorSet.DiscardUnknown(m) @@ -574,19 +774,24 @@ func (m *GetProposalParam) Reset() { *m = GetProposalParam{} } func (m *GetProposalParam) String() string { return proto.CompactTextString(m) } func (*GetProposalParam) ProtoMessage() {} func (*GetProposalParam) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{13} + return fileDescriptor_88e25d9b99e39f02, []int{16} } func (m *GetProposalParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetProposalParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetProposalParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetProposalParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetProposalParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetProposalParam.Merge(m, src) } func (m *GetProposalParam) XXX_Size() int { - return xxx_messageInfo_GetProposalParam.Size(m) + return m.Size() } func (m *GetProposalParam) XXX_DiscardUnknown() { xxx_messageInfo_GetProposalParam.DiscardUnknown(m) @@ -616,19 +821,24 @@ func (m *ListProposalsParam) Reset() { *m = ListProposalsParam{} } func (m *ListProposalsParam) String() string { return proto.CompactTextString(m) } func (*ListProposalsParam) ProtoMessage() {} func (*ListProposalsParam) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{14} + return fileDescriptor_88e25d9b99e39f02, []int{17} } func (m *ListProposalsParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListProposalsParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ListProposalsParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListProposalsParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ListProposalsParam) XXX_Merge(src proto.Message) { xxx_messageInfo_ListProposalsParam.Merge(m, src) } func (m *ListProposalsParam) XXX_Size() int { - return xxx_messageInfo_ListProposalsParam.Size(m) + return m.Size() } func (m *ListProposalsParam) XXX_DiscardUnknown() { xxx_messageInfo_ListProposalsParam.DiscardUnknown(m) @@ -659,19 +869,24 @@ func (m *ProposalResult) Reset() { *m = ProposalResult{} } func (m *ProposalResult) String() string { return proto.CompactTextString(m) } func (*ProposalResult) ProtoMessage() {} func (*ProposalResult) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{15} + return fileDescriptor_88e25d9b99e39f02, []int{18} } func (m *ProposalResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ProposalResult.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ProposalResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ProposalResult.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *ProposalResult) XXX_Merge(src proto.Message) { xxx_messageInfo_ProposalResult.Merge(m, src) } func (m *ProposalResult) XXX_Size() int { - return xxx_messageInfo_ProposalResult.Size(m) + return m.Size() } func (m *ProposalResult) XXX_DiscardUnknown() { xxx_messageInfo_ProposalResult.DiscardUnknown(m) @@ -707,19 +922,24 @@ func (m *GetStatsParam) Reset() { *m = GetStatsParam{} } func (m *GetStatsParam) String() string { return proto.CompactTextString(m) } func (*GetStatsParam) ProtoMessage() {} func (*GetStatsParam) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{16} + return fileDescriptor_88e25d9b99e39f02, []int{19} } func (m *GetStatsParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetStatsParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetStatsParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetStatsParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetStatsParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetStatsParam.Merge(m, src) } func (m *GetStatsParam) XXX_Size() int { - return xxx_messageInfo_GetStatsParam.Size(m) + return m.Size() } func (m *GetStatsParam) XXX_DiscardUnknown() { xxx_messageInfo_GetStatsParam.DiscardUnknown(m) @@ -743,19 +963,24 @@ func (m *Stats) Reset() { *m = Stats{} } func (m *Stats) String() string { return proto.CompactTextString(m) } func (*Stats) ProtoMessage() {} func (*Stats) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{17} + return fileDescriptor_88e25d9b99e39f02, []int{20} } func (m *Stats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Stats.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *Stats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Stats.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *Stats) XXX_Merge(src proto.Message) { xxx_messageInfo_Stats.Merge(m, src) } func (m *Stats) XXX_Size() int { - return xxx_messageInfo_Stats.Size(m) + return m.Size() } func (m *Stats) XXX_DiscardUnknown() { xxx_messageInfo_Stats.DiscardUnknown(m) @@ -792,19 +1017,24 @@ func (m *GetBlockParam) Reset() { *m = GetBlockParam{} } func (m *GetBlockParam) String() string { return proto.CompactTextString(m) } func (*GetBlockParam) ProtoMessage() {} func (*GetBlockParam) Descriptor() ([]byte, []int) { - return fileDescriptor_88e25d9b99e39f02, []int{18} + return fileDescriptor_88e25d9b99e39f02, []int{21} } func (m *GetBlockParam) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetBlockParam.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetBlockParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetBlockParam.Marshal(b, m, deterministic) + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } func (m *GetBlockParam) XXX_Merge(src proto.Message) { xxx_messageInfo_GetBlockParam.Merge(m, src) } func (m *GetBlockParam) XXX_Size() int { - return xxx_messageInfo_GetBlockParam.Size(m) + return m.Size() } func (m *GetBlockParam) XXX_DiscardUnknown() { xxx_messageInfo_GetBlockParam.DiscardUnknown(m) @@ -841,10 +1071,16 @@ func init() { golang_proto.RegisterType((*GetNameParam)(nil), "rpcquery.GetNameParam") proto.RegisterType((*ListNamesParam)(nil), "rpcquery.ListNamesParam") golang_proto.RegisterType((*ListNamesParam)(nil), "rpcquery.ListNamesParam") + proto.RegisterType((*GetNetworkRegistryParam)(nil), "rpcquery.GetNetworkRegistryParam") + golang_proto.RegisterType((*GetNetworkRegistryParam)(nil), "rpcquery.GetNetworkRegistryParam") proto.RegisterType((*GetValidatorSetParam)(nil), "rpcquery.GetValidatorSetParam") golang_proto.RegisterType((*GetValidatorSetParam)(nil), "rpcquery.GetValidatorSetParam") proto.RegisterType((*GetValidatorSetHistoryParam)(nil), "rpcquery.GetValidatorSetHistoryParam") golang_proto.RegisterType((*GetValidatorSetHistoryParam)(nil), "rpcquery.GetValidatorSetHistoryParam") + proto.RegisterType((*NetworkRegistry)(nil), "rpcquery.NetworkRegistry") + golang_proto.RegisterType((*NetworkRegistry)(nil), "rpcquery.NetworkRegistry") + proto.RegisterType((*RegisteredValidator)(nil), "rpcquery.RegisteredValidator") + golang_proto.RegisterType((*RegisteredValidator)(nil), "rpcquery.RegisteredValidator") proto.RegisterType((*ValidatorSetHistory)(nil), "rpcquery.ValidatorSetHistory") golang_proto.RegisterType((*ValidatorSetHistory)(nil), "rpcquery.ValidatorSetHistory") proto.RegisterType((*ValidatorSet)(nil), "rpcquery.ValidatorSet") @@ -867,619 +1103,911 @@ func init() { proto.RegisterFile("rpcquery.proto", fileDescriptor_88e25d9b99e39f func init() { golang_proto.RegisterFile("rpcquery.proto", fileDescriptor_88e25d9b99e39f02) } var fileDescriptor_88e25d9b99e39f02 = []byte{ - // 955 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0x66, 0x93, 0xc6, 0x71, 0x8e, 0x1d, 0xbb, 0x9d, 0x06, 0x63, 0xb6, 0xe0, 0x54, 0x23, 0x91, - 0x86, 0xaa, 0x5d, 0x1b, 0xd3, 0x00, 0x02, 0x24, 0x54, 0x57, 0x60, 0x87, 0xd2, 0x28, 0xac, 0xa1, - 0x95, 0x40, 0x42, 0x1a, 0xef, 0x0e, 0xf6, 0x8a, 0xb5, 0xc7, 0xcc, 0xce, 0x16, 0xf6, 0x91, 0x78, - 0x00, 0xae, 0xe1, 0xb2, 0x8f, 0x80, 0x7a, 0x11, 0xa1, 0xf6, 0x45, 0xd0, 0xce, 0xcf, 0x7a, 0x77, - 0xe3, 0x44, 0x80, 0xd4, 0x9b, 0x68, 0xce, 0x99, 0x6f, 0xbe, 0x93, 0x39, 0x73, 0xbe, 0x6f, 0x0d, - 0x0d, 0xbe, 0xf4, 0x7e, 0x8e, 0x29, 0x4f, 0x9c, 0x25, 0x67, 0x82, 0xa1, 0xaa, 0x89, 0xed, 0xbb, - 0xd3, 0x40, 0xcc, 0xe2, 0x89, 0xe3, 0xb1, 0x79, 0x77, 0xca, 0xa6, 0xac, 0x2b, 0x01, 0x93, 0xf8, - 0x47, 0x19, 0xc9, 0x40, 0xae, 0xd4, 0x41, 0xfb, 0xc3, 0x1c, 0x5c, 0xd0, 0x85, 0x4f, 0xf9, 0x3c, - 0x58, 0x88, 0xfc, 0x92, 0x4c, 0xbc, 0xa0, 0x2b, 0x92, 0x25, 0x8d, 0xd4, 0x5f, 0x7d, 0xb0, 0xb6, - 0x20, 0xf3, 0x2c, 0xd8, 0x21, 0xde, 0x5c, 0x2f, 0x9b, 0x4f, 0x49, 0x18, 0xf8, 0x44, 0x30, 0x6e, - 0xf6, 0xf8, 0xd2, 0xd3, 0xcb, 0xdd, 0x25, 0x49, 0x42, 0x46, 0x7c, 0x15, 0xe2, 0x00, 0x6a, 0x63, - 0x41, 0x44, 0x1c, 0x9d, 0x12, 0x4e, 0xe6, 0xe8, 0x10, 0x9a, 0x83, 0x90, 0x79, 0x3f, 0x7d, 0x13, - 0xcc, 0xe9, 0x93, 0x40, 0xcc, 0x82, 0x45, 0xdb, 0xba, 0x69, 0x1d, 0xee, 0xb8, 0xe5, 0x34, 0xea, - 0xc1, 0x75, 0x99, 0x1a, 0x53, 0xba, 0xc8, 0xa1, 0x37, 0x24, 0x7a, 0xdd, 0x16, 0x26, 0xd0, 0x1c, - 0x52, 0x71, 0xdf, 0xf3, 0x58, 0xbc, 0x10, 0xaa, 0xdc, 0x09, 0x6c, 0xdf, 0xf7, 0x7d, 0x4e, 0xa3, - 0x48, 0x96, 0xa9, 0x0f, 0xee, 0x3d, 0x3b, 0xdb, 0x7f, 0xed, 0xf9, 0xd9, 0xfe, 0x9d, 0x5c, 0x4b, - 0x66, 0xc9, 0x92, 0xf2, 0x90, 0xfa, 0x53, 0xca, 0xbb, 0x93, 0x98, 0x73, 0xf6, 0x4b, 0xd7, 0xe3, - 0xc9, 0x52, 0x30, 0x47, 0x9f, 0x75, 0x0d, 0x09, 0xfe, 0xdd, 0x82, 0xab, 0x43, 0x2a, 0x1e, 0x51, - 0x41, 0x7c, 0x22, 0x88, 0x2a, 0xf2, 0x65, 0xb9, 0x48, 0xef, 0x7f, 0x17, 0x40, 0xdf, 0x42, 0xdd, - 0x90, 0x8f, 0x48, 0x34, 0x93, 0xd7, 0xad, 0x0f, 0xde, 0x7b, 0x7e, 0xb6, 0x7f, 0xf7, 0x72, 0xc2, - 0x49, 0xb0, 0x20, 0x3c, 0x71, 0x46, 0xf4, 0xd7, 0x41, 0x22, 0x68, 0xe4, 0x16, 0x68, 0xf0, 0x1d, - 0x68, 0x98, 0xd8, 0xa5, 0x51, 0x1c, 0x0a, 0x64, 0x43, 0xd5, 0x64, 0xf4, 0x0b, 0x64, 0x31, 0xfe, - 0xcd, 0x92, 0x9d, 0x1c, 0x0b, 0xc6, 0xc9, 0x94, 0xbe, 0x92, 0x4e, 0xa2, 0x2f, 0x60, 0xf3, 0x21, - 0x4d, 0xf4, 0xfd, 0xfe, 0x25, 0x97, 0xbe, 0xe3, 0x13, 0xc6, 0xfd, 0xfe, 0xd1, 0x07, 0x6e, 0x4a, - 0x80, 0xbf, 0x87, 0xba, 0xfe, 0x3f, 0x1f, 0x93, 0x30, 0xa6, 0xe8, 0x21, 0x6c, 0xc9, 0x85, 0xfe, - 0x2f, 0x8f, 0x34, 0xf3, 0x7f, 0xec, 0x9e, 0xe2, 0xc0, 0xef, 0xc2, 0xb5, 0xaf, 0x82, 0xc8, 0x8c, - 0x94, 0x1e, 0xe1, 0x3d, 0xd8, 0xfa, 0x3a, 0x55, 0xa1, 0x6e, 0x9b, 0x0a, 0x30, 0x86, 0xfa, 0x90, - 0x8a, 0x13, 0x32, 0xd7, 0xfd, 0x42, 0x70, 0x25, 0x0d, 0x34, 0x48, 0xae, 0xf1, 0x01, 0x34, 0x52, - 0xba, 0x74, 0x7d, 0x29, 0x57, 0x0b, 0xf6, 0x86, 0x54, 0x3c, 0x36, 0x1a, 0x1b, 0x53, 0x35, 0xcd, - 0x78, 0x08, 0x37, 0x4a, 0xf9, 0x51, 0x10, 0x09, 0xc6, 0x93, 0x4c, 0x5b, 0xc7, 0x0b, 0x2f, 0x8c, - 0x7d, 0x7a, 0xca, 0xe9, 0xd3, 0x80, 0xc5, 0xea, 0xa9, 0x36, 0xdd, 0x72, 0x1a, 0x0f, 0xe1, 0xfa, - 0x1a, 0x16, 0xd4, 0x83, 0x6d, 0xbd, 0x6c, 0x5b, 0x37, 0x37, 0x0f, 0x6b, 0xfd, 0x96, 0x93, 0x59, - 0x50, 0x1e, 0xef, 0x1a, 0x18, 0x3e, 0x81, 0x7a, 0x7e, 0x03, 0xb5, 0xa0, 0x32, 0xa3, 0xc1, 0x74, - 0x26, 0x64, 0xe5, 0x2b, 0xae, 0x8e, 0xd0, 0x01, 0x6c, 0x8e, 0xa9, 0x68, 0x6f, 0x48, 0xd6, 0x3d, - 0x67, 0x65, 0x1f, 0xd9, 0x69, 0x37, 0x05, 0xe0, 0x03, 0x29, 0xaf, 0x53, 0xce, 0x96, 0x2c, 0x22, - 0x61, 0xd6, 0x49, 0x29, 0x05, 0xf9, 0xa0, 0xae, 0x5c, 0xe3, 0x1e, 0xa0, 0xb4, 0x93, 0x06, 0xa8, - 0xbb, 0x69, 0x43, 0x55, 0x65, 0xa8, 0x2f, 0xd1, 0x55, 0x37, 0x8b, 0xf1, 0x23, 0x68, 0x18, 0xb4, - 0x56, 0xc0, 0x1a, 0x5e, 0x74, 0x0b, 0x2a, 0x03, 0x12, 0x86, 0x4c, 0xc8, 0xc1, 0xac, 0xf5, 0x9b, - 0x8e, 0x71, 0x33, 0x95, 0x76, 0xf5, 0x36, 0x6e, 0xc2, 0xae, 0x54, 0x08, 0xd1, 0x53, 0x81, 0x29, - 0x6c, 0xc9, 0x08, 0xdd, 0x86, 0xab, 0x66, 0x5e, 0x52, 0x5f, 0x7a, 0xc0, 0x7c, 0xaa, 0x9b, 0x71, - 0x2e, 0x9f, 0x7a, 0x5c, 0x3e, 0xc7, 0x62, 0x21, 0xe1, 0x1b, 0x12, 0xbe, 0x6e, 0x0b, 0xdf, 0x92, - 0x75, 0xa5, 0xfb, 0xa9, 0x3b, 0xb7, 0xa0, 0x32, 0x2a, 0x74, 0x5c, 0x45, 0xfd, 0x3f, 0x2a, 0x7a, - 0xb4, 0x50, 0x1f, 0x2a, 0xca, 0x81, 0xd1, 0xeb, 0xab, 0xe7, 0xcc, 0x79, 0xb2, 0x7d, 0x2d, 0x4d, - 0x3b, 0xaa, 0x2b, 0x1a, 0x79, 0x04, 0xb0, 0xb2, 0x52, 0xf4, 0xe6, 0xea, 0x5c, 0xc9, 0x60, 0xed, - 0xba, 0x93, 0x7e, 0x15, 0x0c, 0xf0, 0x01, 0xd4, 0x72, 0xee, 0x88, 0xec, 0xc2, 0xb9, 0x82, 0x69, - 0xda, 0xed, 0xd5, 0x5e, 0xc9, 0x99, 0x3e, 0x93, 0xb5, 0xb5, 0xa8, 0x4b, 0xb5, 0xf3, 0x96, 0x64, - 0xb7, 0xf2, 0xd7, 0xc9, 0x59, 0xc0, 0x27, 0x50, 0xcf, 0xab, 0x16, 0xdd, 0x58, 0xe1, 0xce, 0xa9, - 0xb9, 0x78, 0x81, 0x9e, 0x85, 0xba, 0xb0, 0xad, 0x75, 0x8c, 0x5a, 0x85, 0xd2, 0x99, 0xb4, 0xed, - 0xba, 0xa3, 0x3e, 0x8b, 0x9f, 0x2f, 0x04, 0x4f, 0xd0, 0x11, 0xec, 0x64, 0xa2, 0x46, 0xed, 0x62, - 0xa9, 0x95, 0xd2, 0x8b, 0x87, 0x7a, 0x16, 0x3a, 0x96, 0x16, 0x5b, 0x10, 0x4f, 0xa7, 0x50, 0xef, - 0x9c, 0xfc, 0xed, 0x0b, 0xd4, 0x88, 0x7e, 0x80, 0xd6, 0x7a, 0x5b, 0x40, 0xef, 0x5c, 0xc8, 0x98, - 0x37, 0x0e, 0xfb, 0xed, 0xf5, 0xc4, 0x86, 0xe5, 0x63, 0xf9, 0xaa, 0x46, 0x3d, 0xa5, 0x57, 0x2d, - 0x68, 0xd5, 0x2e, 0xeb, 0x05, 0x1d, 0xc3, 0x6e, 0x41, 0xa8, 0xe8, 0xad, 0x62, 0x87, 0x8a, 0x0a, - 0xce, 0x4f, 0x45, 0x51, 0xad, 0x3d, 0x0b, 0xdd, 0x83, 0xaa, 0x91, 0x1c, 0x7a, 0xa3, 0x34, 0x15, - 0x46, 0x86, 0x76, 0xb3, 0x38, 0xe2, 0x11, 0xfa, 0x08, 0x1a, 0x46, 0x30, 0x23, 0x4a, 0x7c, 0xca, - 0x4b, 0x67, 0x57, 0x52, 0xb2, 0x77, 0x1d, 0xf5, 0xdb, 0x47, 0xe1, 0x06, 0x9f, 0xfe, 0xf5, 0xa2, - 0x63, 0xfd, 0xfd, 0xa2, 0x63, 0xfd, 0xf9, 0xb2, 0x63, 0x3d, 0x7b, 0xd9, 0xb1, 0xbe, 0xbb, 0x7d, - 0xf9, 0x47, 0x84, 0x2f, 0xbd, 0xae, 0xa1, 0x9e, 0x54, 0xe4, 0xcf, 0x9f, 0xf7, 0xff, 0x09, 0x00, - 0x00, 0xff, 0xff, 0xac, 0x34, 0xcd, 0x8f, 0xc5, 0x09, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - Status(ctx context.Context, in *StatusParam, opts ...grpc.CallOption) (*rpc.ResultStatus, error) - GetAccount(ctx context.Context, in *GetAccountParam, opts ...grpc.CallOption) (*acm.Account, error) - GetMetadata(ctx context.Context, in *GetMetadataParam, opts ...grpc.CallOption) (*MetadataResult, error) - GetStorage(ctx context.Context, in *GetStorageParam, opts ...grpc.CallOption) (*StorageValue, error) - ListAccounts(ctx context.Context, in *ListAccountsParam, opts ...grpc.CallOption) (Query_ListAccountsClient, error) - GetName(ctx context.Context, in *GetNameParam, opts ...grpc.CallOption) (*names.Entry, error) - ListNames(ctx context.Context, in *ListNamesParam, opts ...grpc.CallOption) (Query_ListNamesClient, error) - GetValidatorSet(ctx context.Context, in *GetValidatorSetParam, opts ...grpc.CallOption) (*ValidatorSet, error) - GetValidatorSetHistory(ctx context.Context, in *GetValidatorSetHistoryParam, opts ...grpc.CallOption) (*ValidatorSetHistory, error) - GetProposal(ctx context.Context, in *GetProposalParam, opts ...grpc.CallOption) (*payload.Ballot, error) - ListProposals(ctx context.Context, in *ListProposalsParam, opts ...grpc.CallOption) (Query_ListProposalsClient, error) - GetStats(ctx context.Context, in *GetStatsParam, opts ...grpc.CallOption) (*Stats, error) - GetBlockHeader(ctx context.Context, in *GetBlockParam, opts ...grpc.CallOption) (*types.Header, error) -} - -type queryClient struct { - cc *grpc.ClientConn -} - -func NewQueryClient(cc *grpc.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Status(ctx context.Context, in *StatusParam, opts ...grpc.CallOption) (*rpc.ResultStatus, error) { - out := new(rpc.ResultStatus) - err := c.cc.Invoke(ctx, "/rpcquery.Query/Status", in, out, opts...) + // 1048 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0xff, 0x6f, 0xf3, 0x7d, 0xec, 0xd8, 0xed, 0x24, 0x7f, 0xd7, 0xdd, 0xb6, 0x4e, 0x19, 0x89, + 0x34, 0x44, 0x65, 0x6d, 0x4c, 0xc3, 0x05, 0x5c, 0xa0, 0x3a, 0x80, 0x1d, 0x4a, 0xa3, 0xb0, 0x86, + 0x56, 0x02, 0x09, 0x69, 0xb2, 0x3b, 0xb2, 0x57, 0x5d, 0xef, 0x98, 0xd9, 0xd9, 0x16, 0x3f, 0x06, + 0x2f, 0xc0, 0x3d, 0x0f, 0xc0, 0x3d, 0x97, 0xb9, 0xe4, 0x12, 0xf5, 0x22, 0x42, 0xe9, 0x8b, 0xa0, + 0x9d, 0x0f, 0xef, 0x47, 0xdc, 0x08, 0x10, 0xdc, 0x58, 0x73, 0xce, 0x9c, 0x0f, 0x9f, 0x33, 0xe7, + 0xf7, 0x3b, 0x0b, 0x35, 0x3e, 0xf5, 0xbe, 0x4f, 0x28, 0x9f, 0x39, 0x53, 0xce, 0x04, 0x43, 0xeb, + 0x46, 0xb6, 0xb7, 0x47, 0x6c, 0xc4, 0xa4, 0xb2, 0x9d, 0x9e, 0xd4, 0xbd, 0x7d, 0x47, 0xd0, 0xc8, + 0xa7, 0x7c, 0x12, 0x44, 0xa2, 0x2d, 0x66, 0x53, 0x1a, 0xab, 0x5f, 0x7d, 0x5b, 0x89, 0xc8, 0x64, + 0x2e, 0x6c, 0x10, 0x6f, 0xa2, 0x8f, 0xf5, 0x17, 0x24, 0x0c, 0x7c, 0x22, 0x18, 0xd7, 0x8a, 0x1a, + 0xa7, 0xa3, 0x20, 0x16, 0x26, 0xad, 0xbd, 0xc1, 0xa7, 0x9e, 0x3e, 0x6e, 0x4e, 0xc9, 0x2c, 0x64, + 0xc4, 0x57, 0x22, 0x0e, 0xa0, 0x32, 0x14, 0x44, 0x24, 0xf1, 0x09, 0xe1, 0x64, 0x82, 0xf6, 0xa0, + 0xde, 0x0b, 0x99, 0xf7, 0xfc, 0xab, 0x60, 0x42, 0x9f, 0x05, 0x62, 0x1c, 0x44, 0x4d, 0xeb, 0x9e, + 0xb5, 0xb7, 0xe1, 0x96, 0xd5, 0xa8, 0x03, 0x5b, 0x52, 0x35, 0xa4, 0x34, 0xca, 0x59, 0x5f, 0x93, + 0xd6, 0x8b, 0xae, 0x30, 0x81, 0x7a, 0x9f, 0x8a, 0x47, 0x9e, 0xc7, 0x92, 0x48, 0xa8, 0x74, 0xc7, + 0xb0, 0xf6, 0xc8, 0xf7, 0x39, 0x8d, 0x63, 0x99, 0xa6, 0xda, 0x7b, 0x78, 0x76, 0xbe, 0xf3, 0xbf, + 0x57, 0xe7, 0x3b, 0x0f, 0x46, 0x81, 0x18, 0x27, 0xa7, 0x8e, 0xc7, 0x26, 0xed, 0xf1, 0x6c, 0x4a, + 0x79, 0x48, 0xfd, 0x11, 0xe5, 0xed, 0xd3, 0x84, 0x73, 0xf6, 0xb2, 0xed, 0xf1, 0xd9, 0x54, 0x30, + 0x47, 0xfb, 0xba, 0x26, 0x08, 0xfe, 0xc5, 0x82, 0xeb, 0x7d, 0x2a, 0x9e, 0x50, 0x41, 0x7c, 0x22, + 0x88, 0x4a, 0xf2, 0x79, 0x39, 0x49, 0xe7, 0x1f, 0x27, 0x40, 0x5f, 0x43, 0xd5, 0x04, 0x1f, 0x90, + 0x78, 0x2c, 0xcb, 0xad, 0xf6, 0xde, 0x7b, 0x75, 0xbe, 0xf3, 0xee, 0xd5, 0x01, 0x4f, 0x83, 0x88, + 0xf0, 0x99, 0x33, 0xa0, 0x3f, 0xf4, 0x66, 0x82, 0xc6, 0x6e, 0x21, 0x0c, 0x7e, 0x00, 0x35, 0x23, + 0xbb, 0x34, 0x4e, 0x42, 0x81, 0x6c, 0x58, 0x37, 0x1a, 0xfd, 0x02, 0x73, 0x19, 0xff, 0x6c, 0xc9, + 0x4e, 0x0e, 0x05, 0xe3, 0x64, 0x44, 0xff, 0x93, 0x4e, 0xa2, 0xcf, 0x60, 0xe9, 0x31, 0x9d, 0xe9, + 0xfa, 0xfe, 0x62, 0x2c, 0x5d, 0xe3, 0x33, 0xc6, 0xfd, 0xee, 0xc1, 0x07, 0x6e, 0x1a, 0x00, 0x7f, + 0x0b, 0x55, 0xfd, 0x3f, 0x9f, 0x92, 0x30, 0xa1, 0xe8, 0x31, 0xac, 0xc8, 0x83, 0xfe, 0x97, 0x07, + 0x3a, 0xf2, 0xdf, 0xec, 0x9e, 0x8a, 0x81, 0xdf, 0x81, 0x1b, 0x5f, 0x04, 0xb1, 0x19, 0x29, 0x3d, + 0xc2, 0xdb, 0xb0, 0xf2, 0x65, 0x8a, 0x30, 0xdd, 0x36, 0x25, 0x60, 0x0c, 0xd5, 0x3e, 0x15, 0xc7, + 0x64, 0xa2, 0xfb, 0x85, 0x60, 0x39, 0x15, 0xb4, 0x91, 0x3c, 0xe3, 0x5d, 0xa8, 0xa5, 0xe1, 0xd2, + 0xf3, 0x95, 0xb1, 0x6e, 0xc1, 0xcd, 0x34, 0x16, 0x15, 0x2f, 0x19, 0x7f, 0xee, 0x6a, 0xa4, 0x49, + 0x07, 0xdc, 0x80, 0xed, 0x3e, 0x15, 0x4f, 0x0d, 0x1c, 0x87, 0x54, 0x0d, 0x3a, 0xee, 0xc3, 0xed, + 0x92, 0x7e, 0x10, 0xc4, 0x82, 0x69, 0xb7, 0x14, 0x76, 0x47, 0x91, 0x17, 0x26, 0x3e, 0x3d, 0xe1, + 0xf4, 0x45, 0xc0, 0x12, 0xf5, 0x8a, 0x4b, 0x6e, 0x59, 0x8d, 0x7b, 0x50, 0x2f, 0x25, 0x46, 0x6d, + 0x58, 0x1a, 0x52, 0xd1, 0xb4, 0xee, 0x2d, 0xed, 0x55, 0xba, 0x77, 0x9d, 0x39, 0xe3, 0x28, 0x03, + 0xca, 0xa9, 0x3f, 0xcf, 0xeb, 0xa6, 0x96, 0xf8, 0x47, 0x0b, 0xb6, 0x16, 0x5c, 0xfe, 0xeb, 0x33, + 0xb4, 0x0f, 0xcb, 0xc7, 0xcc, 0xa7, 0x72, 0x88, 0x2a, 0xdd, 0x86, 0x33, 0x27, 0xa5, 0x54, 0x7b, + 0xe4, 0xd3, 0x48, 0x04, 0x62, 0xe6, 0x4a, 0x1b, 0xdc, 0x87, 0xad, 0x05, 0xdd, 0x41, 0x1d, 0x58, + 0xd3, 0x47, 0x5d, 0x5f, 0x23, 0xab, 0x2f, 0x6f, 0xef, 0x1a, 0x33, 0x7c, 0x0c, 0xd5, 0xfc, 0x05, + 0x6a, 0xc0, 0xea, 0x98, 0x06, 0xa3, 0xb1, 0x90, 0x35, 0x2d, 0xbb, 0x5a, 0x42, 0xbb, 0xaa, 0x6b, + 0xd7, 0x64, 0xd4, 0x6d, 0x27, 0x63, 0xd0, 0x52, 0xb3, 0x76, 0x25, 0xa3, 0x9c, 0x70, 0x36, 0x65, + 0x31, 0x09, 0xe7, 0xc3, 0x23, 0xd1, 0x2f, 0xbb, 0xe4, 0xca, 0x33, 0xee, 0x00, 0x4a, 0x87, 0xc7, + 0x18, 0xea, 0x01, 0xb2, 0x61, 0x5d, 0x69, 0xa8, 0x2f, 0xad, 0xd7, 0xdd, 0xb9, 0x8c, 0x9f, 0x40, + 0xcd, 0x58, 0x6b, 0xd0, 0x2f, 0x88, 0x8b, 0xee, 0xc3, 0x6a, 0x8f, 0x84, 0x21, 0x13, 0xba, 0x8d, + 0x75, 0xc7, 0x10, 0xb8, 0x52, 0xbb, 0xfa, 0x1a, 0xd7, 0x61, 0x53, 0x92, 0x02, 0xd1, 0x40, 0xc0, + 0x14, 0x56, 0xa4, 0x84, 0xf6, 0xe1, 0xba, 0x81, 0x48, 0x4a, 0xc5, 0x87, 0xe9, 0x9b, 0xa8, 0x66, + 0x5c, 0xd2, 0xa7, 0xb4, 0x9e, 0xd7, 0xb1, 0x44, 0x1c, 0x9a, 0x27, 0x5c, 0x76, 0x17, 0x5d, 0xe1, + 0xfb, 0x32, 0xaf, 0x24, 0x7c, 0x55, 0x73, 0x03, 0x56, 0x07, 0x85, 0x8e, 0x2b, 0xa9, 0xfb, 0xd3, + 0x9a, 0x46, 0x13, 0xea, 0xc2, 0xaa, 0x5a, 0x3a, 0xe8, 0xff, 0xd9, 0x73, 0xe6, 0xd6, 0x90, 0x7d, + 0x23, 0x55, 0x3b, 0xaa, 0x2b, 0xda, 0xf2, 0x00, 0x20, 0xdb, 0x1e, 0xe8, 0x56, 0xe6, 0x57, 0xda, + 0x29, 0x76, 0xd5, 0x49, 0x17, 0xa3, 0x31, 0x3c, 0x84, 0x4a, 0x6e, 0x21, 0x20, 0xbb, 0xe0, 0x57, + 0xd8, 0x13, 0x76, 0x33, 0xbb, 0x2b, 0x91, 0xf1, 0xc7, 0x32, 0xb7, 0xe6, 0xb1, 0x52, 0xee, 0x3c, + 0x0b, 0xdb, 0x8d, 0x7c, 0x39, 0x39, 0xd6, 0xfb, 0x08, 0xaa, 0x79, 0xa2, 0x42, 0xb7, 0x33, 0xbb, + 0x4b, 0x04, 0x56, 0x2c, 0xa0, 0x63, 0xa1, 0x36, 0xac, 0x69, 0xea, 0x42, 0x8d, 0x42, 0xea, 0x39, + 0x9b, 0xd9, 0x55, 0x47, 0x7d, 0x19, 0x7c, 0x1a, 0xa5, 0x84, 0x70, 0x00, 0x1b, 0x73, 0x1e, 0x43, + 0xcd, 0x62, 0xaa, 0x8c, 0xdc, 0x8a, 0x4e, 0x1d, 0x0b, 0xb9, 0x80, 0x2e, 0xd3, 0x1a, 0x7a, 0xab, + 0x98, 0x72, 0x01, 0xe9, 0xd9, 0xb9, 0x86, 0x94, 0xbd, 0x8f, 0xe4, 0xa6, 0x2a, 0x00, 0xb2, 0x55, + 0x08, 0x78, 0x89, 0x2a, 0xed, 0x37, 0x20, 0x1c, 0x7d, 0x07, 0x8d, 0xc5, 0x14, 0x8a, 0xde, 0x7e, + 0x63, 0xc4, 0x3c, 0xc9, 0xda, 0x77, 0x17, 0x07, 0x36, 0x51, 0x3e, 0x94, 0x93, 0x62, 0x10, 0x59, + 0x9a, 0x94, 0x02, 0xfe, 0xed, 0x32, 0x06, 0xd1, 0x11, 0x6c, 0x16, 0xc0, 0x8f, 0xee, 0x14, 0xbb, + 0x5e, 0x64, 0x85, 0xfc, 0xa4, 0x15, 0x19, 0xa0, 0x63, 0xa1, 0x87, 0xb0, 0x6e, 0x60, 0x8c, 0x6e, + 0x96, 0x26, 0xcd, 0x40, 0xdb, 0xae, 0x17, 0x61, 0x13, 0xa3, 0x43, 0xa8, 0x19, 0x10, 0x0e, 0x28, + 0xf1, 0x29, 0x2f, 0xf9, 0x66, 0xf0, 0xb4, 0x9b, 0x4e, 0xf6, 0x8d, 0xe9, 0xa8, 0xaf, 0x4b, 0xe5, + 0xd2, 0xfb, 0xe4, 0xec, 0xa2, 0x65, 0xfd, 0x76, 0xd1, 0xb2, 0x7e, 0xbf, 0x68, 0x59, 0x7f, 0x5c, + 0xb4, 0xac, 0x5f, 0x5f, 0xb7, 0xac, 0xb3, 0xd7, 0x2d, 0xeb, 0x9b, 0xfd, 0xab, 0x17, 0x00, 0x9f, + 0x7a, 0x6d, 0x93, 0xed, 0x74, 0x55, 0x7e, 0x58, 0xbe, 0xff, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xe6, 0xd8, 0xa5, 0xb6, 0xfb, 0x0a, 0x00, 0x00, +} + +func (m *StatusParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *queryClient) GetAccount(ctx context.Context, in *GetAccountParam, opts ...grpc.CallOption) (*acm.Account, error) { - out := new(acm.Account) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetAccount", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *StatusParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) GetMetadata(ctx context.Context, in *GetMetadataParam, opts ...grpc.CallOption) (*MetadataResult, error) { - out := new(MetadataResult) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetMetadata", in, out, opts...) +func (m *StatusParam) 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.BlockSeenTimeWithin) > 0 { + i -= len(m.BlockSeenTimeWithin) + copy(dAtA[i:], m.BlockSeenTimeWithin) + i = encodeVarintRpcquery(dAtA, i, uint64(len(m.BlockSeenTimeWithin))) + i-- + dAtA[i] = 0x12 + } + if len(m.BlockTimeWithin) > 0 { + i -= len(m.BlockTimeWithin) + copy(dAtA[i:], m.BlockTimeWithin) + i = encodeVarintRpcquery(dAtA, i, uint64(len(m.BlockTimeWithin))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAccountParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *queryClient) GetStorage(ctx context.Context, in *GetStorageParam, opts ...grpc.CallOption) (*StorageValue, error) { - out := new(StorageValue) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetStorage", in, out, opts...) - if err != nil { - return nil, err +func (m *GetAccountParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAccountParam) 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) + } + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpcquery(dAtA, i, uint64(size)) } - return out, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (c *queryClient) ListAccounts(ctx context.Context, in *ListAccountsParam, opts ...grpc.CallOption) (Query_ListAccountsClient, error) { - stream, err := c.cc.NewStream(ctx, &_Query_serviceDesc.Streams[0], "/rpcquery.Query/ListAccounts", opts...) +func (m *GetMetadataParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - x := &queryListAccountsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Query_ListAccountsClient interface { - Recv() (*acm.Account, error) - grpc.ClientStream + return dAtA[:n], nil } -type queryListAccountsClient struct { - grpc.ClientStream +func (m *GetMetadataParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (x *queryListAccountsClient) Recv() (*acm.Account, error) { - m := new(acm.Account) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err +func (m *GetMetadataParam) 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 m.MetadataHash != nil { + { + size := m.MetadataHash.Size() + i -= size + if _, err := m.MetadataHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpcquery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return m, nil + if m.Address != nil { + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpcquery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (c *queryClient) GetName(ctx context.Context, in *GetNameParam, opts ...grpc.CallOption) (*names.Entry, error) { - out := new(names.Entry) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetName", in, out, opts...) +func (m *MetadataResult) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *queryClient) ListNames(ctx context.Context, in *ListNamesParam, opts ...grpc.CallOption) (Query_ListNamesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Query_serviceDesc.Streams[1], "/rpcquery.Query/ListNames", opts...) - if err != nil { - return nil, err - } - x := &queryListNamesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err +func (m *MetadataResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetadataResult) 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 err := x.ClientStream.CloseSend(); err != nil { - return nil, err + if len(m.Metadata) > 0 { + i -= len(m.Metadata) + copy(dAtA[i:], m.Metadata) + i = encodeVarintRpcquery(dAtA, i, uint64(len(m.Metadata))) + i-- + dAtA[i] = 0xa } - return x, nil + return len(dAtA) - i, nil } -type Query_ListNamesClient interface { - Recv() (*names.Entry, error) - grpc.ClientStream +func (m *GetStorageParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -type queryListNamesClient struct { - grpc.ClientStream +func (m *GetStorageParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (x *queryListNamesClient) Recv() (*names.Entry, error) { - m := new(names.Entry) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err +func (m *GetStorageParam) 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) + } + { + size := m.Key.Size() + i -= size + if _, err := m.Key.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpcquery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpcquery(dAtA, i, uint64(size)) } - return m, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (c *queryClient) GetValidatorSet(ctx context.Context, in *GetValidatorSetParam, opts ...grpc.CallOption) (*ValidatorSet, error) { - out := new(ValidatorSet) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetValidatorSet", in, out, opts...) +func (m *StorageValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil + return dAtA[:n], nil } -func (c *queryClient) GetValidatorSetHistory(ctx context.Context, in *GetValidatorSetHistoryParam, opts ...grpc.CallOption) (*ValidatorSetHistory, error) { - out := new(ValidatorSetHistory) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetValidatorSetHistory", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *StorageValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) GetProposal(ctx context.Context, in *GetProposalParam, opts ...grpc.CallOption) (*payload.Ballot, error) { - out := new(payload.Ballot) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetProposal", in, out, opts...) - if err != nil { - return nil, err +func (m *StorageValue) 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) + } + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpcquery(dAtA, i, uint64(size)) } - return out, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (c *queryClient) ListProposals(ctx context.Context, in *ListProposalsParam, opts ...grpc.CallOption) (Query_ListProposalsClient, error) { - stream, err := c.cc.NewStream(ctx, &_Query_serviceDesc.Streams[2], "/rpcquery.Query/ListProposals", opts...) +func (m *ListAccountsParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - x := &queryListProposalsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil + return dAtA[:n], nil } -type Query_ListProposalsClient interface { - Recv() (*ProposalResult, error) - grpc.ClientStream +func (m *ListAccountsParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -type queryListProposalsClient struct { - grpc.ClientStream +func (m *ListAccountsParam) 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.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintRpcquery(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (x *queryListProposalsClient) Recv() (*ProposalResult, error) { - m := new(ProposalResult) - if err := x.ClientStream.RecvMsg(m); err != nil { +func (m *GetNameParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - return m, nil + return dAtA[:n], nil } -func (c *queryClient) GetStats(ctx context.Context, in *GetStatsParam, opts ...grpc.CallOption) (*Stats, error) { - out := new(Stats) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetStats", in, out, opts...) - if err != nil { - return nil, err +func (m *GetNameParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetNameParam) 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.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRpcquery(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return out, nil + return len(dAtA) - i, nil } -func (c *queryClient) GetBlockHeader(ctx context.Context, in *GetBlockParam, opts ...grpc.CallOption) (*types.Header, error) { - out := new(types.Header) - err := c.cc.Invoke(ctx, "/rpcquery.Query/GetBlockHeader", in, out, opts...) +func (m *ListNamesParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - Status(context.Context, *StatusParam) (*rpc.ResultStatus, error) - GetAccount(context.Context, *GetAccountParam) (*acm.Account, error) - GetMetadata(context.Context, *GetMetadataParam) (*MetadataResult, error) - GetStorage(context.Context, *GetStorageParam) (*StorageValue, error) - ListAccounts(*ListAccountsParam, Query_ListAccountsServer) error - GetName(context.Context, *GetNameParam) (*names.Entry, error) - ListNames(*ListNamesParam, Query_ListNamesServer) error - GetValidatorSet(context.Context, *GetValidatorSetParam) (*ValidatorSet, error) - GetValidatorSetHistory(context.Context, *GetValidatorSetHistoryParam) (*ValidatorSetHistory, error) - GetProposal(context.Context, *GetProposalParam) (*payload.Ballot, error) - ListProposals(*ListProposalsParam, Query_ListProposalsServer) error - GetStats(context.Context, *GetStatsParam) (*Stats, error) - GetBlockHeader(context.Context, *GetBlockParam) (*types.Header, error) + return dAtA[:n], nil } -func RegisterQueryServer(s *grpc.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) +func (m *ListNamesParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StatusParam) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Status(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/Status", +func (m *ListNamesParam) 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) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Status(ctx, req.(*StatusParam)) + if len(m.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintRpcquery(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_GetAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAccountParam) - if err := dec(in); err != nil { +func (m *GetNetworkRegistryParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).GetAccount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetAccount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAccount(ctx, req.(*GetAccountParam)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMetadataParam) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetMetadata(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetMetadata", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetMetadata(ctx, req.(*GetMetadataParam)) - } - return interceptor(ctx, in, info, handler) +func (m *GetNetworkRegistryParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_GetStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetStorageParam) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetStorage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetStorage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetStorage(ctx, req.(*GetStorageParam)) +func (m *GetNetworkRegistryParam) 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) } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_ListAccounts_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListAccountsParam) - if err := stream.RecvMsg(m); err != nil { - return err +func (m *GetValidatorSetParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return srv.(QueryServer).ListAccounts(m, &queryListAccountsServer{stream}) + return dAtA[:n], nil } -type Query_ListAccountsServer interface { - Send(*acm.Account) error - grpc.ServerStream +func (m *GetValidatorSetParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -type queryListAccountsServer struct { - grpc.ServerStream +func (m *GetValidatorSetParam) 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) + } + return len(dAtA) - i, nil } -func (x *queryListAccountsServer) Send(m *acm.Account) error { - return x.ServerStream.SendMsg(m) +func (m *GetValidatorSetHistoryParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetValidatorSetHistoryParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetValidatorSetHistoryParam) 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 m.IncludePrevious != 0 { + i = encodeVarintRpcquery(dAtA, i, uint64(m.IncludePrevious)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func _Query_GetName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetNameParam) - if err := dec(in); err != nil { +func (m *NetworkRegistry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).GetName(ctx, in) + return dAtA[:n], nil +} + +func (m *NetworkRegistry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NetworkRegistry) 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) } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetName", + if len(m.Set) > 0 { + for iNdEx := len(m.Set) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Set[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcquery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetName(ctx, req.(*GetNameParam)) + return len(dAtA) - i, nil +} + +func (m *RegisteredValidator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_ListNames_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListNamesParam) - if err := stream.RecvMsg(m); err != nil { - return err +func (m *RegisteredValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RegisteredValidator) 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 m.Node != nil { + { + size, err := m.Node.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcquery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpcquery(dAtA, i, uint64(size)) } - return srv.(QueryServer).ListNames(m, &queryListNamesServer{stream}) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -type Query_ListNamesServer interface { - Send(*names.Entry) error - grpc.ServerStream +func (m *ValidatorSetHistory) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -type queryListNamesServer struct { - grpc.ServerStream +func (m *ValidatorSetHistory) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (x *queryListNamesServer) Send(m *names.Entry) error { - return x.ServerStream.SendMsg(m) +func (m *ValidatorSetHistory) 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.History) > 0 { + for iNdEx := len(m.History) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.History[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcquery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func _Query_GetValidatorSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetValidatorSetParam) - if err := dec(in); err != nil { +func (m *ValidatorSet) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).GetValidatorSet(ctx, in) + return dAtA[:n], nil +} + +func (m *ValidatorSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorSet) 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) } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetValidatorSet", + if len(m.Set) > 0 { + for iNdEx := len(m.Set) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Set[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcquery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetValidatorSet(ctx, req.(*GetValidatorSetParam)) + if m.Height != 0 { + i = encodeVarintRpcquery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_GetValidatorSetHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetValidatorSetHistoryParam) - if err := dec(in); err != nil { +func (m *GetProposalParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).GetValidatorSetHistory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetValidatorSetHistory", + return dAtA[:n], nil +} + +func (m *GetProposalParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetProposalParam) 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) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetValidatorSetHistory(ctx, req.(*GetValidatorSetHistoryParam)) + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintRpcquery(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_GetProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProposalParam) - if err := dec(in); err != nil { +func (m *ListProposalsParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).GetProposal(ctx, in) + return dAtA[:n], nil +} + +func (m *ListProposalsParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListProposalsParam) 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) } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetProposal", + if m.Proposed { + i-- + if m.Proposed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetProposal(ctx, req.(*GetProposalParam)) + return len(dAtA) - i, nil +} + +func (m *ProposalResult) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil +} + +func (m *ProposalResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_ListProposals_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListProposalsParam) - if err := stream.RecvMsg(m); err != nil { - return err +func (m *ProposalResult) 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 m.Ballot != nil { + { + size, err := m.Ballot.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpcquery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintRpcquery(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa } - return srv.(QueryServer).ListProposals(m, &queryListProposalsServer{stream}) + return len(dAtA) - i, nil } -type Query_ListProposalsServer interface { - Send(*ProposalResult) error - grpc.ServerStream +func (m *GetStatsParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -type queryListProposalsServer struct { - grpc.ServerStream +func (m *GetStatsParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (x *queryListProposalsServer) Send(m *ProposalResult) error { - return x.ServerStream.SendMsg(m) +func (m *GetStatsParam) 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) + } + return len(dAtA) - i, nil } -func _Query_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetStatsParam) - if err := dec(in); err != nil { +func (m *Stats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).GetStats(ctx, in) + return dAtA[:n], nil +} + +func (m *Stats) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Stats) 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) } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetStats", + if m.AccountsWithoutCode != 0 { + i = encodeVarintRpcquery(dAtA, i, uint64(m.AccountsWithoutCode)) + i-- + dAtA[i] = 0x10 } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetStats(ctx, req.(*GetStatsParam)) + if m.AccountsWithCode != 0 { + i = encodeVarintRpcquery(dAtA, i, uint64(m.AccountsWithCode)) + i-- + dAtA[i] = 0x8 } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_GetBlockHeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetBlockParam) - if err := dec(in); err != nil { +func (m *GetBlockParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).GetBlockHeader(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpcquery.Query/GetBlockHeader", + return dAtA[:n], nil +} + +func (m *GetBlockParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetBlockParam) 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) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetBlockHeader(ctx, req.(*GetBlockParam)) + if m.Height != 0 { + i = encodeVarintRpcquery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "rpcquery.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Status", - Handler: _Query_Status_Handler, - }, - { - MethodName: "GetAccount", - Handler: _Query_GetAccount_Handler, - }, - { - MethodName: "GetMetadata", - Handler: _Query_GetMetadata_Handler, - }, - { - MethodName: "GetStorage", - Handler: _Query_GetStorage_Handler, - }, - { - MethodName: "GetName", - Handler: _Query_GetName_Handler, - }, - { - MethodName: "GetValidatorSet", - Handler: _Query_GetValidatorSet_Handler, - }, - { - MethodName: "GetValidatorSetHistory", - Handler: _Query_GetValidatorSetHistory_Handler, - }, - { - MethodName: "GetProposal", - Handler: _Query_GetProposal_Handler, - }, - { - MethodName: "GetStats", - Handler: _Query_GetStats_Handler, - }, - { - MethodName: "GetBlockHeader", - Handler: _Query_GetBlockHeader_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ListAccounts", - Handler: _Query_ListAccounts_Handler, - ServerStreams: true, - }, - { - StreamName: "ListNames", - Handler: _Query_ListNames_Handler, - ServerStreams: true, - }, - { - StreamName: "ListProposals", - Handler: _Query_ListProposals_Handler, - ServerStreams: true, - }, - }, - Metadata: "rpcquery.proto", +func encodeVarintRpcquery(dAtA []byte, offset int, v uint64) int { + offset -= sovRpcquery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base } - func (m *StatusParam) Size() (n int) { if m == nil { return 0 @@ -1628,6 +2156,18 @@ func (m *ListNamesParam) Size() (n int) { return n } +func (m *GetNetworkRegistryParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *GetValidatorSetParam) Size() (n int) { if m == nil { return 0 @@ -1655,6 +2195,42 @@ func (m *GetValidatorSetHistoryParam) Size() (n int) { return n } +func (m *NetworkRegistry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Set) > 0 { + for _, e := range m.Set { + l = e.Size() + n += 1 + l + sovRpcquery(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RegisteredValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Address.Size() + n += 1 + l + sovRpcquery(uint64(l)) + if m.Node != nil { + l = m.Node.Size() + n += 1 + l + sovRpcquery(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *ValidatorSetHistory) Size() (n int) { if m == nil { return 0 @@ -1791,15 +2367,1998 @@ func (m *GetBlockParam) Size() (n int) { } func sovRpcquery(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRpcquery(x uint64) (n int) { return sovRpcquery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *StatusParam) 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 ErrIntOverflowRpcquery + } + 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: StatusParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatusParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockTimeWithin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + 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 ErrInvalidLengthRpcquery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockTimeWithin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockSeenTimeWithin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + 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 ErrInvalidLengthRpcquery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockSeenTimeWithin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetAccountParam) 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 ErrIntOverflowRpcquery + } + 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: GetAccountParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAccountParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetMetadataParam) 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 ErrIntOverflowRpcquery + } + 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: GetMetadataParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetMetadataParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_hyperledger_burrow_crypto.Address + m.Address = &v + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetadataHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_hyperledger_burrow_binary.HexBytes + m.MetadataHash = &v + if err := m.MetadataHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *MetadataResult) 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 ErrIntOverflowRpcquery + } + 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: MetadataResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetadataResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + 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 ErrInvalidLengthRpcquery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetStorageParam) 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 ErrIntOverflowRpcquery + } + 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: GetStorageParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetStorageParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Key.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *StorageValue) 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 ErrIntOverflowRpcquery + } + 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: StorageValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StorageValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *ListAccountsParam) 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 ErrIntOverflowRpcquery + } + 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: ListAccountsParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListAccountsParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + 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 ErrInvalidLengthRpcquery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetNameParam) 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 ErrIntOverflowRpcquery + } + 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: GetNameParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNameParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + 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 ErrInvalidLengthRpcquery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *ListNamesParam) 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 ErrIntOverflowRpcquery + } + 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: ListNamesParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListNamesParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + 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 ErrInvalidLengthRpcquery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetNetworkRegistryParam) 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 ErrIntOverflowRpcquery + } + 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: GetNetworkRegistryParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNetworkRegistryParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetValidatorSetParam) 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 ErrIntOverflowRpcquery + } + 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: GetValidatorSetParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetValidatorSetParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetValidatorSetHistoryParam) 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 ErrIntOverflowRpcquery + } + 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: GetValidatorSetHistoryParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetValidatorSetHistoryParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IncludePrevious", wireType) + } + m.IncludePrevious = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IncludePrevious |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *NetworkRegistry) 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 ErrIntOverflowRpcquery + } + 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: NetworkRegistry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetworkRegistry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Set", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Set = append(m.Set, &RegisteredValidator{}) + if err := m.Set[len(m.Set)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *RegisteredValidator) 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 ErrIntOverflowRpcquery + } + 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: RegisteredValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisteredValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Node == nil { + m.Node = ®istry.NodeIdentity{} + } + if err := m.Node.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *ValidatorSetHistory) 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 ErrIntOverflowRpcquery + } + 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: ValidatorSetHistory: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorSetHistory: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field History", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.History = append(m.History, &ValidatorSet{}) + if err := m.History[len(m.History)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *ValidatorSet) 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 ErrIntOverflowRpcquery + } + 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: ValidatorSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Set", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Set = append(m.Set, &validator.Validator{}) + if err := m.Set[len(m.Set)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetProposalParam) 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 ErrIntOverflowRpcquery + } + 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: GetProposalParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetProposalParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *ListProposalsParam) 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 ErrIntOverflowRpcquery + } + 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: ListProposalsParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListProposalsParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Proposed = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *ProposalResult) 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 ErrIntOverflowRpcquery + } + 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: ProposalResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProposalResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ballot", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpcquery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpcquery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Ballot == nil { + m.Ballot = &payload.Ballot{} + } + if err := m.Ballot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetStatsParam) 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 ErrIntOverflowRpcquery + } + 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: GetStatsParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetStatsParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *Stats) 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 ErrIntOverflowRpcquery + } + 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: Stats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Stats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountsWithCode", wireType) + } + m.AccountsWithCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountsWithCode |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountsWithoutCode", wireType) + } + m.AccountsWithoutCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountsWithoutCode |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 *GetBlockParam) 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 ErrIntOverflowRpcquery + } + 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: GetBlockParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetBlockParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpcquery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRpcquery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRpcquery + } + 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 skipRpcquery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRpcquery + } + 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, ErrIntOverflowRpcquery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRpcquery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRpcquery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRpcquery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRpcquery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRpcquery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRpcquery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRpcquery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/rpc/rpcquery/rpcquery_grpc.pb.go b/rpc/rpcquery/rpcquery_grpc.pb.go new file mode 100644 index 000000000..5058f27be --- /dev/null +++ b/rpc/rpcquery/rpcquery_grpc.pb.go @@ -0,0 +1,659 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package rpcquery + +import ( + context "context" + + acm "github.com/hyperledger/burrow/acm" + names "github.com/hyperledger/burrow/execution/names" + rpc "github.com/hyperledger/burrow/rpc" + payload "github.com/hyperledger/burrow/txs/payload" + types "github.com/tendermint/tendermint/proto/tendermint/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type QueryClient interface { + Status(ctx context.Context, in *StatusParam, opts ...grpc.CallOption) (*rpc.ResultStatus, error) + GetAccount(ctx context.Context, in *GetAccountParam, opts ...grpc.CallOption) (*acm.Account, error) + GetMetadata(ctx context.Context, in *GetMetadataParam, opts ...grpc.CallOption) (*MetadataResult, error) + GetStorage(ctx context.Context, in *GetStorageParam, opts ...grpc.CallOption) (*StorageValue, error) + ListAccounts(ctx context.Context, in *ListAccountsParam, opts ...grpc.CallOption) (Query_ListAccountsClient, error) + GetName(ctx context.Context, in *GetNameParam, opts ...grpc.CallOption) (*names.Entry, error) + ListNames(ctx context.Context, in *ListNamesParam, opts ...grpc.CallOption) (Query_ListNamesClient, error) + // GetNetworkRegistry returns for each validator address, the list of their identified node at the current state + GetNetworkRegistry(ctx context.Context, in *GetNetworkRegistryParam, opts ...grpc.CallOption) (*NetworkRegistry, error) + GetValidatorSet(ctx context.Context, in *GetValidatorSetParam, opts ...grpc.CallOption) (*ValidatorSet, error) + GetValidatorSetHistory(ctx context.Context, in *GetValidatorSetHistoryParam, opts ...grpc.CallOption) (*ValidatorSetHistory, error) + GetProposal(ctx context.Context, in *GetProposalParam, opts ...grpc.CallOption) (*payload.Ballot, error) + ListProposals(ctx context.Context, in *ListProposalsParam, opts ...grpc.CallOption) (Query_ListProposalsClient, error) + GetStats(ctx context.Context, in *GetStatsParam, opts ...grpc.CallOption) (*Stats, error) + GetBlockHeader(ctx context.Context, in *GetBlockParam, opts ...grpc.CallOption) (*types.Header, error) +} + +type queryClient struct { + cc grpc.ClientConnInterface +} + +func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Status(ctx context.Context, in *StatusParam, opts ...grpc.CallOption) (*rpc.ResultStatus, error) { + out := new(rpc.ResultStatus) + err := c.cc.Invoke(ctx, "/rpcquery.Query/Status", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAccount(ctx context.Context, in *GetAccountParam, opts ...grpc.CallOption) (*acm.Account, error) { + out := new(acm.Account) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetMetadata(ctx context.Context, in *GetMetadataParam, opts ...grpc.CallOption) (*MetadataResult, error) { + out := new(MetadataResult) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetMetadata", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetStorage(ctx context.Context, in *GetStorageParam, opts ...grpc.CallOption) (*StorageValue, error) { + out := new(StorageValue) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetStorage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ListAccounts(ctx context.Context, in *ListAccountsParam, opts ...grpc.CallOption) (Query_ListAccountsClient, error) { + stream, err := c.cc.NewStream(ctx, &Query_ServiceDesc.Streams[0], "/rpcquery.Query/ListAccounts", opts...) + if err != nil { + return nil, err + } + x := &queryListAccountsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Query_ListAccountsClient interface { + Recv() (*acm.Account, error) + grpc.ClientStream +} + +type queryListAccountsClient struct { + grpc.ClientStream +} + +func (x *queryListAccountsClient) Recv() (*acm.Account, error) { + m := new(acm.Account) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *queryClient) GetName(ctx context.Context, in *GetNameParam, opts ...grpc.CallOption) (*names.Entry, error) { + out := new(names.Entry) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ListNames(ctx context.Context, in *ListNamesParam, opts ...grpc.CallOption) (Query_ListNamesClient, error) { + stream, err := c.cc.NewStream(ctx, &Query_ServiceDesc.Streams[1], "/rpcquery.Query/ListNames", opts...) + if err != nil { + return nil, err + } + x := &queryListNamesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Query_ListNamesClient interface { + Recv() (*names.Entry, error) + grpc.ClientStream +} + +type queryListNamesClient struct { + grpc.ClientStream +} + +func (x *queryListNamesClient) Recv() (*names.Entry, error) { + m := new(names.Entry) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *queryClient) GetNetworkRegistry(ctx context.Context, in *GetNetworkRegistryParam, opts ...grpc.CallOption) (*NetworkRegistry, error) { + out := new(NetworkRegistry) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetNetworkRegistry", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetValidatorSet(ctx context.Context, in *GetValidatorSetParam, opts ...grpc.CallOption) (*ValidatorSet, error) { + out := new(ValidatorSet) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetValidatorSet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetValidatorSetHistory(ctx context.Context, in *GetValidatorSetHistoryParam, opts ...grpc.CallOption) (*ValidatorSetHistory, error) { + out := new(ValidatorSetHistory) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetValidatorSetHistory", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetProposal(ctx context.Context, in *GetProposalParam, opts ...grpc.CallOption) (*payload.Ballot, error) { + out := new(payload.Ballot) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ListProposals(ctx context.Context, in *ListProposalsParam, opts ...grpc.CallOption) (Query_ListProposalsClient, error) { + stream, err := c.cc.NewStream(ctx, &Query_ServiceDesc.Streams[2], "/rpcquery.Query/ListProposals", opts...) + if err != nil { + return nil, err + } + x := &queryListProposalsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Query_ListProposalsClient interface { + Recv() (*ProposalResult, error) + grpc.ClientStream +} + +type queryListProposalsClient struct { + grpc.ClientStream +} + +func (x *queryListProposalsClient) Recv() (*ProposalResult, error) { + m := new(ProposalResult) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *queryClient) GetStats(ctx context.Context, in *GetStatsParam, opts ...grpc.CallOption) (*Stats, error) { + out := new(Stats) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetStats", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBlockHeader(ctx context.Context, in *GetBlockParam, opts ...grpc.CallOption) (*types.Header, error) { + out := new(types.Header) + err := c.cc.Invoke(ctx, "/rpcquery.Query/GetBlockHeader", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +// All implementations must embed UnimplementedQueryServer +// for forward compatibility +type QueryServer interface { + Status(context.Context, *StatusParam) (*rpc.ResultStatus, error) + GetAccount(context.Context, *GetAccountParam) (*acm.Account, error) + GetMetadata(context.Context, *GetMetadataParam) (*MetadataResult, error) + GetStorage(context.Context, *GetStorageParam) (*StorageValue, error) + ListAccounts(*ListAccountsParam, Query_ListAccountsServer) error + GetName(context.Context, *GetNameParam) (*names.Entry, error) + ListNames(*ListNamesParam, Query_ListNamesServer) error + // GetNetworkRegistry returns for each validator address, the list of their identified node at the current state + GetNetworkRegistry(context.Context, *GetNetworkRegistryParam) (*NetworkRegistry, error) + GetValidatorSet(context.Context, *GetValidatorSetParam) (*ValidatorSet, error) + GetValidatorSetHistory(context.Context, *GetValidatorSetHistoryParam) (*ValidatorSetHistory, error) + GetProposal(context.Context, *GetProposalParam) (*payload.Ballot, error) + ListProposals(*ListProposalsParam, Query_ListProposalsServer) error + GetStats(context.Context, *GetStatsParam) (*Stats, error) + GetBlockHeader(context.Context, *GetBlockParam) (*types.Header, error) + mustEmbedUnimplementedQueryServer() +} + +// UnimplementedQueryServer must be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (UnimplementedQueryServer) Status(context.Context, *StatusParam) (*rpc.ResultStatus, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} +func (UnimplementedQueryServer) GetAccount(context.Context, *GetAccountParam) (*acm.Account, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccount not implemented") +} +func (UnimplementedQueryServer) GetMetadata(context.Context, *GetMetadataParam) (*MetadataResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") +} +func (UnimplementedQueryServer) GetStorage(context.Context, *GetStorageParam) (*StorageValue, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStorage not implemented") +} +func (UnimplementedQueryServer) ListAccounts(*ListAccountsParam, Query_ListAccountsServer) error { + return status.Errorf(codes.Unimplemented, "method ListAccounts not implemented") +} +func (UnimplementedQueryServer) GetName(context.Context, *GetNameParam) (*names.Entry, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetName not implemented") +} +func (UnimplementedQueryServer) ListNames(*ListNamesParam, Query_ListNamesServer) error { + return status.Errorf(codes.Unimplemented, "method ListNames not implemented") +} +func (UnimplementedQueryServer) GetNetworkRegistry(context.Context, *GetNetworkRegistryParam) (*NetworkRegistry, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNetworkRegistry not implemented") +} +func (UnimplementedQueryServer) GetValidatorSet(context.Context, *GetValidatorSetParam) (*ValidatorSet, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetValidatorSet not implemented") +} +func (UnimplementedQueryServer) GetValidatorSetHistory(context.Context, *GetValidatorSetHistoryParam) (*ValidatorSetHistory, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetValidatorSetHistory not implemented") +} +func (UnimplementedQueryServer) GetProposal(context.Context, *GetProposalParam) (*payload.Ballot, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProposal not implemented") +} +func (UnimplementedQueryServer) ListProposals(*ListProposalsParam, Query_ListProposalsServer) error { + return status.Errorf(codes.Unimplemented, "method ListProposals not implemented") +} +func (UnimplementedQueryServer) GetStats(context.Context, *GetStatsParam) (*Stats, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStats not implemented") +} +func (UnimplementedQueryServer) GetBlockHeader(context.Context, *GetBlockParam) (*types.Header, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeader not implemented") +} +func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} + +// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to QueryServer will +// result in compilation errors. +type UnsafeQueryServer interface { + mustEmbedUnimplementedQueryServer() +} + +func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { + s.RegisterService(&Query_ServiceDesc, srv) +} + +func _Query_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/Status", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Status(ctx, req.(*StatusParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAccountParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAccount(ctx, req.(*GetAccountParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMetadataParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetMetadata", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetMetadata(ctx, req.(*GetMetadataParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStorageParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetStorage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetStorage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetStorage(ctx, req.(*GetStorageParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ListAccounts_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListAccountsParam) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(QueryServer).ListAccounts(m, &queryListAccountsServer{stream}) +} + +type Query_ListAccountsServer interface { + Send(*acm.Account) error + grpc.ServerStream +} + +type queryListAccountsServer struct { + grpc.ServerStream +} + +func (x *queryListAccountsServer) Send(m *acm.Account) error { + return x.ServerStream.SendMsg(m) +} + +func _Query_GetName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNameParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetName(ctx, req.(*GetNameParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ListNames_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListNamesParam) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(QueryServer).ListNames(m, &queryListNamesServer{stream}) +} + +type Query_ListNamesServer interface { + Send(*names.Entry) error + grpc.ServerStream +} + +type queryListNamesServer struct { + grpc.ServerStream +} + +func (x *queryListNamesServer) Send(m *names.Entry) error { + return x.ServerStream.SendMsg(m) +} + +func _Query_GetNetworkRegistry_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNetworkRegistryParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetNetworkRegistry(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetNetworkRegistry", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetNetworkRegistry(ctx, req.(*GetNetworkRegistryParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetValidatorSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetValidatorSetParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetValidatorSet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetValidatorSet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetValidatorSet(ctx, req.(*GetValidatorSetParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetValidatorSetHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetValidatorSetHistoryParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetValidatorSetHistory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetValidatorSetHistory", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetValidatorSetHistory(ctx, req.(*GetValidatorSetHistoryParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProposalParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetProposal(ctx, req.(*GetProposalParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ListProposals_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListProposalsParam) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(QueryServer).ListProposals(m, &queryListProposalsServer{stream}) +} + +type Query_ListProposalsServer interface { + Send(*ProposalResult) error + grpc.ServerStream +} + +type queryListProposalsServer struct { + grpc.ServerStream +} + +func (x *queryListProposalsServer) Send(m *ProposalResult) error { + return x.ServerStream.SendMsg(m) +} + +func _Query_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStatsParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetStats(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetStats", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetStats(ctx, req.(*GetStatsParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBlockHeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBlockParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBlockHeader(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpcquery.Query/GetBlockHeader", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBlockHeader(ctx, req.(*GetBlockParam)) + } + return interceptor(ctx, in, info, handler) +} + +// Query_ServiceDesc is the grpc.ServiceDesc for Query service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Query_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "rpcquery.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Status", + Handler: _Query_Status_Handler, + }, + { + MethodName: "GetAccount", + Handler: _Query_GetAccount_Handler, + }, + { + MethodName: "GetMetadata", + Handler: _Query_GetMetadata_Handler, + }, + { + MethodName: "GetStorage", + Handler: _Query_GetStorage_Handler, + }, + { + MethodName: "GetName", + Handler: _Query_GetName_Handler, + }, + { + MethodName: "GetNetworkRegistry", + Handler: _Query_GetNetworkRegistry_Handler, + }, + { + MethodName: "GetValidatorSet", + Handler: _Query_GetValidatorSet_Handler, + }, + { + MethodName: "GetValidatorSetHistory", + Handler: _Query_GetValidatorSetHistory_Handler, + }, + { + MethodName: "GetProposal", + Handler: _Query_GetProposal_Handler, + }, + { + MethodName: "GetStats", + Handler: _Query_GetStats_Handler, + }, + { + MethodName: "GetBlockHeader", + Handler: _Query_GetBlockHeader_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListAccounts", + Handler: _Query_ListAccounts_Handler, + ServerStreams: true, + }, + { + StreamName: "ListNames", + Handler: _Query_ListNames_Handler, + ServerStreams: true, + }, + { + StreamName: "ListProposals", + Handler: _Query_ListProposals_Handler, + ServerStreams: true, + }, + }, + Metadata: "rpcquery.proto", +} diff --git a/rpc/rpctransact/rpctransact.pb.go b/rpc/rpctransact/rpctransact.pb.go index ea6523360..40d3a1aed 100644 --- a/rpc/rpctransact/rpctransact.pb.go +++ b/rpc/rpctransact/rpctransact.pb.go @@ -4,10 +4,10 @@ package rpctransact import ( - context "context" fmt "fmt" io "io" math "math" + math_bits "math/bits" time "time" _ "github.com/gogo/protobuf/gogoproto" @@ -16,11 +16,10 @@ import ( golang_proto "github.com/golang/protobuf/proto" _ "github.com/golang/protobuf/ptypes/duration" github_com_hyperledger_burrow_crypto "github.com/hyperledger/burrow/crypto" - exec "github.com/hyperledger/burrow/execution/exec" + _ "github.com/hyperledger/burrow/execution/exec" + _ "github.com/hyperledger/burrow/txs" github_com_hyperledger_burrow_txs "github.com/hyperledger/burrow/txs" - txs "github.com/hyperledger/burrow/txs" payload "github.com/hyperledger/burrow/txs/payload" - grpc "google.golang.org/grpc" ) // Reference imports to suppress errors if they are not otherwise used. @@ -34,7 +33,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 CallCodeParam struct { FromAddress github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=FromAddress,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"FromAddress"` @@ -55,16 +54,12 @@ func (m *CallCodeParam) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *CallCodeParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CallCodeParam.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *CallCodeParam) XXX_Merge(src proto.Message) { xxx_messageInfo_CallCodeParam.Merge(m, src) @@ -113,16 +108,12 @@ func (m *TxEnvelope) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *TxEnvelope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxEnvelope.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *TxEnvelope) XXX_Merge(src proto.Message) { xxx_messageInfo_TxEnvelope.Merge(m, src) @@ -164,16 +155,12 @@ func (m *TxEnvelopeParam) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *TxEnvelopeParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxEnvelopeParam.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *TxEnvelopeParam) XXX_Merge(src proto.Message) { xxx_messageInfo_TxEnvelopeParam.Merge(m, src) @@ -217,511 +204,48 @@ func init() { proto.RegisterFile("rpctransact.proto", fileDescriptor_039da6ebb58 func init() { golang_proto.RegisterFile("rpctransact.proto", fileDescriptor_039da6ebb58a8dc9) } var fileDescriptor_039da6ebb58a8dc9 = []byte{ - // 555 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xc5, 0x7c, 0xf4, 0x63, 0xdc, 0x2a, 0x74, 0x2f, 0x84, 0x08, 0x39, 0x28, 0x07, 0x84, 0x50, - 0xbb, 0x8e, 0x42, 0x8f, 0x7c, 0x28, 0x4e, 0xdb, 0x23, 0xaa, 0x1c, 0x0b, 0x09, 0x6e, 0x1b, 0x7b, - 0x71, 0x2d, 0xd9, 0x5e, 0x6b, 0xbd, 0x06, 0xe7, 0x57, 0x70, 0xe1, 0xc0, 0xcf, 0xe1, 0x98, 0x23, - 0x12, 0xb7, 0x1e, 0x02, 0x4a, 0xff, 0x08, 0xf2, 0xae, 0xdd, 0xda, 0x49, 0xd3, 0x72, 0xe1, 0x36, - 0xfb, 0x66, 0xdf, 0xdb, 0x79, 0x33, 0xb3, 0xb0, 0xc7, 0x13, 0x57, 0x70, 0x12, 0xa7, 0xc4, 0x15, - 0x38, 0xe1, 0x4c, 0x30, 0xa4, 0xd7, 0xa0, 0xce, 0x81, 0x1f, 0x88, 0xb3, 0x6c, 0x82, 0x5d, 0x16, - 0x99, 0x3e, 0xf3, 0x99, 0x29, 0xef, 0x4c, 0xb2, 0x4f, 0xf2, 0x24, 0x0f, 0x32, 0x52, 0xdc, 0x8e, - 0xe1, 0x33, 0xe6, 0x87, 0xf4, 0xea, 0x96, 0x97, 0x71, 0x22, 0x02, 0x16, 0x97, 0x79, 0xa0, 0x39, - 0x75, 0xcb, 0x78, 0x37, 0x21, 0xd3, 0x90, 0x11, 0xaf, 0x3c, 0x6e, 0x8b, 0x3c, 0x55, 0x61, 0xef, - 0xab, 0x06, 0xbb, 0x23, 0x12, 0x86, 0x23, 0xe6, 0xd1, 0x53, 0xc2, 0x49, 0x84, 0xde, 0x83, 0x7e, - 0xc2, 0x59, 0x34, 0xf4, 0x3c, 0x4e, 0xd3, 0xb4, 0xad, 0x3d, 0xd5, 0x9e, 0xef, 0x58, 0x87, 0xb3, - 0x79, 0xf7, 0xce, 0xf9, 0xbc, 0xbb, 0x5f, 0xab, 0xf1, 0x6c, 0x9a, 0x50, 0x1e, 0x52, 0xcf, 0xa7, - 0xdc, 0x9c, 0x64, 0x9c, 0xb3, 0x2f, 0xa6, 0xcb, 0xa7, 0x89, 0x60, 0xb8, 0xe4, 0xda, 0x75, 0x21, - 0x84, 0xe0, 0x7e, 0xf1, 0x48, 0xfb, 0x6e, 0x21, 0x68, 0xcb, 0xb8, 0xc0, 0x8e, 0x88, 0x20, 0xed, - 0x7b, 0x0a, 0x2b, 0xe2, 0x9e, 0x0f, 0xe0, 0xe4, 0xc7, 0xf1, 0x67, 0x1a, 0xb2, 0x84, 0xa2, 0x0f, - 0xb0, 0x55, 0xc5, 0xb2, 0x14, 0x7d, 0xb0, 0x8b, 0x8b, 0xea, 0x2b, 0xd0, 0xc2, 0xe7, 0xf3, 0xee, - 0x8b, 0x9b, 0xab, 0xaa, 0xdf, 0xb7, 0x2f, 0xe5, 0x7a, 0xbf, 0x34, 0x68, 0x5d, 0xbd, 0xa4, 0xcc, - 0xff, 0xbf, 0xe7, 0xd0, 0x33, 0xd8, 0x3c, 0x55, 0x53, 0x90, 0x2d, 0xd0, 0x07, 0x3b, 0xb8, 0x9a, - 0xca, 0x30, 0x9e, 0xda, 0x55, 0x12, 0xbd, 0x86, 0x4d, 0x27, 0x88, 0x28, 0xcb, 0x84, 0x6c, 0x8b, - 0x3e, 0x78, 0x8c, 0xd5, 0xa4, 0x71, 0x35, 0x69, 0x7c, 0x54, 0x4e, 0xda, 0xda, 0x2a, 0xc6, 0xf2, - 0xfd, 0x77, 0x57, 0xb3, 0x2b, 0xce, 0xe0, 0xdb, 0x03, 0xd8, 0x72, 0xca, 0x95, 0x42, 0x16, 0xb4, - 0x2c, 0xce, 0x88, 0xe7, 0x92, 0x54, 0x38, 0xf9, 0x78, 0x1a, 0xbb, 0xe8, 0x09, 0xae, 0xaf, 0xe1, - 0x92, 0xff, 0xce, 0x1e, 0x96, 0x5b, 0xe3, 0xe4, 0xc7, 0x39, 0x75, 0xb3, 0xe2, 0x0d, 0xf4, 0x06, - 0x1e, 0xd6, 0x34, 0x86, 0xe9, 0xed, 0x22, 0x3b, 0xb2, 0x65, 0x36, 0x75, 0x69, 0x90, 0x08, 0xf4, - 0x16, 0x36, 0xc6, 0x81, 0x1f, 0x3b, 0xf9, 0x2d, 0xac, 0x47, 0x6b, 0xb2, 0xe8, 0x10, 0xf4, 0x13, - 0xc6, 0xa3, 0x2c, 0x24, 0x82, 0x3a, 0x39, 0x6a, 0xb4, 0x6d, 0x3d, 0xab, 0x0f, 0x50, 0xec, 0x75, - 0xe9, 0xba, 0x75, 0x49, 0x52, 0xe0, 0x75, 0x46, 0xf7, 0x41, 0x57, 0x49, 0xe5, 0x71, 0x85, 0xd2, - 0xb4, 0x65, 0xc2, 0x76, 0xa9, 0x1f, 0x44, 0xff, 0x24, 0xff, 0x4a, 0xc9, 0x17, 0x7b, 0x5f, 0x50, - 0x3a, 0x8d, 0xc2, 0x1b, 0x5f, 0xf0, 0x3a, 0x76, 0x1f, 0x60, 0x4c, 0x63, 0x6f, 0xc5, 0x8e, 0x02, - 0xd7, 0xd8, 0x51, 0xc9, 0x65, 0x3b, 0x25, 0xa5, 0x69, 0xa7, 0x0f, 0xf0, 0x8e, 0x44, 0x74, 0x45, - 0x5f, 0x81, 0x6b, 0xf4, 0x55, 0x72, 0x59, 0xbf, 0xa4, 0x34, 0xf4, 0xad, 0xd1, 0x6c, 0x61, 0x68, - 0x3f, 0x17, 0x86, 0xf6, 0x67, 0x61, 0x68, 0x3f, 0x2e, 0x0c, 0x6d, 0x76, 0x61, 0x68, 0x1f, 0x0f, - 0x6e, 0xfe, 0x49, 0x3c, 0x71, 0xcd, 0x5a, 0x97, 0x26, 0x1b, 0xf2, 0x07, 0xbc, 0xfc, 0x1b, 0x00, - 0x00, 0xff, 0xff, 0x70, 0x12, 0x34, 0xbe, 0x4a, 0x05, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// TransactClient is the client API for Transact service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type TransactClient interface { - // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side - // and wait for it to be included in block - BroadcastTxSync(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*exec.TxExecution, error) - // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side - BroadcastTxAsync(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*txs.Receipt, error) - // Sign transaction server-side - SignTx(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*TxEnvelope, error) - // Formulate a transaction from a Payload and retrun the envelop with the Tx bytes ready to sign - FormulateTx(ctx context.Context, in *payload.Any, opts ...grpc.CallOption) (*TxEnvelope, error) - // Formulate and sign a CallTx transaction signed server-side and wait for it to be included in a block, retrieving response - CallTxSync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) - // Formulate and sign a CallTx transaction signed server-side - CallTxAsync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*txs.Receipt, error) - // Perform a 'simulated' call of a contract against the current committed EVM state without any changes been saved - // and wait for the transaction to be included in a block - CallTxSim(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) - // Perform a 'simulated' execution of provided code against the current committed EVM state without any changes been saved - CallCodeSim(ctx context.Context, in *CallCodeParam, opts ...grpc.CallOption) (*exec.TxExecution, error) - // Formulate a SendTx transaction signed server-side and wait for it to be included in a block, retrieving response - SendTxSync(ctx context.Context, in *payload.SendTx, opts ...grpc.CallOption) (*exec.TxExecution, error) - // Formulate and SendTx transaction signed server-side - SendTxAsync(ctx context.Context, in *payload.SendTx, opts ...grpc.CallOption) (*txs.Receipt, error) - // Formualte a NameTx signed server-side and wait for it to be included in a block returning the registered name - NameTxSync(ctx context.Context, in *payload.NameTx, opts ...grpc.CallOption) (*exec.TxExecution, error) - // Formulate a NameTx signed server-side - NameTxAsync(ctx context.Context, in *payload.NameTx, opts ...grpc.CallOption) (*txs.Receipt, error) -} - -type transactClient struct { - cc *grpc.ClientConn -} - -func NewTransactClient(cc *grpc.ClientConn) TransactClient { - return &transactClient{cc} -} - -func (c *transactClient) BroadcastTxSync(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*exec.TxExecution, error) { - out := new(exec.TxExecution) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/BroadcastTxSync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) BroadcastTxAsync(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*txs.Receipt, error) { - out := new(txs.Receipt) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/BroadcastTxAsync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) SignTx(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*TxEnvelope, error) { - out := new(TxEnvelope) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/SignTx", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) FormulateTx(ctx context.Context, in *payload.Any, opts ...grpc.CallOption) (*TxEnvelope, error) { - out := new(TxEnvelope) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/FormulateTx", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) CallTxSync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) { - out := new(exec.TxExecution) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/CallTxSync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) CallTxAsync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*txs.Receipt, error) { - out := new(txs.Receipt) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/CallTxAsync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) CallTxSim(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) { - out := new(exec.TxExecution) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/CallTxSim", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) CallCodeSim(ctx context.Context, in *CallCodeParam, opts ...grpc.CallOption) (*exec.TxExecution, error) { - out := new(exec.TxExecution) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/CallCodeSim", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) SendTxSync(ctx context.Context, in *payload.SendTx, opts ...grpc.CallOption) (*exec.TxExecution, error) { - out := new(exec.TxExecution) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/SendTxSync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) SendTxAsync(ctx context.Context, in *payload.SendTx, opts ...grpc.CallOption) (*txs.Receipt, error) { - out := new(txs.Receipt) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/SendTxAsync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) NameTxSync(ctx context.Context, in *payload.NameTx, opts ...grpc.CallOption) (*exec.TxExecution, error) { - out := new(exec.TxExecution) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/NameTxSync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *transactClient) NameTxAsync(ctx context.Context, in *payload.NameTx, opts ...grpc.CallOption) (*txs.Receipt, error) { - out := new(txs.Receipt) - err := c.cc.Invoke(ctx, "/rpctransact.Transact/NameTxAsync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// TransactServer is the server API for Transact service. -type TransactServer interface { - // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side - // and wait for it to be included in block - BroadcastTxSync(context.Context, *TxEnvelopeParam) (*exec.TxExecution, error) - // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side - BroadcastTxAsync(context.Context, *TxEnvelopeParam) (*txs.Receipt, error) - // Sign transaction server-side - SignTx(context.Context, *TxEnvelopeParam) (*TxEnvelope, error) - // Formulate a transaction from a Payload and retrun the envelop with the Tx bytes ready to sign - FormulateTx(context.Context, *payload.Any) (*TxEnvelope, error) - // Formulate and sign a CallTx transaction signed server-side and wait for it to be included in a block, retrieving response - CallTxSync(context.Context, *payload.CallTx) (*exec.TxExecution, error) - // Formulate and sign a CallTx transaction signed server-side - CallTxAsync(context.Context, *payload.CallTx) (*txs.Receipt, error) - // Perform a 'simulated' call of a contract against the current committed EVM state without any changes been saved - // and wait for the transaction to be included in a block - CallTxSim(context.Context, *payload.CallTx) (*exec.TxExecution, error) - // Perform a 'simulated' execution of provided code against the current committed EVM state without any changes been saved - CallCodeSim(context.Context, *CallCodeParam) (*exec.TxExecution, error) - // Formulate a SendTx transaction signed server-side and wait for it to be included in a block, retrieving response - SendTxSync(context.Context, *payload.SendTx) (*exec.TxExecution, error) - // Formulate and SendTx transaction signed server-side - SendTxAsync(context.Context, *payload.SendTx) (*txs.Receipt, error) - // Formualte a NameTx signed server-side and wait for it to be included in a block returning the registered name - NameTxSync(context.Context, *payload.NameTx) (*exec.TxExecution, error) - // Formulate a NameTx signed server-side - NameTxAsync(context.Context, *payload.NameTx) (*txs.Receipt, error) -} - -func RegisterTransactServer(s *grpc.Server, srv TransactServer) { - s.RegisterService(&_Transact_serviceDesc, srv) -} - -func _Transact_BroadcastTxSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TxEnvelopeParam) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).BroadcastTxSync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/BroadcastTxSync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).BroadcastTxSync(ctx, req.(*TxEnvelopeParam)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_BroadcastTxAsync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TxEnvelopeParam) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).BroadcastTxAsync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/BroadcastTxAsync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).BroadcastTxAsync(ctx, req.(*TxEnvelopeParam)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_SignTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TxEnvelopeParam) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).SignTx(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/SignTx", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).SignTx(ctx, req.(*TxEnvelopeParam)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_FormulateTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.Any) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).FormulateTx(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/FormulateTx", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).FormulateTx(ctx, req.(*payload.Any)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_CallTxSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.CallTx) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).CallTxSync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/CallTxSync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).CallTxSync(ctx, req.(*payload.CallTx)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_CallTxAsync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.CallTx) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).CallTxAsync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/CallTxAsync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).CallTxAsync(ctx, req.(*payload.CallTx)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_CallTxSim_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.CallTx) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).CallTxSim(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/CallTxSim", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).CallTxSim(ctx, req.(*payload.CallTx)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_CallCodeSim_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CallCodeParam) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).CallCodeSim(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/CallCodeSim", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).CallCodeSim(ctx, req.(*CallCodeParam)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_SendTxSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.SendTx) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).SendTxSync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/SendTxSync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).SendTxSync(ctx, req.(*payload.SendTx)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_SendTxAsync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.SendTx) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).SendTxAsync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/SendTxAsync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).SendTxAsync(ctx, req.(*payload.SendTx)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_NameTxSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.NameTx) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).NameTxSync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/NameTxSync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).NameTxSync(ctx, req.(*payload.NameTx)) - } - return interceptor(ctx, in, info, handler) -} - -func _Transact_NameTxAsync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(payload.NameTx) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TransactServer).NameTxAsync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rpctransact.Transact/NameTxAsync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TransactServer).NameTxAsync(ctx, req.(*payload.NameTx)) - } - return interceptor(ctx, in, info, handler) -} - -var _Transact_serviceDesc = grpc.ServiceDesc{ - ServiceName: "rpctransact.Transact", - HandlerType: (*TransactServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "BroadcastTxSync", - Handler: _Transact_BroadcastTxSync_Handler, - }, - { - MethodName: "BroadcastTxAsync", - Handler: _Transact_BroadcastTxAsync_Handler, - }, - { - MethodName: "SignTx", - Handler: _Transact_SignTx_Handler, - }, - { - MethodName: "FormulateTx", - Handler: _Transact_FormulateTx_Handler, - }, - { - MethodName: "CallTxSync", - Handler: _Transact_CallTxSync_Handler, - }, - { - MethodName: "CallTxAsync", - Handler: _Transact_CallTxAsync_Handler, - }, - { - MethodName: "CallTxSim", - Handler: _Transact_CallTxSim_Handler, - }, - { - MethodName: "CallCodeSim", - Handler: _Transact_CallCodeSim_Handler, - }, - { - MethodName: "SendTxSync", - Handler: _Transact_SendTxSync_Handler, - }, - { - MethodName: "SendTxAsync", - Handler: _Transact_SendTxAsync_Handler, - }, - { - MethodName: "NameTxSync", - Handler: _Transact_NameTxSync_Handler, - }, - { - MethodName: "NameTxAsync", - Handler: _Transact_NameTxAsync_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "rpctransact.proto", + // 557 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0x7e, 0xfd, 0x02, 0xfd, 0x18, 0x37, 0x0a, 0x5d, 0x21, 0x11, 0x22, 0xe4, 0xa0, 0x1c, 0x10, + 0x42, 0x65, 0x1d, 0x85, 0x1e, 0xf9, 0x50, 0xdc, 0x0f, 0x6e, 0xa8, 0x72, 0x2c, 0x24, 0xb8, 0x6d, + 0xec, 0xc5, 0xb5, 0x64, 0x7b, 0xad, 0xf5, 0x1a, 0x9c, 0x5f, 0xc1, 0x85, 0x03, 0x3f, 0x87, 0x63, + 0x8e, 0x48, 0x5c, 0x50, 0x0f, 0x01, 0xa5, 0x7f, 0x04, 0xad, 0xd7, 0x2e, 0x76, 0xd2, 0xb4, 0x5c, + 0xb8, 0x8d, 0x9f, 0xf1, 0xf3, 0xcc, 0x3c, 0x33, 0xb3, 0xb0, 0xcb, 0x13, 0x57, 0x70, 0x12, 0xa7, + 0xc4, 0x15, 0x38, 0xe1, 0x4c, 0x30, 0xa4, 0xd7, 0xa0, 0xee, 0x1d, 0x9f, 0xf9, 0xac, 0xc0, 0x4d, + 0x19, 0xa9, 0x5f, 0xba, 0x86, 0xcf, 0x98, 0x1f, 0x52, 0xb3, 0xf8, 0x9a, 0x64, 0xef, 0x4d, 0x2f, + 0xe3, 0x44, 0x04, 0x2c, 0x2e, 0xf3, 0x40, 0x73, 0xea, 0x96, 0x71, 0x2b, 0x21, 0xd3, 0x90, 0x11, + 0xaf, 0xfc, 0xdc, 0x16, 0x79, 0xaa, 0xc2, 0xfe, 0x27, 0x0d, 0x5a, 0x07, 0x24, 0x0c, 0x0f, 0x98, + 0x47, 0x4f, 0x08, 0x27, 0x11, 0x7a, 0x03, 0xfa, 0x31, 0x67, 0xd1, 0xc8, 0xf3, 0x38, 0x4d, 0xd3, + 0x8e, 0xf6, 0x40, 0x7b, 0xb4, 0x63, 0xed, 0xcf, 0xe6, 0xbd, 0xff, 0xce, 0xe6, 0xbd, 0x3d, 0x3f, + 0x10, 0xa7, 0xd9, 0x04, 0xbb, 0x2c, 0x32, 0x4f, 0xa7, 0x09, 0xe5, 0x21, 0xf5, 0x7c, 0xca, 0xcd, + 0x49, 0xc6, 0x39, 0xfb, 0x68, 0xba, 0x7c, 0x9a, 0x08, 0x86, 0x4b, 0xae, 0x5d, 0x17, 0x42, 0x08, + 0x6e, 0xca, 0x22, 0x9d, 0xff, 0xa5, 0xa0, 0x5d, 0xc4, 0x12, 0x3b, 0x24, 0x82, 0x74, 0x6e, 0x28, + 0x4c, 0xc6, 0x7d, 0x1f, 0xc0, 0xc9, 0x8f, 0xe2, 0x0f, 0x34, 0x64, 0x09, 0x45, 0x6f, 0x61, 0xab, + 0x8a, 0x8b, 0x56, 0xf4, 0x61, 0x0b, 0xcb, 0xee, 0x2b, 0xd0, 0xc2, 0x67, 0xf3, 0xde, 0xe3, 0xab, + 0xbb, 0xaa, 0xff, 0x6f, 0x5f, 0xc8, 0xf5, 0xbf, 0x6b, 0xd0, 0xfe, 0x53, 0x49, 0x99, 0xff, 0x77, + 0xe5, 0xd0, 0x43, 0xd8, 0x3c, 0x51, 0x5b, 0x28, 0x46, 0xa0, 0x0f, 0x77, 0x70, 0xb5, 0x95, 0x51, + 0x3c, 0xb5, 0xab, 0x24, 0x7a, 0x0e, 0x9b, 0x4e, 0x10, 0x51, 0x96, 0x89, 0x62, 0x2c, 0xfa, 0xf0, + 0x1e, 0x56, 0x9b, 0xc6, 0xd5, 0xa6, 0xf1, 0x61, 0xb9, 0x69, 0x6b, 0x4b, 0xae, 0xe5, 0xcb, 0xcf, + 0x9e, 0x66, 0x57, 0x9c, 0xe1, 0xe7, 0x5b, 0xb0, 0xe5, 0x94, 0x97, 0x83, 0x2c, 0x68, 0x5b, 0x9c, + 0x11, 0xcf, 0x25, 0xa9, 0x70, 0xf2, 0xf1, 0x34, 0x76, 0xd1, 0x7d, 0x5c, 0xbf, 0xb6, 0x25, 0xff, + 0xdd, 0x5d, 0x5c, 0x5c, 0x8d, 0x93, 0x1f, 0xe5, 0xd4, 0xcd, 0x64, 0x0d, 0xf4, 0x02, 0x6e, 0xd7, + 0x34, 0x46, 0xe9, 0xf5, 0x22, 0x3b, 0xc5, 0xc8, 0x6c, 0xea, 0xd2, 0x20, 0x11, 0xe8, 0x25, 0x6c, + 0x8c, 0x03, 0x3f, 0x76, 0xf2, 0x6b, 0x58, 0x77, 0xd7, 0x64, 0xd1, 0x3e, 0xe8, 0xc7, 0x8c, 0x47, + 0x59, 0x48, 0x04, 0x75, 0x72, 0xd4, 0x18, 0xdb, 0x7a, 0xd6, 0x00, 0x40, 0xde, 0x75, 0xe9, 0xba, + 0x7d, 0x41, 0x52, 0xe0, 0x65, 0x46, 0xf7, 0x40, 0x57, 0x49, 0xe5, 0x71, 0x85, 0xd2, 0xb4, 0x65, + 0xc2, 0x76, 0xa9, 0x1f, 0x44, 0x7f, 0x25, 0xff, 0x4c, 0xc9, 0xcb, 0xbb, 0x97, 0x94, 0x6e, 0xa3, + 0xf1, 0xc6, 0x13, 0xbc, 0x8c, 0x3d, 0x00, 0x18, 0xd3, 0xd8, 0x5b, 0xb1, 0xa3, 0xc0, 0x35, 0x76, + 0x54, 0x72, 0xd9, 0x4e, 0x49, 0x69, 0xda, 0x19, 0x00, 0xbc, 0x26, 0x11, 0x5d, 0xd1, 0x57, 0xe0, + 0x1a, 0x7d, 0x95, 0x5c, 0xd6, 0x2f, 0x29, 0x0d, 0x7d, 0xeb, 0xd5, 0x6c, 0x61, 0x68, 0xdf, 0x16, + 0x86, 0xf6, 0x63, 0x61, 0x68, 0xbf, 0x16, 0x86, 0xf6, 0xf5, 0xdc, 0xd0, 0x66, 0xe7, 0x86, 0xf6, + 0xee, 0xc9, 0xd5, 0xaf, 0x89, 0x27, 0xae, 0x59, 0x9b, 0xd4, 0x64, 0xa3, 0x78, 0x05, 0x4f, 0x7f, + 0x07, 0x00, 0x00, 0xff, 0xff, 0x69, 0x8d, 0x35, 0xa5, 0x35, 0x05, 0x00, 0x00, } func (m *CallCodeParam) 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 } @@ -729,40 +253,50 @@ func (m *CallCodeParam) Marshal() (dAtA []byte, err error) { } func (m *CallCodeParam) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CallCodeParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRpctransact(dAtA, i, uint64(m.FromAddress.Size())) - n1, err := m.FromAddress.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - if len(m.Code) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpctransact(dAtA, i, uint64(len(m.Code))) - i += copy(dAtA[i:], m.Code) + 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 = encodeVarintRpctransact(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.Code) > 0 { + i -= len(m.Code) + copy(dAtA[i:], m.Code) + i = encodeVarintRpctransact(dAtA, i, uint64(len(m.Code))) + i-- + dAtA[i] = 0x12 + } + { + size := m.FromAddress.Size() + i -= size + if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpctransact(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *TxEnvelope) 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 } @@ -770,30 +304,38 @@ func (m *TxEnvelope) Marshal() (dAtA []byte, err error) { } func (m *TxEnvelope) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxEnvelope) 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 m.Envelope != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpctransact(dAtA, i, uint64(m.Envelope.Size())) - n2, err := m.Envelope.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Envelope.Size() + i -= size + if _, err := m.Envelope.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpctransact(dAtA, i, uint64(size)) } - i += n2 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *TxEnvelopeParam) 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 } @@ -801,52 +343,64 @@ func (m *TxEnvelopeParam) Marshal() (dAtA []byte, err error) { } func (m *TxEnvelopeParam) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxEnvelopeParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Envelope != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpctransact(dAtA, i, uint64(m.Envelope.Size())) - n3, err := m.Envelope.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.Payload != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpctransact(dAtA, i, uint64(m.Payload.Size())) - n4, err := m.Payload.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 + n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Timeout, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Timeout):]) + if err2 != nil { + return 0, err2 } + i -= n2 + i = encodeVarintRpctransact(dAtA, i, uint64(n2)) + i-- dAtA[i] = 0x1a - i++ - i = encodeVarintRpctransact(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.Timeout))) - n5, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Timeout, dAtA[i:]) - if err != nil { - return 0, err + if m.Payload != nil { + { + size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpctransact(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - i += n5 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Envelope != nil { + { + size := m.Envelope.Size() + i -= size + if _, err := m.Envelope.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRpctransact(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintRpctransact(dAtA []byte, offset int, v uint64) int { + offset -= sovRpctransact(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 (m *CallCodeParam) Size() (n int) { if m == nil { @@ -909,14 +463,7 @@ func (m *TxEnvelopeParam) Size() (n int) { } func sovRpctransact(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRpctransact(x uint64) (n int) { return sovRpctransact(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -1057,10 +604,7 @@ func (m *CallCodeParam) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpctransact - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpctransact } if (iNdEx + skippy) > l { @@ -1147,10 +691,7 @@ func (m *TxEnvelope) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpctransact - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpctransact } if (iNdEx + skippy) > l { @@ -1306,10 +847,7 @@ func (m *TxEnvelopeParam) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthRpctransact - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRpctransact } if (iNdEx + skippy) > l { @@ -1328,6 +866,7 @@ func (m *TxEnvelopeParam) Unmarshal(dAtA []byte) error { func skipRpctransact(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1359,10 +898,8 @@ func skipRpctransact(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1383,55 +920,30 @@ func skipRpctransact(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthRpctransact } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthRpctransact - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpctransact - } - 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 := skipRpctransact(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthRpctransact - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRpctransact + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthRpctransact + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthRpctransact = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRpctransact = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthRpctransact = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRpctransact = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRpctransact = fmt.Errorf("proto: unexpected end of group") ) diff --git a/rpc/rpctransact/rpctransact_grpc.pb.go b/rpc/rpctransact/rpctransact_grpc.pb.go new file mode 100644 index 000000000..124ee37c0 --- /dev/null +++ b/rpc/rpctransact/rpctransact_grpc.pb.go @@ -0,0 +1,529 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package rpctransact + +import ( + context "context" + + exec "github.com/hyperledger/burrow/execution/exec" + txs "github.com/hyperledger/burrow/txs" + payload "github.com/hyperledger/burrow/txs/payload" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// TransactClient is the client API for Transact service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TransactClient interface { + // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side + // and wait for it to be included in block + BroadcastTxSync(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*exec.TxExecution, error) + // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side + BroadcastTxAsync(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*txs.Receipt, error) + // Sign transaction server-side + SignTx(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*TxEnvelope, error) + // Formulate a transaction from a Payload and retrun the envelop with the Tx bytes ready to sign + FormulateTx(ctx context.Context, in *payload.Any, opts ...grpc.CallOption) (*TxEnvelope, error) + // Formulate and sign a CallTx transaction signed server-side and wait for it to be included in a block, retrieving response + CallTxSync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) + // Formulate and sign a CallTx transaction signed server-side + CallTxAsync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*txs.Receipt, error) + // Perform a 'simulated' call of a contract against the current committed EVM state without any changes been saved + // and wait for the transaction to be included in a block + CallTxSim(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) + // Perform a 'simulated' execution of provided code against the current committed EVM state without any changes been saved + CallCodeSim(ctx context.Context, in *CallCodeParam, opts ...grpc.CallOption) (*exec.TxExecution, error) + // Formulate a SendTx transaction signed server-side and wait for it to be included in a block, retrieving response + SendTxSync(ctx context.Context, in *payload.SendTx, opts ...grpc.CallOption) (*exec.TxExecution, error) + // Formulate and SendTx transaction signed server-side + SendTxAsync(ctx context.Context, in *payload.SendTx, opts ...grpc.CallOption) (*txs.Receipt, error) + // Formulate a NameTx signed server-side and wait for it to be included in a block returning the registered name + NameTxSync(ctx context.Context, in *payload.NameTx, opts ...grpc.CallOption) (*exec.TxExecution, error) + // Formulate a NameTx signed server-side + NameTxAsync(ctx context.Context, in *payload.NameTx, opts ...grpc.CallOption) (*txs.Receipt, error) +} + +type transactClient struct { + cc grpc.ClientConnInterface +} + +func NewTransactClient(cc grpc.ClientConnInterface) TransactClient { + return &transactClient{cc} +} + +func (c *transactClient) BroadcastTxSync(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*exec.TxExecution, error) { + out := new(exec.TxExecution) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/BroadcastTxSync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) BroadcastTxAsync(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*txs.Receipt, error) { + out := new(txs.Receipt) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/BroadcastTxAsync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) SignTx(ctx context.Context, in *TxEnvelopeParam, opts ...grpc.CallOption) (*TxEnvelope, error) { + out := new(TxEnvelope) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/SignTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) FormulateTx(ctx context.Context, in *payload.Any, opts ...grpc.CallOption) (*TxEnvelope, error) { + out := new(TxEnvelope) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/FormulateTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) CallTxSync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) { + out := new(exec.TxExecution) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/CallTxSync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) CallTxAsync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*txs.Receipt, error) { + out := new(txs.Receipt) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/CallTxAsync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) CallTxSim(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) { + out := new(exec.TxExecution) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/CallTxSim", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) CallCodeSim(ctx context.Context, in *CallCodeParam, opts ...grpc.CallOption) (*exec.TxExecution, error) { + out := new(exec.TxExecution) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/CallCodeSim", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) SendTxSync(ctx context.Context, in *payload.SendTx, opts ...grpc.CallOption) (*exec.TxExecution, error) { + out := new(exec.TxExecution) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/SendTxSync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) SendTxAsync(ctx context.Context, in *payload.SendTx, opts ...grpc.CallOption) (*txs.Receipt, error) { + out := new(txs.Receipt) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/SendTxAsync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) NameTxSync(ctx context.Context, in *payload.NameTx, opts ...grpc.CallOption) (*exec.TxExecution, error) { + out := new(exec.TxExecution) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/NameTxSync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *transactClient) NameTxAsync(ctx context.Context, in *payload.NameTx, opts ...grpc.CallOption) (*txs.Receipt, error) { + out := new(txs.Receipt) + err := c.cc.Invoke(ctx, "/rpctransact.Transact/NameTxAsync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TransactServer is the server API for Transact service. +// All implementations must embed UnimplementedTransactServer +// for forward compatibility +type TransactServer interface { + // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side + // and wait for it to be included in block + BroadcastTxSync(context.Context, *TxEnvelopeParam) (*exec.TxExecution, error) + // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side + BroadcastTxAsync(context.Context, *TxEnvelopeParam) (*txs.Receipt, error) + // Sign transaction server-side + SignTx(context.Context, *TxEnvelopeParam) (*TxEnvelope, error) + // Formulate a transaction from a Payload and retrun the envelop with the Tx bytes ready to sign + FormulateTx(context.Context, *payload.Any) (*TxEnvelope, error) + // Formulate and sign a CallTx transaction signed server-side and wait for it to be included in a block, retrieving response + CallTxSync(context.Context, *payload.CallTx) (*exec.TxExecution, error) + // Formulate and sign a CallTx transaction signed server-side + CallTxAsync(context.Context, *payload.CallTx) (*txs.Receipt, error) + // Perform a 'simulated' call of a contract against the current committed EVM state without any changes been saved + // and wait for the transaction to be included in a block + CallTxSim(context.Context, *payload.CallTx) (*exec.TxExecution, error) + // Perform a 'simulated' execution of provided code against the current committed EVM state without any changes been saved + CallCodeSim(context.Context, *CallCodeParam) (*exec.TxExecution, error) + // Formulate a SendTx transaction signed server-side and wait for it to be included in a block, retrieving response + SendTxSync(context.Context, *payload.SendTx) (*exec.TxExecution, error) + // Formulate and SendTx transaction signed server-side + SendTxAsync(context.Context, *payload.SendTx) (*txs.Receipt, error) + // Formulate a NameTx signed server-side and wait for it to be included in a block returning the registered name + NameTxSync(context.Context, *payload.NameTx) (*exec.TxExecution, error) + // Formulate a NameTx signed server-side + NameTxAsync(context.Context, *payload.NameTx) (*txs.Receipt, error) + mustEmbedUnimplementedTransactServer() +} + +// UnimplementedTransactServer must be embedded to have forward compatible implementations. +type UnimplementedTransactServer struct { +} + +func (UnimplementedTransactServer) BroadcastTxSync(context.Context, *TxEnvelopeParam) (*exec.TxExecution, error) { + return nil, status.Errorf(codes.Unimplemented, "method BroadcastTxSync not implemented") +} +func (UnimplementedTransactServer) BroadcastTxAsync(context.Context, *TxEnvelopeParam) (*txs.Receipt, error) { + return nil, status.Errorf(codes.Unimplemented, "method BroadcastTxAsync not implemented") +} +func (UnimplementedTransactServer) SignTx(context.Context, *TxEnvelopeParam) (*TxEnvelope, error) { + return nil, status.Errorf(codes.Unimplemented, "method SignTx not implemented") +} +func (UnimplementedTransactServer) FormulateTx(context.Context, *payload.Any) (*TxEnvelope, error) { + return nil, status.Errorf(codes.Unimplemented, "method FormulateTx not implemented") +} +func (UnimplementedTransactServer) CallTxSync(context.Context, *payload.CallTx) (*exec.TxExecution, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallTxSync not implemented") +} +func (UnimplementedTransactServer) CallTxAsync(context.Context, *payload.CallTx) (*txs.Receipt, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallTxAsync not implemented") +} +func (UnimplementedTransactServer) CallTxSim(context.Context, *payload.CallTx) (*exec.TxExecution, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallTxSim not implemented") +} +func (UnimplementedTransactServer) CallCodeSim(context.Context, *CallCodeParam) (*exec.TxExecution, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallCodeSim not implemented") +} +func (UnimplementedTransactServer) SendTxSync(context.Context, *payload.SendTx) (*exec.TxExecution, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendTxSync not implemented") +} +func (UnimplementedTransactServer) SendTxAsync(context.Context, *payload.SendTx) (*txs.Receipt, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendTxAsync not implemented") +} +func (UnimplementedTransactServer) NameTxSync(context.Context, *payload.NameTx) (*exec.TxExecution, error) { + return nil, status.Errorf(codes.Unimplemented, "method NameTxSync not implemented") +} +func (UnimplementedTransactServer) NameTxAsync(context.Context, *payload.NameTx) (*txs.Receipt, error) { + return nil, status.Errorf(codes.Unimplemented, "method NameTxAsync not implemented") +} +func (UnimplementedTransactServer) mustEmbedUnimplementedTransactServer() {} + +// UnsafeTransactServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TransactServer will +// result in compilation errors. +type UnsafeTransactServer interface { + mustEmbedUnimplementedTransactServer() +} + +func RegisterTransactServer(s grpc.ServiceRegistrar, srv TransactServer) { + s.RegisterService(&Transact_ServiceDesc, srv) +} + +func _Transact_BroadcastTxSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxEnvelopeParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).BroadcastTxSync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/BroadcastTxSync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).BroadcastTxSync(ctx, req.(*TxEnvelopeParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_BroadcastTxAsync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxEnvelopeParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).BroadcastTxAsync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/BroadcastTxAsync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).BroadcastTxAsync(ctx, req.(*TxEnvelopeParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_SignTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxEnvelopeParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).SignTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/SignTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).SignTx(ctx, req.(*TxEnvelopeParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_FormulateTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.Any) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).FormulateTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/FormulateTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).FormulateTx(ctx, req.(*payload.Any)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_CallTxSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.CallTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).CallTxSync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/CallTxSync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).CallTxSync(ctx, req.(*payload.CallTx)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_CallTxAsync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.CallTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).CallTxAsync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/CallTxAsync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).CallTxAsync(ctx, req.(*payload.CallTx)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_CallTxSim_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.CallTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).CallTxSim(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/CallTxSim", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).CallTxSim(ctx, req.(*payload.CallTx)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_CallCodeSim_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CallCodeParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).CallCodeSim(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/CallCodeSim", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).CallCodeSim(ctx, req.(*CallCodeParam)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_SendTxSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.SendTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).SendTxSync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/SendTxSync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).SendTxSync(ctx, req.(*payload.SendTx)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_SendTxAsync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.SendTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).SendTxAsync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/SendTxAsync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).SendTxAsync(ctx, req.(*payload.SendTx)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_NameTxSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.NameTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).NameTxSync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/NameTxSync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).NameTxSync(ctx, req.(*payload.NameTx)) + } + return interceptor(ctx, in, info, handler) +} + +func _Transact_NameTxAsync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(payload.NameTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TransactServer).NameTxAsync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpctransact.Transact/NameTxAsync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TransactServer).NameTxAsync(ctx, req.(*payload.NameTx)) + } + return interceptor(ctx, in, info, handler) +} + +// Transact_ServiceDesc is the grpc.ServiceDesc for Transact service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Transact_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "rpctransact.Transact", + HandlerType: (*TransactServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "BroadcastTxSync", + Handler: _Transact_BroadcastTxSync_Handler, + }, + { + MethodName: "BroadcastTxAsync", + Handler: _Transact_BroadcastTxAsync_Handler, + }, + { + MethodName: "SignTx", + Handler: _Transact_SignTx_Handler, + }, + { + MethodName: "FormulateTx", + Handler: _Transact_FormulateTx_Handler, + }, + { + MethodName: "CallTxSync", + Handler: _Transact_CallTxSync_Handler, + }, + { + MethodName: "CallTxAsync", + Handler: _Transact_CallTxAsync_Handler, + }, + { + MethodName: "CallTxSim", + Handler: _Transact_CallTxSim_Handler, + }, + { + MethodName: "CallCodeSim", + Handler: _Transact_CallCodeSim_Handler, + }, + { + MethodName: "SendTxSync", + Handler: _Transact_SendTxSync_Handler, + }, + { + MethodName: "SendTxAsync", + Handler: _Transact_SendTxAsync_Handler, + }, + { + MethodName: "NameTxSync", + Handler: _Transact_NameTxSync_Handler, + }, + { + MethodName: "NameTxAsync", + Handler: _Transact_NameTxAsync_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rpctransact.proto", +} diff --git a/rpc/rpctransact/transact_server.go b/rpc/rpctransact/transact_server.go index 644bbf907..493edbae1 100644 --- a/rpc/rpctransact/transact_server.go +++ b/rpc/rpctransact/transact_server.go @@ -20,6 +20,7 @@ import ( const maxBroadcastSyncTimeout = time.Hour type transactServer struct { + UnimplementedTransactServer state acmstate.Reader blockchain bcm.BlockchainInfo transactor *execution.Transactor diff --git a/rpc/service.go b/rpc/service.go index 7757a6f49..8aacdf2ba 100644 --- a/rpc/service.go +++ b/rpc/service.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package rpc @@ -28,6 +17,7 @@ import ( "github.com/hyperledger/burrow/consensus/tendermint" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/names" + "github.com/hyperledger/burrow/execution/registry" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" "github.com/hyperledger/burrow/permission" @@ -47,6 +37,7 @@ const MaxBlockLookback = 1000 type Service struct { state acmstate.IterableStatsReader nameReg names.IterableReader + nodeReg registry.IterableReader blockchain bcm.BlockchainInfo validators validator.History nodeView *tendermint.NodeView @@ -55,12 +46,13 @@ type Service struct { // Service provides an internal query and information service with serialisable return types on which can accomodate // a number of transport front ends -func NewService(state acmstate.IterableStatsReader, nameReg names.IterableReader, blockchain bcm.BlockchainInfo, +func NewService(state acmstate.IterableStatsReader, nameReg names.IterableReader, nodeReg registry.IterableReader, blockchain bcm.BlockchainInfo, validators validator.History, nodeView *tendermint.NodeView, logger *logging.Logger) *Service { return &Service{ state: state, nameReg: nameReg, + nodeReg: nodeReg, blockchain: blockchain, validators: validators, nodeView: nodeView, @@ -147,6 +139,22 @@ func (s *Service) Network() (*ResultNetwork, error) { }, nil } +func (s *Service) NetworkRegistry() ([]*ResultNetworkRegistry, error) { + if s.nodeView == nil { + return nil, fmt.Errorf("cannot return network registry info because NodeView not mounted") + } + + rnr := make([]*ResultNetworkRegistry, 0) + err := s.nodeReg.IterateNodes(func(id crypto.Address, rn *registry.NodeIdentity) error { + rnr = append(rnr, &ResultNetworkRegistry{ + Address: rn.ValidatorPublicKey.GetAddress(), + NodeIdentity: *rn, + }) + return nil + }) + return rnr, err +} + func (s *Service) Genesis() (*ResultGenesis, error) { return &ResultGenesis{ Genesis: s.blockchain.GenesisDoc(), @@ -376,7 +384,7 @@ func (s *Service) ConsensusState() (*ResultConsensusState, error) { } func (s *Service) GeneratePrivateAccount() (*ResultGeneratePrivateAccount, error) { - privateAccount, err := acm.GeneratePrivateAccount() + privateAccount, err := acm.GeneratePrivateAccount(crypto.CurveTypeEd25519) if err != nil { return nil, err } @@ -394,7 +402,7 @@ func Status(blockchain bcm.BlockchainInfo, validators validator.History, nodeVie GenesisHash: blockchain.GenesisHash(), NodeInfo: nodeView.NodeInfo(), SyncInfo: bcm.GetSyncInfo(blockchain), - CatchingUp: nodeView.IsFastSyncing(), + CatchingUp: nodeView.IsSyncing(), } if nodeView != nil { address := nodeView.ValidatorAddress() diff --git a/rpc/test.sol b/rpc/test.sol new file mode 100644 index 000000000..e9a541bf7 --- /dev/null +++ b/rpc/test.sol @@ -0,0 +1,9 @@ +pragma solidity >=0.4.20; + +contract HelloWorld { + + function Hello() public pure returns (string memory) { + return "Hello, World"; + } + +} diff --git a/rpc/test.sol.go b/rpc/test.sol.go new file mode 100644 index 000000000..787ef5522 --- /dev/null +++ b/rpc/test.sol.go @@ -0,0 +1,7 @@ +package rpc + +import hex "github.com/tmthrgd/go-hex" + +var Bytecode_HelloWorld = hex.MustDecodeString("608060405234801561001057600080fd5b5061011d806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063bcdfe0d514602d575b600080fd5b603360ab565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101560715780820151818401526020810190506058565b50505050905090810190601f168015609d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040518060400160405280600c81526020017f48656c6c6f2c20576f726c64000000000000000000000000000000000000000081525090509056fea265627a7a723158200b2a5b7a53ba54371daa99f4d02346044f39e951d89df28ce64b4d36dd3fda0664736f6c634300050b0032") +var DeployedBytecode_HelloWorld = hex.MustDecodeString("6080604052348015600f57600080fd5b506004361060285760003560e01c8063bcdfe0d514602d575b600080fd5b603360ab565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101560715780820151818401526020810190506058565b50505050905090810190601f168015609d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040518060400160405280600c81526020017f48656c6c6f2c20576f726c64000000000000000000000000000000000000000081525090509056fea265627a7a723158200b2a5b7a53ba54371daa99f4d02346044f39e951d89df28ce64b4d36dd3fda0664736f6c634300050b0032") +var Abi_HelloWorld = []byte(`[{"constant":true,"inputs":[],"name":"Hello","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"}]`) diff --git a/rpc/web3/eth_service.go b/rpc/web3/eth_service.go new file mode 100644 index 000000000..16a2c222a --- /dev/null +++ b/rpc/web3/eth_service.go @@ -0,0 +1,998 @@ +package web3 + +import ( + "context" + "encoding/hex" + "fmt" + "math/big" + "strconv" + + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/encoding/rlp" + "github.com/hyperledger/burrow/encoding/web3hex" + + "github.com/hyperledger/burrow/acm/acmstate" + "github.com/hyperledger/burrow/acm/balance" + "github.com/hyperledger/burrow/acm/validator" + bcm "github.com/hyperledger/burrow/bcm" + "github.com/hyperledger/burrow/consensus/tendermint" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/execution/state" + "github.com/hyperledger/burrow/keys" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/project" + "github.com/hyperledger/burrow/txs" + "github.com/hyperledger/burrow/txs/payload" + tmConfig "github.com/tendermint/tendermint/config" + "github.com/tendermint/tendermint/types" +) + +const ( + maxGasLimit = 2<<52 - 1 + hexZero = "0x0" + hexZeroNonce = "0x0000000000000000" + pending = "null" +) + +// EthService is a web3 provider +type EthService struct { + accounts acmstate.IterableStatsReader + events EventsReader + blockchain bcm.BlockchainInfo + validators validator.History + nodeView *tendermint.NodeView + trans *execution.Transactor + keyClient keys.KeyClient + keyStore *keys.FilesystemKeyStore + config *tmConfig.Config + chainID *big.Int + logger *logging.Logger +} + +// NewEthService returns our web3 provider +func NewEthService( + accounts acmstate.IterableStatsReader, + events EventsReader, + blockchain bcm.BlockchainInfo, + validators validator.History, + nodeView *tendermint.NodeView, + trans *execution.Transactor, + keyStore *keys.FilesystemKeyStore, + logger *logging.Logger, +) *EthService { + + keyClient := keys.NewLocalKeyClient(keyStore, logger) + + return &EthService{ + accounts: accounts, + events: events, + blockchain: blockchain, + validators: validators, + nodeView: nodeView, + trans: trans, + keyClient: keyClient, + keyStore: keyStore, + config: tmConfig.DefaultConfig(), + // Ethereum expects ChainID to be an integer value + chainID: encoding.GetEthChainID(blockchain.ChainID()), + logger: logger, + } +} + +var _ Service = &EthService{} + +type EventsReader interface { + TxsAtHeight(height uint64) ([]*exec.TxExecution, error) + TxByHash(txHash []byte) (*exec.TxExecution, error) +} + +var _ EventsReader = &state.State{} + +// Web3ClientVersion returns the version of burrow +func (srv *EthService) Web3ClientVersion() (*Web3ClientVersionResult, error) { + return &Web3ClientVersionResult{ + ClientVersion: project.FullVersion(), + }, nil +} + +// Web3Sha3 returns Keccak-256 (not the standardized SHA3-256) of the given data +func (srv *EthService) Web3Sha3(req *Web3Sha3Params) (*Web3Sha3Result, error) { + d := new(web3hex.Decoder) + return &Web3Sha3Result{ + HashedData: web3hex.Encoder.Bytes(crypto.Keccak256(d.Bytes(req.Data))), + }, d.Err() +} + +// NetListening returns true if the peer is running +func (srv *EthService) NetListening() (*NetListeningResult, error) { + return &NetListeningResult{ + IsNetListening: srv.nodeView.NodeInfo().GetListenAddress() != "", + }, nil +} + +// NetPeerCount returns the number of connected peers +func (srv *EthService) NetPeerCount() (*NetPeerCountResult, error) { + s := web3hex.Encoder.Uint64(uint64(srv.nodeView.Peers().Size())) + return &NetPeerCountResult{ + s, + }, nil +} + +// NetVersion returns the hex encoding of the network id, +// this is typically a small int (where 1 == Ethereum mainnet) +func (srv *EthService) NetVersion() (*NetVersionResult, error) { + return &NetVersionResult{ + ChainID: web3hex.Encoder.BigInt(srv.chainID), + }, nil +} + +// EthProtocolVersion returns the version of tendermint +func (srv *EthService) EthProtocolVersion() (*EthProtocolVersionResult, error) { + return &EthProtocolVersionResult{ + ProtocolVersion: srv.nodeView.NodeInfo().Version, + }, nil +} + +// EthChainId returns the chainID +func (srv *EthService) EthChainId() (*EthChainIdResult, error) { + return &EthChainIdResult{ + ChainId: web3hex.Encoder.BigInt(srv.chainID), + }, nil +} + +// EthBlockNumber returns the latest height +func (srv *EthService) EthBlockNumber() (*EthBlockNumberResult, error) { + return &EthBlockNumberResult{ + BlockNumber: web3hex.Encoder.Uint64(srv.blockchain.LastBlockHeight()), + }, nil +} + +// EthCall executes a new message call immediately without creating a transaction +func (srv *EthService) EthCall(req *EthCallParams) (*EthCallResult, error) { + d := new(web3hex.Decoder) + + from := d.Address(req.Transaction.From) + to := d.Address(req.Transaction.To) + data := d.Bytes(req.Transaction.Data) + + if d.Err() != nil { + return nil, d.Err() + } + txe, err := execution.CallSim(srv.accounts, srv.blockchain, from, to, data, srv.logger) + if err != nil { + return nil, err + } else if txe.Exception != nil { + return nil, txe.Exception.AsError() + } + + var result string + if r := txe.GetResult(); r != nil { + result = web3hex.Encoder.Bytes(r.GetReturn()) + } + + return &EthCallResult{ + ReturnValue: result, + }, nil +} + +// EthGetBalance returns an accounts balance, or an error if it does not exist +func (srv *EthService) EthGetBalance(req *EthGetBalanceParams) (*EthGetBalanceResult, error) { + d := new(web3hex.Decoder) + addr := d.Address(req.Address) + if d.Err() != nil { + return nil, d.Err() + } + + // TODO: read account state at height + acc, err := srv.accounts.GetAccount(addr) + if err != nil { + return nil, err + } else if acc == nil { + return nil, fmt.Errorf("account not found at address %s", req.Address) + } + + return &EthGetBalanceResult{ + GetBalanceResult: web3hex.Encoder.Bytes(balance.NativeToWei(acc.Balance).Bytes()), + }, nil +} + +// EthGetBlockByHash iterates through all headers to find a matching block height for a given hash +func (srv *EthService) EthGetBlockByHash(req *EthGetBlockByHashParams) (*EthGetBlockByHashResult, error) { + height, err := srv.getBlockHeightByHash(req.BlockHash) + if err != nil { + return nil, err + } + + block, err := srv.getBlockInfoAtHeight(height, req.IsTransactionsIncluded) + if err != nil { + return nil, err + } + + return &EthGetBlockByHashResult{ + GetBlockByHashResult: block, + }, nil +} + +// EthGetBlockByNumber returns block info at the given height +func (srv *EthService) EthGetBlockByNumber(req *EthGetBlockByNumberParams) (*EthGetBlockByNumberResult, error) { + height, err := srv.getHeightByWordOrNumber(req.BlockNumber) + if err != nil { + return nil, err + } + + block, err := srv.getBlockInfoAtHeight(height, req.IsTransactionsIncluded) + if err != nil { + return nil, err + } + + return &EthGetBlockByNumberResult{ + GetBlockByNumberResult: block, + }, nil +} + +// EthGetBlockTransactionCountByHash returns the number of transactions in a block matching a given hash +func (srv *EthService) EthGetBlockTransactionCountByHash(req *EthGetBlockTransactionCountByHashParams) (*EthGetBlockTransactionCountByHashResult, error) { + height, err := srv.getBlockHeightByHash(req.BlockHash) + if err != nil { + return nil, err + } + + numTxs, err := srv.blockchain.GetNumTxs(height) + if err != nil { + return nil, err + } + + return &EthGetBlockTransactionCountByHashResult{ + BlockTransactionCountByHash: web3hex.Encoder.Uint64(uint64(numTxs)), + }, nil +} + +// EthGetBlockTransactionCountByNumber returns the number of transactions in a block matching a given height +func (srv *EthService) EthGetBlockTransactionCountByNumber(req *EthGetBlockTransactionCountByNumberParams) (*EthGetBlockTransactionCountByNumberResult, error) { + height, err := srv.getHeightByWordOrNumber(req.BlockNumber) + if err != nil { + return nil, err + } + + numTxs, err := srv.blockchain.GetNumTxs(height) + if err != nil { + return nil, err + } + + return &EthGetBlockTransactionCountByNumberResult{ + BlockTransactionCountByHash: web3hex.Encoder.Uint64(uint64(numTxs)), + }, nil +} + +// EthGetCode returns the EVM bytecode at an address +func (srv *EthService) EthGetCode(req *EthGetCodeParams) (*EthGetCodeResult, error) { + d := new(web3hex.Decoder) + addr := d.Address(req.Address) + if d.Err() != nil { + return nil, d.Err() + } + + acc, err := srv.accounts.GetAccount(addr) + if err != nil { + return nil, err + } else if acc == nil { + return nil, fmt.Errorf("account not found at address %s", req.Address) + } + + return &EthGetCodeResult{ + Bytes: web3hex.Encoder.Bytes(acc.EVMCode), + }, nil +} + +func (srv *EthService) EthGetStorageAt(req *EthGetStorageAtParams) (*EthGetStorageAtResult, error) { + // TODO + return nil, ErrNotFound +} + +func (srv *EthService) EthGetTransactionByBlockHashAndIndex(req *EthGetTransactionByBlockHashAndIndexParams) (*EthGetTransactionByBlockHashAndIndexResult, error) { + height, err := srv.getBlockHeightByHash(req.BlockHash) + if err != nil { + return nil, err + } + + head, err := srv.blockchain.GetBlockHeader(height) + if err != nil { + return nil, err + } + + txes, err := srv.events.TxsAtHeight(height) + if err != nil { + return nil, err + } + + d := new(web3hex.Decoder) + + index := d.Uint64(req.Index) + + if d.Err() != nil { + return nil, d.Err() + } + + for _, txe := range txes { + if txe.GetIndex() == index { + hash, tx, err := getHashAndCallTxFromExecution(txe) + if err != nil { + return nil, err + } + return &EthGetTransactionByBlockHashAndIndexResult{ + TransactionResult: getTransaction(head, hash, tx), + }, nil + } + } + + return nil, fmt.Errorf("tx not found at hash %s, index %d", req.BlockHash, index) +} + +func (srv *EthService) EthGetTransactionByBlockNumberAndIndex(req *EthGetTransactionByBlockNumberAndIndexParams) (*EthGetTransactionByBlockNumberAndIndexResult, error) { + height, err := srv.getHeightByWordOrNumber(req.BlockNumber) + if err != nil { + return nil, err + } + + head, err := srv.blockchain.GetBlockHeader(height) + if err != nil { + return nil, err + } + + txes, err := srv.events.TxsAtHeight(height) + if err != nil { + return nil, err + } + d := new(web3hex.Decoder) + index := d.Uint64(req.Index) + if d.Err() != nil { + return nil, d.Err() + } + + for _, txe := range txes { + if txe.GetIndex() == index { + hash, tx, err := getHashAndCallTxFromExecution(txe) + if err != nil { + return nil, err + } + return &EthGetTransactionByBlockNumberAndIndexResult{ + TransactionResult: getTransaction(head, hash, tx), + }, nil + } + } + + return nil, fmt.Errorf("tx not found at height %d, index %d", height, index) +} + +// EthGetTransactionByHash finds a tx by the given hash +func (srv *EthService) EthGetTransactionByHash(req *EthGetTransactionByHashParams) (*EthGetTransactionByHashResult, error) { + d := new(web3hex.Decoder) + + hash := d.Bytes(req.TransactionHash) + if d.Err() != nil { + return nil, d.Err() + } + txe, err := srv.events.TxByHash(hash) + if err != nil { + return nil, err + } + + head, err := srv.blockchain.GetBlockHeader(txe.Height) + if err != nil { + return nil, err + } + + hash, tx, err := getHashAndCallTxFromExecution(txe) + if err != nil { + return nil, err + } + + return &EthGetTransactionByHashResult{ + Transaction: getTransaction(head, hash, tx), + }, nil +} + +// EthGetTransactionCount returns the number of transactions sent from an address +func (srv *EthService) EthGetTransactionCount(req *EthGetTransactionCountParams) (*EthGetTransactionCountResult, error) { + d := new(web3hex.Decoder) + addr := d.Address(req.Address) + if d.Err() != nil { + return nil, d.Err() + } + + // TODO: get tx count at height + acc, err := srv.accounts.GetAccount(addr) + if err != nil { + return nil, err + } + + // TODO: sequence may not always be accurate, is there a better way? + return &EthGetTransactionCountResult{ + NonceOrNull: web3hex.Encoder.Uint64(acc.GetSequence()), + }, nil +} + +func getHashAndCallTxFromEnvelope(env *txs.Envelope) ([]byte, *payload.CallTx, error) { + if env.Tx == nil { + return nil, nil, fmt.Errorf("tx not found for %s", env.String()) + } else if tx, ok := env.Tx.Payload.(*payload.CallTx); ok { + return env.Tx.Hash().Bytes(), tx, nil + } + return nil, nil, fmt.Errorf("tx not valid") +} + +func getHashAndCallTxFromExecution(txe *exec.TxExecution) ([]byte, *payload.CallTx, error) { + if txe.Envelope == nil { + return nil, nil, fmt.Errorf("envelope not found for %s", txe.GetTxHash().String()) + } + return getHashAndCallTxFromEnvelope(txe.Envelope) +} + +// EthGetTransactionReceipt returns the receipt of a previously committed tx +func (srv *EthService) EthGetTransactionReceipt(req *EthGetTransactionReceiptParams) (*EthGetTransactionReceiptResult, error) { + d := new(web3hex.Decoder) + + data := d.Bytes(req.TransactionHash) + if d.Err() != nil { + return nil, d.Err() + } + + txe, err := srv.events.TxByHash(data) + if err != nil { + return nil, err + } else if txe == nil { + return nil, fmt.Errorf("tx with hash %s does not exist", req.TransactionHash) + } + + hash, tx, err := getHashAndCallTxFromExecution(txe) + if err != nil { + return nil, err + } + + block, err := srv.blockchain.GetBlockHeader(txe.Height) + if err != nil { + return nil, err + } + + status := web3hex.Encoder.Uint64(1) + if err := txe.Exception.AsError(); err != nil { + status = web3hex.Encoder.Uint64(0) + } + + result := &EthGetTransactionReceiptResult{ + Receipt: Receipt{ + Status: status, + TransactionIndex: web3hex.Encoder.Uint64(txe.GetIndex()), + BlockNumber: web3hex.Encoder.Uint64(uint64(block.Height)), + BlockHash: web3hex.Encoder.Bytes(block.Hash()), + From: web3hex.Encoder.Bytes(tx.GetInput().Address.Bytes()), + GasUsed: web3hex.Encoder.Uint64(txe.Result.GetGasUsed()), + TransactionHash: web3hex.Encoder.Bytes(hash), + CumulativeGasUsed: hexZero, + LogsBloom: hexZero, + Logs: []Logs{}, + }, + } + + if txe.Receipt != nil { + result.Receipt.ContractAddress = web3hex.Encoder.Bytes(txe.Receipt.ContractAddress.Bytes()) + result.Receipt.To = pending + } else if tx.Address != nil { + result.Receipt.To = web3hex.Encoder.Bytes(tx.Address.Bytes()) + } + + return result, nil +} + +// EthHashrate returns the configured tendermint commit timeout +func (srv *EthService) EthHashrate() (*EthHashrateResult, error) { + return &EthHashrateResult{ + HashesPerSecond: srv.config.Consensus.TimeoutCommit.String(), + }, nil +} + +// EthMining returns true if client is a validator +func (srv *EthService) EthMining() (*EthMiningResult, error) { + var isVal bool + addr := srv.nodeView.ValidatorAddress() + val := srv.validators.Validators(1) + err := val.IterateValidators(func(id crypto.Addressable, _ *big.Int) error { + if addr == id.GetAddress() { + isVal = true + } + return nil + }) + if err != nil { + return nil, err + } + return &EthMiningResult{ + Mining: isVal, + }, nil +} + +// EthPendingTransactions returns all txs in the mempool +func (srv *EthService) EthPendingTransactions() (*EthPendingTransactionsResult, error) { + pending := make([]PendingTransactions, 0) + envelopes, err := srv.nodeView.MempoolTransactions(-1) + if err != nil { + return nil, err + } + + for _, env := range envelopes { + hash, tx, err := getHashAndCallTxFromEnvelope(env) + if err != nil { + continue + } + pending = append(pending, PendingTransactions{ + Transaction: getTransaction(nil, hash, tx), + }) + } + + return &EthPendingTransactionsResult{ + PendingTransactions: pending, + }, nil +} + +func (srv *EthService) EthEstimateGas(req *EthEstimateGasParams) (*EthEstimateGasResult, error) { + // TODO + return &EthEstimateGasResult{ + GasUsed: hexZero, + }, nil +} + +func (srv *EthService) EthGasPrice() (*EthGasPriceResult, error) { + // TODO + return &EthGasPriceResult{ + GasPrice: hexZero, + }, nil +} + +func (srv *EthService) EthGetRawTransactionByHash(req *EthGetRawTransactionByHashParams) (*EthGetRawTransactionByHashResult, error) { + // TODO + return nil, ErrNotFound +} + +func (srv *EthService) EthGetRawTransactionByBlockHashAndIndex(req *EthGetRawTransactionByBlockHashAndIndexParams) (*EthGetRawTransactionByBlockHashAndIndexResult, error) { + // TODO + return nil, ErrNotFound +} + +func (srv *EthService) EthGetRawTransactionByBlockNumberAndIndex(req *EthGetRawTransactionByBlockNumberAndIndexParams) (*EthGetRawTransactionByBlockNumberAndIndexResult, error) { + // TODO + return nil, ErrNotFound +} + +func (srv *EthService) EthSendRawTransaction(req *EthSendRawTransactionParams) (*EthSendRawTransactionResult, error) { + d := new(web3hex.Decoder) + + data := d.Bytes(req.SignedTransactionData) + + if d.Err() != nil { + return nil, d.Err() + } + + rawTx := txs.NewEthRawTx(srv.chainID) + err := rlp.Decode(data, rawTx) + if err != nil { + return nil, err + } + + publicKey, signature, err := rawTx.RecoverPublicKey() + if err != nil { + return nil, err + } + + from := publicKey.GetAddress() + + to, err := crypto.AddressFromBytes(rawTx.To) + if err != nil { + return nil, err + } + + amount := balance.WeiToNative(rawTx.Amount).Uint64() + + txEnv := &txs.Envelope{ + Signatories: []txs.Signatory{ + { + Address: &from, + PublicKey: publicKey, + Signature: signature, + }, + }, + Encoding: txs.Envelope_RLP, + Tx: &txs.Tx{ + ChainID: srv.blockchain.ChainID(), + Payload: &payload.CallTx{ + Input: &payload.TxInput{ + Address: from, + Amount: amount, + // first tx sequence should be 1, + // but metamask starts at 0 + Sequence: rawTx.Sequence + 1, + }, + Address: &to, + GasLimit: rawTx.GasLimit, + GasPrice: rawTx.GasPrice, + Data: rawTx.Data, + }, + }, + } + + ctx := context.Background() + txe, err := srv.trans.BroadcastTxSync(ctx, txEnv) + if err != nil { + return nil, err + } else if txe.Exception != nil { + return nil, txe.Exception.AsError() + } + + return &EthSendRawTransactionResult{ + TransactionHash: web3hex.Encoder.Bytes(txe.GetTxHash().Bytes()), + }, nil +} + +// EthSyncing returns this nodes syncing status (i.e. whether it has caught up) +func (srv *EthService) EthSyncing() (*EthSyncingResult, error) { + // TODO: remaining sync fields + return &EthSyncingResult{ + Syncing: SyncStatus{ + CurrentBlock: web3hex.Encoder.Uint64(srv.blockchain.LastBlockHeight()), + }, + }, nil +} + +func (srv *EthService) getBlockHeightByHash(hash string) (uint64, error) { + for i := uint64(1); i < srv.blockchain.LastBlockHeight(); i++ { + head, err := srv.blockchain.GetBlockHeader(i) + if err != nil { + return 0, err + } else if hexKeccak(head.Hash().Bytes()) == hash { + return i, nil + } + } + return 0, ErrNotFound +} + +func (srv *EthService) getBlockHeaderAtHeight(height uint64) (*types.Header, error) { + return srv.blockchain.GetBlockHeader(height) +} + +func hexKeccak(data []byte) string { + return web3hex.Encoder.Bytes(crypto.Keccak256(data)) +} + +func hexKeccakAddress(data []byte) string { + addr := crypto.Keccak256(data) + return web3hex.Encoder.Bytes(addr[len(addr)-20:]) +} + +func (srv *EthService) getBlockInfoAtHeight(height uint64, includeTxs bool) (Block, error) { + doc := srv.blockchain.GenesisDoc() + if height == 0 { + // genesis + return Block{ + Transactions: make([]Transactions, 0), + Uncles: make([]string, 0), + Nonce: hexZeroNonce, + Hash: hexKeccak(doc.AppHash.Bytes()), + ParentHash: hexKeccak(doc.AppHash.Bytes()), + ReceiptsRoot: hexKeccak(doc.AppHash.Bytes()), + StateRoot: hexKeccak(doc.AppHash.Bytes()), + Miner: web3hex.Encoder.Bytes(doc.Validators[0].Address.Bytes()), + Timestamp: web3hex.Encoder.Uint64(uint64(doc.GenesisTime.Unix())), + Number: hexZero, + Size: hexZero, + ExtraData: hexZero, + Difficulty: hexZero, + TotalDifficulty: hexZero, + GasLimit: hexZero, + GasUsed: hexZero, + }, nil + } + block, err := srv.getBlockHeaderAtHeight(height) + if err != nil { + return Block{}, err + } else if block == nil { + return Block{}, fmt.Errorf("block at height %d does not exist", height) + } + + numTxs, err := srv.blockchain.GetNumTxs(height) + if err != nil { + return Block{}, err + } + + transactions := make([]Transactions, 0) + if includeTxs { + txes, err := srv.events.TxsAtHeight(height) + if err != nil { + return Block{}, err + } + for _, txe := range txes { + hash, tx, err := getHashAndCallTxFromExecution(txe) + if err != nil { + continue + } + transactions = append(transactions, Transactions{ + getTransaction(block, hash, tx), + }) + } + } + + return Block{ + Hash: hexKeccak(block.Hash().Bytes()), + ParentHash: hexKeccak(block.Hash().Bytes()), + TransactionsRoot: hexKeccak(block.Hash().Bytes()), + StateRoot: hexKeccak(block.Hash().Bytes()), + ReceiptsRoot: hexKeccak(block.Hash().Bytes()), + Nonce: hexZeroNonce, + Size: web3hex.Encoder.Uint64(uint64(numTxs)), + Number: web3hex.Encoder.Uint64(uint64(block.Height)), + Miner: web3hex.Encoder.Bytes(block.ProposerAddress.Bytes()), + Sha3Uncles: hexZero, + LogsBloom: hexZero, + ExtraData: hexZero, + Difficulty: hexZero, + TotalDifficulty: hexZero, + GasUsed: hexZero, + GasLimit: web3hex.Encoder.Uint64(maxGasLimit), + Timestamp: web3hex.Encoder.Uint64(uint64(block.Time.Unix())), + Transactions: transactions, + Uncles: []string{}, + }, nil +} + +func getTransaction(block *types.Header, hash []byte, tx *payload.CallTx) Transaction { + // TODO: sensible defaults for non-call + transaction := Transaction{ + V: hexZero, + R: hexZero, + S: hexZero, + From: web3hex.Encoder.Bytes(tx.Input.Address.Bytes()), + Value: web3hex.Encoder.Uint64(tx.Input.Amount), + Nonce: web3hex.Encoder.Uint64(tx.Input.Sequence), + Gas: web3hex.Encoder.Uint64(tx.GasLimit), + GasPrice: web3hex.Encoder.Uint64(tx.GasPrice), + Data: web3hex.Encoder.Bytes(tx.Data), + } + + if block != nil { + // may be pending + transaction.BlockHash = hexKeccak(block.Hash().Bytes()) + transaction.Hash = web3hex.Encoder.Bytes(hash) + transaction.BlockNumber = web3hex.Encoder.Uint64(uint64(block.Height)) + transaction.TransactionIndex = hexZero + } + + if tx.Address != nil { + transaction.To = web3hex.Encoder.Bytes(tx.Address.Bytes()) + } else { + transaction.To = pending + } + + return transaction +} + +func (srv *EthService) getHeightByWord(height string) (uint64, bool) { + switch height { + case "earliest": + return 0, true + case "latest", "pending": + return srv.blockchain.LastBlockHeight(), true + // TODO: pending state/transactions + default: + return 0, false + } +} + +func getHeightByNumber(height string) (uint64, error) { + d := new(web3hex.Decoder) + return d.Uint64(height), d.Err() +} + +func (srv *EthService) getHeightByWordOrNumber(i string) (uint64, error) { + var err error + height, ok := srv.getHeightByWord(i) + if !ok { + height, err = getHeightByNumber(i) + if err != nil { + return 0, err + } + } + return height, nil +} + +// EthSendTransaction constructs, signs and broadcasts a tx from the local node +// Note: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1767.md#rationale +func (srv *EthService) EthSendTransaction(req *EthSendTransactionParams) (*EthSendTransactionResult, error) { + tx := &payload.CallTx{ + Input: new(payload.TxInput), + } + + var err error + d := new(web3hex.Decoder) + if from := req.Transaction.From; from != "" { + tx.Input.Address = d.Address(from) + if d.Err() != nil { + return nil, fmt.Errorf("failed to parse from address: %v", d.Err()) + } + } else { + return nil, fmt.Errorf("no from address specified") + } + + if value := req.Transaction.Value; value != "" { + tx.Input.Amount, err = strconv.ParseUint(value, 0, 64) + if err != nil { + return nil, fmt.Errorf("failed to parse amount: %v", err) + } + } + + if to := req.Transaction.To; to != "" { + addr := d.Address(to) + if d.Err() != nil { + return nil, fmt.Errorf("failed to parse to address: %v", d.Err()) + } + tx.Address = &addr + } + + // gas provided for the transaction execution + if gasLimit := req.Transaction.Gas; gasLimit != "" { + tx.GasLimit, err = strconv.ParseUint(gasLimit, 0, 64) + if err != nil { + return nil, fmt.Errorf("failed to parse gasLimit: %v", err) + } + } + + if gasPrice := req.Transaction.GasPrice; gasPrice != "" { + tx.GasPrice, err = strconv.ParseUint(gasPrice, 0, 64) + if err != nil { + return nil, fmt.Errorf("failed to parse gasPrice: %v", err) + } + } + + if data := req.Transaction.Data; data != "" { + bs := d.Bytes(data) + if d.Err() != nil { + return nil, fmt.Errorf("failed to parse data: %v", d.Err()) + } + tx.Data = bs + } + + txEnv := txs.Enclose(srv.blockchain.ChainID(), tx) + + ctx := context.Background() + txe, err := srv.trans.BroadcastTxSync(ctx, txEnv) + if err != nil { + return nil, err + } else if txe.Exception != nil { + return nil, txe.Exception.AsError() + } + + return &EthSendTransactionResult{ + TransactionHash: web3hex.Encoder.Bytes(txe.GetTxHash().Bytes()), + }, nil +} + +// EthAccounts returns all accounts signable from the local node +func (srv *EthService) EthAccounts() (*EthAccountsResult, error) { + addresses, err := srv.keyStore.GetAllAddresses() + if err != nil { + return nil, err + } + + addrs := make([]string, 0, len(addresses)) + for _, addr := range addresses { + data, err := hex.DecodeString(addr) + if err != nil { + return nil, fmt.Errorf("could not decode address %s", addr) + } + key, err := srv.keyStore.GetKey("", data) + if err != nil { + return nil, fmt.Errorf("could not retrieve key for %s", addr) + } else if key.CurveType != crypto.CurveTypeSecp256k1 { + // we only want ethereum keys + continue + } + // TODO: only return accounts that exist in current chain + addrs = append(addrs, web3hex.Encoder.Bytes(key.Address.Bytes())) + } + + return &EthAccountsResult{ + Addresses: addrs, + }, nil +} + +// EthSign: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign +func (srv *EthService) EthSign(req *EthSignParams) (*EthSignResult, error) { + d := new(web3hex.Decoder) + to := d.Address(req.Address) + signer, err := keys.AddressableSigner(srv.keyClient, to) + if err != nil { + return nil, err + } + + data := d.Bytes(req.Bytes) + if d.Err() != nil { + return nil, d.Err() + } + + msg := append([]byte{0x19}, []byte("Ethereum Signed Message:\n")...) + msg = append(msg, byte(len(data))) + msg = append(msg, data...) + + sig, err := signer.Sign(crypto.Keccak256(msg)) + if err != nil { + return nil, err + } + + return &EthSignResult{ + Signature: web3hex.Encoder.Bytes(sig.RawBytes()), + }, nil +} + +// N / A + +func (srv *EthService) EthUninstallFilter(*EthUninstallFilterParams) (*EthUninstallFilterResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthSubmitHashrate(req *EthSubmitHashrateParams) (*EthSubmitHashrateResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthSubmitWork(*EthSubmitWorkParams) (*EthSubmitWorkResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthNewBlockFilter() (*EthNewBlockFilterResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthNewFilter(req *EthNewFilterParams) (*EthNewFilterResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthNewPendingTransactionFilter() (*EthNewPendingTransactionFilterResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetUncleByBlockHashAndIndex(req *EthGetUncleByBlockHashAndIndexParams) (*EthGetUncleByBlockHashAndIndexResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetUncleByBlockNumberAndIndex(req *EthGetUncleByBlockNumberAndIndexParams) (*EthGetUncleByBlockNumberAndIndexResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetUncleCountByBlockHash(req *EthGetUncleCountByBlockHashParams) (*EthGetUncleCountByBlockHashResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetUncleCountByBlockNumber(req *EthGetUncleCountByBlockNumberParams) (*EthGetUncleCountByBlockNumberResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetProof(req *EthGetProofParams) (*EthGetProofResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetWork() (*EthGetWorkResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetFilterChanges(req *EthGetFilterChangesParams) (*EthGetFilterChangesResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetFilterLogs(req *EthGetFilterLogsParams) (*EthGetFilterLogsResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthCoinbase() (*EthCoinbaseResult, error) { + return nil, ErrNotFound +} + +func (srv *EthService) EthGetLogs(req *EthGetLogsParams) (*EthGetLogsResult, error) { + return nil, ErrNotFound +} diff --git a/rpc/web3/eth_service_test.go b/rpc/web3/eth_service_test.go new file mode 100644 index 000000000..594ead86b --- /dev/null +++ b/rpc/web3/eth_service_test.go @@ -0,0 +1,289 @@ +package web3_test + +import ( + "context" + "io/ioutil" + "os" + "strings" + "testing" + "time" + + "github.com/hyperledger/burrow/acm/balance" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/encoding/web3hex" + "github.com/hyperledger/burrow/execution/evm/abi" + "github.com/hyperledger/burrow/integration" + "github.com/hyperledger/burrow/keys" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/project" + "github.com/hyperledger/burrow/rpc" + "github.com/hyperledger/burrow/rpc/web3" + "github.com/hyperledger/burrow/txs" + "github.com/hyperledger/burrow/txs/payload" + "github.com/stretchr/testify/require" +) + +var d = new(web3hex.Decoder).Must() + +// Check we can force set a decimal ChainID +const chainID = "15321" + +func TestWeb3Service(t *testing.T) { + ctx := context.Background() + genesisAccounts := integration.MakePrivateAccounts("burrow", 1) + genesisAccounts = append(genesisAccounts, integration.MakeEthereumAccounts("ethereum", 3)...) + genesisDoc := integration.TestGenesisDoc(genesisAccounts, 0) + genesisDoc.ChainID = chainID + config, _ := integration.NewTestConfig(genesisDoc) + logger := logging.NewNoopLogger() + kern, err := integration.TestKernel(genesisAccounts[0], genesisAccounts, config) + require.NoError(t, err) + err = kern.Boot() + defer kern.Shutdown(ctx) + + dir, err := ioutil.TempDir(os.TempDir(), "") + require.NoError(t, err) + defer os.RemoveAll(dir) + + store := keys.NewFilesystemKeyStore(dir, true) + for _, acc := range genesisAccounts { + err = store.StoreKeyPlain(&keys.Key{ + CurveType: acc.PrivateKey().CurveType, + Address: acc.GetAddress(), + PublicKey: *acc.GetPublicKey(), + PrivateKey: acc.PrivateKey(), + }) + require.NoError(t, err) + } + + nodeView, err := kern.GetNodeView() + require.NoError(t, err) + + accountState := kern.State + eventsState := kern.State + validatorState := kern.State + eth := web3.NewEthService(accountState, eventsState, kern.Blockchain, validatorState, + nodeView, kern.Transactor, store, kern.Logger) + + t.Run("Web3Sha3", func(t *testing.T) { + result, err := eth.Web3Sha3(&web3.Web3Sha3Params{"0x68656c6c6f20776f726c64"}) // hello world + require.NoError(t, err) + // hex encoded + require.Equal(t, "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad", result.HashedData) + }) + + t.Run("NetListening", func(t *testing.T) { + result, err := eth.NetListening() + require.NoError(t, err) + require.Equal(t, true, result.IsNetListening) + }) + + t.Run("NetPeerCount", func(t *testing.T) { + result, err := eth.NetPeerCount() + require.NoError(t, err) + require.Equal(t, "0x0", result.NumConnectedPeers) + }) + + t.Run("Version+ID", func(t *testing.T) { + t.Run("Web3ClientVersion", func(t *testing.T) { + result, err := eth.Web3ClientVersion() + require.NoError(t, err) + require.Equal(t, project.FullVersion(), result.ClientVersion) + }) + + t.Run("NetVersion", func(t *testing.T) { + result, err := eth.NetVersion() + require.NoError(t, err) + require.Equal(t, web3hex.Encoder.BigInt(encoding.GetEthChainID(genesisDoc.GetChainID())), result.ChainID) + }) + + t.Run("EthProtocolVersion", func(t *testing.T) { + result, err := eth.EthProtocolVersion() + require.NoError(t, err) + require.NotEmpty(t, result.ProtocolVersion) + }) + + t.Run("EthChainId", func(t *testing.T) { + result, err := eth.EthChainId() + require.NoError(t, err) + doc := config.GenesisDoc + require.Equal(t, web3hex.Encoder.BigInt(encoding.GetEthChainID(doc.GetChainID())), result.ChainId) + }) + }) + + t.Run("EthTransactions", func(t *testing.T) { + var txHash, contractAddress string + + sender := genesisAccounts[1] + receivee := genesisAccounts[2].GetPublicKey().GetAddress() + acc, err := kern.State.GetAccount(receivee) + require.NoError(t, err) + before := acc.GetBalance() + + t.Run("EthSendRawTransaction", func(t *testing.T) { + txEnv := txs.Enclose(chainID, &payload.CallTx{ + Input: &payload.TxInput{ + Address: sender.GetAddress(), + Amount: 1, + Sequence: 0, + }, + Address: &receivee, + Data: nil, + }) + txEnv.Encoding = txs.Envelope_RLP + err = txEnv.Sign(sender) + require.NoError(t, err) + + rawTx, err := txs.EthRawTxFromEnvelope(txEnv) + require.NoError(t, err) + + bs, err := rawTx.Marshal() + require.NoError(t, err) + + raw := web3hex.Encoder.BytesTrim(bs) + + _, err = eth.EthSendRawTransaction(&web3.EthSendRawTransactionParams{ + SignedTransactionData: raw, + }) + require.NoError(t, err) + }) + + t.Run("EthGetBalance", func(t *testing.T) { + result, err := eth.EthGetBalance(&web3.EthGetBalanceParams{ + Address: web3hex.Encoder.BytesTrim(receivee.Bytes()), + BlockNumber: "latest", + }) + require.NoError(t, err) + after := d.BigInt(result.GetBalanceResult) + after = balance.WeiToNative(after) + require.Equal(t, after.Uint64(), before+1) + }) + + t.Run("EthGetTransactionCount", func(t *testing.T) { + result, err := eth.EthGetTransactionCount(&web3.EthGetTransactionCountParams{ + Address: genesisAccounts[1].GetAddress().String(), + }) + require.NoError(t, err) + require.Equal(t, web3hex.Encoder.Uint64(1), result.NonceOrNull) + }) + + // create contract on chain + t.Run("EthSendTransaction", func(t *testing.T) { + type ret struct { + *web3.EthSendTransactionResult + error + } + ch := make(chan ret) + numSends := 5 + for i := 0; i < numSends; i++ { + idx := i + go func() { + tx := &web3.EthSendTransactionParams{ + Transaction: web3.Transaction{ + From: web3hex.Encoder.BytesTrim(genesisAccounts[3].GetAddress().Bytes()), + Gas: web3hex.Encoder.Uint64(uint64(40 + idx)), // make tx unique in mempool + Data: web3hex.Encoder.BytesTrim(rpc.Bytecode_HelloWorld), + }, + } + result, err := eth.EthSendTransaction(tx) + ch <- ret{result, err} + }() + } + for i := 0; i < numSends; i++ { + select { + case r := <-ch: + require.NoError(t, r.error) + require.NotEmpty(t, r.TransactionHash) + case <-time.After(2 * time.Second): + t.Fatalf("timed out waiting for EthSendTransaction result") + } + } + }) + + t.Run("EthGetTransactionReceipt", func(t *testing.T) { + sendResult, err := eth.EthSendTransaction(&web3.EthSendTransactionParams{ + Transaction: web3.Transaction{ + From: web3hex.Encoder.BytesTrim(genesisAccounts[3].GetAddress().Bytes()), + Gas: web3hex.Encoder.Uint64(40), + Data: web3hex.Encoder.BytesTrim(rpc.Bytecode_HelloWorld), + }, + }) + require.NoError(t, err) + txHash = sendResult.TransactionHash + require.NotEmpty(t, txHash, "need tx hash to get tx receipt") + receiptResult, err := eth.EthGetTransactionReceipt(&web3.EthGetTransactionReceiptParams{ + TransactionHash: txHash, + }) + require.NoError(t, err) + contractAddress = receiptResult.Receipt.ContractAddress + require.NotEmpty(t, contractAddress) + }) + + t.Run("EthCall", func(t *testing.T) { + require.NotEmpty(t, contractAddress, "need contract address to call") + + packed, _, err := abi.EncodeFunctionCall(string(rpc.Abi_HelloWorld), "Hello", logger) + require.NoError(t, err) + + result, err := eth.EthCall(&web3.EthCallParams{ + Transaction: web3.Transaction{ + From: web3hex.Encoder.BytesTrim(genesisAccounts[1].GetAddress().Bytes()), + To: contractAddress, + Data: web3hex.Encoder.BytesTrim(packed), + }, + }) + require.NoError(t, err) + + value := d.Bytes(result.ReturnValue) + vars, err := abi.DecodeFunctionReturn(string(rpc.Abi_HelloWorld), "Hello", value) + require.NoError(t, err) + require.Len(t, vars, 1) + require.Equal(t, "Hello, World", vars[0].Value) + }) + + t.Run("EthGetCode", func(t *testing.T) { + require.NotEmpty(t, contractAddress, "need contract address get code") + result, err := eth.EthGetCode(&web3.EthGetCodeParams{ + Address: contractAddress, + }) + require.NoError(t, err) + require.Equal(t, web3hex.Encoder.BytesTrim(rpc.DeployedBytecode_HelloWorld), strings.ToLower(result.Bytes)) + }) + }) + + t.Run("EthMining", func(t *testing.T) { + result, err := eth.EthMining() + require.NoError(t, err) + require.Equal(t, true, result.Mining) + }) + + t.Run("EthAccounts", func(t *testing.T) { + result, err := eth.EthAccounts() + require.NoError(t, err) + require.Len(t, result.Addresses, len(genesisAccounts)-1) + for _, acc := range genesisAccounts { + if acc.PrivateKey().CurveType == crypto.CurveTypeSecp256k1 { + require.Contains(t, result.Addresses, web3hex.Encoder.BytesTrim(acc.GetAddress().Bytes())) + } + } + }) + + t.Run("EthSign", func(t *testing.T) { + result, err := eth.EthSign(&web3.EthSignParams{ + Address: "0x" + genesisAccounts[1].GetAddress().String(), + Bytes: "0xdeadbeaf", + }) + require.NoError(t, err) + require.Equal(t, `0x1ba96f3dd6cbbc27aaaafe9d68a5368653f72a5677e365e2505ad207a5e8741949717cfc1cc107583142bfe54b9ba4840f5ad7cb12b224dd97b2fb6a735b93c57a`, result.Signature) + }) + + t.Run("EthGetBlock", func(t *testing.T) { + numberResult, err := eth.EthGetBlockByNumber(&web3.EthGetBlockByNumberParams{BlockNumber: web3hex.Encoder.Uint64(1)}) + require.NoError(t, err) + hashResult, err := eth.EthGetBlockByHash(&web3.EthGetBlockByHashParams{BlockHash: numberResult.GetBlockByNumberResult.Hash}) + require.NoError(t, err) + require.Equal(t, numberResult.GetBlockByNumberResult, hashResult.GetBlockByHashResult) + }) + +} diff --git a/rpc/web3/ethclient/client.go b/rpc/web3/ethclient/client.go new file mode 100644 index 000000000..cdeab8f29 --- /dev/null +++ b/rpc/web3/ethclient/client.go @@ -0,0 +1,200 @@ +package ethclient + +import ( + "context" + "fmt" + "time" + + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding/web3hex" + "github.com/hyperledger/burrow/rpc" + "github.com/hyperledger/burrow/rpc/rpcevents" + "github.com/hyperledger/burrow/rpc/web3" +) + +const ( + EthGetLogsMethod = "eth_getLogs" + EthSyncingMethod = "eth_syncing" + EthBlockNumberMethod = "eth_blockNumber" + EthSendTransactionMethod = "eth_sendTransaction" + EthSendRawTransactionMethod = "eth_sendRawTransaction" + EthGetTransactionCountMethod = "eth_getTransactionCount" + EthAccountsMethod = "eth_accounts" + EthGetBlockByNumberMethod = "eth_getBlockByNumber" + EthGetTransactionByHashMethod = "eth_getTransactionByHash" + EthGetTransactionReceiptMethod = "eth_getTransactionReceipt" + EthGasPriceMethod = "eth_gasPrice" + NetVersionMethod = "net_version" + Web3ClientVersionMethod = "web3_clientVersion" +) + +// Adjust the polling frequency of AwaitTransaction +const awaitTransactionSleep = 200 * time.Millisecond + +type EthClient struct { + rpc.Client +} + +func NewEthClient(cli rpc.Client) *EthClient { + return &EthClient{Client: cli} +} + +func (c *EthClient) SendTransaction(tx *EthSendTransactionParam) (string, error) { + hash := new(string) + err := c.Call(EthSendTransactionMethod, []*EthSendTransactionParam{tx}, &hash) + if err != nil { + return "", err + } + return *hash, nil +} + +func (c *EthClient) SendRawTransaction(txHex string) (string, error) { + hash := new(string) + err := c.Call(EthSendRawTransactionMethod, []string{txHex}, &hash) + if err != nil { + return "", err + } + return *hash, nil +} + +func (c *EthClient) GetTransactionCount(address crypto.Address) (string, error) { + var count string + err := c.Call(EthGetTransactionCountMethod, []string{web3hex.Encoder.Address(address), "latest"}, &count) + if err != nil { + return "", err + } + return count, nil +} + +func (c *EthClient) GetLogs(filter *Filter) ([]*EthLog, error) { + var logs []*EthLog + err := c.Call(EthGetLogsMethod, []*EthFilter{filter.EthFilter()}, &logs) + if err != nil { + return nil, err + } + return logs, nil +} + +func (c *EthClient) Accounts() ([]string, error) { + var accounts []string + err := c.Call(EthAccountsMethod, nil, &accounts) + if err != nil { + return nil, err + } + return accounts, nil +} + +func (c *EthClient) GetBlockByNumber(height string) (*Block, error) { + block := new(Block) + err := c.Call(EthGetBlockByNumberMethod, []interface{}{height, false}, block) + if err != nil { + return nil, err + } + return block, nil +} + +func (c *EthClient) GetTransactionByHash(txHash string) (*web3.Transaction, error) { + tx := new(web3.Transaction) + err := c.Call(EthGetTransactionByHashMethod, []string{txHash}, tx) + if err != nil { + return nil, err + } + return tx, nil +} + +func (c *EthClient) GetTransactionReceipt(txHash string) (*Receipt, error) { + tx := new(Receipt) + err := c.Call(EthGetTransactionReceiptMethod, []string{txHash}, tx) + if err != nil { + return nil, err + } + return tx, nil +} + +func (c *EthClient) Syncing() (bool, error) { + syncing := new(bool) + err := c.Call(EthSyncingMethod, nil, syncing) + if err != nil { + return false, err + } + return *syncing, nil +} + +func (c *EthClient) BlockNumber() (uint64, error) { + latestBlock := new(string) + err := c.Call(EthBlockNumberMethod, nil, latestBlock) + if err != nil { + return 0, err + } + d := new(web3hex.Decoder) + return d.Uint64(*latestBlock), d.Err() +} + +func (c *EthClient) GasPrice() (string, error) { + gasPrice := new(string) + err := c.Call(EthGasPriceMethod, nil, gasPrice) + if err != nil { + return "", err + } + return *gasPrice, nil +} + +// AKA ChainID +func (c *EthClient) NetVersion() (string, error) { + version := new(string) + err := c.Call(NetVersionMethod, nil, version) + if err != nil { + return "", err + } + return *version, nil +} + +func (c *EthClient) Web3ClientVersion() (string, error) { + version := new(string) + err := c.Call(Web3ClientVersionMethod, nil, version) + if err != nil { + return "", err + } + return *version, nil +} + +// Wait for a transaction to be mined/confirmed +func (c *EthClient) AwaitTransaction(ctx context.Context, txHash string) (*Receipt, error) { + for { + tx, err := c.GetTransactionReceipt(txHash) + if err != nil { + return nil, fmt.Errorf("AwaitTransaction failed to get ethereum transaction: %w", err) + } + if tx.BlockNumber != "" { + if tx.BlockHash == "" { + return nil, fmt.Errorf("expected Blockhash to be non-empty when BlockNumber is non-empty (%s)", + tx.BlockNumber) + } + // Transaction has been confirmed (is included in a block) + return tx, nil + } + time.Sleep(awaitTransactionSleep) + select { + case <-ctx.Done(): + return nil, fmt.Errorf("AwaitTransaction interrupted: %w", ctx.Err()) + default: + + } + } +} + +func logBound(bound *rpcevents.Bound) string { + if bound == nil { + return "" + } + switch bound.Type { + case rpcevents.Bound_FIRST: + return "earliest" + case rpcevents.Bound_LATEST: + return "latest" + case rpcevents.Bound_ABSOLUTE: + return web3hex.Encoder.Uint64(bound.Index) + default: + return "" + } +} diff --git a/rpc/web3/ethclient/client_test.go b/rpc/web3/ethclient/client_test.go new file mode 100644 index 000000000..1086c5804 --- /dev/null +++ b/rpc/web3/ethclient/client_test.go @@ -0,0 +1,112 @@ +// +build integration,ethereum + +package ethclient + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding/web3hex" + "github.com/hyperledger/burrow/execution/solidity" + "github.com/hyperledger/burrow/rpc/rpcevents" + "github.com/hyperledger/burrow/tests/web3/web3test" + "github.com/stretchr/testify/assert" + + "github.com/stretchr/testify/require" +) + +var client = NewEthClient(web3test.GetChainRPCClient()) + +func TestEthAccounts(t *testing.T) { + accounts, err := client.Accounts() + require.NoError(t, err) + fmt.Println(accounts) +} + +func TestEthSendTransaction(t *testing.T) { + pk := web3test.GetPrivateKey(t) + + d := new(web3hex.Decoder) + param := &EthSendTransactionParam{ + From: web3hex.Encoder.Address(pk.GetAddress()), + Gas: web3hex.Encoder.Uint64(999999), + Data: web3hex.Encoder.BytesTrim(solidity.Bytecode_EventEmitter), + } + txHash, err := client.SendTransaction(param) + require.NoError(t, err) + require.NotEmpty(t, txHash) + + tx, err := client.GetTransactionByHash(txHash) + require.NoError(t, err) + assert.Greater(t, d.Uint64(tx.BlockNumber), uint64(0)) + + receipt, err := client.GetTransactionReceipt(txHash) + require.NoError(t, err) + assert.Equal(t, txHash, receipt.TransactionHash) + + require.NoError(t, d.Err()) +} + +func TestNonExistentTransaction(t *testing.T) { + txHash := "0x990258f47aba0cf913c14cc101ddf5b589c04765429d5709f643c891442bfcf7" + receipt, err := client.GetTransactionReceipt(txHash) + require.NoError(t, err) + require.Equal(t, "", receipt.TransactionHash) + require.Equal(t, "", receipt.BlockNumber) + require.Equal(t, "", receipt.BlockHash) + tx, err := client.GetTransactionByHash(txHash) + require.NoError(t, err) + require.Equal(t, "", tx.Hash) + require.Equal(t, "", tx.BlockNumber) + require.Equal(t, "", tx.BlockHash) +} + +func TestEthClient_GetLogs(t *testing.T) { + // TODO: make this test generate its own fixutres + filter := &Filter{ + BlockRange: rpcevents.AbsoluteRange(1, 34340), + Addresses: []crypto.Address{ + crypto.MustAddressFromHexString("a1e378f122fec6aa8c841397042e21bc19368768"), + crypto.MustAddressFromHexString("f73aaa468496a87675d27638878a1600b0db3c71"), + }, + } + result, err := client.GetLogs(filter) + require.NoError(t, err) + bs, err := json.Marshal(result) + require.NoError(t, err) + fmt.Printf("%s\n", string(bs)) +} + +func TestEthClient_GetBlockByNumber(t *testing.T) { + block, err := client.GetBlockByNumber("latest") + require.NoError(t, err) + d := new(web3hex.Decoder) + assert.Greater(t, d.Uint64(block.Number), uint64(0)) + require.NoError(t, d.Err()) +} + +func TestNetVersion(t *testing.T) { + chainID, err := client.NetVersion() + require.NoError(t, err) + require.NotEmpty(t, chainID) +} + +func TestWeb3ClientVersion(t *testing.T) { + version, err := client.Web3ClientVersion() + require.NoError(t, err) + require.NotEmpty(t, version) +} + +func TestEthSyncing(t *testing.T) { + result, err := client.Syncing() + require.NoError(t, err) + fmt.Printf("%#v\n", result) +} + +func TestEthBlockNumber(t *testing.T) { + height, err := client.BlockNumber() + require.NoError(t, err) + require.Greater(t, height, uint64(0)) +} diff --git a/rpc/web3/ethclient/transact_client.go b/rpc/web3/ethclient/transact_client.go new file mode 100644 index 000000000..6258468bc --- /dev/null +++ b/rpc/web3/ethclient/transact_client.go @@ -0,0 +1,200 @@ +package ethclient + +import ( + "context" + "fmt" + + "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding/web3hex" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/txs" + "github.com/hyperledger/burrow/txs/payload" + "google.golang.org/grpc" +) + +const BasicGasLimit = 21000 + +// Provides a partial implementation of the GRPC-generated TransactClient suitable for testing Vent on Ethereum +type TransactClient struct { + client ethClient + chainID string + accounts []acm.AddressableSigner +} + +type ethClient interface { + AwaitTransaction(ctx context.Context, txHash string) (*Receipt, error) + SendTransaction(tx *EthSendTransactionParam) (string, error) + SendRawTransaction(txHex string) (string, error) + GetTransactionCount(address crypto.Address) (string, error) + NetVersion() (string, error) + GasPrice() (string, error) +} + +func NewTransactClient(client ethClient) *TransactClient { + return &TransactClient{ + client: client, + } +} + +func (cli *TransactClient) WithAccounts(signers ...acm.AddressableSigner) *TransactClient { + return &TransactClient{ + client: cli.client, + accounts: append(cli.accounts, signers...), + } +} + +func (cli *TransactClient) CallTxSync(ctx context.Context, tx *payload.CallTx, + opts ...grpc.CallOption) (*exec.TxExecution, error) { + + var signer acm.AddressableSigner + + for _, sa := range cli.accounts { + if sa.GetAddress() == tx.Input.Address { + signer = sa + break + } + } + + // Only set nonce for tx we sign, otherwise let server do it + err := cli.completeTx(tx, signer != nil) + if err != nil { + return nil, fmt.Errorf("could not set values on transaction") + } + + var txHash string + if signer == nil { + txHash, err = cli.SendTransaction(tx) + } else { + txHash, err = cli.SendRawTransaction(tx, signer) + } + if err != nil { + return nil, fmt.Errorf("could not send ethereum transaction: %w", err) + } + + fmt.Printf("Waiting for tranasaction %s to be confirmed...\n", txHash) + receipt, err := cli.client.AwaitTransaction(ctx, txHash) + if err != nil { + return nil, err + } + + d := new(web3hex.Decoder) + + header := &exec.TxHeader{ + TxType: payload.TypeCall, + TxHash: d.Bytes(receipt.TransactionHash), + Height: d.Uint64(receipt.BlockNumber), + Index: d.Uint64(receipt.TransactionIndex), + } + + // Attempt to provide sufficient return values to satisfy Vent's needs. + return &exec.TxExecution{ + TxHeader: header, + Receipt: &txs.Receipt{ + TxType: header.TxType, + TxHash: header.TxHash, + CreatesContract: receipt.ContractAddress != "", + ContractAddress: d.Address(receipt.ContractAddress), + }, + }, d.Err() +} + +func (cli *TransactClient) SendTransaction(tx *payload.CallTx) (string, error) { + var to string + if tx.Address != nil { + to = web3hex.Encoder.Address(*tx.Address) + } + + var nonce string + if tx.Input.Sequence != 0 { + nonce = web3hex.Encoder.Uint64OmitEmpty(tx.Input.Sequence) + } + + param := &EthSendTransactionParam{ + From: web3hex.Encoder.Address(tx.Input.Address), + To: to, + Gas: web3hex.Encoder.Uint64OmitEmpty(tx.GasLimit), + GasPrice: web3hex.Encoder.Uint64OmitEmpty(tx.GasPrice), + Value: web3hex.Encoder.Uint64OmitEmpty(tx.Input.Amount), + Data: web3hex.Encoder.BytesTrim(tx.Data), + Nonce: nonce, + } + + return cli.client.SendTransaction(param) +} + +func (cli *TransactClient) SendRawTransaction(tx *payload.CallTx, signer acm.AddressableSigner) (string, error) { + chainID, err := cli.GetChainID() + if err != nil { + return "", err + } + txEnv := txs.Enclose(chainID, tx) + + txEnv.Encoding = txs.Envelope_RLP + + err = txEnv.Sign(signer) + if err != nil { + return "", fmt.Errorf("could not sign Ethereum transaction: %w", err) + } + + rawTx, err := txs.EthRawTxFromEnvelope(txEnv) + if err != nil { + return "", fmt.Errorf("could not generate Ethereum raw transaction: %w", err) + } + + bs, err := rawTx.Marshal() + if err != nil { + return "", fmt.Errorf("could not marshal Ethereum raw transaction: %w", err) + } + + return cli.client.SendRawTransaction(web3hex.Encoder.BytesTrim(bs)) +} + +func (cli *TransactClient) GetChainID() (string, error) { + if cli.chainID == "" { + var err error + cli.chainID, err = cli.client.NetVersion() + if err != nil { + return "", fmt.Errorf("TransactClient could not get ChainID: %w", err) + } + } + return cli.chainID, nil +} + +func (cli *TransactClient) GetGasPrice() (uint64, error) { + gasPrice, err := cli.client.GasPrice() + if err != nil { + return 0, fmt.Errorf("could not get gas price: %w", err) + } + d := new(web3hex.Decoder) + return d.Uint64(gasPrice), d.Err() +} + +func (cli *TransactClient) GetTransactionCount(address crypto.Address) (uint64, error) { + count, err := cli.client.GetTransactionCount(address) + if err != nil { + return 0, fmt.Errorf("could not get transaction acount for address %s: %w", address, err) + } + d := new(web3hex.Decoder) + return d.Uint64(count), d.Err() +} + +func (cli *TransactClient) completeTx(tx *payload.CallTx, setNonce bool) error { + if tx.GasLimit == 0 { + tx.GasLimit = BasicGasLimit + } + var err error + if tx.GasPrice == 0 { + tx.GasPrice, err = cli.GetGasPrice() + if err != nil { + return err + } + } + if setNonce && tx.Input.Sequence == 0 { + tx.Input.Sequence, err = cli.GetTransactionCount(tx.Input.Address) + if err != nil { + return err + } + } + return nil +} diff --git a/rpc/web3/ethclient/transact_client_test.go b/rpc/web3/ethclient/transact_client_test.go new file mode 100644 index 000000000..f77b4c88b --- /dev/null +++ b/rpc/web3/ethclient/transact_client_test.go @@ -0,0 +1,35 @@ +// +build ethereum,integration + +package ethclient + +import ( + "context" + "fmt" + "testing" + + "github.com/hyperledger/burrow/execution/solidity" + "github.com/hyperledger/burrow/tests/web3/web3test" + "github.com/hyperledger/burrow/txs/payload" + "github.com/stretchr/testify/require" +) + +func TestEthTransactClient_CallTxSync(t *testing.T) { + pk := web3test.GetPrivateKey(t) + cli := NewTransactClient(NewEthClient(web3test.GetChainRPCClient())).WithAccounts(pk) + input := pk.GetAddress() + gasPrice, err := cli.GetGasPrice() + require.NoError(t, err) + nonce, err := cli.GetTransactionCount(input) + require.NoError(t, err) + txe, err := cli.CallTxSync(context.Background(), &payload.CallTx{ + Input: &payload.TxInput{ + Address: input, + Sequence: nonce, + }, + GasPrice: gasPrice, + GasLimit: BasicGasLimit * 10, + Data: solidity.Bytecode_EventEmitter, + }) + require.NoError(t, err) + fmt.Println(txe) +} diff --git a/rpc/web3/ethclient/types.go b/rpc/web3/ethclient/types.go new file mode 100644 index 000000000..c7ede5d4b --- /dev/null +++ b/rpc/web3/ethclient/types.go @@ -0,0 +1,150 @@ +package ethclient + +import ( + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding/web3hex" + "github.com/hyperledger/burrow/rpc/rpcevents" +) + +// These types partially duplicate some of those web3/types.go, the should probably be unified at some point but +// the types in web3/types.go are generated and some are incorrect so adding ones used by client here + +type EthLog struct { + Topics []string `json:"topics"` + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` + // Sender of the transaction + Address string `json:"address"` + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` + // Hex representation of a variable length byte array + Data string `json:"data"` + // Hex representation of the integer + LogIndex string `json:"logIndex"` + // Hex representation of the integer + TransactionIndex string `json:"transactionIndex"` +} + +// This is wrong in web3/types.go +type EthSendTransactionParam struct { + // Address of the sender + From string `json:"from"` + // address of the receiver. null when its a contract creation transaction + To string `json:"to,omitempty"` + // The data field sent with the transaction + Gas string `json:"gas,omitempty"` + // The gas price willing to be paid by the sender in Wei + GasPrice string `json:"gasPrice,omitempty"` + // The gas limit provided by the sender in Wei + Value string `json:"value,omitempty"` + // Hex representation of a Keccak 256 hash + Data string `json:"data"` + // A number only to be used once + Nonce string `json:"nonce,omitempty"` +} + +type Filter struct { + *rpcevents.BlockRange + Addresses []crypto.Address + Topics []binary.Word256 +} + +func (f *Filter) EthFilter() *EthFilter { + topics := make([]string, len(f.Topics)) + for i, t := range f.Topics { + topics[i] = web3hex.Encoder.BytesTrim(t[:]) + } + addresses := make([]string, len(f.Addresses)) + for i, a := range f.Addresses { + addresses[i] = web3hex.Encoder.Address(a) + } + return &EthFilter{ + FromBlock: logBound(f.GetStart()), + ToBlock: logBound(f.GetEnd()), + Addresses: addresses, + Topics: topics, + } +} + +type Receipt struct { + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` + // Hex representation of the integer + CumulativeGasUsed string `json:"cumulativeGasUsed"` + // Hex representation of the integer + GasUsed string `json:"gasUsed"` + // An array of all the logs triggered during the transaction + Logs []EthLog `json:"logs"` + // A 2048 bit bloom filter from the logs of the transaction. Each log sets 3 bits though taking the low-order 11 bits of each of the first three pairs of bytes in a Keccak 256 hash of the log's byte series + TransactionIndex string `json:"transactionIndex"` + // Whether or not the transaction threw an error. + Status string `json:"status"` + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // The contract address created, if the transaction was a contract creation, otherwise null + ContractAddress string `json:"contractAddress"` + // The sender of the transaction + From string `json:"from"` + // A 2048 bit bloom filter from the logs of the transaction. Each log sets 3 bits though taking the low-order 11 bits of each of the first three pairs of bytes in a Keccak 256 hash of the log's byte series + LogsBloom string `json:"logsBloom"` + // Destination address of the transaction + To string `json:"to"` + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` +} + +// Duplicated here to allow for arrays of addresses +type EthFilter struct { + // The hex representation of the block's height + FromBlock string `json:"fromBlock,omitempty"` + // The hex representation of the block's height + ToBlock string `json:"toBlock,omitempty"` + // Yes this is JSON address since allowed to be singular + Addresses []string `json:"address,omitempty"` + // Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with 'or' options + Topics []string `json:"topics,omitempty"` +} + +type Block struct { + // Hex representation of a Keccak 256 hash + Sha3Uncles string `json:"sha3Uncles"` + // Hex representation of a Keccak 256 hash + TransactionsRoot string `json:"transactionsRoot"` + // Hex representation of a Keccak 256 hash + ParentHash string `json:"parentHash"` + // The address of the beneficiary to whom the mining rewards were given or null when its the pending block + Miner string `json:"miner"` + // Integer of the difficulty for this block + Difficulty string `json:"difficulty"` + // The total used gas by all transactions in this block + GasUsed string `json:"gasUsed"` + // The unix timestamp for when the block was collated + Timestamp string `json:"timestamp"` + // Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter + Transactions []string `json:"transactions"` + // The block number or null when its the pending block + Number string `json:"number"` + // The block hash or null when its the pending block + Hash string `json:"hash"` + // Array of uncle hashes + Uncles []string `json:"uncles"` + // Hex representation of a Keccak 256 hash + ReceiptsRoot string `json:"receiptsRoot"` + // The 'extra data' field of this block + ExtraData string `json:"extraData"` + // Hex representation of a Keccak 256 hash + StateRoot string `json:"stateRoot"` + // Integer of the total difficulty of the chain until this block + TotalDifficulty string `json:"totalDifficulty"` + // Integer the size of this block in bytes + Size string `json:"size"` + // The maximum gas allowed in this block + GasLimit string `json:"gasLimit"` + // Randomly selected number to satisfy the proof-of-work or null when its the pending block + Nonce string `json:"nonce"` + // The bloom filter for the logs of the block or null when its the pending block + LogsBloom string `json:"logsBloom"` +} diff --git a/rpc/web3/server.go b/rpc/web3/server.go new file mode 100644 index 000000000..4e336a4c9 --- /dev/null +++ b/rpc/web3/server.go @@ -0,0 +1,508 @@ +// Code generated by go-openrpc. DO NOT EDIT. +package web3 + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "reflect" +) + +const JSONRPC = "2.0" + +type Code uint32 + +const ( + ErrUnknown Code = iota + ErrCouldNotParse + ErrInvalidRequest + ErrNotFound + ErrInvalidParams + ErrInternal + ErrServer +) + +func (c Code) Error() string { + return fmt.Sprintf("Error %d: %s", c, c.String()) +} + +func (c Code) String() string { + switch c { + case ErrCouldNotParse: + return "could not parse input" + case ErrInvalidRequest: + return "invalid request" + case ErrNotFound: + return "not found" + case ErrInvalidParams: + return "invalid parameters" + case ErrInternal: + return "internal error" + case ErrServer: + return "server error" + default: + return "unknown error" + } +} + +func (c Code) RPCError() *RPCError { + switch c { + case ErrCouldNotParse: + return NewRPCError(-32700, c.String()) + case ErrInvalidRequest: + return NewRPCError(-32600, c.String()) + case ErrNotFound: + return NewRPCError(-32601, c.String()) + case ErrInvalidParams: + return NewRPCError(-32602, c.String()) + case ErrInternal: + return NewRPCError(-32603, c.String()) + case ErrServer: + return NewRPCError(-32000, c.String()) + default: + return NewRPCError(-32099, c.String()) + } +} + +func (c Code) RPCErrorWithMessage(msg string) *RPCError { + resp := c.RPCError() + resp.Message = msg + return resp +} + +// https://www.jsonrpc.org/specification#request_object +type RPCRequest struct { + JSONRPC string `json:"jsonrpc"` + ID interface{} `json:"id"` + Method string `json:"method"` + Params json.RawMessage `json:"params"` +} + +// https://www.jsonrpc.org/specification#response_object +type RPCResultResponse struct { + JSONRPC string `json:"jsonrpc"` + ID interface{} `json:"id"` + Result interface{} `json:"result"` +} + +// https://www.jsonrpc.org/specification#response_object +type RPCErrorResponse struct { + JSONRPC string `json:"jsonrpc"` + ID interface{} `json:"id"` + Error *RPCError `json:"error"` +} + +// https://www.jsonrpc.org/specification#error_object +type RPCError struct { + Code int `json:"code"` + Message string `json:"message"` + Data interface{} `json:"data,omitempty"` +} + +func NewRPCError(code int, msg string) *RPCError { + return &RPCError{Code: code, Message: msg} +} + +func (r *RPCError) AsRPCErrorResponse(id interface{}) RPCErrorResponse { + return RPCErrorResponse{ + JSONRPC: JSONRPC, + ID: id, + Error: r, + } +} + +type Server struct { + service Service +} + +func NewServer(rpc Service) *Server { + return &Server{rpc} +} + +func (srv *Server) HandleHTTP(rpcPath string) { + http.Handle(rpcPath, srv) +} + +// https://github.com/a8m/reflect-examples#wrap-a-reflectvalue-with-pointer-t--t +func ptr(v reflect.Value) reflect.Value { + pt := reflect.PtrTo(v.Type()) + pv := reflect.New(pt.Elem()) + pv.Elem().Set(v) + return pv +} + +func ParamsToStruct(msg json.RawMessage, req interface{}) error { + // by-name + err := json.Unmarshal(msg, req) + if err == nil { + return nil + } + + // by-position + params := make([]json.RawMessage, 0) + err = json.Unmarshal(msg, ¶ms) + if err != nil { + return err + } + val := reflect.ValueOf(req) + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + + for i, p := range params { + if i >= val.NumField() { + break + } + field := val.Field(i) + if field.CanSet() { + pf := ptr(field) + err = json.Unmarshal(p, pf.Interface()) + if err != nil { + return err + } + field.Set(pf.Elem()) + } + } + return nil +} + +func StructToResult(in interface{}) interface{} { + val := reflect.ValueOf(in) + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + if val.Kind() != reflect.Struct { + return in + } + if val.NumField() == 1 { + return val.Field(0).Interface() + } else if val.NumField() > 1 { + result := make([]interface{}, 0) + for i := 0; i < val.NumField(); i++ { + field := val.Field(i) + if val.Kind() == reflect.Ptr { + field = field.Elem() + } + + if field.Kind() == reflect.Slice { + for i := 0; i < field.Len(); i++ { + result = append(result, field.Index(i).Interface()) + } + } else if field.CanInterface() { + result = append(result, field.Interface()) + } + } + return result + } else { + return nil + } +} + +func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.Method == http.MethodOptions { + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS") + w.Header().Set("Access-Control-Allow-Headers", "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range") + w.Header().Set("Accept-Range", "bytes") + w.WriteHeader(http.StatusOK) + w.Write([]byte{}) + return + } else if r.Method != http.MethodPost { + WriteData(w, ErrInternal.RPCError().AsRPCErrorResponse(nil)) + return + } + + data, err := ioutil.ReadAll(r.Body) + if err != nil { + WriteData(w, ErrInvalidRequest.RPCError().AsRPCErrorResponse(nil)) + return + } + r.Body.Close() + + requests := make([]RPCRequest, 0) + err = json.Unmarshal(data, &requests) + if err != nil { + request := new(RPCRequest) + err = json.Unmarshal(data, request) + if err != nil { + WriteData(w, ErrCouldNotParse.RPCError().AsRPCErrorResponse(nil)) + return + } + requests = []RPCRequest{*request} + } + + responses := make([]interface{}, 0) + for _, req := range requests { + responses = append(responses, srv.Do(req)) + } + + if len(responses) == 1 { + WriteData(w, responses[0]) + } else { + WriteData(w, responses) + } +} + +func (srv *Server) Do(in RPCRequest) interface{} { + if in.JSONRPC != JSONRPC || in.Method == "" || in.ID == nil { + return ErrInvalidParams.RPCError().AsRPCErrorResponse(nil) + } + + var err error + var out interface{} + + switch in.Method { + case "web3_clientVersion": + out, err = srv.service.Web3ClientVersion() + case "web3_sha3": + req := new(Web3Sha3Params) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.Web3Sha3(req) + } + case "net_listening": + out, err = srv.service.NetListening() + case "net_peerCount": + out, err = srv.service.NetPeerCount() + case "net_version": + out, err = srv.service.NetVersion() + case "eth_blockNumber": + out, err = srv.service.EthBlockNumber() + case "eth_call": + req := new(EthCallParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthCall(req) + } + case "eth_chainId": + out, err = srv.service.EthChainId() + case "eth_coinbase": + out, err = srv.service.EthCoinbase() + case "eth_estimateGas": + req := new(EthEstimateGasParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthEstimateGas(req) + } + case "eth_gasPrice": + out, err = srv.service.EthGasPrice() + case "eth_getBalance": + req := new(EthGetBalanceParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetBalance(req) + } + case "eth_getBlockByHash": + req := new(EthGetBlockByHashParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetBlockByHash(req) + } + case "eth_getBlockByNumber": + req := new(EthGetBlockByNumberParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetBlockByNumber(req) + } + case "eth_getBlockTransactionCountByHash": + req := new(EthGetBlockTransactionCountByHashParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetBlockTransactionCountByHash(req) + } + case "eth_getBlockTransactionCountByNumber": + req := new(EthGetBlockTransactionCountByNumberParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetBlockTransactionCountByNumber(req) + } + case "eth_getCode": + req := new(EthGetCodeParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetCode(req) + } + case "eth_getFilterChanges": + req := new(EthGetFilterChangesParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetFilterChanges(req) + } + case "eth_getFilterLogs": + req := new(EthGetFilterLogsParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetFilterLogs(req) + } + case "eth_getRawTransactionByHash": + req := new(EthGetRawTransactionByHashParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetRawTransactionByHash(req) + } + case "eth_getRawTransactionByBlockHashAndIndex": + req := new(EthGetRawTransactionByBlockHashAndIndexParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetRawTransactionByBlockHashAndIndex(req) + } + case "eth_getRawTransactionByBlockNumberAndIndex": + req := new(EthGetRawTransactionByBlockNumberAndIndexParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetRawTransactionByBlockNumberAndIndex(req) + } + case "eth_getLogs": + req := new(EthGetLogsParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetLogs(req) + } + case "eth_getStorageAt": + req := new(EthGetStorageAtParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetStorageAt(req) + } + case "eth_getTransactionByBlockHashAndIndex": + req := new(EthGetTransactionByBlockHashAndIndexParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetTransactionByBlockHashAndIndex(req) + } + case "eth_getTransactionByBlockNumberAndIndex": + req := new(EthGetTransactionByBlockNumberAndIndexParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetTransactionByBlockNumberAndIndex(req) + } + case "eth_getTransactionByHash": + req := new(EthGetTransactionByHashParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetTransactionByHash(req) + } + case "eth_getTransactionCount": + req := new(EthGetTransactionCountParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetTransactionCount(req) + } + case "eth_getTransactionReceipt": + req := new(EthGetTransactionReceiptParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetTransactionReceipt(req) + } + case "eth_getUncleByBlockHashAndIndex": + req := new(EthGetUncleByBlockHashAndIndexParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetUncleByBlockHashAndIndex(req) + } + case "eth_getUncleByBlockNumberAndIndex": + req := new(EthGetUncleByBlockNumberAndIndexParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetUncleByBlockNumberAndIndex(req) + } + case "eth_getUncleCountByBlockHash": + req := new(EthGetUncleCountByBlockHashParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetUncleCountByBlockHash(req) + } + case "eth_getUncleCountByBlockNumber": + req := new(EthGetUncleCountByBlockNumberParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetUncleCountByBlockNumber(req) + } + case "eth_getProof": + req := new(EthGetProofParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthGetProof(req) + } + case "eth_getWork": + out, err = srv.service.EthGetWork() + case "eth_hashrate": + out, err = srv.service.EthHashrate() + case "eth_mining": + out, err = srv.service.EthMining() + case "eth_newBlockFilter": + out, err = srv.service.EthNewBlockFilter() + case "eth_newFilter": + req := new(EthNewFilterParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthNewFilter(req) + } + case "eth_newPendingTransactionFilter": + out, err = srv.service.EthNewPendingTransactionFilter() + case "eth_pendingTransactions": + out, err = srv.service.EthPendingTransactions() + case "eth_protocolVersion": + out, err = srv.service.EthProtocolVersion() + case "eth_sign": + req := new(EthSignParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthSign(req) + } + case "eth_accounts": + out, err = srv.service.EthAccounts() + case "eth_sendTransaction": + req := new(EthSendTransactionParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthSendTransaction(req) + } + case "eth_sendRawTransaction": + req := new(EthSendRawTransactionParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthSendRawTransaction(req) + } + case "eth_submitHashrate": + req := new(EthSubmitHashrateParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthSubmitHashrate(req) + } + case "eth_submitWork": + req := new(EthSubmitWorkParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthSubmitWork(req) + } + case "eth_syncing": + out, err = srv.service.EthSyncing() + case "eth_uninstallFilter": + req := new(EthUninstallFilterParams) + err = ParamsToStruct(in.Params, req) + if err == nil { + out, err = srv.service.EthUninstallFilter(req) + } + } + + if err != nil { + return ErrInternal.RPCErrorWithMessage(err.Error()).AsRPCErrorResponse(in.ID) + } + + return RPCResultResponse{ + JSONRPC: JSONRPC, + ID: in.ID, + Result: StructToResult(out), + } +} + +func WriteData(w http.ResponseWriter, resp interface{}) { + data, err := json.Marshal(resp) + if err != nil { + panic(err) + } + w.Header().Set("Content-Type", "application/json") + w.Write(data) +} diff --git a/rpc/web3/types.go b/rpc/web3/types.go new file mode 100644 index 000000000..4cc18fc2b --- /dev/null +++ b/rpc/web3/types.go @@ -0,0 +1,818 @@ +// Code generated by go-openrpc. DO NOT EDIT. +package web3 + +type Service interface { + // Returns the version of the current client + Web3ClientVersion() (*Web3ClientVersionResult, error) + // Hashes data using the Keccak-256 algorithm + Web3Sha3(*Web3Sha3Params) (*Web3Sha3Result, error) + // Determines if this client is listening for new network connections. + NetListening() (*NetListeningResult, error) + // Returns the number of peers currently connected to this client. + NetPeerCount() (*NetPeerCountResult, error) + // Returns the chain ID associated with the current network. + NetVersion() (*NetVersionResult, error) + // Returns the number of most recent block. + EthBlockNumber() (*EthBlockNumberResult, error) + // Executes a new message call (locally) immediately without creating a transaction on the block chain. + EthCall(*EthCallParams) (*EthCallResult, error) + // Returns the currently configured chain id, a value used in replay-protected transaction signing as introduced by [EIP-155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md). + EthChainId() (*EthChainIdResult, error) + // Returns the client coinbase address. + EthCoinbase() (*EthCoinbaseResult, error) + // Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance. + EthEstimateGas(*EthEstimateGasParams) (*EthEstimateGasResult, error) + // Returns the current price per gas in wei + EthGasPrice() (*EthGasPriceResult, error) + // Returns Ether balance of a given or account or contract + EthGetBalance(*EthGetBalanceParams) (*EthGetBalanceResult, error) + // Gets a block for a given hash + EthGetBlockByHash(*EthGetBlockByHashParams) (*EthGetBlockByHashResult, error) + // Gets a block for a given number salad + EthGetBlockByNumber(*EthGetBlockByNumberParams) (*EthGetBlockByNumberResult, error) + // Returns the number of transactions in a block from a block matching the given block hash. + EthGetBlockTransactionCountByHash(*EthGetBlockTransactionCountByHashParams) (*EthGetBlockTransactionCountByHashResult, error) + // Returns the number of transactions in a block from a block matching the given block number. + EthGetBlockTransactionCountByNumber(*EthGetBlockTransactionCountByNumberParams) (*EthGetBlockTransactionCountByNumberResult, error) + // Returns code at a given contract address + EthGetCode(*EthGetCodeParams) (*EthGetCodeResult, error) + // Polling method for a filter, which returns an array of logs which occurred since last poll. + EthGetFilterChanges(*EthGetFilterChangesParams) (*EthGetFilterChangesResult, error) + // Returns an array of all logs matching filter with given id. + EthGetFilterLogs(*EthGetFilterLogsParams) (*EthGetFilterLogsResult, error) + // Returns raw transaction data of a transaction with the given hash. + EthGetRawTransactionByHash(*EthGetRawTransactionByHashParams) (*EthGetRawTransactionByHashResult, error) + // Returns raw transaction data of a transaction with the given hash. + EthGetRawTransactionByBlockHashAndIndex(*EthGetRawTransactionByBlockHashAndIndexParams) (*EthGetRawTransactionByBlockHashAndIndexResult, error) + // Returns raw transaction data of a transaction with the given hash. + EthGetRawTransactionByBlockNumberAndIndex(*EthGetRawTransactionByBlockNumberAndIndexParams) (*EthGetRawTransactionByBlockNumberAndIndexResult, error) + // Returns an array of all logs matching a given filter object. + EthGetLogs(*EthGetLogsParams) (*EthGetLogsResult, error) + // Gets a storage value from a contract address, a position, and an optional blockNumber + EthGetStorageAt(*EthGetStorageAtParams) (*EthGetStorageAtResult, error) + // Returns the information about a transaction requested by the block hash and index of which it was mined. + EthGetTransactionByBlockHashAndIndex(*EthGetTransactionByBlockHashAndIndexParams) (*EthGetTransactionByBlockHashAndIndexResult, error) + // Returns the information about a transaction requested by the block hash and index of which it was mined. + EthGetTransactionByBlockNumberAndIndex(*EthGetTransactionByBlockNumberAndIndexParams) (*EthGetTransactionByBlockNumberAndIndexResult, error) + // Returns the information about a transaction requested by transaction hash. + EthGetTransactionByHash(*EthGetTransactionByHashParams) (*EthGetTransactionByHashResult, error) + // Returns the number of transactions sent from an address + EthGetTransactionCount(*EthGetTransactionCountParams) (*EthGetTransactionCountResult, error) + // Returns the receipt information of a transaction by its hash. + EthGetTransactionReceipt(*EthGetTransactionReceiptParams) (*EthGetTransactionReceiptResult, error) + // Returns information about a uncle of a block by hash and uncle index position. + EthGetUncleByBlockHashAndIndex(*EthGetUncleByBlockHashAndIndexParams) (*EthGetUncleByBlockHashAndIndexResult, error) + // Returns information about a uncle of a block by hash and uncle index position. + EthGetUncleByBlockNumberAndIndex(*EthGetUncleByBlockNumberAndIndexParams) (*EthGetUncleByBlockNumberAndIndexResult, error) + // Returns the number of uncles in a block from a block matching the given block hash. + EthGetUncleCountByBlockHash(*EthGetUncleCountByBlockHashParams) (*EthGetUncleCountByBlockHashResult, error) + // Returns the number of uncles in a block from a block matching the given block number. + EthGetUncleCountByBlockNumber(*EthGetUncleCountByBlockNumberParams) (*EthGetUncleCountByBlockNumberResult, error) + // Returns the account- and storage-values of the specified account including the Merkle-proof. + EthGetProof(*EthGetProofParams) (*EthGetProofResult, error) + // Returns the hash of the current block, the seedHash, and the boundary condition to be met ('target'). + EthGetWork() (*EthGetWorkResult, error) + // Returns the number of hashes per second that the node is mining with. + EthHashrate() (*EthHashrateResult, error) + // Returns true if client is actively mining new blocks. + EthMining() (*EthMiningResult, error) + // Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges. + EthNewBlockFilter() (*EthNewBlockFilterResult, error) + // Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges. + EthNewFilter(*EthNewFilterParams) (*EthNewFilterResult, error) + // Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges. + EthNewPendingTransactionFilter() (*EthNewPendingTransactionFilterResult, error) + // Returns the pending transactions list + EthPendingTransactions() (*EthPendingTransactionsResult, error) + // Returns the current ethereum protocol version. + EthProtocolVersion() (*EthProtocolVersionResult, error) + // The sign method calculates an Ethereum specific signature. + EthSign(*EthSignParams) (*EthSignResult, error) + // Returns a list of addresses owned by client. + EthAccounts() (*EthAccountsResult, error) + // Creates new message call transaction or a contract creation, if the data field contains code. + EthSendTransaction(*EthSendTransactionParams) (*EthSendTransactionResult, error) + // Creates new message call transaction or a contract creation for signed transactions. + EthSendRawTransaction(*EthSendRawTransactionParams) (*EthSendRawTransactionResult, error) + // Returns an array of all logs matching a given filter object. + EthSubmitHashrate(*EthSubmitHashrateParams) (*EthSubmitHashrateResult, error) + // Used for submitting a proof-of-work solution. + EthSubmitWork(*EthSubmitWorkParams) (*EthSubmitWorkResult, error) + // Returns an object with data about the sync status or false. + EthSyncing() (*EthSyncingResult, error) + // Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additionally Filters timeout when they aren't requested with eth_getFilterChanges for a period of time. + EthUninstallFilter(*EthUninstallFilterParams) (*EthUninstallFilterResult, error) +} +type Web3ClientVersionResult struct { + // client version + ClientVersion string `json:"clientVersion"` +} +type Web3Sha3Params struct { + // data to hash using the Keccak-256 algorithm + Data string `json:"data"` +} +type Web3Sha3Result struct { + // Hex representation of a Keccak 256 hash + HashedData string `json:"hashedData"` +} +type NetListeningResult struct { + // `true` if listening is active or `false` if listening is not active + IsNetListening bool `json:"isNetListening"` +} +type NetPeerCountResult struct { + // Hex representation of number of connected peers + NumConnectedPeers string `json:"numConnectedPeers"` +} +type NetVersionResult struct { + // chain ID associated with the current network + ChainID string `json:"chainID"` +} +type BlockNumber struct { + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` +} +type EthBlockNumberResult struct { + BlockNumber string `json:"blockNumber"` +} +type TransactionIndex struct { + // Hex representation of the integer + Integer string `json:"integer"` +} +type Transaction struct { + // Integer of the transaction's index position in the block. null when its pending + TransactionIndex string `json:"transactionIndex"` + // Hash of the block where this transaction was in. null when its pending + BlockHash string `json:"blockHash"` + // Address of the sender + From string `json:"from"` + // Hex representation of a Keccak 256 hash + Hash string `json:"hash"` + // The data field sent with the transaction + Data string `json:"data"` + // A number only to be used once + Nonce string `json:"nonce"` + // The gas limit provided by the sender in Wei + Gas string `json:"gas"` + // Hex representation of a Keccak 256 hash + Value string `json:"value"` + // ECDSA recovery id + V string `json:"v"` + // ECDSA signature s + S string `json:"s"` + // The gas price willing to be paid by the sender in Wei + GasPrice string `json:"gasPrice"` + // address of the receiver. null when its a contract creation transaction + To string `json:"to"` + // Block number where this transaction was in. null when its pending + BlockNumber string `json:"blockNumber"` + // ECDSA signature r + R string `json:"r"` +} +type BlockHash struct { + // Hex representation of a Keccak 256 hash + Keccak string `json:"keccak"` +} +type EthCallParams struct { + Transaction + + BlockNumber string `json:"blockNumber"` +} +type EthCallResult struct { + // Hex representation of a variable length byte array + ReturnValue string `json:"returnValue"` +} +type EthChainIdResult struct { + // hex format integer of the current chain id. Defaults are mainnet=61, morden=62. + ChainId string `json:"chainId"` +} +type EthCoinbaseResult struct { + // The address owned by the client that is used as default for things like the mining reward + Address string `json:"address"` +} +type EthEstimateGasParams struct { + Transaction +} +type EthEstimateGasResult struct { + // Hex representation of the integer + GasUsed string `json:"gasUsed"` +} +type EthGasPriceResult struct { + // Hex representation of the integer + GasPrice string `json:"gasPrice"` +} +type EthGetBalanceParams struct { + // The address of the account or contract + Address string `json:"address"` + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` +} +type GetBalanceResult struct { + // Hex representation of the integer + Integer string `json:"integer"` +} +type EthGetBalanceResult struct { + GetBalanceResult string `json:"getBalanceResult"` +} +type EthGetBlockByHashParams struct { + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // If `true` it returns the full transaction objects, if `false` only the hashes of the transactions. + IsTransactionsIncluded bool `json:"isTransactionsIncluded"` +} +type Block struct { + // Hex representation of a Keccak 256 hash + Sha3Uncles string `json:"sha3Uncles"` + // Hex representation of a Keccak 256 hash + TransactionsRoot string `json:"transactionsRoot"` + // Hex representation of a Keccak 256 hash + ParentHash string `json:"parentHash"` + // The address of the beneficiary to whom the mining rewards were given or null when its the pending block + Miner string `json:"miner"` + // Integer of the difficulty for this block + Difficulty string `json:"difficulty"` + // The total used gas by all transactions in this block + GasUsed string `json:"gasUsed"` + // The unix timestamp for when the block was collated + Timestamp string `json:"timestamp"` + // Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter + Transactions []Transactions `json:"transactions"` + // The block number or null when its the pending block + Number string `json:"number"` + // The block hash or null when its the pending block + Hash string `json:"hash"` + // Array of uncle hashes + Uncles []string `json:"uncles"` + // Hex representation of a Keccak 256 hash + ReceiptsRoot string `json:"receiptsRoot"` + // The 'extra data' field of this block + ExtraData string `json:"extraData"` + // Hex representation of a Keccak 256 hash + StateRoot string `json:"stateRoot"` + // Integer of the total difficulty of the chain until this block + TotalDifficulty string `json:"totalDifficulty"` + // Integer the size of this block in bytes + Size string `json:"size"` + // The maximum gas allowed in this block + GasLimit string `json:"gasLimit"` + // Randomly selected number to satisfy the proof-of-work or null when its the pending block + Nonce string `json:"nonce"` + // The bloom filter for the logs of the block or null when its the pending block + LogsBloom string `json:"logsBloom"` +} +type Miner struct { + Address string `json:"address"` +} +type Transactions struct { + Transaction +} +type Number struct { + // Hex representation of the integer + Integer string `json:"integer"` +} +type Hash struct { + // Hex representation of a Keccak 256 hash + Keccak string `json:"keccak"` +} +type Uncles struct { + // Hex representation of a Keccak 256 hash + Keccak string `json:"keccak"` +} +type TotalDifficulty struct { + // Hex representation of the integer + Integer string `json:"integer"` +} +type Nonce struct { + // Hex representation of the integer + Integer string `json:"integer"` +} +type GetBlockByHashResult struct { + Block +} +type EthGetBlockByHashResult struct { + GetBlockByHashResult Block `json:"getBlockByHashResult"` +} +type EthGetBlockByNumberParams struct { + BlockNumber string `json:"blockNumber"` + // If `true` it returns the full transaction objects, if `false` only the hashes of the transactions. + IsTransactionsIncluded bool `json:"isTransactionsIncluded"` +} +type GetBlockByNumberResult struct { + Block +} +type EthGetBlockByNumberResult struct { + GetBlockByNumberResult Block `json:"getBlockByNumberResult"` +} +type EthGetBlockTransactionCountByHashParams struct { + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` +} +type BlockTransactionCountByHash struct { + // Hex representation of the integer + Integer string `json:"integer"` +} +type EthGetBlockTransactionCountByHashResult struct { + // The Number of total transactions in the given block + BlockTransactionCountByHash string `json:"blockTransactionCountByHash"` +} +type EthGetBlockTransactionCountByNumberParams struct { + BlockNumber string `json:"blockNumber"` +} +type EthGetBlockTransactionCountByNumberResult struct { + // The Number of total transactions in the given block + BlockTransactionCountByHash string `json:"blockTransactionCountByHash"` +} +type EthGetCodeParams struct { + // The address of the contract + Address string `json:"address"` + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` +} +type EthGetCodeResult struct { + // Hex representation of a variable length byte array + Bytes string `json:"bytes"` +} +type EthGetFilterChangesParams struct { + // An identifier used to reference the filter. + FilterId string `json:"filterId"` +} +type Log struct { + Topics []Topics `json:"topics"` + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` + // Sender of the transaction + Address string `json:"address"` + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` + // Hex representation of a variable length byte array + Data string `json:"data"` + // Hex representation of the integer + LogIndex string `json:"logIndex"` + // Hex representation of the integer + TransactionIndex string `json:"transactionIndex"` +} +type LogResult struct { + // An indexed event generated during a transaction + Log + + Topics []Topics `json:"topics"` + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` + // Sender of the transaction + Address string `json:"address"` + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` + // Hex representation of a variable length byte array + Data string `json:"data"` + // Hex representation of the integer + LogIndex string `json:"logIndex"` + // Hex representation of the integer + TransactionIndex string `json:"transactionIndex"` +} +type EthGetFilterChangesResult struct { + LogResult []LogResult `json:"logResult"` +} +type EthGetFilterLogsParams struct { + // An identifier used to reference the filter. + FilterId string `json:"filterId"` +} +type Logs struct { + // An indexed event generated during a transaction + Log + // Hex representation of the integer + LogIndex string `json:"logIndex"` + // Hex representation of the integer + TransactionIndex string `json:"transactionIndex"` + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` + // Sender of the transaction + Address string `json:"address"` + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` + // Hex representation of a variable length byte array + Data string `json:"data"` + + Topics []Topics `json:"topics"` +} +type EthGetFilterLogsResult struct { + Logs []Logs `json:"logs"` +} +type EthGetRawTransactionByHashParams struct { + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` +} +type EthGetRawTransactionByHashResult struct { + // Hex representation of a variable length byte array + RawTransactionByHash string `json:"rawTransactionByHash"` +} +type EthGetRawTransactionByBlockHashAndIndexParams struct { + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // Hex representation of the integer + Index string `json:"index"` +} +type EthGetRawTransactionByBlockHashAndIndexResult struct { + // Hex representation of a variable length byte array + RawTransaction string `json:"rawTransaction"` +} +type EthGetRawTransactionByBlockNumberAndIndexParams struct { + BlockNumber string `json:"blockNumber"` + // Hex representation of the integer + Index string `json:"index"` +} +type EthGetRawTransactionByBlockNumberAndIndexResult struct { + // Hex representation of a variable length byte array + RawTransaction string `json:"rawTransaction"` +} +type Filter struct { + // The hex representation of the block's height + FromBlock string `json:"fromBlock"` + // The hex representation of the block's height + ToBlock string `json:"toBlock"` + + Address string `json:"address"` + // Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with 'or' options + Topics []string `json:"topics"` +} +type Address struct { + // Address of the contract from which to monitor events + Address string `json:"address"` +} +type Topics struct { + // Hex representation of a 256 bit unit of data + DataWord string `json:"dataWord"` +} +type EthGetLogsParams struct { + // A filter used to monitor the blockchain for log/events + Filter +} +type EthGetLogsResult struct { + Logs []Logs `json:"logs"` +} +type EthGetStorageAtParams struct { + Address string `json:"address"` + // Hex representation of the storage slot where the variable exists + Position string `json:"position"` + + BlockNumber string `json:"blockNumber"` +} +type EthGetStorageAtResult struct { + // Hex representation of a 256 bit unit of data + DataWord string `json:"dataWord"` +} +type EthGetTransactionByBlockHashAndIndexParams struct { + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // Hex representation of the integer + Index string `json:"index"` +} +type TransactionResult struct { + Transaction +} +type EthGetTransactionByBlockHashAndIndexResult struct { + TransactionResult Transaction `json:"transactionResult"` +} +type EthGetTransactionByBlockNumberAndIndexParams struct { + BlockNumber string `json:"blockNumber"` + // Hex representation of the integer + Index string `json:"index"` +} +type EthGetTransactionByBlockNumberAndIndexResult struct { + TransactionResult Transaction `json:"transactionResult"` +} +type EthGetTransactionByHashParams struct { + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` +} +type EthGetTransactionByHashResult struct { + Transaction +} +type EthGetTransactionCountParams struct { + Address string `json:"address"` + + BlockNumber string `json:"blockNumber"` +} +type NonceOrNull struct { + // A number only to be used once + Nonce string `json:"nonce"` +} +type EthGetTransactionCountResult struct { + NonceOrNull string `json:"nonceOrNull"` +} +type EthGetTransactionReceiptParams struct { + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` +} +type Receipt struct { + // The hex representation of the block's height + BlockNumber string `json:"blockNumber"` + // Hex representation of the integer + CumulativeGasUsed string `json:"cumulativeGasUsed"` + // Hex representation of the integer + GasUsed string `json:"gasUsed"` + // An array of all the logs triggered during the transaction + Logs []Logs `json:"logs"` + // A 2048 bit bloom filter from the logs of the transaction. Each log sets 3 bits though taking the low-order 11 bits of each of the first three pairs of bytes in a Keccak 256 hash of the log's byte series + TransactionIndex string `json:"transactionIndex"` + // Whether or not the transaction threw an error. + Status string `json:"status"` + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // The contract address created, if the transaction was a contract creation, otherwise null + ContractAddress string `json:"contractAddress"` + // The sender of the transaction + From string `json:"from"` + // A 2048 bit bloom filter from the logs of the transaction. Each log sets 3 bits though taking the low-order 11 bits of each of the first three pairs of bytes in a Keccak 256 hash of the log's byte series + LogsBloom string `json:"logsBloom"` + // Destination address of the transaction + To string `json:"to"` + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` +} +type EthGetTransactionReceiptResult struct { + // returns either a receipt or null + Receipt +} +type EthGetUncleByBlockHashAndIndexParams struct { + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` + // Hex representation of the integer + Index string `json:"index"` +} +type Uncle struct { + // Randomly selected number to satisfy the proof-of-work or null when its the pending block + Nonce string `json:"nonce"` + // Hex representation of a Keccak 256 hash + TransactionsRoot string `json:"transactionsRoot"` + // Integer of the total difficulty of the chain until this block + TotalDifficulty string `json:"totalDifficulty"` + // Integer the size of this block in bytes + Size string `json:"size"` + // The total used gas by all transactions in this block + GasUsed string `json:"gasUsed"` + // Array of uncle hashes + Uncles []string `json:"uncles"` + // The block number or null when its the pending block + Number string `json:"number"` + // The block hash or null when its the pending block + Hash string `json:"hash"` + // Hex representation of a Keccak 256 hash + Sha3Uncles string `json:"sha3Uncles"` + // Hex representation of a Keccak 256 hash + StateRoot string `json:"stateRoot"` + // The 'extra data' field of this block + ExtraData string `json:"extraData"` + // The unix timestamp for when the block was collated + Timestamp string `json:"timestamp"` + // Hex representation of a Keccak 256 hash + ReceiptsRoot string `json:"receiptsRoot"` + // The address of the beneficiary to whom the mining rewards were given or null when its the pending block + Miner string `json:"miner"` + // The maximum gas allowed in this block + GasLimit string `json:"gasLimit"` + // Hex representation of a Keccak 256 hash + ParentHash string `json:"parentHash"` + // The bloom filter for the logs of the block or null when its the pending block + LogsBloom string `json:"logsBloom"` + // Integer of the difficulty for this block + Difficulty string `json:"difficulty"` +} +type UncleOrNull struct { + // Orphaned blocks that can be included in the chain but at a lower block reward. NOTE: An uncle doesn’t contain individual transactions. + Uncle +} +type EthGetUncleByBlockHashAndIndexResult struct { + UncleOrNull Uncle `json:"uncleOrNull"` +} +type EthGetUncleByBlockNumberAndIndexParams struct { + // The hex representation of the block's height + UncleBlockNumber string `json:"uncleBlockNumber"` + // Hex representation of the integer + Index string `json:"index"` +} +type UncleResult struct { + // Orphaned blocks that can be included in the chain but at a lower block reward. NOTE: An uncle doesn’t contain individual transactions. + Uncle +} +type EthGetUncleByBlockNumberAndIndexResult struct { + // returns an uncle or null + UncleResult Uncle `json:"uncleResult"` +} +type EthGetUncleCountByBlockHashParams struct { + // The hex representation of the Keccak 256 of the RLP encoded block + BlockHash string `json:"blockHash"` +} +type UncleCountOrNull struct { + // Hex representation of the integer + Integer string `json:"integer"` +} +type EthGetUncleCountByBlockHashResult struct { + UncleCountOrNull string `json:"uncleCountOrNull"` +} +type EthGetUncleCountByBlockNumberParams struct { + BlockNumber string `json:"blockNumber"` +} +type EthGetUncleCountByBlockNumberResult struct { + UncleCountOrNull string `json:"uncleCountOrNull"` +} +type EthGetProofParams struct { + // The address of the account or contract + Address string `json:"address"` + // The storage keys of all the storage slots being requested + StorageKeys []string `json:"storageKeys"` + + BlockNumber string `json:"blockNumber"` +} +type StorageKeys struct { + // Hex representation of the integer + Integer string `json:"integer"` +} +type ProofAccount struct { + // Hex representation of the integer + Balance string `json:"balance"` + // Hex representation of a Keccak 256 hash + CodeHash string `json:"codeHash"` + // A number only to be used once + Nonce string `json:"nonce"` + // Hex representation of a Keccak 256 hash + StorageHash string `json:"storageHash"` + // Current block header PoW hash. + StorageProof []StorageProof `json:"storageProof"` + // The address of the account or contract of the request + Address string `json:"address"` + // The set of node values needed to traverse a patricia merkle tree (from root to leaf) to retrieve a value + AccountProof []string `json:"accountProof"` +} +type Proof struct { + // Hex representation of a variable length byte array + ProofNode string `json:"proofNode"` +} +type StorageProof struct { + // The set of node values needed to traverse a patricia merkle tree (from root to leaf) to retrieve a value + Proof []string `json:"proof"` + // Hex representation of the integer + Key string `json:"key"` + // Hex representation of the integer + Value string `json:"value"` +} +type AccountProof struct { + // Hex representation of a variable length byte array + ProofNode string `json:"proofNode"` +} +type ProofAccountOrNull struct { + // The merkle proofs of the specified account connecting them to the blockhash of the block specified + ProofAccount +} +type EthGetProofResult struct { + ProofAccountOrNull ProofAccount `json:"proofAccountOrNull"` +} +type EthGetWorkResult struct { + Work []string `json:"work"` +} +type EthHashrateResult struct { + // Hex representation of the integer + HashesPerSecond string `json:"hashesPerSecond"` +} +type EthMiningResult struct { + // Whether of not the client is mining + Mining bool `json:"mining"` +} +type EthNewBlockFilterResult struct { + // Hex representation of the integer + FilterId string `json:"filterId"` +} +type EthNewFilterParams struct { + // A filter used to monitor the blockchain for log/events + Filter +} +type EthNewFilterResult struct { + // Hex representation of the integer + FilterId string `json:"filterId"` +} +type EthNewPendingTransactionFilterResult struct { + // Hex representation of the integer + FilterId string `json:"filterId"` +} +type PendingTransactions struct { + Transaction + // Integer of the transaction's index position in the block. null when its pending + TransactionIndex string `json:"transactionIndex"` + // Hash of the block where this transaction was in. null when its pending + BlockHash string `json:"blockHash"` + // Address of the sender + From string `json:"from"` + // Hex representation of a Keccak 256 hash + Hash string `json:"hash"` + // The data field sent with the transaction + Data string `json:"data"` + // A number only to be used once + Nonce string `json:"nonce"` + // The gas limit provided by the sender in Wei + Gas string `json:"gas"` + // Hex representation of a Keccak 256 hash + Value string `json:"value"` + // ECDSA recovery id + V string `json:"v"` + // ECDSA signature s + S string `json:"s"` + // The gas price willing to be paid by the sender in Wei + GasPrice string `json:"gasPrice"` + // address of the receiver. null when its a contract creation transaction + To string `json:"to"` + // Block number where this transaction was in. null when its pending + BlockNumber string `json:"blockNumber"` + // ECDSA signature r + R string `json:"r"` +} +type EthPendingTransactionsResult struct { + PendingTransactions []PendingTransactions `json:"pendingTransactions"` +} +type EthProtocolVersionResult struct { + // Hex representation of the integer + ProtocolVersion string `json:"protocolVersion"` +} +type EthSignParams struct { + Address string `json:"address"` + // Hex representation of a variable length byte array + Bytes string `json:"bytes"` +} +type EthSignResult struct { + // Hex representation of a variable length byte array + Signature string `json:"signature"` +} +type Addresses struct { + Address string `json:"address"` +} +type EthAccountsResult struct { + // addresses owned by the client + Addresses []string `json:"addresses"` +} +type EthSendTransactionParams struct { + Transaction +} +type EthSendTransactionResult struct { + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` +} +type EthSendRawTransactionParams struct { + // Hex representation of a variable length byte array + SignedTransactionData string `json:"signedTransactionData"` +} +type EthSendRawTransactionResult struct { + // Hex representation of a Keccak 256 hash + TransactionHash string `json:"transactionHash"` +} +type EthSubmitHashrateParams struct { + // Hex representation of a 256 bit unit of data + HashRate string `json:"hashRate"` + // Hex representation of a 256 bit unit of data + Id string `json:"id"` +} +type EthSubmitHashrateResult struct { + // whether of not submitting went through successfully + SubmitHashRateSuccess bool `json:"submitHashRateSuccess"` +} +type EthSubmitWorkParams struct { + // A number only to be used once + Nonce string `json:"nonce"` + // Hex representation of a 256 bit unit of data + PowHash string `json:"powHash"` + // Hex representation of a 256 bit unit of data + MixHash string `json:"mixHash"` +} +type EthSubmitWorkResult struct { + // Whether or not the provided solution is valid + SolutionValid bool `json:"solutionValid"` +} +type SyncStatus struct { + // Hex representation of the integer + StartingBlock string `json:"startingBlock"` + // Hex representation of the integer + CurrentBlock string `json:"currentBlock"` + // Hex representation of the integer + HighestBlock string `json:"highestBlock"` + // Hex representation of the integer + KnownStates string `json:"knownStates"` + // Hex representation of the integer + PulledStates string `json:"pulledStates"` +} +type Syncing struct { + // An object with sync status data + SyncStatus +} +type EthSyncingResult struct { + Syncing SyncStatus `json:"syncing"` +} +type EthUninstallFilterParams struct { + // An identifier used to reference the filter. + FilterId string `json:"filterId"` +} +type EthUninstallFilterResult struct { + // Whether of not the filter was successfully uninstalled + FilterUninstalledSuccess bool `json:"filterUninstalledSuccess"` +} diff --git a/scripts/commit_hash.sh b/scripts/commit_hash.sh index cd20bcb14..ae8206881 100755 --- a/scripts/commit_hash.sh +++ b/scripts/commit_hash.sh @@ -4,7 +4,7 @@ commit=$(git describe --tags) dirty=$(git ls-files -m) if [[ -n ${dirty} ]]; then - commit="$commit+dirty.$(echo ${dirty} | git hash-object --stdin | head -c8)" + commit="$commit+dirty.$(echo ${dirty} | git hash-object --stdin | dd bs=8 count=1 status=none)" fi echo "$commit" diff --git a/scripts/local_version.sh b/scripts/local_version.sh index 1491a601b..250a1c5c5 100755 --- a/scripts/local_version.sh +++ b/scripts/local_version.sh @@ -11,12 +11,11 @@ set -e REPO=${REPO:-"$PWD"} VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$" - version=$(go run "$REPO/project/cmd/version/main.go") tag=$(git tag --points-at HEAD) function log() { - echo "$*" >> /dev/stderr + echo "$*" >>/dev/stderr } # Gives RFC 3339 with T instead of space @@ -24,20 +23,23 @@ date=$(date -Idate) commit=$(git rev-parse --short HEAD) -if [[ ${tag} =~ ${VERSION_REGEX} ]] ; then - # Only label a build as a release version when the commit is tagged - log "Building release version (tagged $tag)..." - # Fail noisily when trying to build a release version that does not match code tag - if [[ ! ${tag} = "v$version" ]]; then - log "Build failure: version tag $tag does not match version/version.go version $version" - exit 1 - fi +if [[ ${tag} =~ ${VERSION_REGEX} ]]; then + # Only label a build as a release version when the commit is tagged + log "Building release version (tagged $tag)..." + # Fail noisily when trying to build a release version that does not match code tag + if [[ ! ${tag} == "v$version" ]]; then + log "Build failure: version tag $tag does not match version/version.go version $version" + exit 1 + fi else - version="$version-dev-$date-$commit" - log "Building non-release version $version..." + # Semver pre-release build suffix + prerelease="dev.$commit" + prerelease=${prerelease//-/.} + version="$version-$prerelease" + log "Building non-release version $version..." fi # for export date=$(date -Iseconds) -echo ${version} \ No newline at end of file +echo "$version" diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index a889a1508..000000000 --- a/scripts/release.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -version_regex="^v[0-9]+\.[0-9]+\.[0-9]+$" - -set -e - -DOCKER_REPO=${DOCKER_REPO:-"hyperledger/burrow"} -DOCKER_REPO_DEV=${DOCKER_REPO_DEV:-"quay.io/monax/burrow"} - -function release { - [[ -z "$DOCKER_PASS" ]] && echo "\$DOCKER_PASS must be set to release" && exit 1 - notes="NOTES.md" - echo "Building and releasing $tag..." - echo "Pushing docker image..." - echo ${DOCKER_PASS} | docker login --username ${DOCKER_USER} --password-stdin - docker tag ${DOCKER_REPO}:${tag#v} ${DOCKER_REPO}:latest - docker push ${DOCKER_REPO} - - git config --global user.email "billings@monax.io" - npm-cli-login - npm version from-git - npm publish --access public . - - echo "Building and pushing binaries" - [[ -e "$notes" ]] && goreleaser --release-notes "$notes" || goreleaser -} - - -# If passed argument try to use that as tag otherwise read from local repo -if [[ $1 ]]; then - # Override mode, try to release this tag - export tag=$1 -else - echo "Getting tag from HEAD which is $(git rev-parse HEAD)" - export tag=$(git tag --points-at HEAD) -fi - -if [[ ! ${tag} ]]; then - echo "No tag so not releasing." - exit 0 -fi - -# Only release semantic version syntax tags -if [[ ! ${tag} =~ ${version_regex} ]] ; then - echo "Tag '$tag' does not match version regex '$version_regex' so not releasing." - exit 0 -fi - -release diff --git a/scripts/release_dev.sh b/scripts/release_dev.sh deleted file mode 100755 index b146997b6..000000000 --- a/scripts/release_dev.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DOCKER_REPO=${DOCKER_REPO:-"hyperledger/burrow"} -DOCKER_REPO_DEV=${DOCKER_REPO_DEV:-"quay.io/monax/burrow"} - -function release { - echo "Pushing dev release to $DOCKER_REPO_DEV..." - [[ -z "$DOCKER_PASS_DEV" ]] && echo "\$DOCKER_PASS_DEV must be set to release dev version" && exit 1 - version=$(./scripts/local_version.sh) - echo ${DOCKER_PASS_DEV} | docker login --username ${DOCKER_USER_DEV} ${CI_REGISTRY} ${DOCKER_HUB_DEV} --password-stdin - docker tag ${DOCKER_REPO}:${version} ${DOCKER_REPO_DEV}:${version} - docker push ${DOCKER_REPO_DEV} -} - - -# Only do a dev release outside pull requests -if [[ -n "$CIRCLE_PULL_REQUESTS" ]]; then - echo "CIRCLE_PULL_REQUESTS is set to: '$CIRCLE_PULL_REQUEST' so not pushing dev release" - exit 0 -fi - -release \ No newline at end of file diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 000000000..fecc25655 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +# Gives the tag if we are exactly on a tag otherwise gives the tag last reachable tag with short commit hash as suffix +tagish="$(git describe --tags)" + +# Drop the version +echo "${tagish#v}" diff --git a/storage/forest.go b/storage/forest.go index b5874f843..676c4b1b3 100644 --- a/storage/forest.go +++ b/storage/forest.go @@ -94,7 +94,10 @@ var WithOverwriting ForestOption = func(imf *ImmutableForest) { imf.overwriting func NewMutableForest(db dbm.DB, cacheSize int) (*MutableForest, error) { // The tree whose state root hash is the global state hash - commitsTree := NewRWTree(NewPrefixDB(db, commitsPrefix), cacheSize) + commitsTree, err := NewRWTree(NewPrefixDB(db, commitsPrefix), cacheSize) + if err != nil { + return nil, err + } forest, err := NewImmutableForest(commitsTree, NewPrefixDB(db, treePrefix), cacheSize, WithOverwriting) if err != nil { return nil, err @@ -261,7 +264,7 @@ func (imf *ImmutableForest) tree(prefix []byte) (*RWTree, error) { } func (imf *ImmutableForest) commitID(prefix []byte) (*CommitID, error) { - bs := imf.commitsTree.Get(prefix) + bs, _ := imf.commitsTree.Get(prefix) if bs == nil { return new(CommitID), nil } @@ -274,14 +277,17 @@ func (imf *ImmutableForest) commitID(prefix []byte) (*CommitID, error) { func (imf *ImmutableForest) loadOrCreateTree(prefix []byte) (*RWTree, error) { const errHeader = "ImmutableForest.loadOrCreateTree():" - tree := imf.newTree(prefix) + tree, err := imf.newTree(prefix) + if err != nil { + return nil, err + } commitID, err := imf.commitID(prefix) if err != nil { return nil, fmt.Errorf("%s %v", errHeader, err) } if commitID.Version == 0 { // This is the first time we have been asked to load this tree - return imf.newTree(prefix), nil + return imf.newTree(prefix) } err = tree.Load(commitID.Version, imf.overwriting) if err != nil { @@ -291,11 +297,14 @@ func (imf *ImmutableForest) loadOrCreateTree(prefix []byte) (*RWTree, error) { } // Create a new in-memory IAVL tree -func (imf *ImmutableForest) newTree(prefix []byte) *RWTree { +func (imf *ImmutableForest) newTree(prefix []byte) (*RWTree, error) { p := string(prefix) - tree := NewRWTree(NewPrefixDB(imf.treeDB, p), imf.cacheSize) + tree, err := NewRWTree(NewPrefixDB(imf.treeDB, p), imf.cacheSize) + if err != nil { + return nil, err + } imf.treeCache.Add(p, tree) - return tree + return tree, nil } // CommitID serialisation diff --git a/storage/forest_test.go b/storage/forest_test.go index b78adf73c..827153c9a 100644 --- a/storage/forest_test.go +++ b/storage/forest_test.go @@ -31,7 +31,9 @@ func TestMutableForest_Genesis(t *testing.T) { assert.Contains(t, dump, "\"bar\" -> \"nog\"") reader, err := rwf.Reader(prefix) require.NoError(t, err) - require.Equal(t, val1, reader.Get(key1)) + val2, err := reader.Get(key1) + require.NoError(t, err) + require.Equal(t, val1, val2) } diff --git a/storage/key_format.go b/storage/key_format.go index f716cd01c..888dcdc8a 100644 --- a/storage/key_format.go +++ b/storage/key_format.go @@ -211,7 +211,7 @@ func (kf *KeyFormat) Fix(args ...interface{}) (*KeyFormat, error) { // Returns an iterator over the underlying iterable using this KeyFormat's prefix. This is to support proper iteration over the // prefix in the presence of nil start or end which requests iteration to the inclusive edges of the domain. An optional // argument for reverse can be passed to get reverse iteration. -func (kf *KeyFormat) Iterator(iterable KVIterable, start, end []byte, reverse ...bool) KVIterator { +func (kf *KeyFormat) Iterator(iterable KVIterable, start, end []byte, reverse ...bool) (KVIterator, error) { if len(reverse) > 0 && reverse[0] { return kf.prefix.Iterator(iterable.ReverseIterator, start, end) } diff --git a/storage/key_value_store.go b/storage/key_value_store.go new file mode 100644 index 000000000..dfdf753a8 --- /dev/null +++ b/storage/key_value_store.go @@ -0,0 +1,41 @@ +package storage + +import ( + "bytes" +) + +// KeyOrder maps []byte{} -> -1, []byte(nil) -> 1, and everything else to 0. This encodes the assumptions of the +// KVIterator domain endpoints +func KeyOrder(key []byte) int { + if key == nil { + // Sup + return 1 + } + if len(key) == 0 { + // Inf + return -1 + } + // Normal key + return 0 +} + +// Sorts the keys as if they were compared lexicographically with their KeyOrder prepended +func CompareKeys(k1, k2 []byte) int { + ko1 := KeyOrder(k1) + ko2 := KeyOrder(k2) + if ko1 < ko2 { + return -1 + } + if ko1 > ko2 { + return 1 + } + return bytes.Compare(k1, k2) +} + +// NormaliseDomain encodes the assumption that when nil is used as a lower bound is interpreted as low rather than high +func NormaliseDomain(low, high []byte) ([]byte, []byte) { + if len(low) == 0 { + low = []byte{} + } + return low, high +} diff --git a/storage/kvstore_test.go b/storage/key_value_store_test.go similarity index 100% rename from storage/kvstore_test.go rename to storage/key_value_store_test.go diff --git a/storage/prefix.go b/storage/prefix.go index 343708c48..1c1f9c47c 100644 --- a/storage/prefix.go +++ b/storage/prefix.go @@ -89,7 +89,7 @@ func (pi *prefixCallbackIterable) Iterate(start, end []byte, ascending bool, fn }) } -func (p Prefix) Iterator(iteratorFn func(start, end []byte) dbm.Iterator, start, end []byte) KVIterator { +func (p Prefix) Iterator(iteratorFn func(start, end []byte) (dbm.Iterator, error), start, end []byte) (KVIterator, error) { var pstart, pend []byte = p.Key(start), nil if end == nil { @@ -97,12 +97,18 @@ func (p Prefix) Iterator(iteratorFn func(start, end []byte) dbm.Iterator, start, } else { pend = p.Key(end) } + + source, err := iteratorFn(pstart, pend) + if err != nil { + return nil, err + } + return &prefixIterator{ start: start, end: end, prefix: p, - source: iteratorFn(pstart, pend), - } + source: source, + }, nil } func (p Prefix) Iterable(source KVIterable) KVIterable { @@ -117,11 +123,11 @@ type prefixIterable struct { source KVIterable } -func (pi *prefixIterable) Iterator(low, high []byte) KVIterator { +func (pi *prefixIterable) Iterator(low, high []byte) (KVIterator, error) { return pi.prefix.Iterator(pi.source.Iterator, low, high) } -func (pi *prefixIterable) ReverseIterator(low, high []byte) KVIterator { +func (pi *prefixIterable) ReverseIterator(low, high []byte) (KVIterator, error) { return pi.prefix.Iterator(pi.source.ReverseIterator, low, high) } @@ -183,8 +189,12 @@ func (pi *prefixIterator) Value() []byte { return pi.source.Value() } -func (pi *prefixIterator) Close() { - pi.source.Close() +func (pi *prefixIterator) Close() error { + return pi.source.Close() +} + +func (pi *prefixIterator) Error() error { + return nil } func (pi *prefixIterator) validate() { @@ -203,26 +213,26 @@ type prefixKVStore struct { source KVStore } -func (ps *prefixKVStore) Get(key []byte) []byte { +func (ps *prefixKVStore) Get(key []byte) ([]byte, error) { return ps.source.Get(ps.prefix.Key(key)) } -func (ps *prefixKVStore) Has(key []byte) bool { +func (ps *prefixKVStore) Has(key []byte) (bool, error) { return ps.source.Has(ps.prefix.Key(key)) } -func (ps *prefixKVStore) Set(key, value []byte) { - ps.source.Set(ps.prefix.Key(key), value) +func (ps *prefixKVStore) Set(key, value []byte) error { + return ps.source.Set(ps.prefix.Key(key), value) } -func (ps *prefixKVStore) Delete(key []byte) { - ps.source.Delete(ps.prefix.Key(key)) +func (ps *prefixKVStore) Delete(key []byte) error { + return ps.source.Delete(ps.prefix.Key(key)) } -func (ps *prefixKVStore) Iterator(low, high []byte) KVIterator { +func (ps *prefixKVStore) Iterator(low, high []byte) (KVIterator, error) { return ps.prefix.Iterator(ps.source.Iterator, low, high) } -func (ps *prefixKVStore) ReverseIterator(low, high []byte) KVIterator { +func (ps *prefixKVStore) ReverseIterator(low, high []byte) (KVIterator, error) { return ps.prefix.Iterator(ps.source.ReverseIterator, low, high) } diff --git a/storage/prefix_db.go b/storage/prefix_db.go index 1aa3db479..da6a43bbb 100644 --- a/storage/prefix_db.go +++ b/storage/prefix_db.go @@ -19,44 +19,44 @@ func NewPrefixDB(db dbm.DB, prefix string) *PrefixDB { } // DB implementation -func (pdb *PrefixDB) Get(key []byte) []byte { +func (pdb *PrefixDB) Get(key []byte) ([]byte, error) { return pdb.db.Get(pdb.prefix.Key(key)) } -func (pdb *PrefixDB) Has(key []byte) bool { +func (pdb *PrefixDB) Has(key []byte) (bool, error) { return pdb.db.Has(pdb.prefix.Key(key)) } -func (pdb *PrefixDB) Set(key, value []byte) { - pdb.db.Set(pdb.prefix.Key(key), value) +func (pdb *PrefixDB) Set(key, value []byte) error { + return pdb.db.Set(pdb.prefix.Key(key), value) } -func (pdb *PrefixDB) SetSync(key, value []byte) { - pdb.db.SetSync(pdb.prefix.Key(key), value) +func (pdb *PrefixDB) SetSync(key, value []byte) error { + return pdb.db.SetSync(pdb.prefix.Key(key), value) } -func (pdb *PrefixDB) Delete(key []byte) { - pdb.db.Delete(pdb.prefix.Key(key)) +func (pdb *PrefixDB) Delete(key []byte) error { + return pdb.db.Delete(pdb.prefix.Key(key)) } -func (pdb *PrefixDB) DeleteSync(key []byte) { - pdb.db.DeleteSync(pdb.prefix.Key(key)) +func (pdb *PrefixDB) DeleteSync(key []byte) error { + return pdb.db.DeleteSync(pdb.prefix.Key(key)) } -func (pdb *PrefixDB) Iterator(low, high []byte) KVIterator { +func (pdb *PrefixDB) Iterator(low, high []byte) (KVIterator, error) { return pdb.prefix.Iterator(pdb.db.Iterator, low, high) } -func (pdb *PrefixDB) ReverseIterator(low, high []byte) KVIterator { +func (pdb *PrefixDB) ReverseIterator(low, high []byte) (KVIterator, error) { return pdb.prefix.Iterator(pdb.db.ReverseIterator, low, high) } -func (pdb *PrefixDB) Close() { - pdb.db.Close() +func (pdb *PrefixDB) Close() error { + return pdb.db.Close() } -func (pdb *PrefixDB) Print() { - pdb.db.Print() +func (pdb *PrefixDB) Print() error { + return pdb.db.Print() } func (pdb *PrefixDB) Stats() map[string]string { @@ -82,22 +82,22 @@ type prefixBatch struct { batch dbm.Batch } -func (pb *prefixBatch) Set(key, value []byte) { - pb.batch.Set(pb.prefix.Key(key), value) +func (pb *prefixBatch) Set(key, value []byte) error { + return pb.batch.Set(pb.prefix.Key(key), value) } -func (pb *prefixBatch) Delete(key []byte) { - pb.batch.Delete(pb.prefix.Key(key)) +func (pb *prefixBatch) Delete(key []byte) error { + return pb.batch.Delete(pb.prefix.Key(key)) } -func (pb *prefixBatch) Write() { - pb.batch.Write() +func (pb *prefixBatch) Write() error { + return pb.batch.Write() } -func (pb *prefixBatch) WriteSync() { - pb.batch.WriteSync() +func (pb *prefixBatch) WriteSync() error { + return pb.batch.WriteSync() } -func (pb *prefixBatch) Close() { - pb.batch.Close() +func (pb *prefixBatch) Close() error { + return pb.batch.Close() } diff --git a/storage/prefix_db_test.go b/storage/prefix_db_test.go index faafe4273..e45a91ebd 100644 --- a/storage/prefix_db_test.go +++ b/storage/prefix_db_test.go @@ -35,7 +35,8 @@ func TestPrefixDBSimple(t *testing.T) { } get := func(key []byte, value []byte) interface{} { - act := db.Get(key) + act, err := db.Get(key) + require.NoError(t, err) return act } @@ -48,7 +49,8 @@ func TestPrefixDBIterator1(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.Iterator(nil, nil) + itr, err := pdb.Iterator(nil, nil) + require.NoError(t, err) checkDomain(t, itr, nil, nil) checkItem(t, itr, []byte(""), []byte("value")) checkNext(t, itr, true) @@ -66,7 +68,8 @@ func TestPrefixDBIterator2(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.Iterator(nil, []byte("")) + itr, err := pdb.Iterator(nil, []byte("")) + require.NoError(t, err) checkDomain(t, itr, nil, []byte("")) checkInvalid(t, itr) itr.Close() @@ -76,7 +79,8 @@ func TestPrefixDBIterator3(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.Iterator([]byte(""), nil) + itr, err := pdb.Iterator([]byte(""), nil) + require.NoError(t, err) checkDomain(t, itr, []byte(""), nil) checkItem(t, itr, []byte(""), []byte("value")) checkNext(t, itr, true) @@ -94,7 +98,8 @@ func TestPrefixDBIterator4(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.Iterator([]byte(""), []byte("")) + itr, err := pdb.Iterator([]byte(""), []byte("")) + require.NoError(t, err) checkDomain(t, itr, []byte(""), []byte("")) checkInvalid(t, itr) itr.Close() @@ -104,7 +109,8 @@ func TestPrefixDBReverseIterator1(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.ReverseIterator(nil, nil) + itr, err := pdb.ReverseIterator(nil, nil) + require.NoError(t, err) checkDomain(t, itr, nil, nil) checkItem(t, itr, []byte("3"), []byte("value3")) checkNext(t, itr, true) @@ -122,7 +128,8 @@ func TestPrefixDBReverseIterator2(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.ReverseIterator([]byte(""), nil) + itr, err := pdb.ReverseIterator([]byte(""), nil) + require.NoError(t, err) checkDomain(t, itr, []byte(""), nil) checkItem(t, itr, []byte("3"), []byte("value3")) checkNext(t, itr, true) @@ -140,7 +147,8 @@ func TestPrefixDBReverseIterator3(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.ReverseIterator(nil, []byte("")) + itr, err := pdb.ReverseIterator(nil, []byte("")) + require.NoError(t, err) checkDomain(t, itr, nil, []byte("")) checkInvalid(t, itr) itr.Close() @@ -150,7 +158,8 @@ func TestPrefixDBReverseIterator4(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.ReverseIterator([]byte(""), []byte("")) + itr, err := pdb.ReverseIterator([]byte(""), []byte("")) + require.NoError(t, err) checkDomain(t, itr, []byte(""), []byte("")) checkInvalid(t, itr) itr.Close() @@ -160,7 +169,8 @@ func TestPrefixDBReverseIterator5(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.ReverseIterator([]byte("1"), nil) + itr, err := pdb.ReverseIterator([]byte("1"), nil) + require.NoError(t, err) checkDomain(t, itr, []byte("1"), nil) checkItem(t, itr, []byte("3"), []byte("value3")) checkNext(t, itr, true) @@ -176,7 +186,8 @@ func TestPrefixDBReverseIterator6(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.ReverseIterator([]byte("2"), nil) + itr, err := pdb.ReverseIterator([]byte("2"), nil) + require.NoError(t, err) checkDomain(t, itr, []byte("2"), nil) checkItem(t, itr, []byte("3"), []byte("value3")) checkNext(t, itr, true) @@ -190,7 +201,8 @@ func TestPrefixDBReverseIterator7(t *testing.T) { db := mockDBWithStuff() pdb := NewPrefixDB(db, "key") - itr := pdb.ReverseIterator(nil, []byte("2")) + itr, err := pdb.ReverseIterator(nil, []byte("2")) + require.NoError(t, err) checkDomain(t, itr, nil, []byte("2")) checkItem(t, itr, []byte("1"), []byte("value1")) checkNext(t, itr, true) @@ -216,7 +228,8 @@ func TestBadSuffix(t *testing.T) { } func checkValue(t *testing.T, db dbm.DB, key []byte, valueWanted []byte) { - valueGot := db.Get(key) + valueGot, err := db.Get(key) + require.NoError(t, err) assert.Equal(t, valueWanted, valueGot) } diff --git a/storage/prefix_test.go b/storage/prefix_test.go index 4616fa0c6..7953ef70a 100644 --- a/storage/prefix_test.go +++ b/storage/prefix_test.go @@ -58,7 +58,10 @@ func requireKeysSorted(t *testing.T, keys [][]byte, reverse ...bool) { require.Equal(t, sortedKeys, keys) } -func dumpKeys(it dbm.Iterator) [][]byte { +func dumpKeys(it dbm.Iterator, err error) [][]byte { + if err != nil { + panic(err) + } var keys [][]byte for it.Valid() { keys = append(keys, it.Key()) diff --git a/storage/rwtree.go b/storage/rwtree.go index a8511975d..d4667f9b8 100644 --- a/storage/rwtree.go +++ b/storage/rwtree.go @@ -2,9 +2,10 @@ package storage import ( "fmt" + "sync" + "sync/atomic" - "github.com/tendermint/iavl" - + "github.com/cosmos/iavl" dbm "github.com/tendermint/tm-db" "github.com/xlab/treeprint" ) @@ -13,26 +14,40 @@ import ( // recently saved version of the tree - which provides immutable access. Writes are routed to a working tree that is // mutable. On save the working tree is saved to DB, frozen, and replaces the previous immutable read tree. type RWTree struct { + // Synchronise 'write side access' - i.e. to the write tree and updated flag (which only read-locks this mutex) + sync.RWMutex // Working tree accumulating writes tree *MutableTree // Read-only tree serving previous state - *ImmutableTree + readTree atomic.Value // *ImmutableTree // Have any writes occurred since last save updated bool } +var _ KVCallbackIterableReader = &RWTree{} +var _ Versioned = &RWTree{} + // Creates a concurrency safe version of an IAVL tree whereby reads are routed to the last saved tree. // Writes must be serialised (as they are within a commit for example). -func NewRWTree(db dbm.DB, cacheSize int) *RWTree { - tree := NewMutableTree(db, cacheSize) - return &RWTree{ - tree: tree, - ImmutableTree: &ImmutableTree{iavl.NewImmutableTree(db, cacheSize)}, +func NewRWTree(db dbm.DB, cacheSize int) (*RWTree, error) { + tree, err := NewMutableTree(db, cacheSize) + if err != nil { + return nil, err } + readTree := &ImmutableTree{iavl.NewImmutableTree(db, cacheSize)} + rwt := &RWTree{ + tree: tree, + } + rwt.readTree.Store(readTree) + return rwt, nil } +// Write-side write methods - of the mutable tree - synchronised by write-lock of RWMutex + // Tries to load the execution state from DB, returns nil with no error if no state found func (rwt *RWTree) Load(version int64, overwriting bool) error { + rwt.Lock() + defer rwt.Unlock() const errHeader = "RWTree.Load():" if version <= 0 { return fmt.Errorf("%s trying to load from non-positive version %d", errHeader, version) @@ -42,52 +57,92 @@ func (rwt *RWTree) Load(version int64, overwriting bool) error { return fmt.Errorf("%s loading version %d: %v", errHeader, version, err) } // Set readTree at commit point == tree - rwt.ImmutableTree, err = rwt.tree.GetImmutable(version) + readTree, err := rwt.tree.GetImmutable(version) if err != nil { return fmt.Errorf("%s loading version %d: %v", errHeader, version, err) } + rwt.readTree.Store(readTree) + rwt.updated = false + return nil } // Save the current write tree making writes accessible from read tree. func (rwt *RWTree) Save() ([]byte, int64, error) { + rwt.Lock() + defer rwt.Unlock() // save state at a new version may still be orphaned before we save the version against the hash hash, version, err := rwt.tree.SaveVersion() if err != nil { return nil, 0, fmt.Errorf("could not save RWTree: %v", err) } // Take an immutable reference to the tree we just saved for querying - rwt.ImmutableTree, err = rwt.tree.GetImmutable(version) + readTree, err := rwt.tree.GetImmutable(version) if err != nil { - return nil, 0, fmt.Errorf("RWTree.Save() could not obtain ImmutableTree read tree: %v", err) + return nil, 0, fmt.Errorf("RWTree.Save() could not obtain immutable read tree: %v", err) } + rwt.readTree.Store(readTree) rwt.updated = false return hash, version, nil } func (rwt *RWTree) Set(key, value []byte) bool { + rwt.Lock() + defer rwt.Unlock() rwt.updated = true return rwt.tree.Set(key, value) } func (rwt *RWTree) Delete(key []byte) ([]byte, bool) { + rwt.Lock() + defer rwt.Unlock() rwt.updated = true return rwt.tree.Remove(key) } +// Write-side read methods - of the mutable tree - synchronised by read-lock of RWMutex + // Returns true if there have been any writes since last save func (rwt *RWTree) Updated() bool { + rwt.RLock() + defer rwt.RUnlock() return rwt.updated } func (rwt *RWTree) GetImmutable(version int64) (*ImmutableTree, error) { + rwt.RLock() + defer rwt.RUnlock() return rwt.tree.GetImmutable(version) } func (rwt *RWTree) IterateWriteTree(start, end []byte, ascending bool, fn func(key []byte, value []byte) error) error { + rwt.RLock() + defer rwt.RUnlock() return rwt.tree.IterateWriteTree(start, end, ascending, fn) } +// Read-side read methods - of the immutable read tree (previous saved state) - synchronised solely via atomic.Value + +func (rwt *RWTree) Hash() []byte { + return rwt.readTree.Load().(*ImmutableTree).Hash() +} + +func (rwt *RWTree) Version() int64 { + return rwt.readTree.Load().(*ImmutableTree).Version() +} + +func (rwt *RWTree) Get(key []byte) ([]byte, error) { + return rwt.readTree.Load().(*ImmutableTree).Get(key) +} + +func (rwt *RWTree) Has(key []byte) (bool, error) { + return rwt.readTree.Load().(*ImmutableTree).Has(key) +} + +func (rwt *RWTree) Iterate(low, high []byte, ascending bool, fn func(key []byte, value []byte) error) error { + return rwt.readTree.Load().(*ImmutableTree).Iterate(low, high, ascending, fn) +} + // Tree printing func (rwt *RWTree) Dump() string { diff --git a/storage/rwtree_test.go b/storage/rwtree_test.go index 7f38ab556..06ad750a0 100644 --- a/storage/rwtree_test.go +++ b/storage/rwtree_test.go @@ -2,7 +2,10 @@ package storage import ( "fmt" + "math/rand" + "runtime/debug" "testing" + "time" "github.com/stretchr/testify/require" @@ -12,31 +15,40 @@ import ( func TestSave(t *testing.T) { db := dbm.NewMemDB() - rwt := NewRWTree(db, 100) - foo := []byte("foo") - gaa := []byte("gaa") - dam := []byte("dam") - rwt.Set(foo, gaa) - _, _, err := rwt.Save() - require.NoError(t, err) - assert.Equal(t, gaa, rwt.Get(foo)) - rwt.Set(foo, dam) - _, _, err = rwt.Save() + rwt, err := NewRWTree(db, 100) require.NoError(t, err) - assert.Equal(t, dam, rwt.Get(foo)) + + var tests = []struct { + key []byte + value []byte + }{ + {[]byte("foo"), []byte("foo")}, + {[]byte("gaa"), []byte("gaa")}, + {[]byte("dam"), []byte("dam")}, + } + for _, tt := range tests { + rwt.Set(tt.key, tt.value) + _, _, err = rwt.Save() + require.NoError(t, err) + val, err := rwt.Get(tt.key) + require.NoError(t, err) + assert.Equal(t, tt.value, val) + } } func TestEmptyTree(t *testing.T) { db := dbm.NewMemDB() - rwt := NewRWTree(db, 100) + rwt, err := NewRWTree(db, 100) + require.NoError(t, err) fmt.Printf("%X\n", rwt.Hash()) } func TestRollback(t *testing.T) { db := dbm.NewMemDB() - rwt := NewRWTree(db, 100) + rwt, err := NewRWTree(db, 100) + require.NoError(t, err) rwt.Set([]byte("Raffle"), []byte("Topper")) - _, _, err := rwt.Save() + _, _, err = rwt.Save() require.NoError(t, err) foo := []byte("foo") @@ -58,7 +70,8 @@ func TestRollback(t *testing.T) { require.NoError(t, err) // Make a new tree - rwt = NewRWTree(db, 100) + rwt, err = NewRWTree(db, 100) + require.NoError(t, err) err = rwt.Load(version1, true) require.NoError(t, err) // If you load version1 the working hash is that which you saved after version0, i.e. hash0 @@ -82,12 +95,14 @@ func TestRollback(t *testing.T) { func TestVersionDivergence(t *testing.T) { // This test serves as a reminder that IAVL nodes contain the version and a new node is created for every write - rwt1 := NewRWTree(dbm.NewMemDB(), 100) + rwt1, err := NewRWTree(dbm.NewMemDB(), 100) + require.NoError(t, err) rwt1.Set([]byte("Raffle"), []byte("Topper")) hash11, _, err := rwt1.Save() require.NoError(t, err) - rwt2 := NewRWTree(dbm.NewMemDB(), 100) + rwt2, err := NewRWTree(dbm.NewMemDB(), 100) + require.NoError(t, err) rwt2.Set([]byte("Raffle"), []byte("Topper")) hash21, _, err := rwt2.Save() require.NoError(t, err) @@ -103,13 +118,14 @@ func TestVersionDivergence(t *testing.T) { } func TestMutableTree_Iterate(t *testing.T) { - mut := NewMutableTree(dbm.NewMemDB(), 100) + mut, err := NewMutableTree(dbm.NewMemDB(), 100) + require.NoError(t, err) mut.Set([]byte("aa"), []byte("1")) mut.Set([]byte("aab"), []byte("2")) mut.Set([]byte("aac"), []byte("3")) mut.Set([]byte("aad"), []byte("4")) mut.Set([]byte("ab"), []byte("5")) - _, _, err := mut.SaveVersion() + _, _, err = mut.SaveVersion() require.NoError(t, err) mut.IterateRange([]byte("aab"), []byte("aad"), true, func(key []byte, value []byte) bool { fmt.Printf("%q -> %q\n", key, value) @@ -126,3 +142,79 @@ func TestMutableTree_Iterate(t *testing.T) { return false }) } + +func capturePanic(f func() error) (err error) { + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("%v: %s", r, debug.Stack()) + } + }() + err = f() + return +} + +func TestConcurrentReadWriteSave(t *testing.T) { + rwt, err := NewRWTree(dbm.NewMemDB(), 100) + require.NoError(t, err) + n := 100 + + doneCh := make(chan struct{}) + errCh := make(chan interface{}) + + // Saturate with concurrent reads and writes + var spin func() + spin = func() { + for i := 0; i < n; i++ { + val := []byte{byte(i)} + go func() { + err := capturePanic(func() error { + rwt.Set(val, val) + return nil + }) + if err != nil { + errCh <- err + } + }() + go func() { + err := capturePanic(func() error { + _, err := rwt.Get(val) + return err + }) + if err != nil { + errCh <- err + } + }() + + } + select { + case <-doneCh: + return + default: + // Avoid starvation + time.Sleep(time.Millisecond) + spin() + } + } + + // let's + go spin() + + // Ensure Save() is safe with concurrent read/writes + for i := 0; i < n/10; i++ { + time.Sleep(time.Duration(rand.Int63n(100)) * time.Millisecond) + err := capturePanic(func() error { + _, _, err := rwt.Save() + return err + }) + if err != nil { + break + } + } + close(doneCh) + + select { + case err := <-errCh: + t.Fatal(err) + default: + } +} diff --git a/storage/sort_order.go b/storage/sort_order.go new file mode 100644 index 000000000..3f4ce11fb --- /dev/null +++ b/storage/sort_order.go @@ -0,0 +1,8 @@ +package storage + +type SortOrder byte + +const ( + AscendingSort SortOrder = iota + DescendingSort +) diff --git a/storage/storage.pb.go b/storage/storage.pb.go index 3bbe1d8a1..51abeecea 100644 --- a/storage/storage.pb.go +++ b/storage/storage.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -23,7 +24,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 // This is the object that is stored in the leaves of the commitsTree - it captures the sub-tree hashes so that the // commitsTree's hash becomes a mixture of the hashes of all the sub-trees. @@ -45,7 +46,7 @@ func (m *CommitID) XXX_Unmarshal(b []byte) error { } func (m *CommitID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } @@ -89,25 +90,25 @@ func init() { proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffd func init() { golang_proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffdb) } var fileDescriptor_0d2c4ccf1453ffdb = []byte{ - // 186 bytes of a gzipped FileDescriptorProto + // 177 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2d, 0x2e, 0xc9, 0x2f, - 0x4a, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0xa5, 0x74, 0xd3, - 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, - 0xf2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xf4, 0x29, 0xd9, 0x71, 0x71, 0x38, - 0xe7, 0xe7, 0xe6, 0x66, 0x96, 0x78, 0xba, 0x08, 0x49, 0x70, 0xb1, 0x87, 0xa5, 0x16, 0x15, 0x67, - 0xe6, 0xe7, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x42, 0x5c, 0x2c, 0x1e, - 0x89, 0xc5, 0x19, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x60, 0xb6, 0x15, 0xcb, 0x8c, 0x05, - 0xf2, 0x0c, 0x4e, 0xf6, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x07, 0x1e, 0xcb, 0x31, 0x9e, 0x78, 0x2c, 0xc7, 0x18, 0xa5, 0x8a, - 0xe4, 0x90, 0x8c, 0xca, 0x82, 0xd4, 0xa2, 0x9c, 0xd4, 0x94, 0xf4, 0xd4, 0x22, 0xfd, 0xa4, 0xd2, - 0xa2, 0xa2, 0xfc, 0x72, 0x7d, 0xa8, 0x7b, 0x93, 0xd8, 0xc0, 0xee, 0x30, 0x06, 0x04, 0x00, 0x00, - 0xff, 0xff, 0xc6, 0xa6, 0xc1, 0x7f, 0xd0, 0x00, 0x00, 0x00, + 0x4a, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0xa5, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0xc1, 0x62, 0xfa, 0x20, 0x16, 0x44, 0x5a, 0xc9, 0x8e, 0x8b, 0xc3, 0x39, 0x3f, + 0x37, 0x37, 0xb3, 0xc4, 0xd3, 0x45, 0x48, 0x82, 0x8b, 0x3d, 0x2c, 0xb5, 0xa8, 0x38, 0x33, 0x3f, + 0x4f, 0x82, 0x51, 0x81, 0x51, 0x83, 0x39, 0x08, 0xc6, 0x15, 0x12, 0xe2, 0x62, 0xf1, 0x48, 0x2c, + 0xce, 0x90, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x09, 0x02, 0xb3, 0xad, 0x58, 0x66, 0x2c, 0x90, 0x67, + 0x70, 0xb2, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, 0x8f, 0xe4, 0x18, 0x1f, + 0x3c, 0x92, 0x63, 0x3c, 0xf0, 0x58, 0x8e, 0xf1, 0xc4, 0x63, 0x39, 0xc6, 0x28, 0xd5, 0xf4, 0xcc, + 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0x8c, 0xca, 0x82, 0xd4, 0xa2, 0x9c, 0xd4, + 0x94, 0xf4, 0xd4, 0x22, 0xfd, 0xa4, 0xd2, 0xa2, 0xa2, 0xfc, 0x72, 0x7d, 0xa8, 0xb3, 0x92, 0xd8, + 0xc0, 0xee, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1e, 0xd4, 0x9e, 0xb7, 0x00, 0x00, + 0x00, } func (m *CommitID) 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 } @@ -115,35 +116,44 @@ func (m *CommitID) Marshal() (dAtA []byte, err error) { } func (m *CommitID) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Version != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Version)) + 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 = encodeVarintStorage(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.Version != 0 { + i = encodeVarintStorage(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func encodeVarintStorage(dAtA []byte, offset int, v uint64) int { + offset -= sovStorage(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 (m *CommitID) Size() (n int) { if m == nil { @@ -165,14 +175,7 @@ func (m *CommitID) Size() (n int) { } func sovStorage(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozStorage(x uint64) (n int) { return sovStorage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -265,10 +268,7 @@ func (m *CommitID) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthStorage } if (iNdEx + skippy) > l { @@ -287,6 +287,7 @@ func (m *CommitID) Unmarshal(dAtA []byte) error { func skipStorage(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -318,10 +319,8 @@ func skipStorage(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -342,55 +341,30 @@ func skipStorage(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthStorage } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthStorage - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStorage - } - 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 := skipStorage(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthStorage - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStorage + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthStorage + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthStorage = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStorage = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthStorage = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStorage = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStorage = fmt.Errorf("proto: unexpected end of group") ) diff --git a/storage/tree.go b/storage/tree.go index 22c91b8cc..0e0265a3b 100644 --- a/storage/tree.go +++ b/storage/tree.go @@ -3,7 +3,7 @@ package storage import ( "fmt" - "github.com/tendermint/iavl" + "github.com/cosmos/iavl" dbm "github.com/tendermint/tm-db" ) @@ -16,11 +16,11 @@ type ImmutableTree struct { *iavl.ImmutableTree } -func NewMutableTree(db dbm.DB, cacheSize int) *MutableTree { - tree := iavl.NewMutableTree(db, cacheSize) +func NewMutableTree(db dbm.DB, cacheSize int) (*MutableTree, error) { + tree, err := iavl.NewMutableTree(db, cacheSize) return &MutableTree{ MutableTree: tree, - } + }, err } func (mut *MutableTree) Load(version int64, overwriting bool) error { @@ -57,9 +57,14 @@ func (mut *MutableTree) IterateWriteTree(start, end []byte, ascending bool, fn f return err } -func (mut *MutableTree) Get(key []byte) []byte { +func (mut *MutableTree) Has(key []byte) (bool, error) { + ok := mut.MutableTree.Has(key) + return ok, nil +} + +func (mut *MutableTree) Get(key []byte) ([]byte, error) { _, bs := mut.MutableTree.Get(key) - return bs + return bs, nil } func (mut *MutableTree) GetImmutable(version int64) (*ImmutableTree, error) { @@ -70,9 +75,14 @@ func (mut *MutableTree) GetImmutable(version int64) (*ImmutableTree, error) { return &ImmutableTree{tree}, nil } -func (imt *ImmutableTree) Get(key []byte) []byte { +func (imt *ImmutableTree) Has(key []byte) (bool, error) { + ok := imt.ImmutableTree.Has(key) + return ok, nil +} + +func (imt *ImmutableTree) Get(key []byte) ([]byte, error) { _, value := imt.ImmutableTree.Get(key) - return value + return value, nil } func (imt *ImmutableTree) Iterate(start, end []byte, ascending bool, fn func(key []byte, value []byte) error) error { diff --git a/storage/kvstore.go b/storage/types.go similarity index 59% rename from storage/kvstore.go rename to storage/types.go index de2291a41..030e7b8fc 100644 --- a/storage/kvstore.go +++ b/storage/types.go @@ -1,14 +1,12 @@ package storage import ( - "bytes" - dbm "github.com/tendermint/tm-db" ) type KVIterator = dbm.Iterator -// This is partially extrated from Cosmos SDK for alignment but is more minimal, we should suggest this becomes an +// This is partially extracted from Cosmos SDK for alignment but is more minimal, we should suggest this becomes an // embedded interface type KVIterable interface { // Iterator over a domain of keys in ascending order. high is exclusive. @@ -16,13 +14,13 @@ type KVIterable interface { // Iterator must be closed by caller. // To iterate over entire domain, use store.Iterator(nil, nil) // CONTRACT: No writes may happen within a domain while an iterator exists over it. - Iterator(low, high []byte) KVIterator + Iterator(low, high []byte) (KVIterator, error) // Iterator over a domain of keys in descending order. high is exclusive. // must be less than high, or the Iterator is invalid. // Iterator must be closed by caller. // CONTRACT: No writes may happen within a domain while an iterator exists over it. - ReverseIterator(low, high []byte) KVIterator + ReverseIterator(low, high []byte) (KVIterator, error) } // Provides the native iteration for IAVLTree @@ -34,16 +32,16 @@ type KVCallbackIterable interface { type KVReader interface { // Get returns nil iff key doesn't exist. Panics on nil key. - Get(key []byte) []byte + Get(key []byte) ([]byte, error) // Has checks if a key exists. Panics on nil key. - Has(key []byte) bool + Has(key []byte) (bool, error) } type KVWriter interface { // Set sets the key. Panics on nil key. - Set(key, value []byte) + Set(key, value []byte) error // Delete deletes the key. Panics on nil key. - Delete(key []byte) + Delete(key []byte) error } type KVIterableReader interface { @@ -67,38 +65,7 @@ type KVStore interface { KVIterable } -// KeyOrder maps []byte{} -> -1, []byte(nil) -> 1, and everything else to 0. This encodes the assumptions of the -// KVIterator domain endpoints -func KeyOrder(key []byte) int { - if key == nil { - // Sup - return 1 - } - if len(key) == 0 { - // Inf - return -1 - } - // Normal key - return 0 -} - -// Sorts the keys as if they were compared lexicographically with their KeyOrder prepended -func CompareKeys(k1, k2 []byte) int { - ko1 := KeyOrder(k1) - ko2 := KeyOrder(k2) - if ko1 < ko2 { - return -1 - } - if ko1 > ko2 { - return 1 - } - return bytes.Compare(k1, k2) -} - -// NormaliseDomain encodes the assumption that when nil is used as a lower bound is interpreted as low rather than high -func NormaliseDomain(low, high []byte) ([]byte, []byte) { - if len(low) == 0 { - low = []byte{} - } - return low, high +type Versioned interface { + Hash() []byte + Version() int64 } diff --git a/testnet/burrow.toml b/testnet/burrow.toml new file mode 100644 index 000000000..3bff73fde --- /dev/null +++ b/testnet/burrow.toml @@ -0,0 +1,60 @@ +BurrowDir = ".burrow" + +[Tendermint] + Enabled = true + Seeds = "" + SeedMode = false + PersistentPeers = "" + ListenHost = "0.0.0.0" + ListenPort = "26656" + ExternalAddress = "" + AddrBookStrict = false + Moniker = "" + IdentifyPeers = false + AuthorizedPeers = "" + CreateEmptyBlocks = "5m" + +[Execution] + TimeoutFactor = 0.33 + CallStackMaxDepth = 0 + DataStackInitialCapacity = 1024 + DataStackMaxDepth = 0 + +[Keys] + GRPCServiceEnabled = true + AllowBadFilePermissions = true + RemoteAddress = "" + KeysDirectory = "keys" + +[RPC] + [RPC.Info] + Enabled = true + ListenHost = "0.0.0.0" + ListenPort = "26658" + [RPC.Profiler] + Enabled = false + ListenHost = "0.0.0.0" + ListenPort = "6060" + [RPC.GRPC] + Enabled = true + ListenHost = "0.0.0.0" + ListenPort = "10997" + [RPC.Metrics] + Enabled = false + ListenHost = "0.0.0.0" + ListenPort = "9102" + MetricsPath = "/metrics" + BlockSampleSize = 100 + [RPC.Web3] + Enabled = true + ListenHost = "0.0.0.0" + ListenPort = "26660" + +[Logging] + Trace = false + NonBlocking = false + [Logging.RootSink] + [Logging.RootSink.Output] + OutputType = "stdout" + Format = "json" + diff --git a/testnet/genesis.json b/testnet/genesis.json new file mode 100644 index 000000000..f7111b51f --- /dev/null +++ b/testnet/genesis.json @@ -0,0 +1,111 @@ +{ + "GenesisTime": "2021-02-05T17:29:45.612487942Z", + "ChainName": "Burrow Testnet", + "Params": { + "ProposalThreshold": 3 + }, + "GlobalPermissions": { + "Base": { + "Perms": "send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | hasRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + }, + "Accounts": [ + { + "Address": "83896EE39F92CCFC91EB8185D8AADCBE8321A687", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "94E1542E21C9DDF6796F21B5B29A136FB7553123F9C9960DD8DFB2610FD7D02C" + }, + "Amount": 9999999999, + "Name": "Validator_0", + "Permissions": { + "Base": { + "Perms": "bond", + "SetBit": "bond" + } + } + }, + { + "Address": "7D2F766B60461EA787B35FA0352BA4F1449CAEC3", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "F3E03123373B4089022A9E94D9D5628795F6F59BDD87DD1940A68E539DD602C1" + }, + "Amount": 99999999999999, + "Name": "Root_0", + "Permissions": { + "Base": { + "Perms": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + } + }, + { + "Address": "545D5025216A47B37F4C611BD0494F4025704331", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "49BDE104BD224137D39FE8CE7BB1DCEF7F72A9387CDEC9E3749597B234032730" + }, + "Amount": 99999999999999, + "Name": "Root_1", + "Permissions": { + "Base": { + "Perms": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole", + "SetBit": "root | send | call | createContract | createAccount | bond | name | proposal | input | batch | identify | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole" + } + } + }, + { + "Address": "ABE2314B5D38BE9EA2BEDB8E58345C62FA6636BA", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "9348C950DD9986E3347455BC82EA796C1B9AF6062A2A4E13B9D706C38A7757F4" + }, + "Amount": 9999999999, + "Name": "Participant_0", + "Permissions": { + "Base": { + "Perms": "send | call | name | proposal | input | hasRole", + "SetBit": "send | call | name | proposal | input | hasRole" + } + } + }, + { + "Address": "A094BFF202E3C5ED2998DCF210E1D9F84705287D", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "85D4EF470CA14D3C1490EFF2DBC21B97D97D6D2BC2D6C3FE21E4289AECC2E0B1" + }, + "Amount": 9999999999, + "Name": "Participant_1", + "Permissions": { + "Base": { + "Perms": "send | call | name | proposal | input | hasRole", + "SetBit": "send | call | name | proposal | input | hasRole" + } + } + } + ], + "Validators": [ + { + "Address": "83896EE39F92CCFC91EB8185D8AADCBE8321A687", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "94E1542E21C9DDF6796F21B5B29A136FB7553123F9C9960DD8DFB2610FD7D02C" + }, + "Amount": 9999999998, + "Name": "Validator_0", + "UnbondTo": [ + { + "Address": "83896EE39F92CCFC91EB8185D8AADCBE8321A687", + "PublicKey": { + "CurveType": "ed25519", + "PublicKey": "94E1542E21C9DDF6796F21B5B29A136FB7553123F9C9960DD8DFB2610FD7D02C" + }, + "Amount": 9999999998 + } + ] + } + ] +} \ No newline at end of file diff --git a/testnet/keys/data/545D5025216A47B37F4C611BD0494F4025704331.json b/testnet/keys/data/545D5025216A47B37F4C611BD0494F4025704331.json new file mode 100644 index 000000000..19d60587d --- /dev/null +++ b/testnet/keys/data/545D5025216A47B37F4C611BD0494F4025704331.json @@ -0,0 +1 @@ +{"CurveType":"ed25519","Address":"545D5025216A47B37F4C611BD0494F4025704331","PublicKey":"49BDE104BD224137D39FE8CE7BB1DCEF7F72A9387CDEC9E3749597B234032730","AddressHash":"go-crypto-0.5.0","PrivateKey":{"Crypto":"none","Plain":"FD003063B619409634B7EACD5A354A9C239522E0A7E182C866E25CB0F3FB6FAB49BDE104BD224137D39FE8CE7BB1DCEF7F72A9387CDEC9E3749597B234032730"}} \ No newline at end of file diff --git a/testnet/keys/data/7D2F766B60461EA787B35FA0352BA4F1449CAEC3.json b/testnet/keys/data/7D2F766B60461EA787B35FA0352BA4F1449CAEC3.json new file mode 100644 index 000000000..66c01d517 --- /dev/null +++ b/testnet/keys/data/7D2F766B60461EA787B35FA0352BA4F1449CAEC3.json @@ -0,0 +1 @@ +{"CurveType":"ed25519","Address":"7D2F766B60461EA787B35FA0352BA4F1449CAEC3","PublicKey":"F3E03123373B4089022A9E94D9D5628795F6F59BDD87DD1940A68E539DD602C1","AddressHash":"go-crypto-0.5.0","PrivateKey":{"Crypto":"none","Plain":"862F94EDF894FA8E7E366A91F3974EC5D286FC9EB9A9D39DE4FF0B9FF32C79E8F3E03123373B4089022A9E94D9D5628795F6F59BDD87DD1940A68E539DD602C1"}} \ No newline at end of file diff --git a/testnet/keys/data/83896EE39F92CCFC91EB8185D8AADCBE8321A687.json b/testnet/keys/data/83896EE39F92CCFC91EB8185D8AADCBE8321A687.json new file mode 100644 index 000000000..7cb6cbf09 --- /dev/null +++ b/testnet/keys/data/83896EE39F92CCFC91EB8185D8AADCBE8321A687.json @@ -0,0 +1 @@ +{"CurveType":"ed25519","Address":"83896EE39F92CCFC91EB8185D8AADCBE8321A687","PublicKey":"94E1542E21C9DDF6796F21B5B29A136FB7553123F9C9960DD8DFB2610FD7D02C","AddressHash":"go-crypto-0.5.0","PrivateKey":{"Crypto":"none","Plain":"AFBEDADEA32C2F94D78FB1023ED0ACAF2FD92711627A036237B1C8256275C44294E1542E21C9DDF6796F21B5B29A136FB7553123F9C9960DD8DFB2610FD7D02C"}} \ No newline at end of file diff --git a/testnet/keys/data/A094BFF202E3C5ED2998DCF210E1D9F84705287D.json b/testnet/keys/data/A094BFF202E3C5ED2998DCF210E1D9F84705287D.json new file mode 100644 index 000000000..0afd0fde0 --- /dev/null +++ b/testnet/keys/data/A094BFF202E3C5ED2998DCF210E1D9F84705287D.json @@ -0,0 +1 @@ +{"CurveType":"ed25519","Address":"A094BFF202E3C5ED2998DCF210E1D9F84705287D","PublicKey":"85D4EF470CA14D3C1490EFF2DBC21B97D97D6D2BC2D6C3FE21E4289AECC2E0B1","AddressHash":"go-crypto-0.5.0","PrivateKey":{"Crypto":"none","Plain":"F40244D46AAFA9648959AD9F4B2F5E026F37E6D7E9D664AA963E915B1F2F671B85D4EF470CA14D3C1490EFF2DBC21B97D97D6D2BC2D6C3FE21E4289AECC2E0B1"}} \ No newline at end of file diff --git a/testnet/keys/data/ABE2314B5D38BE9EA2BEDB8E58345C62FA6636BA.json b/testnet/keys/data/ABE2314B5D38BE9EA2BEDB8E58345C62FA6636BA.json new file mode 100644 index 000000000..3cdd9aa1f --- /dev/null +++ b/testnet/keys/data/ABE2314B5D38BE9EA2BEDB8E58345C62FA6636BA.json @@ -0,0 +1 @@ +{"CurveType":"ed25519","Address":"ABE2314B5D38BE9EA2BEDB8E58345C62FA6636BA","PublicKey":"9348C950DD9986E3347455BC82EA796C1B9AF6062A2A4E13B9D706C38A7757F4","AddressHash":"go-crypto-0.5.0","PrivateKey":{"Crypto":"none","Plain":"2D04310BCDD502B930D027F65B27ABE81F32144058CA5FFE20BCEB4E868CA0DE9348C950DD9986E3347455BC82EA796C1B9AF6062A2A4E13B9D706C38A7757F4"}} \ No newline at end of file diff --git a/testnet/keys/names/Participant_0 b/testnet/keys/names/Participant_0 new file mode 100644 index 000000000..2431c00a2 --- /dev/null +++ b/testnet/keys/names/Participant_0 @@ -0,0 +1 @@ +ABE2314B5D38BE9EA2BEDB8E58345C62FA6636BA \ No newline at end of file diff --git a/testnet/keys/names/Participant_1 b/testnet/keys/names/Participant_1 new file mode 100644 index 000000000..f65bdbd1e --- /dev/null +++ b/testnet/keys/names/Participant_1 @@ -0,0 +1 @@ +A094BFF202E3C5ED2998DCF210E1D9F84705287D \ No newline at end of file diff --git a/testnet/keys/names/Root_0 b/testnet/keys/names/Root_0 new file mode 100644 index 000000000..e57187ad0 --- /dev/null +++ b/testnet/keys/names/Root_0 @@ -0,0 +1 @@ +7D2F766B60461EA787B35FA0352BA4F1449CAEC3 \ No newline at end of file diff --git a/testnet/keys/names/Root_1 b/testnet/keys/names/Root_1 new file mode 100644 index 000000000..1559fa2d5 --- /dev/null +++ b/testnet/keys/names/Root_1 @@ -0,0 +1 @@ +545D5025216A47B37F4C611BD0494F4025704331 \ No newline at end of file diff --git a/testnet/keys/names/Validator_0 b/testnet/keys/names/Validator_0 new file mode 100644 index 000000000..0848c7f71 --- /dev/null +++ b/testnet/keys/names/Validator_0 @@ -0,0 +1 @@ +83896EE39F92CCFC91EB8185D8AADCBE8321A687 \ No newline at end of file diff --git a/tests/chain/burrow.toml b/tests/chain/burrow.toml index 49d2dd8b2..0d3415065 100644 --- a/tests/chain/burrow.toml +++ b/tests/chain/burrow.toml @@ -1,16 +1,26 @@ BurrowDir = ".burrow" [Tendermint] + Enabled = true Seeds = "" + SeedMode = false PersistentPeers = "" - ListenHost = "0.0.0.0" - ListenPort = "36656" + ListenHost = "127.0.0.1" + ListenPort = "26656" ExternalAddress = "" - Moniker = "BurrowIntegrationTestNode" - CreateEmptyBlocks = "always" + AddrBookStrict = false + Moniker = "" + IdentifyPeers = false + AuthorizedPeers = "" + CreateEmptyBlocks = "5m" [Execution] - TimeoutFactor = 0.33 + TimeoutFactor = 0.2 + CallStackMaxDepth = 0 + DataStackInitialCapacity = 1024 + DataStackMaxDepth = 0 + # Uncomment for opcode splurge + # VMOptions = ["DebugOpcodes"] [Keys] GRPCServiceEnabled = true @@ -19,30 +29,34 @@ BurrowDir = ".burrow" KeysDirectory = "../keys" [RPC] - [RPC.TM] + [RPC.Info] Enabled = true ListenHost = "127.0.0.1" ListenPort = "36658" [RPC.Profiler] Enabled = false ListenHost = "127.0.0.1" - ListenPort = "7060" + ListenPort = "6060" [RPC.GRPC] Enabled = true ListenHost = "127.0.0.1" ListenPort = "20997" [RPC.Metrics] Enabled = false - ListenAddress = "127.0.0.1" - ListenPort = "10102" + ListenHost = "127.0.0.1" + ListenPort = "9102" MetricsPath = "/metrics" BlockSampleSize = 100 + [RPC.Web3] + Enabled = false + ListenHost = "127.0.0.1" + ListenPort = "26660" [Logging] - ExcludeTrace = false + Trace = false NonBlocking = false [Logging.RootSink] - [Logging.RootSink.Output] - OutputType = "stderr" - Format = "json" +# [Logging.RootSink.Output] +# OutputType = "stderr" +# Format = "json" diff --git a/tests/compilers_fixtures/contractImport1.sol b/tests/compilers_fixtures/contractImport1.sol index db1d2a7e6..a9873accf 100644 --- a/tests/compilers_fixtures/contractImport1.sol +++ b/tests/compilers_fixtures/contractImport1.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; import {importedContract as poop} from './contractImport2.sol'; import "./contractImport3.sol"; diff --git a/tests/compilers_fixtures/contractImport2.sol b/tests/compilers_fixtures/contractImport2.sol index f6986deff..221ccda7d 100644 --- a/tests/compilers_fixtures/contractImport2.sol +++ b/tests/compilers_fixtures/contractImport2.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; import "contractImport3.sol" as moarPoop; contract importedContract { diff --git a/tests/compilers_fixtures/contractImport3.sol b/tests/compilers_fixtures/contractImport3.sol index a409ccb6d..46cca680d 100644 --- a/tests/compilers_fixtures/contractImport3.sol +++ b/tests/compilers_fixtures/contractImport3.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; import * as foo from "contractImport4.sol"; contract map { diff --git a/tests/compilers_fixtures/contractImport4.sol b/tests/compilers_fixtures/contractImport4.sol index 74806b3e3..2b83316b1 100644 --- a/tests/compilers_fixtures/contractImport4.sol +++ b/tests/compilers_fixtures/contractImport4.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract bar { struct Mod { diff --git a/tests/compilers_fixtures/faultyContract.sol b/tests/compilers_fixtures/faultyContract.sol index c2243a6c1..7813e318d 100644 --- a/tests/compilers_fixtures/faultyContract.sol +++ b/tests/compilers_fixtures/faultyContract.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract c { blah } \ No newline at end of file diff --git a/tests/compilers_fixtures/libraryContract.sol b/tests/compilers_fixtures/libraryContract.sol index 1c38ff2df..898807cea 100644 --- a/tests/compilers_fixtures/libraryContract.sol +++ b/tests/compilers_fixtures/libraryContract.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; library Set { // We define a new struct datatype that will be used to diff --git a/tests/compilers_fixtures/simpleContract.sol b/tests/compilers_fixtures/simpleContract.sol index 25d22f3e5..e4963a63c 100644 --- a/tests/compilers_fixtures/simpleContract.sol +++ b/tests/compilers_fixtures/simpleContract.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract c { function f() public { diff --git a/tests/dump/test.sh b/tests/dump/test.sh index 2f40fcee6..5bebcbfa0 100755 --- a/tests/dump/test.sh +++ b/tests/dump/test.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/usr/bin/env bash # Test the dump restore functionality # @@ -48,7 +48,7 @@ echo -e "${title//?/-}\n${title}\n${title//?/-}\n" $burrow_bin dump remote -b dump.bin $burrow_bin dump remote dump.json -height=$(head -1 dump.json | jq .Height) +height=$(head -n 1 dump.json | jq .Height) kill $burrow_pid diff --git a/tests/dump/undeclared.sol b/tests/dump/undeclared.sol index a7e72078c..0aab88209 100644 --- a/tests/dump/undeclared.sol +++ b/tests/dump/undeclared.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract test { event Bar(bytes32 a, int b); diff --git a/tests/jobs_fixtures/app03-basic_and_advanced_permission_txs_and_queries/deploy.yaml b/tests/jobs_fixtures/app03-basic_and_advanced_permission_txs_and_queries/deploy.yaml index 4d6968337..c391662bd 100644 --- a/tests/jobs_fixtures/app03-basic_and_advanced_permission_txs_and_queries/deploy.yaml +++ b/tests/jobs_fixtures/app03-basic_and_advanced_permission_txs_and_queries/deploy.yaml @@ -11,26 +11,26 @@ jobs: - name: permTest1 permission: action: setBase - target: $key2 + target: Participant_1 permission: $perm value: "true" - name: permTest2 permission: action: unsetBase - target: $key2 + target: Participant_1 permission: $perm - name: permTest3 permission: action: addRole - target: $key2 + target: Participant_1 role: $role - name: permTest4 permission: action: removeRole - target: $key2 + target: Participant_1 role: $role - name: permTest5 @@ -41,7 +41,7 @@ jobs: - name: queryPerm1 query-account: - account: $key2 + account: Participant_1 field: permissions.roles - name: assertPerm1 @@ -52,11 +52,11 @@ jobs: - name: queryPerm2 query-account: - account: $key2 + account: Participant_1 field: permissions.base - name: assertPerm2 assert: key: $queryPerm2 relation: eq - val: 16454 + val: 32838 diff --git a/tests/jobs_fixtures/app33-evm_connection_edb_permissions_and_roles_layer/deploy.yaml b/tests/jobs_fixtures/app33-evm_connection_edb_permissions_and_roles_layer/deploy.yaml index a31967c25..53095d564 100644 --- a/tests/jobs_fixtures/app33-evm_connection_edb_permissions_and_roles_layer/deploy.yaml +++ b/tests/jobs_fixtures/app33-evm_connection_edb_permissions_and_roles_layer/deploy.yaml @@ -69,8 +69,8 @@ jobs: - name: setRole call: destination: $deployPermK - function: addRole - data: + function: addRole + data: - $key2_addr - $role @@ -129,9 +129,9 @@ jobs: call: destination: $deployPermK function: hasBase - data: + data: - $key2_addr - - 59007 + - 35838 - name: assertBase2 assert: @@ -142,11 +142,11 @@ jobs: - name: setBase call: destination: $deployPermK - function: setBase + function: setBase data: - $key2_addr - - 8263 - - true + - 1 + - false - name: checkBase3 call: @@ -154,13 +154,13 @@ jobs: function: hasBase data: - $key2_addr - - 8263 + - 1 - name: assertBase3 assert: key: $checkBase3 relation: eq - val: "true" + val: "false" - name: unsetBase call: @@ -168,7 +168,7 @@ jobs: function: unsetBase data: - $key2_addr - - 8263 + - 1 - name: checkBase4 call: @@ -176,7 +176,7 @@ jobs: function: hasBase data: - $key2_addr - - 8263 + - 1 - name: assertBase4 assert: diff --git a/tests/jobs_fixtures/app33-evm_connection_edb_permissions_and_roles_layer/permissions.sol b/tests/jobs_fixtures/app33-evm_connection_edb_permissions_and_roles_layer/permissions.sol index 2aec52bd3..99a08e280 100644 --- a/tests/jobs_fixtures/app33-evm_connection_edb_permissions_and_roles_layer/permissions.sol +++ b/tests/jobs_fixtures/app33-evm_connection_edb_permissions_and_roles_layer/permissions.sol @@ -1,102 +1,101 @@ +pragma solidity >=0.4.24; -pragma solidity >=0.4.0; +contract permSNative { + Permissions perm = Permissions(address(uint256(keccak256("Permissions")))); + + function hasBase(address addr, uint64 permFlag) public returns (bool) { + return perm.hasBase(addr, permFlag); + } + + function setBase(address addr, uint64 permFlag, bool value) public returns (uint64) { + return perm.setBase(addr, permFlag, value); + } + + function unsetBase(address addr, uint64 permFlag) public returns (uint64) { + return perm.unsetBase(addr, permFlag); + } + + // not currently tested + function setGlobal(uint64 permFlag, bool value) public returns (int pf) { + return perm.setGlobal(permFlag, value); + } + + function hasRole(address addr, string memory role) public returns (bool val) { + return perm.hasRole(addr, role); + } + + function addRole(address addr, string memory role) public returns (bool added) { + return perm.addRole(addr, role); + } + + function removeRole(address addr, string memory role) public returns (bool removed) { + return perm.removeRole(addr, role); + } +} /** * Interface for managing Secure Native authorizations. -* @dev This interface describes the functions exposed by the SNative permissions layer in burrow. +* @dev This interface describes the functions exposed by the native permissions layer in burrow. * @dev These functions can be accessed as if this contract were deployed at a special address (0x0A758FEB535243577C1A79AE55BED8CA03E226EC). * @dev This special address is defined as the last 20 bytes of the sha3 hash of the the contract name. * @dev To instantiate the contract use: -* @dev Permissions permissions = Permissions(address(keccak256("Permissions"))); +* @dev Permissions permissions = Permissions(address(uint256(keccak256("Permissions")))); */ -contract Permissions { +interface Permissions { /** * @notice Adds a role to an account - * @param Account account address - * @param Role role name - * @return result whether role was added + * @param _account account address + * @param _role role name + * @return _result whether role was added */ - function addRole(address Account, string memory Role) public view returns (bool Result); + function addRole(address _account, string calldata _role) external returns (bool _result); /** * @notice Removes a role from an account - * @param Account account address - * @param Role role name - * @return result whether role was removed + * @param _account account address + * @param _role role name + * @return _result whether role was removed */ - function removeRole(address Account, string memory Role) public view returns (bool Result); + function removeRole(address _account, string calldata _role) external returns (bool _result); /** * @notice Indicates whether an account has a role - * @param Account account address - * @param Role role name - * @return result whether account has role + * @param _account account address + * @param _role role name + * @return _result whether account has role */ - function hasRole(address Account, string memory Role) public view returns (bool Result); + function hasRole(address _account, string calldata _role) external returns (bool _result); /** * @notice Sets the permission flags for an account. Makes them explicitly set (on or off). - * @param Account account address - * @param Permission the base permissions flags to set for the account - * @param Set whether to set or unset the permissions flags at the account level - * @return result the effective permissions flags on the account after the call + * @param _account account address + * @param _permission the base permissions flags to set for the account + * @param _set whether to set or unset the permissions flags at the account level + * @return _result is the permission flag that was set as uint64 */ - function setBase(address Account, uint64 Permission, bool Set) public view returns (uint64 Result); + function setBase(address _account, uint64 _permission, bool _set) external returns (uint64 _result); /** * @notice Unsets the permissions flags for an account. Causes permissions being unset to fall through to global permissions. - * @param Account account address - * @param Permission the permissions flags to unset for the account - * @return result the effective permissions flags on the account after the call + * @param _account account address + * @param _permission the permissions flags to unset for the account + * @return _result is the permission flag that was unset as uint64 */ - function unsetBase(address Account, uint64 Permission) public view returns (uint64 Result); + function unsetBase(address _account, uint64 _permission) external returns (uint64 _result); /** * @notice Indicates whether an account has a subset of permissions set - * @param Account account address - * @param Permission the permissions flags (mask) to check whether enabled against base permissions for the account - * @return result whether account has the passed permissions flags set + * @param _account account address + * @param _permission the permissions flags (mask) to check whether enabled against base permissions for the account + * @return _result is whether account has the passed permissions flags set */ - function hasBase(address Account, uint64 Permission) public view returns (bool Result); + function hasBase(address _account, uint64 _permission) external returns (bool _result); /** * @notice Sets the global (default) permissions flags for the entire chain - * @param Permission the permissions flags to set - * @param Set whether to set (or unset) the permissions flags - * @return result the global permissions flags after the call + * @param _permission the permissions flags to set + * @param _set whether to set (or unset) the permissions flags + * @return _result is the permission flag that was set as uint64 */ - function setGlobal(uint64 Permission, bool Set) public view returns (uint64 Result); -} - -contract permSNative { - Permissions perm = Permissions(address(uint256(keccak256("Permissions")))); - - function hasBase(address addr, uint64 permFlag) public view returns (bool) { - return perm.hasBase(addr, permFlag); - } - - function setBase(address addr, uint64 permFlag, bool value) public view returns (uint64) { - return perm.setBase(addr, permFlag, value); - } - - function unsetBase(address addr, uint64 permFlag) public view returns (uint64) { - return perm.unsetBase(addr, permFlag); - } - - // not currently tested - function setGlobal(uint64 permFlag, bool value) public view returns (int pf) { - return perm.setGlobal(permFlag, value); - } - - function hasRole(address addr, string memory role) public view returns (bool val) { - return perm.hasRole(addr, role); - } - - function addRole(address addr, string memory role) public view returns (bool added) { - return perm.addRole(addr, role); - } - - function removeRole(address addr, string memory role) public view returns (bool removed) { - return perm.removeRole(addr, role); - } + function setGlobal(uint64 _permission, bool _set) external returns (uint64 _result); } diff --git a/tests/jobs_fixtures/app37-fallback_function/deploy.yaml b/tests/jobs_fixtures/app37-fallback_function/deploy.yaml index 17d6b3c27..9a0554b70 100644 --- a/tests/jobs_fixtures/app37-fallback_function/deploy.yaml +++ b/tests/jobs_fixtures/app37-fallback_function/deploy.yaml @@ -11,10 +11,10 @@ jobs: - name: getX query-contract: destination: $deployC - function: x + function: x - name: assertLevelUp assert: key: $getX relation: eq - val: 1 \ No newline at end of file + val: 1 diff --git a/tests/jobs_fixtures/app40-simple-storage/simple_storage.sol b/tests/jobs_fixtures/app40-simple-storage/simple_storage.sol index 4af027a7e..a1fd8fa90 100644 --- a/tests/jobs_fixtures/app40-simple-storage/simple_storage.sol +++ b/tests/jobs_fixtures/app40-simple-storage/simple_storage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract SimpleStorage { uint storedData; diff --git a/tests/jobs_fixtures/app41-filename-too-long/test.sol b/tests/jobs_fixtures/app41-filename-too-long/test.sol index 8b1a0eb33..82a403b3b 100644 --- a/tests/jobs_fixtures/app41-filename-too-long/test.sol +++ b/tests/jobs_fixtures/app41-filename-too-long/test.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract Test { } \ No newline at end of file diff --git a/tests/jobs_fixtures/app46-meta-mixed-with-normal/test.sol b/tests/jobs_fixtures/app46-meta-mixed-with-normal/test.sol index 031654be1..20d2328d3 100644 --- a/tests/jobs_fixtures/app46-meta-mixed-with-normal/test.sol +++ b/tests/jobs_fixtures/app46-meta-mixed-with-normal/test.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract Concatenator { string _name; diff --git a/tests/jobs_fixtures/app48-govern-account/deploy.yaml b/tests/jobs_fixtures/app48-govern-account/deploy.yaml index 6bf5a2723..91c949762 100644 --- a/tests/jobs_fixtures/app48-govern-account/deploy.yaml +++ b/tests/jobs_fixtures/app48-govern-account/deploy.yaml @@ -1,3 +1,6 @@ +# Exclusive with app57 +no-parallel: true + jobs: # # Add validator @@ -43,7 +46,7 @@ jobs: query-vals: field: "Set.TotalPower" -- name: AssertPowerNonZero +- name: AssertPowerConserved assert: key: $PowerAfterRemoved relation: eq diff --git a/tests/jobs_fixtures/app49-return-array-with-RETURNDATACOPY/consumeArray.sol b/tests/jobs_fixtures/app49-return-array-with-RETURNDATACOPY/consumeArray.sol index 6eecf0072..bc5ef26cf 100644 --- a/tests/jobs_fixtures/app49-return-array-with-RETURNDATACOPY/consumeArray.sol +++ b/tests/jobs_fixtures/app49-return-array-with-RETURNDATACOPY/consumeArray.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; import 'returnArray.sol'; diff --git a/tests/jobs_fixtures/app49-return-array-with-RETURNDATACOPY/returnArray.sol b/tests/jobs_fixtures/app49-return-array-with-RETURNDATACOPY/returnArray.sol index 1d2ac3d53..e6ab9a955 100644 --- a/tests/jobs_fixtures/app49-return-array-with-RETURNDATACOPY/returnArray.sol +++ b/tests/jobs_fixtures/app49-return-array-with-RETURNDATACOPY/returnArray.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract ReturnArray { function singleDigitPrimes() pure external returns (uint256[] memory) { diff --git a/tests/jobs_fixtures/app50-set-storage-zero/storageIssueWithZero.sol b/tests/jobs_fixtures/app50-set-storage-zero/storageIssueWithZero.sol index e0571c14f..44a5c3fea 100644 --- a/tests/jobs_fixtures/app50-set-storage-zero/storageIssueWithZero.sol +++ b/tests/jobs_fixtures/app50-set-storage-zero/storageIssueWithZero.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract storageIssueWithZero { diff --git a/tests/jobs_fixtures/app52-proposal-execute/contract.sol b/tests/jobs_fixtures/app52-proposal-execute/contract.sol index ae0eecef3..fd99d2c7b 100644 --- a/tests/jobs_fixtures/app52-proposal-execute/contract.sol +++ b/tests/jobs_fixtures/app52-proposal-execute/contract.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract foo { uint foobar; diff --git a/tests/jobs_fixtures/app52-proposal-execute/deploy.yaml b/tests/jobs_fixtures/app52-proposal-execute/deploy.yaml index 49d79d945..1b47b6c16 100644 --- a/tests/jobs_fixtures/app52-proposal-execute/deploy.yaml +++ b/tests/jobs_fixtures/app52-proposal-execute/deploy.yaml @@ -1,3 +1,5 @@ +no-parallel: true + jobs: - name: foobar deploy: @@ -10,7 +12,7 @@ jobs: - name: SystemAccount update-account: target: new() - native: 300 + native: 3001234 permissions: ["all"] - name: AssertSystemAccountCreated @@ -22,7 +24,7 @@ jobs: - name: DeployerAccount update-account: target: new() - native: 300 + native: 3001234 permissions: ["all"] - name: AssertDeployerAccountCreated diff --git a/tests/jobs_fixtures/app52-proposal-execute/test.sol b/tests/jobs_fixtures/app52-proposal-execute/test.sol index f56f5ebc2..7aa6fe413 100644 --- a/tests/jobs_fixtures/app52-proposal-execute/test.sol +++ b/tests/jobs_fixtures/app52-proposal-execute/test.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract bar { uint foobar; diff --git a/tests/jobs_fixtures/app54-static-call/Adoption.sol b/tests/jobs_fixtures/app54-static-call/Adoption.sol index ed53dc08f..e8f60e7f8 100644 --- a/tests/jobs_fixtures/app54-static-call/Adoption.sol +++ b/tests/jobs_fixtures/app54-static-call/Adoption.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract Adoption { diff --git a/tests/jobs_fixtures/app54-static-call/AdoptionTest.sol b/tests/jobs_fixtures/app54-static-call/AdoptionTest.sol index b5181ba7a..c43754109 100644 --- a/tests/jobs_fixtures/app54-static-call/AdoptionTest.sol +++ b/tests/jobs_fixtures/app54-static-call/AdoptionTest.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; interface AdoptionInterface{ function adopt(uint petId) external returns (uint); function getAdopters() external view returns (address[16] memory); diff --git a/tests/jobs_fixtures/app57-bond-unbond/deploy.yaml b/tests/jobs_fixtures/app57-bond-unbond/deploy.yaml index a33a1e7b7..8a086a910 100644 --- a/tests/jobs_fixtures/app57-bond-unbond/deploy.yaml +++ b/tests/jobs_fixtures/app57-bond-unbond/deploy.yaml @@ -1,5 +1,6 @@ -jobs: +no-parallel: true +jobs: - name: power set: val: 12345 @@ -42,4 +43,4 @@ jobs: assert: key: $PowerAfterRemoved relation: eq - val: $InitialTotalPower \ No newline at end of file + val: $InitialTotalPower diff --git a/tests/jobs_fixtures/app57-bond-unbond/storage.sol b/tests/jobs_fixtures/app57-bond-unbond/storage.sol new file mode 100644 index 000000000..337fdcce9 --- /dev/null +++ b/tests/jobs_fixtures/app57-bond-unbond/storage.sol @@ -0,0 +1,14 @@ +pragma solidity >=0.0.0; + +contract Storage { + int storedData; + + function set(int x) public { + storedData = x; + } + + function get() view public returns (int retVal) { + return storedData; + } +} + diff --git a/tests/jobs_fixtures/app58-operator-sdiv/OperatorSdiv.sol b/tests/jobs_fixtures/app58-operator-sdiv/OperatorSdiv.sol new file mode 100644 index 000000000..a93f53f0e --- /dev/null +++ b/tests/jobs_fixtures/app58-operator-sdiv/OperatorSdiv.sol @@ -0,0 +1,7 @@ +pragma solidity >=0.0.0; + +contract OperatorSdiv { + function sdiv(int a, int b) public returns(int) { + return a / b; + } +} diff --git a/tests/jobs_fixtures/app58-operator-sdiv/deploy.yaml b/tests/jobs_fixtures/app58-operator-sdiv/deploy.yaml new file mode 100644 index 000000000..a92767886 --- /dev/null +++ b/tests/jobs_fixtures/app58-operator-sdiv/deploy.yaml @@ -0,0 +1,65 @@ +jobs: + +- name: deployOperatorSdiv + deploy: + contract: OperatorSdiv.sol + +# first test: 7 / 3 == 2 +- name: test1 + call: + destination: $deployOperatorSdiv + function: sdiv + data: + - 7 + - 3 + +- name: assertTest1 + assert: + key: $test1 + relation: eq + val: 2 + +# second test: 7 / (-3) == -2 +- name: test2 + call: + destination: $deployOperatorSdiv + function: sdiv + data: + - 7 + - -3 + +- name: assertTest2 + assert: + key: $test2 + relation: eq + val: -2 + +# third test: (-7) / 3 == -2 +- name: test3 + call: + destination: $deployOperatorSdiv + function: sdiv + data: + - -7 + - 3 + +- name: assertTest3 + assert: + key: $test3 + relation: eq + val: -2 + +# fourth test: (-7) / (-3) == 2 +- name: test4 + call: + destination: $deployOperatorSdiv + function: sdiv + data: + - -7 + - -3 + +- name: assertTest4 + assert: + key: $test4 + relation: eq + val: 2 \ No newline at end of file diff --git a/tests/jobs_fixtures/app58-operator-sdiv/readme.md b/tests/jobs_fixtures/app58-operator-sdiv/readme.md new file mode 100644 index 000000000..e3031a04c --- /dev/null +++ b/tests/jobs_fixtures/app58-operator-sdiv/readme.md @@ -0,0 +1,3 @@ +* According to [Ethereum Yellow Paper](https://ethereum.github.io/yellowpaper/paper.pdf), +for signed division `a / b == sign(a/b) * floor(abs(a/b))`. +Therefore, `7 / 3`, `7 / (-3)`, `(-7) / 3` and `(-7) / (-3)` should give `2`, `-2`, `-2` and `2` respectively. \ No newline at end of file diff --git a/tests/jobs_fixtures/app59-operator-smod/OperatorSmod.sol b/tests/jobs_fixtures/app59-operator-smod/OperatorSmod.sol new file mode 100644 index 000000000..15879a3fc --- /dev/null +++ b/tests/jobs_fixtures/app59-operator-smod/OperatorSmod.sol @@ -0,0 +1,7 @@ +pragma solidity >=0.0.0; + +contract OperatorSmod { + function smod(int a, int b) public returns(int) { + return a % b; + } +} diff --git a/tests/jobs_fixtures/app59-operator-smod/deploy.yaml b/tests/jobs_fixtures/app59-operator-smod/deploy.yaml new file mode 100644 index 000000000..7b7e76219 --- /dev/null +++ b/tests/jobs_fixtures/app59-operator-smod/deploy.yaml @@ -0,0 +1,65 @@ +jobs: + + - name: deployOperatorSmod + deploy: + contract: OperatorSmod.sol + + # first test: 7 % 3 == 1 + - name: test1 + call: + destination: $deployOperatorSmod + function: smod + data: + - 7 + - 3 + + - name: assertTest1 + assert: + key: $test1 + relation: eq + val: 1 + + # second test: 7 % (-3) == 1 + - name: test2 + call: + destination: $deployOperatorSmod + function: smod + data: + - 7 + - -3 + + - name: assertTest2 + assert: + key: $test2 + relation: eq + val: 1 + + # third test: (-7) % 3 == -1 + - name: test3 + call: + destination: $deployOperatorSmod + function: smod + data: + - -7 + - 3 + + - name: assertTest3 + assert: + key: $test3 + relation: eq + val: -1 + + # fourth test: (-7) % (-3) == -1 + - name: test4 + call: + destination: $deployOperatorSmod + function: smod + data: + - -7 + - -3 + + - name: assertTest4 + assert: + key: $test4 + relation: eq + val: -1 \ No newline at end of file diff --git a/tests/jobs_fixtures/app59-operator-smod/readme.md b/tests/jobs_fixtures/app59-operator-smod/readme.md new file mode 100644 index 000000000..2fe2a53d1 --- /dev/null +++ b/tests/jobs_fixtures/app59-operator-smod/readme.md @@ -0,0 +1,3 @@ +* According to [Ethereum Yellow Paper](https://ethereum.github.io/yellowpaper/paper.pdf), +for signed modulo `a % b == sign(a) * (abs(a) % abs(b))`. +Therefore, `7 % 3`, `7 % (-3)`, `(-7) % 3` and `(-7) % (-3)` should give `1`, `1`, `-1` and `-1` respectively. \ No newline at end of file diff --git a/tests/jobs_fixtures/expected-failure-revert/revert.sol b/tests/jobs_fixtures/expected-failure-revert/revert.sol index c7c4ea776..73d18126d 100644 --- a/tests/jobs_fixtures/expected-failure-revert/revert.sol +++ b/tests/jobs_fixtures/expected-failure-revert/revert.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.5; contract Revert { function RevertIf0(uint32 i) public pure diff --git a/tests/js/deploy.yaml b/tests/js/deploy.yaml deleted file mode 100644 index 840ac0100..000000000 --- a/tests/js/deploy.yaml +++ /dev/null @@ -1,12 +0,0 @@ -jobs: - -- name: randomDeploy - deploy: - contract: random.sol - -- name: randomRegister - register: - name: random - data: $randomDeploy - amount: 5000 - fee: 2000 diff --git a/tests/js/js.sh b/tests/js/js.sh deleted file mode 100755 index 432bea388..000000000 --- a/tests/js/js.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -# ---------------------------------------------------------- -# PURPOSE - -# This is the test manager for playbooks. It will run the testing -# sequence for playbooks referencing test fixtures in this tests directory. - -# ---------------------------------------------------------- -# REQUIREMENTS - -# m - -# ---------------------------------------------------------- -# USAGE - -# run_pkgs_tests.sh [appXX] - - -export jsscript_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source "$jsscript_dir/../test_runner.sh" - -export js_dir="${script_dir}/../js" - - -perform_js_tests(){ - cd "$jsscript_dir" - # First deploy a solidity file using burrow deploy so it has metadata - $burrow_bin deploy --chain=$BURROW_HOST:$BURROW_GRPC_PORT -a $key1_addr deploy.yaml - cd "$js_dir" - test_account="{\"address\": \"$key1_addr\"}" - echo "Using test account:" - echo $test_account - account="$test_account" mocha --bail --exit --recursive ${1} - test_exit=$? -} - -burrowjs_tests() { - echo "Hello! I'm the marmot that tests burrow-js." - echo - - test_setup - trap test_teardown EXIT - - echo "Running js tests..." - perform_js_tests "$1" -} - -burrowjs_tests "$1" diff --git a/tests/js/random.sol b/tests/js/random.sol deleted file mode 100644 index ed3cca635..000000000 --- a/tests/js/random.sol +++ /dev/null @@ -1,7 +0,0 @@ -pragma solidity >=0.0.0; - -contract random { - function getRandomNumber() public pure returns (uint) { - return 55; - } -} diff --git a/tests/keys_server/test.sh b/tests/keys_server/test.sh index 0418d6b7e..f4d0471a9 100755 --- a/tests/keys_server/test.sh +++ b/tests/keys_server/test.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/usr/bin/env bash # tests # run the suite with and without the daemon diff --git a/tests/scripts/deps/solang.sh b/tests/scripts/deps/solang.sh new file mode 100755 index 000000000..4db93801d --- /dev/null +++ b/tests/scripts/deps/solang.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e +SOLANG_URL="https://github.com/hyperledger-labs/solang/releases/download/v0.1.7/solang-linux" +SOLANG_BIN="$1" + +wget -O "$SOLANG_BIN" "$SOLANG_URL" + +chmod +x "$SOLANG_BIN" diff --git a/tests/scripts/deps/solc.sh b/tests/scripts/deps/solc.sh index d86299687..6a45c9966 100755 --- a/tests/scripts/deps/solc.sh +++ b/tests/scripts/deps/solc.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e # Static solc that will run on linux included Alpine -SOLC_URL="https://github.com/ethereum/solidity/releases/download/v0.5.4/solc-static-linux" +SOLC_URL="https://github.com/ethereum/solidity/releases/download/v0.5.12/solc-static-linux" SOLC_BIN="$1" wget -O "$SOLC_BIN" "$SOLC_URL" diff --git a/tests/test_runner.sh b/tests/test_runner.sh index 638ac5d9f..d92c30521 100755 --- a/tests/test_runner.sh +++ b/tests/test_runner.sh @@ -19,14 +19,13 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export burrow_bin=${burrow_bin:-burrow} export solc_bin=${solc_bin:-solc} +export solang_bin=${solang_bin:-solang} # If false we will not try to start Burrow and expect them to be running export boot=${boot:-true} export debug=${debug:-false} export clean=${clean:-true} -export failures="not supplied by test" - export test_exit=0 if [[ "$debug" = true ]]; then @@ -39,8 +38,8 @@ fi # Constants # Ports etc must match those in burrow.toml -export BURROW_GRPC_PORT=20997 export BURROW_HOST=127.0.0.1 +export BURROW_GRPC_PORT=20123 export chain_dir="$script_dir/chain" @@ -69,15 +68,17 @@ test_setup(){ echo echo "Using binaries:" echo " $(type ${solc_bin}) (version: $(${solc_bin} --version))" + echo " $(type ${solang_bin}) (version: $(${solang_bin} --version))" echo " $(type ${burrow_bin}) (version: $(${burrow_bin} --version))" echo # start test chain + BURROW_ADDRESS="$BURROW_HOST:$BURROW_GRPC_PORT" if [[ "$boot" = true ]]; then - echo "Starting Burrow using GRPC address: $BURROW_HOST:$BURROW_GRPC_PORT..." + echo "Starting Burrow using GRPC address: $BURROW_ADDRESS..." echo rm -rf ${burrow_root} pushd "$chain_dir" - ${burrow_bin} start -i0 2> "$burrow_log"& + ${burrow_bin} start --index 0 --grpc-address $BURROW_ADDRESS 2> "$burrow_log"& burrow_pid=$! popd else @@ -114,11 +115,6 @@ test_teardown(){ echo "Tests complete! Tests are Green. :)" else echo "Tests complete. Tests are Red. :(" - echo "Failures in:" - for failure in "${failures[@]}" - do - echo "$failure" - done fi exit ${test_exit} } diff --git a/tests/web3/truffle.sh b/tests/web3/truffle.sh new file mode 100755 index 000000000..593d4d40a --- /dev/null +++ b/tests/web3/truffle.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +chain=$(mktemp -d) +cd $chain +$burrow_bin spec -v1 -d2 | $burrow_bin configure -s- --curve-type secp256k1 > burrow.toml +$burrow_bin start &> /dev/null & +burrow_pid=$! + +contracts=$(mktemp -d) +cd $contracts + +function finish { + kill -TERM $burrow_pid + rm -rf "$chain" + rm -rf "$contracts" +} +trap finish EXIT + +npm install -g truffle +truffle unbox metacoin + +cat << EOF > truffle-config.js +module.exports = { + networks: { + burrow: { + host: "127.0.0.1", + port: 26660, + network_id: "*", + }, + } +}; +EOF +truffle test --network burrow diff --git a/tests/web3/web3test/web3test.go b/tests/web3/web3test/web3test.go new file mode 100644 index 000000000..8b6913b0a --- /dev/null +++ b/tests/web3/web3test/web3test.go @@ -0,0 +1,50 @@ +package web3test + +import ( + "fmt" + "os" + "testing" + + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/rpc/lib/jsonrpc" + "github.com/stretchr/testify/require" + "github.com/tmthrgd/go-hex" +) + +const ganacheRemote = "http://127.0.0.1:8545" + +// Configured in the "ganache" yarn script in vent/test/eth/package.json +var ganachePrivateKey = hex.MustDecodeString("cfad15e9e8f24b5b5608cac150293fe971d23cd9168206b231c859b7974d4295") + +// Set INFURA_SECRET to the basic auth password to use infura remote +var infuraRemote = fmt.Sprintf("https://:%s@ropsten.infura.io/v3/7ed3059377654803a190fa44560d528f", + os.Getenv("INFURA_SECRET")) + +// Toggle below to switch to an infura test +var remote = ganacheRemote + +//var remote = infuraRemote + +var client = jsonrpc.NewClient(remote) + +func GetChainRemote() string { + return remote +} + +func GetChainRPCClient() *jsonrpc.Client { + return client +} + +func GetPrivateKey(t testing.TB) *crypto.PrivateKey { + if remote == ganacheRemote { + pk, err := crypto.PrivateKeyFromRawBytes(ganachePrivateKey, crypto.CurveTypeSecp256k1) + require.NoError(t, err) + return &pk + } + // This account (5DA093B66C2D373E4CBB6081312BE5DFCFF66189) had some test ether on Ropsten at some point: + // https://ropsten.etherscan.io/address/0x5DA093B66C2D373E4CBB6081312BE5DFCFF66189 + // https://faucet.dimensions.network/ seems to be less trigger happy on banning you to top up eth supply + pk := crypto.PrivateKeyFromSecret("fooooo", crypto.CurveTypeSecp256k1) + fmt.Println(pk.GetAddress()) + return &pk +} diff --git a/txs/envelope.go b/txs/envelope.go index d54318461..ae4e20065 100644 --- a/txs/envelope.go +++ b/txs/envelope.go @@ -50,7 +50,7 @@ func (s *Signatory) RealisePublicKey(getter acmstate.AccountGetter) error { return fmt.Errorf("%s: could not get account %v: %v", errPrefix, *s.Address, err) } publicKey := acc.PublicKey - s.PublicKey = &publicKey + s.PublicKey = publicKey } if !s.PublicKey.IsValid() { return fmt.Errorf("%s: public key %v is invalid", errPrefix, *s.PublicKey) @@ -94,7 +94,7 @@ func (sig *Signatory) Validate() error { // Verifies the validity of the Signatories' Signatures in the Envelope. The Signatories must // appear in the same order as the inputs as returned by Tx.GetInputs(). -func (txEnv *Envelope) Verify(getter acmstate.AccountGetter, chainID string) error { +func (txEnv *Envelope) Verify(chainID string) error { err := txEnv.Validate() if err != nil { return err @@ -109,7 +109,7 @@ func (txEnv *Envelope) Verify(getter acmstate.AccountGetter, chainID string) err return fmt.Errorf("%s: number of inputs (= %v) should equal number of signatories (= %v)", errPrefix, len(inputs), len(txEnv.Signatories)) } - signBytes, err := txEnv.Tx.SignBytes() + signBytes, err := txEnv.Tx.SignBytes(txEnv.GetEncoding()) if err != nil { return fmt.Errorf("%s: could not generate SignBytes: %v", errPrefix, err) } @@ -132,7 +132,7 @@ func (txEnv *Envelope) Verify(getter acmstate.AccountGetter, chainID string) err func (txEnv *Envelope) Sign(signingAccounts ...acm.AddressableSigner) error { // Clear any existing txEnv.Signatories = nil - signBytes, err := txEnv.Tx.SignBytes() + signBytes, err := txEnv.Tx.SignBytes(txEnv.GetEncoding()) if err != nil { return err } @@ -154,7 +154,7 @@ func (txEnv *Envelope) Sign(signingAccounts ...acm.AddressableSigner) error { publicKey := sa.GetPublicKey() txEnv.Signatories = append(txEnv.Signatories, Signatory{ Address: &address, - PublicKey: &publicKey, + PublicKey: publicKey, Signature: sig, }) } diff --git a/txs/ethereum_tx.go b/txs/ethereum_tx.go new file mode 100644 index 000000000..b697da426 --- /dev/null +++ b/txs/ethereum_tx.go @@ -0,0 +1,130 @@ +package txs + +import ( + "fmt" + "math/big" + + "github.com/btcsuite/btcd/btcec" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/encoding/rlp" + "github.com/tmthrgd/go-hex" +) + +// Order matters for serialisation +type EthRawTx struct { + Sequence uint64 `json:"nonce"` + GasPrice uint64 `json:"gasPrice"` + GasLimit uint64 `json:"gasLimit"` + To []byte `json:"to"` + Amount *big.Int `json:"value"` + Data []byte `json:"data"` + // Signature + V *big.Int + R *big.Int + S *big.Int + // Included in hash but not part of serialised message + chainID *big.Int +} + +func NewEthRawTx(chainID *big.Int) *EthRawTx { + return &EthRawTx{chainID: chainID} +} + +func EthRawTxFromEnvelope(txEnv *Envelope) (*EthRawTx, error) { + if txEnv.GetEncoding() != Envelope_RLP { + return nil, fmt.Errorf("can only form EthRawTx from RLP-encoded Envelope") + } + rawTx, err := txEnv.Tx.RLPRawTx() + if err != nil { + return nil, err + } + if len(txEnv.Signatories) == 0 { + return rawTx, nil + } + if len(txEnv.Signatories) > 1 { + return nil, fmt.Errorf("can only form EthRawTx from Envelope with a zero or one signatories") + } + sig, err := txEnv.Signatories[0].Signature.GetEthSignature(encoding.GetEthChainID(txEnv.Tx.ChainID)) + if err != nil { + return nil, err + } + // Link signature values into EthRawTx + rawTx.V = &sig.V + rawTx.R = &sig.R + rawTx.S = &sig.S + return rawTx, nil +} + +func (tx *EthRawTx) RecoverPublicKey() (*crypto.PublicKey, *crypto.Signature, error) { + hash, err := tx.Hash() + if err != nil { + return nil, nil, err + } + if tx.R.Sign() == 0 || tx.S.Sign() == 0 { + return nil, nil, fmt.Errorf("EthRawTx does not appear to be signed") + } + ethSig := crypto.EIP155Signature{ + Secp256k1Signature: crypto.Secp256k1Signature{ + V: *tx.V, + R: *tx.R, + S: *tx.S, + }, + } + compactSig, err := ethSig.ToCompactSignature() + if err != nil { + return nil, nil, err + } + pubKey, compressed, err := btcec.RecoverCompact(btcec.S256(), compactSig, hash) + if err != nil { + return nil, nil, err + } + var pubKeyBytes []byte + if compressed { + pubKeyBytes = pubKey.SerializeCompressed() + } else { + pubKeyBytes = pubKey.SerializeUncompressed() + } + publicKey, err := crypto.PublicKeyFromBytes(pubKeyBytes, crypto.CurveTypeSecp256k1) + if err != nil { + return nil, nil, err + } + signature, err := crypto.SignatureFromBytes(compactSig, crypto.CurveTypeSecp256k1) + if err != nil { + return nil, nil, err + } + return publicKey, signature, nil +} + +func (tx *EthRawTx) SignBytes() ([]byte, error) { + return rlp.Encode([]interface{}{ + tx.Sequence, + tx.GasPrice, + tx.GasLimit, + tx.To, + tx.Amount, + tx.Data, + tx.chainID, + uint(0), uint(0), + }) +} + +func (tx *EthRawTx) Hash() ([]byte, error) { + enc, err := tx.SignBytes() + if err != nil { + return nil, err + } + return crypto.Keccak256(enc), nil +} + +func (tx *EthRawTx) Marshal() ([]byte, error) { + return rlp.Encode(tx) +} + +func (tx *EthRawTx) MarshalString() (string, error) { + bs, err := tx.Marshal() + if err != nil { + return "", err + } + return "0x" + hex.EncodeToString(bs), nil +} diff --git a/txs/payload/bond_tx.go b/txs/payload/bond_tx.go index d42c0722d..1c8750a4a 100644 --- a/txs/payload/bond_tx.go +++ b/txs/payload/bond_tx.go @@ -28,7 +28,7 @@ func (tx *BondTx) String() string { return fmt.Sprintf("BondTx{%v}", tx.Input) } -func (tx *BondTx) AddInput(st acmstate.AccountGetter, pubkey crypto.PublicKey, amt uint64) error { +func (tx *BondTx) AddInput(st acmstate.AccountGetter, pubkey *crypto.PublicKey, amt uint64) error { addr := pubkey.GetAddress() acc, err := st.GetAccount(addr) if err != nil { @@ -40,7 +40,7 @@ func (tx *BondTx) AddInput(st acmstate.AccountGetter, pubkey crypto.PublicKey, a return tx.AddInputWithSequence(pubkey, amt, acc.Sequence+uint64(1)) } -func (tx *BondTx) AddInputWithSequence(pubkey crypto.PublicKey, amt uint64, sequence uint64) error { +func (tx *BondTx) AddInputWithSequence(pubkey *crypto.PublicKey, amt uint64, sequence uint64) error { tx.Input = &TxInput{ Address: pubkey.GetAddress(), Amount: amt, diff --git a/txs/payload/call_tx.go b/txs/payload/call_tx.go index 2806d5996..7827ec3f4 100644 --- a/txs/payload/call_tx.go +++ b/txs/payload/call_tx.go @@ -7,7 +7,7 @@ import ( "github.com/hyperledger/burrow/crypto" ) -func NewCallTx(st acmstate.AccountGetter, from crypto.PublicKey, to *crypto.Address, data []byte, +func NewCallTx(st acmstate.AccountGetter, from *crypto.PublicKey, to *crypto.Address, data []byte, amt, gasLimit, fee uint64) (*CallTx, error) { addr := from.GetAddress() @@ -23,7 +23,7 @@ func NewCallTx(st acmstate.AccountGetter, from crypto.PublicKey, to *crypto.Addr return NewCallTxWithSequence(from, to, data, amt, gasLimit, fee, sequence), nil } -func NewCallTxWithSequence(from crypto.PublicKey, to *crypto.Address, data []byte, +func NewCallTxWithSequence(from *crypto.PublicKey, to *crypto.Address, data []byte, amt, gasLimit, fee, sequence uint64) *CallTx { input := &TxInput{ Address: from.GetAddress(), diff --git a/txs/payload/gov_tx.go b/txs/payload/gov_tx.go index eb4e5a1d4..b68a65bd9 100644 --- a/txs/payload/gov_tx.go +++ b/txs/payload/gov_tx.go @@ -2,8 +2,16 @@ package payload import ( "fmt" + + "github.com/hyperledger/burrow/acm/balance" + "github.com/hyperledger/burrow/crypto" + spec "github.com/hyperledger/burrow/genesis/spec" + permission "github.com/hyperledger/burrow/permission" ) +// GovernanceTx contains functionality for altering permissions, token distribution, consensus parameters, +// validators, and network forks. + func (tx *GovTx) Type() Type { return TypeGovernance } @@ -21,3 +29,47 @@ func (tx *GovTx) Any() *Any { GovTx: tx, } } + +// TODO: +// - Set validator power +// - Set account amount(s) +// - Set account permissions +// - Set global permissions +// - Set ConsensusParams +// Future considerations: +// - Handle network forks/termination/merging/replacement ? +// - Provide transaction in stasis/sudo (voting?) +// - Handle bonding by other means (e.g. pre-shared key permitting n bondings) +// - Network administered proxies (i.e. instead of keys have password authentication for identities - allow calls to originate as if from address without key?) +// Subject to: +// - Less than 1/3 validator power change per block + +// Creates a GovTx that alters the validator power of id to the power passed +func AlterPowerTx(inputAddress crypto.Address, id crypto.Addressable, power uint64) *GovTx { + return AlterBalanceTx(inputAddress, id, balance.New().Power(power)) +} + +func AlterBalanceTx(inputAddress crypto.Address, id crypto.Addressable, bal balance.Balances) *GovTx { + publicKey := id.GetPublicKey() + return UpdateAccountTx(inputAddress, &spec.TemplateAccount{ + PublicKey: publicKey, + Amounts: bal, + }) +} + +func AlterPermissionsTx(inputAddress crypto.Address, id crypto.Addressable, perms permission.PermFlag) *GovTx { + address := id.GetAddress() + return UpdateAccountTx(inputAddress, &spec.TemplateAccount{ + Address: &address, + Permissions: permission.PermFlagToStringList(perms), + }) +} + +func UpdateAccountTx(inputAddress crypto.Address, updates ...*spec.TemplateAccount) *GovTx { + return &GovTx{ + Inputs: []*TxInput{{ + Address: inputAddress, + }}, + AccountUpdates: updates, + } +} diff --git a/txs/payload/identify_tx.go b/txs/payload/identify_tx.go new file mode 100644 index 000000000..e58e0fe92 --- /dev/null +++ b/txs/payload/identify_tx.go @@ -0,0 +1,35 @@ +package payload + +import ( + "fmt" + + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/registry" +) + +func NewIdentifyTx(address crypto.Address, node *registry.NodeIdentity) *IdentifyTx { + return &IdentifyTx{ + Inputs: []*TxInput{&TxInput{ + Address: address, + }}, + Node: node, + } +} + +func (tx *IdentifyTx) Type() Type { + return TypeIdentify +} + +func (tx *IdentifyTx) GetInputs() []*TxInput { + return tx.Inputs +} + +func (tx *IdentifyTx) String() string { + return fmt.Sprintf("IdentifyTx{%v -> %v}", tx.Inputs, tx.Node.NetworkAddress) +} + +func (tx *IdentifyTx) Any() *Any { + return &Any{ + IdentifyTx: tx, + } +} diff --git a/txs/payload/name_tx.go b/txs/payload/name_tx.go index 9a8076fee..6bef57506 100644 --- a/txs/payload/name_tx.go +++ b/txs/payload/name_tx.go @@ -7,7 +7,7 @@ import ( "github.com/hyperledger/burrow/crypto" ) -func NewNameTx(st acmstate.AccountGetter, from crypto.PublicKey, name, data string, amt, fee uint64) (*NameTx, error) { +func NewNameTx(st acmstate.AccountGetter, from *crypto.PublicKey, name, data string, amt, fee uint64) (*NameTx, error) { addr := from.GetAddress() acc, err := st.GetAccount(addr) if err != nil { @@ -21,7 +21,7 @@ func NewNameTx(st acmstate.AccountGetter, from crypto.PublicKey, name, data stri return NewNameTxWithSequence(from, name, data, amt, fee, sequence), nil } -func NewNameTxWithSequence(from crypto.PublicKey, name, data string, amt, fee, sequence uint64) *NameTx { +func NewNameTxWithSequence(from *crypto.PublicKey, name, data string, amt, fee, sequence uint64) *NameTx { input := &TxInput{ Address: from.GetAddress(), Amount: amt, diff --git a/txs/payload/payload.go b/txs/payload/payload.go index 95bdbe777..9b25466cf 100644 --- a/txs/payload/payload.go +++ b/txs/payload/payload.go @@ -2,7 +2,6 @@ package payload import ( "fmt" - "strings" ) /* @@ -40,6 +39,7 @@ const ( TypePermissions = Type(0x21) TypeGovernance = Type(0x22) TypeProposal = Type(0x23) + TypeIdentify = Type(0x24) ) type Payload interface { @@ -62,6 +62,7 @@ var nameFromType = map[Type]string{ TypeProposal: "ProposalTx", TypeBond: "BondTx", TypeUnbond: "UnbondTx", + TypeIdentify: "IdentifyTx", } var typeFromName = make(map[string]Type) @@ -102,14 +103,23 @@ func (typ *Type) Unmarshal(data []byte) error { return typ.UnmarshalText(data) } -func InputsString(inputs []*TxInput) string { - strs := make([]string, len(inputs)) - for i, in := range inputs { - strs[i] = in.Address.String() - } - return strings.Join(strs, ",") -} - +//func (tx *CallTx) ProtoReflect() protoreflect.Message { +// fd, _ := descriptor.ForMessage(tx) +// ggfd, _ := descriptor.ForMessage() +// protodesc.NewFiles(&descriptorpb.FileDescriptorSet{File: }) +// f, err := protodesc.NewFile(fd, nil) +// if err != nil { +// panic(err) +// } +// mi := &protoimpl.MessageInfo{ +// GoReflectType: reflect.TypeOf(tx), +// Desc: f.Messages().Get(0), +// } +// m := mi.MessageOf(tx) +// fmt.Sprint(fd) +// return m +//} +// func New(txType Type) (Payload, error) { switch txType { case TypeSend: @@ -130,6 +140,8 @@ func New(txType Type) (Payload, error) { return &UnbondTx{}, nil case TypeProposal: return &ProposalTx{}, nil + case TypeIdentify: + return &IdentifyTx{}, nil } return nil, fmt.Errorf("unknown payload type: %d", txType) } diff --git a/txs/payload/payload.pb.go b/txs/payload/payload.pb.go index 8bbb5e8b0..0923fbc57 100644 --- a/txs/payload/payload.pb.go +++ b/txs/payload/payload.pb.go @@ -7,12 +7,14 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" golang_proto "github.com/golang/protobuf/proto" github_com_hyperledger_burrow_binary "github.com/hyperledger/burrow/binary" github_com_hyperledger_burrow_crypto "github.com/hyperledger/burrow/crypto" + registry "github.com/hyperledger/burrow/execution/registry" spec "github.com/hyperledger/burrow/genesis/spec" permission "github.com/hyperledger/burrow/permission" ) @@ -27,7 +29,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 type Ballot_ProposalState int32 @@ -55,9 +57,10 @@ func (x Ballot_ProposalState) String() string { } func (Ballot_ProposalState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_678c914f1bee6d56, []int{15, 0} + return fileDescriptor_678c914f1bee6d56, []int{16, 0} } +// Any encodes a sum type for which only one should be set type Any struct { CallTx *CallTx `protobuf:"bytes,1,opt,name=CallTx,proto3" json:"CallTx,omitempty"` SendTx *SendTx `protobuf:"bytes,2,opt,name=SendTx,proto3" json:"SendTx,omitempty"` @@ -68,6 +71,7 @@ type Any struct { UnbondTx *UnbondTx `protobuf:"bytes,7,opt,name=UnbondTx,proto3" json:"UnbondTx,omitempty"` BatchTx *BatchTx `protobuf:"bytes,8,opt,name=BatchTx,proto3" json:"BatchTx,omitempty"` ProposalTx *ProposalTx `protobuf:"bytes,9,opt,name=ProposalTx,proto3" json:"ProposalTx,omitempty"` + IdentifyTx *IdentifyTx `protobuf:"bytes,10,opt,name=IdentifyTx,proto3" json:"IdentifyTx,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -83,16 +87,12 @@ func (m *Any) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Any.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *Any) XXX_Merge(src proto.Message) { xxx_messageInfo_Any.Merge(m, src) @@ -169,6 +169,13 @@ func (m *Any) GetProposalTx() *ProposalTx { return nil } +func (m *Any) GetIdentifyTx() *IdentifyTx { + if m != nil { + return m.IdentifyTx + } + return nil +} + func (*Any) XXX_MessageName() string { return "payload.Any" } @@ -196,16 +203,12 @@ func (m *TxInput) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *TxInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxInput.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *TxInput) XXX_Merge(src proto.Message) { xxx_messageInfo_TxInput.Merge(m, src) @@ -257,16 +260,12 @@ func (m *TxOutput) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *TxOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxOutput.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *TxOutput) XXX_Merge(src proto.Message) { xxx_messageInfo_TxOutput.Merge(m, src) @@ -306,10 +305,12 @@ type CallTx struct { // WASM bytecode WASM github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,6,opt,name=WASM,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"tags,omitempty"` // Set of contracts this code will deploy - ContractMeta []*ContractMeta `protobuf:"bytes,7,rep,name=ContractMeta,proto3" json:"ContractMeta,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ContractMeta []*ContractMeta `protobuf:"bytes,7,rep,name=ContractMeta,proto3" json:"ContractMeta,omitempty"` + // The upper bound on the price per unit of gas + GasPrice uint64 `protobuf:"varint,8,opt,name=GasPrice,proto3" json:"GasPrice,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CallTx) Reset() { *m = CallTx{} } @@ -321,16 +322,12 @@ func (m *CallTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *CallTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CallTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *CallTx) XXX_Merge(src proto.Message) { xxx_messageInfo_CallTx.Merge(m, src) @@ -372,6 +369,13 @@ func (m *CallTx) GetContractMeta() []*ContractMeta { return nil } +func (m *CallTx) GetGasPrice() uint64 { + if m != nil { + return m.GasPrice + } + return 0 +} + func (*CallTx) XXX_MessageName() string { return "payload.CallTx" } @@ -394,16 +398,12 @@ func (m *ContractMeta) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ContractMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ContractMeta.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *ContractMeta) XXX_Merge(src proto.Message) { xxx_messageInfo_ContractMeta.Merge(m, src) @@ -448,16 +448,12 @@ func (m *SendTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *SendTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SendTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *SendTx) XXX_Merge(src proto.Message) { xxx_messageInfo_SendTx.Merge(m, src) @@ -495,16 +491,12 @@ func (m *PermsTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *PermsTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PermsTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *PermsTx) XXX_Merge(src proto.Message) { xxx_messageInfo_PermsTx.Merge(m, src) @@ -560,16 +552,12 @@ func (m *NameTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *NameTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NameTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *NameTx) XXX_Merge(src proto.Message) { xxx_messageInfo_NameTx.Merge(m, src) @@ -632,16 +620,12 @@ func (m *BondTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *BondTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BondTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *BondTx) XXX_Merge(src proto.Message) { xxx_messageInfo_BondTx.Merge(m, src) @@ -677,16 +661,12 @@ func (m *UnbondTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *UnbondTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnbondTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *UnbondTx) XXX_Merge(src proto.Message) { xxx_messageInfo_UnbondTx.Merge(m, src) @@ -721,16 +701,12 @@ func (m *GovTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GovTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GovTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *GovTx) XXX_Merge(src proto.Message) { xxx_messageInfo_GovTx.Merge(m, src) @@ -767,16 +743,12 @@ func (m *ProposalTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ProposalTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *ProposalTx) XXX_Merge(src proto.Message) { xxx_messageInfo_ProposalTx.Merge(m, src) @@ -794,6 +766,48 @@ func (*ProposalTx) XXX_MessageName() string { return "payload.ProposalTx" } +type IdentifyTx struct { + // Senders + Inputs []*TxInput `protobuf:"bytes,1,rep,name=Inputs,proto3" json:"Inputs,omitempty"` + // Node to register + Node *registry.NodeIdentity `protobuf:"bytes,2,opt,name=Node,proto3" json:"Node,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IdentifyTx) Reset() { *m = IdentifyTx{} } +func (*IdentifyTx) ProtoMessage() {} +func (*IdentifyTx) Descriptor() ([]byte, []int) { + return fileDescriptor_678c914f1bee6d56, []int{12} +} +func (m *IdentifyTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IdentifyTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *IdentifyTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_IdentifyTx.Merge(m, src) +} +func (m *IdentifyTx) XXX_Size() int { + return m.Size() +} +func (m *IdentifyTx) XXX_DiscardUnknown() { + xxx_messageInfo_IdentifyTx.DiscardUnknown(m) +} + +var xxx_messageInfo_IdentifyTx proto.InternalMessageInfo + +func (*IdentifyTx) XXX_MessageName() string { + return "payload.IdentifyTx" +} + type BatchTx struct { Inputs []*TxInput `protobuf:"bytes,1,rep,name=Inputs,proto3" json:"Inputs,omitempty"` Txs []*Any `protobuf:"bytes,2,rep,name=Txs,proto3" json:"Txs,omitempty"` @@ -805,22 +819,18 @@ type BatchTx struct { func (m *BatchTx) Reset() { *m = BatchTx{} } func (*BatchTx) ProtoMessage() {} func (*BatchTx) Descriptor() ([]byte, []int) { - return fileDescriptor_678c914f1bee6d56, []int{12} + return fileDescriptor_678c914f1bee6d56, []int{13} } func (m *BatchTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *BatchTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BatchTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *BatchTx) XXX_Merge(src proto.Message) { xxx_messageInfo_BatchTx.Merge(m, src) @@ -849,22 +859,18 @@ type Vote struct { func (m *Vote) Reset() { *m = Vote{} } func (*Vote) ProtoMessage() {} func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_678c914f1bee6d56, []int{13} + return fileDescriptor_678c914f1bee6d56, []int{14} } func (m *Vote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Vote.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *Vote) XXX_Merge(src proto.Message) { xxx_messageInfo_Vote.Merge(m, src) @@ -894,22 +900,18 @@ type Proposal struct { func (m *Proposal) Reset() { *m = Proposal{} } func (*Proposal) ProtoMessage() {} func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_678c914f1bee6d56, []int{14} + return fileDescriptor_678c914f1bee6d56, []int{15} } func (m *Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *Proposal) XXX_Merge(src proto.Message) { xxx_messageInfo_Proposal.Merge(m, src) @@ -941,22 +943,18 @@ func (m *Ballot) Reset() { *m = Ballot{} } func (m *Ballot) String() string { return proto.CompactTextString(m) } func (*Ballot) ProtoMessage() {} func (*Ballot) Descriptor() ([]byte, []int) { - return fileDescriptor_678c914f1bee6d56, []int{15} + return fileDescriptor_678c914f1bee6d56, []int{16} } func (m *Ballot) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Ballot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Ballot.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *Ballot) XXX_Merge(src proto.Message) { xxx_messageInfo_Ballot.Merge(m, src) @@ -1021,6 +1019,8 @@ func init() { golang_proto.RegisterType((*GovTx)(nil), "payload.GovTx") proto.RegisterType((*ProposalTx)(nil), "payload.ProposalTx") golang_proto.RegisterType((*ProposalTx)(nil), "payload.ProposalTx") + proto.RegisterType((*IdentifyTx)(nil), "payload.IdentifyTx") + golang_proto.RegisterType((*IdentifyTx)(nil), "payload.IdentifyTx") proto.RegisterType((*BatchTx)(nil), "payload.BatchTx") golang_proto.RegisterType((*BatchTx)(nil), "payload.BatchTx") proto.RegisterType((*Vote)(nil), "payload.Vote") @@ -1035,78 +1035,82 @@ func init() { proto.RegisterFile("payload.proto", fileDescriptor_678c914f1bee6d5 func init() { golang_proto.RegisterFile("payload.proto", fileDescriptor_678c914f1bee6d56) } var fileDescriptor_678c914f1bee6d56 = []byte{ - // 1033 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x66, 0xd7, 0x7f, 0xfa, 0xe2, 0x04, 0x77, 0xa0, 0xc8, 0x8a, 0x84, 0x1d, 0x19, 0x04, - 0x29, 0x34, 0x36, 0xa4, 0xfc, 0x11, 0xb9, 0x20, 0xff, 0x4b, 0x1a, 0xd4, 0x36, 0x61, 0xbc, 0x69, - 0x11, 0x88, 0xc3, 0xd8, 0x1e, 0xd6, 0x2b, 0xd9, 0x3b, 0xcb, 0xee, 0xb8, 0xac, 0x39, 0x71, 0xe0, - 0xc0, 0x15, 0xf5, 0xc2, 0x31, 0x5f, 0x81, 0x6f, 0xc0, 0x31, 0x47, 0xce, 0x1c, 0x22, 0x94, 0x5e, - 0x10, 0x9f, 0x02, 0xcd, 0xec, 0xcc, 0x7a, 0xed, 0x56, 0x8d, 0x13, 0x21, 0x6e, 0x33, 0xef, 0xfd, - 0xe6, 0xbd, 0x37, 0xef, 0xfd, 0xde, 0x9b, 0x81, 0x75, 0x9f, 0x4c, 0x47, 0x8c, 0x0c, 0x6a, 0x7e, - 0xc0, 0x38, 0x43, 0x39, 0xb5, 0xdd, 0xdc, 0x71, 0x5c, 0x3e, 0x9c, 0xf4, 0x6a, 0x7d, 0x36, 0xae, - 0x3b, 0xcc, 0x61, 0x75, 0xa9, 0xef, 0x4d, 0xbe, 0x95, 0x3b, 0xb9, 0x91, 0xab, 0xf8, 0xdc, 0x66, - 0xd1, 0xa7, 0xc1, 0xd8, 0x0d, 0x43, 0x97, 0x79, 0x4a, 0x02, 0xa1, 0x4f, 0xfb, 0xf1, 0xba, 0xfa, - 0x8b, 0x09, 0x66, 0xc3, 0x9b, 0xa2, 0x77, 0x20, 0xdb, 0x22, 0xa3, 0x91, 0x1d, 0x95, 0x8c, 0x2d, - 0x63, 0x7b, 0x6d, 0xf7, 0x95, 0x9a, 0xf6, 0x1e, 0x8b, 0xb1, 0x52, 0x0b, 0x60, 0x97, 0x7a, 0x03, - 0x3b, 0x2a, 0xad, 0x2e, 0x00, 0x63, 0x31, 0x56, 0x6a, 0x01, 0x7c, 0x48, 0xc6, 0xd4, 0x8e, 0x4a, - 0xe6, 0x02, 0x30, 0x16, 0x63, 0xa5, 0x46, 0xef, 0x42, 0xee, 0x98, 0x06, 0xe3, 0xd0, 0x8e, 0x4a, - 0x96, 0x44, 0x16, 0x13, 0xa4, 0x92, 0x63, 0x0d, 0x40, 0x6f, 0x41, 0xe6, 0x80, 0x3d, 0xb1, 0xa3, - 0x52, 0x46, 0x22, 0x37, 0x12, 0xa4, 0x94, 0xe2, 0x58, 0x29, 0x5c, 0x37, 0x99, 0x8c, 0x31, 0xbb, - 0xe0, 0x3a, 0x16, 0x63, 0xa5, 0x46, 0x3b, 0x90, 0x3f, 0xf1, 0x7a, 0x31, 0x34, 0x27, 0xa1, 0x37, - 0x13, 0xa8, 0x56, 0xe0, 0x04, 0x22, 0x22, 0x6d, 0x12, 0xde, 0x1f, 0xda, 0x51, 0x29, 0xbf, 0x10, - 0xa9, 0x92, 0x63, 0x0d, 0x40, 0x77, 0x01, 0x8e, 0x03, 0xe6, 0xb3, 0x90, 0x88, 0xa4, 0xde, 0x90, - 0xf0, 0x57, 0x67, 0x17, 0x4b, 0x54, 0x38, 0x05, 0xdb, 0xb3, 0xce, 0x4e, 0x2b, 0x46, 0xf5, 0xa9, - 0x01, 0x39, 0x3b, 0x3a, 0xf4, 0xfc, 0x09, 0x47, 0x0f, 0x21, 0xd7, 0x18, 0x0c, 0x02, 0x1a, 0x86, - 0xb2, 0x30, 0x85, 0xe6, 0x87, 0x67, 0xe7, 0x95, 0x95, 0x3f, 0xcf, 0x2b, 0x77, 0x52, 0x2c, 0x18, - 0x4e, 0x7d, 0x1a, 0x8c, 0xe8, 0xc0, 0xa1, 0x41, 0xbd, 0x37, 0x09, 0x02, 0xf6, 0x7d, 0xbd, 0x1f, - 0x4c, 0x7d, 0xce, 0x6a, 0xea, 0x2c, 0xd6, 0x46, 0xd0, 0xeb, 0x90, 0x6d, 0x8c, 0xd9, 0xc4, 0xe3, - 0xb2, 0x7c, 0x16, 0x56, 0x3b, 0xb4, 0x09, 0xf9, 0x2e, 0xfd, 0x6e, 0x42, 0xbd, 0x3e, 0x95, 0xf5, - 0xb2, 0x70, 0xb2, 0xdf, 0xb3, 0x7e, 0x3d, 0xad, 0xac, 0x54, 0x23, 0xc8, 0xdb, 0xd1, 0xd1, 0x84, - 0xff, 0x8f, 0x51, 0x29, 0xcf, 0x4f, 0x4d, 0x4d, 0x4e, 0xf4, 0x36, 0x64, 0x64, 0x5e, 0x14, 0x4b, - 0x67, 0xf9, 0x57, 0xf9, 0xc2, 0xb1, 0x1a, 0x7d, 0x3e, 0x0b, 0x70, 0x55, 0x06, 0xf8, 0xfe, 0xf5, - 0x83, 0xdb, 0x84, 0xfc, 0x01, 0x09, 0xef, 0xbb, 0x63, 0x97, 0xeb, 0xd4, 0xe8, 0x3d, 0x2a, 0x82, - 0xb9, 0x4f, 0xa9, 0xe4, 0xad, 0x85, 0xc5, 0x12, 0x1d, 0x82, 0xd5, 0x26, 0x9c, 0x48, 0x82, 0x16, - 0x9a, 0x1f, 0xa9, 0xbc, 0xec, 0xbc, 0xdc, 0x75, 0xcf, 0xf5, 0x48, 0x30, 0xad, 0xdd, 0xa3, 0x51, - 0x73, 0xca, 0x69, 0x88, 0xa5, 0x09, 0xf4, 0x35, 0x58, 0x8f, 0x1b, 0xdd, 0x07, 0x92, 0xc4, 0x85, - 0xe6, 0xc1, 0xb5, 0x4c, 0xfd, 0x73, 0x5e, 0xd9, 0xe0, 0xc4, 0x09, 0xef, 0xb0, 0xb1, 0xcb, 0xe9, - 0xd8, 0xe7, 0x53, 0x2c, 0x8d, 0xa2, 0x4f, 0xa1, 0xd0, 0x62, 0x1e, 0x0f, 0x48, 0x9f, 0x3f, 0xa0, - 0x9c, 0x94, 0x72, 0x5b, 0xe6, 0xf6, 0xda, 0xee, 0xad, 0x59, 0xdb, 0xa7, 0x94, 0x78, 0x0e, 0xaa, - 0xaa, 0x32, 0x99, 0x37, 0x80, 0xbe, 0x80, 0x7c, 0x8b, 0x0d, 0xe8, 0x3d, 0x12, 0x0e, 0x15, 0x29, - 0xae, 0x79, 0xf9, 0xc4, 0x0c, 0x42, 0x60, 0xc9, 0xd8, 0x44, 0x09, 0x6f, 0x60, 0xb9, 0xae, 0xba, - 0x7a, 0xfe, 0xa0, 0x6d, 0xc8, 0xca, 0x62, 0x0b, 0x0e, 0x9a, 0x2f, 0x24, 0x83, 0xd2, 0xa3, 0xf7, - 0x20, 0x17, 0x13, 0x57, 0xb0, 0xc1, 0x9c, 0xeb, 0x72, 0x4d, 0x69, 0xac, 0x11, 0x7b, 0xf9, 0x9f, - 0x4f, 0x2b, 0x2b, 0xf2, 0x86, 0x2c, 0x19, 0x4c, 0x4b, 0xf3, 0xee, 0x63, 0xc8, 0x8b, 0x23, 0x8d, - 0xc0, 0x09, 0xd5, 0x7c, 0x7c, 0xad, 0x96, 0x9a, 0xbf, 0x5a, 0xd7, 0xb4, 0x44, 0x6a, 0x70, 0x82, - 0x55, 0x29, 0xf5, 0xf5, 0xc8, 0x5c, 0xda, 0x1f, 0x02, 0x4b, 0x9c, 0xd0, 0x19, 0x12, 0x6b, 0x21, - 0x93, 0x0c, 0x34, 0x63, 0x99, 0xa4, 0xd2, 0x73, 0x3c, 0x55, 0x1e, 0xf7, 0xf4, 0xa4, 0x5c, 0xd6, - 0x63, 0x2a, 0x3d, 0xce, 0x6c, 0x78, 0x2e, 0x1d, 0xef, 0x6d, 0xc8, 0xc6, 0x79, 0x56, 0xd9, 0x79, - 0x41, 0x21, 0x14, 0x20, 0xe5, 0xe8, 0x47, 0x43, 0x4d, 0xfd, 0x2b, 0x94, 0xbc, 0x05, 0x1b, 0x8d, - 0x7e, 0x5f, 0x0c, 0x91, 0x13, 0x7f, 0x40, 0x38, 0xd5, 0x95, 0xbf, 0x55, 0x93, 0x8f, 0x9f, 0x4d, - 0xc7, 0xfe, 0x88, 0x70, 0xaa, 0x30, 0xb2, 0x1e, 0x06, 0x5e, 0x38, 0x92, 0x0a, 0xe1, 0x6f, 0x23, - 0x3d, 0xce, 0x97, 0xbe, 0x6e, 0x15, 0x0a, 0x8f, 0x18, 0x77, 0x3d, 0xe7, 0x31, 0x75, 0x9d, 0x61, - 0x7c, 0x69, 0x13, 0xcf, 0xc9, 0xd0, 0x09, 0x14, 0xb4, 0x65, 0xd9, 0x3b, 0xa6, 0xec, 0x9d, 0x0f, - 0xae, 0xde, 0x37, 0x73, 0x66, 0xc4, 0xd3, 0xa6, 0xf7, 0xea, 0x59, 0xbd, 0xf9, 0xdc, 0xeb, 0x83, - 0x13, 0x48, 0xea, 0xaa, 0xdf, 0x24, 0x8f, 0xdc, 0x15, 0xd2, 0x5d, 0x06, 0xd3, 0x8e, 0x74, 0x8e, - 0x0b, 0x09, 0xac, 0xe1, 0x4d, 0xb1, 0x50, 0xa4, 0xcc, 0xff, 0x64, 0x80, 0xf5, 0x88, 0x71, 0xfa, - 0x9f, 0xbf, 0x21, 0x4b, 0xe4, 0x3a, 0x15, 0xc6, 0x93, 0x59, 0x7a, 0x92, 0x26, 0x32, 0x52, 0x4d, - 0xb4, 0x05, 0x6b, 0x6d, 0x1a, 0xf6, 0x03, 0xd7, 0xe7, 0x2e, 0xf3, 0x54, 0x7f, 0xa5, 0x45, 0xe9, - 0xcf, 0x80, 0x79, 0xc9, 0x67, 0x20, 0xe5, 0xf7, 0xb7, 0x55, 0xc8, 0x36, 0xc9, 0x68, 0xc4, 0xf8, - 0x5c, 0x85, 0x8c, 0x4b, 0x2b, 0x24, 0x78, 0xb2, 0xef, 0x7a, 0x64, 0xe4, 0xfe, 0xe0, 0x7a, 0x8e, - 0xfa, 0x7e, 0x5d, 0x8f, 0x27, 0x69, 0x33, 0xa8, 0x05, 0xeb, 0xbe, 0x72, 0xd1, 0xe5, 0x84, 0xc7, - 0x33, 0x62, 0x63, 0xf7, 0x8d, 0xd4, 0x65, 0x44, 0xb4, 0x49, 0x44, 0x12, 0x84, 0xe7, 0xcf, 0xa0, - 0x37, 0x21, 0x23, 0x6a, 0x1a, 0x96, 0x32, 0x92, 0x00, 0xeb, 0xc9, 0x61, 0x21, 0xc5, 0xb1, 0xae, - 0xfa, 0x09, 0xac, 0xcf, 0x19, 0x41, 0x05, 0xc8, 0x1f, 0xe3, 0xa3, 0xe3, 0xa3, 0x6e, 0xa7, 0x5d, - 0x5c, 0x11, 0xbb, 0xce, 0x97, 0x9d, 0xd6, 0x89, 0xdd, 0x69, 0x17, 0x0d, 0x04, 0x90, 0xdd, 0x6f, - 0x1c, 0xde, 0xef, 0xb4, 0x8b, 0xab, 0xcd, 0xcf, 0xce, 0x2e, 0xca, 0xc6, 0x1f, 0x17, 0x65, 0xe3, - 0xaf, 0x8b, 0xb2, 0xf1, 0xfb, 0xb3, 0xb2, 0x71, 0xf6, 0xac, 0x6c, 0x7c, 0x75, 0xfb, 0xe5, 0xb7, - 0xe6, 0x51, 0x58, 0x57, 0x51, 0xf4, 0xb2, 0xf2, 0xaf, 0x7b, 0xf7, 0xdf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x8c, 0x43, 0x16, 0xe2, 0x52, 0x0b, 0x00, 0x00, + // 1096 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x66, 0x37, 0xb6, 0xfb, 0xe2, 0xe4, 0xeb, 0xce, 0xb7, 0xad, 0xac, 0x48, 0xd8, 0x91, + 0x41, 0x90, 0x96, 0xd6, 0x86, 0x94, 0x1f, 0x22, 0x37, 0xff, 0x4a, 0x1a, 0xd4, 0x26, 0x66, 0xbc, + 0x69, 0x11, 0x88, 0xc3, 0x7a, 0x3d, 0xac, 0x57, 0xb2, 0x77, 0x96, 0xdd, 0x71, 0xd9, 0xe5, 0xc4, + 0x81, 0x03, 0x77, 0x2e, 0x1c, 0xf3, 0x1f, 0x20, 0xfe, 0x03, 0x4e, 0x28, 0x47, 0x8e, 0x88, 0x43, + 0x84, 0xd2, 0x0b, 0xe2, 0xaf, 0x40, 0x33, 0x3b, 0xbb, 0x1e, 0xbb, 0x55, 0xeb, 0x44, 0x88, 0xdb, + 0xcc, 0x7b, 0x9f, 0x79, 0xef, 0xcd, 0x7b, 0x9f, 0x79, 0x6f, 0x60, 0xc3, 0xb7, 0xe2, 0x31, 0xb5, + 0x86, 0x75, 0x3f, 0xa0, 0x8c, 0xa2, 0xbc, 0xdc, 0x6e, 0xdd, 0x70, 0xa8, 0x43, 0x85, 0xac, 0xc1, + 0x57, 0x89, 0x7a, 0xab, 0xe4, 0x93, 0x60, 0xe2, 0x86, 0xa1, 0x4b, 0x3d, 0x29, 0xd9, 0x0c, 0x88, + 0xe3, 0x86, 0x2c, 0x88, 0xe5, 0x1e, 0x42, 0x9f, 0xd8, 0xc9, 0xba, 0xf6, 0xab, 0x0e, 0x7a, 0xd3, + 0x8b, 0xd1, 0x5b, 0x90, 0x6b, 0x5b, 0xe3, 0xb1, 0x19, 0x95, 0xb5, 0x6d, 0x6d, 0x67, 0x7d, 0xf7, + 0x7f, 0xf5, 0xd4, 0x69, 0x22, 0xc6, 0x52, 0xcd, 0x81, 0x7d, 0xe2, 0x0d, 0xcd, 0xa8, 0xbc, 0xba, + 0x00, 0x4c, 0xc4, 0x58, 0xaa, 0x39, 0xf0, 0xc8, 0x9a, 0x10, 0x33, 0x2a, 0xeb, 0x0b, 0xc0, 0x44, + 0x8c, 0xa5, 0x1a, 0xdd, 0x81, 0x7c, 0x8f, 0x04, 0x93, 0xd0, 0x8c, 0xca, 0x86, 0x40, 0x96, 0x32, + 0xa4, 0x94, 0xe3, 0x14, 0x80, 0xde, 0x80, 0xb5, 0x03, 0xfa, 0xd4, 0x8c, 0xca, 0x6b, 0x02, 0xb9, + 0x99, 0x21, 0x85, 0x14, 0x27, 0x4a, 0xee, 0xba, 0x45, 0x45, 0x8c, 0xb9, 0x05, 0xd7, 0x89, 0x18, + 0x4b, 0x35, 0xba, 0x07, 0x85, 0x13, 0x6f, 0x90, 0x40, 0xf3, 0x02, 0x7a, 0x3d, 0x83, 0xa6, 0x0a, + 0x9c, 0x41, 0x78, 0xa4, 0x2d, 0x8b, 0xd9, 0x23, 0x33, 0x2a, 0x17, 0x16, 0x22, 0x95, 0x72, 0x9c, + 0x02, 0xd0, 0x7d, 0x80, 0x5e, 0x40, 0x7d, 0x1a, 0x5a, 0x3c, 0xa9, 0xd7, 0x04, 0xfc, 0xff, 0xb3, + 0x8b, 0x65, 0x2a, 0xac, 0xc0, 0xf8, 0xa1, 0xc3, 0x21, 0xf1, 0x98, 0xfb, 0x65, 0x6c, 0x46, 0x65, + 0x58, 0x38, 0x34, 0x53, 0x61, 0x05, 0xb6, 0x67, 0x9c, 0x9d, 0x56, 0xb5, 0xda, 0x0f, 0x1a, 0xe4, + 0xcd, 0xe8, 0xd0, 0xf3, 0xa7, 0x0c, 0x1d, 0x41, 0xbe, 0x39, 0x1c, 0x06, 0x24, 0x0c, 0x45, 0x35, + 0x8b, 0xad, 0xf7, 0xce, 0xce, 0xab, 0x2b, 0x7f, 0x9c, 0x57, 0xef, 0x3a, 0x2e, 0x1b, 0x4d, 0x07, + 0x75, 0x9b, 0x4e, 0x1a, 0xa3, 0xd8, 0x27, 0xc1, 0x98, 0x0c, 0x1d, 0x12, 0x34, 0x06, 0xd3, 0x20, + 0xa0, 0x5f, 0x37, 0xec, 0x20, 0xf6, 0x19, 0xad, 0xcb, 0xb3, 0x38, 0x35, 0x82, 0x6e, 0x41, 0xae, + 0x39, 0xa1, 0x53, 0x8f, 0x89, 0x9a, 0x1b, 0x58, 0xee, 0xd0, 0x16, 0x14, 0xfa, 0xe4, 0xab, 0x29, + 0xf1, 0x6c, 0x22, 0x8a, 0x6c, 0xe0, 0x6c, 0xbf, 0x67, 0xfc, 0x78, 0x5a, 0x5d, 0xa9, 0x45, 0x50, + 0x30, 0xa3, 0xe3, 0x29, 0xfb, 0x0f, 0xa3, 0x92, 0x9e, 0x7f, 0xd2, 0x53, 0x46, 0xa3, 0x37, 0x61, + 0x4d, 0xe4, 0x45, 0x52, 0x7b, 0x56, 0x34, 0x99, 0x2f, 0x9c, 0xa8, 0xd1, 0xc7, 0xb3, 0x00, 0x57, + 0x45, 0x80, 0xef, 0x5c, 0x3d, 0xb8, 0x2d, 0x28, 0x1c, 0x58, 0xe1, 0x43, 0x77, 0xe2, 0xb2, 0x34, + 0x35, 0xe9, 0x1e, 0x95, 0x40, 0xdf, 0x27, 0x44, 0x90, 0xdd, 0xc0, 0x7c, 0x89, 0x0e, 0xc1, 0xe8, + 0x58, 0xcc, 0x12, 0xac, 0x2e, 0xb6, 0xde, 0x97, 0x79, 0xb9, 0xf7, 0x72, 0xd7, 0x03, 0xd7, 0xb3, + 0x82, 0xb8, 0xfe, 0x80, 0x44, 0xad, 0x98, 0x91, 0x10, 0x0b, 0x13, 0xe8, 0x73, 0x30, 0x9e, 0x34, + 0xfb, 0x8f, 0x04, 0xf3, 0x8b, 0xad, 0x83, 0x2b, 0x99, 0xfa, 0xfb, 0xbc, 0xba, 0xc9, 0x2c, 0x27, + 0xbc, 0x4b, 0x27, 0x2e, 0x23, 0x13, 0x9f, 0xc5, 0x58, 0x18, 0x45, 0x1f, 0x41, 0xb1, 0x4d, 0x3d, + 0x16, 0x58, 0x36, 0x7b, 0x44, 0x98, 0x55, 0xce, 0x6f, 0xeb, 0x3b, 0xeb, 0xbb, 0x37, 0x67, 0xbd, + 0x42, 0x51, 0xe2, 0x39, 0xa8, 0x4c, 0x48, 0x2f, 0x70, 0x6d, 0x22, 0x1e, 0x4f, 0x92, 0x10, 0xb1, + 0x97, 0x15, 0x9b, 0xce, 0x1b, 0x47, 0x9f, 0x40, 0xa1, 0x4d, 0x87, 0xe4, 0x81, 0x15, 0x8e, 0x24, + 0x61, 0xae, 0x98, 0x98, 0xcc, 0x0c, 0x42, 0x60, 0x88, 0xb8, 0x79, 0x79, 0xaf, 0x61, 0xb1, 0xae, + 0xb9, 0x69, 0x43, 0x43, 0x3b, 0x90, 0x13, 0x44, 0xe0, 0xfc, 0xd4, 0x5f, 0x48, 0x14, 0xa9, 0x47, + 0x6f, 0x43, 0x3e, 0x21, 0x35, 0x67, 0x8a, 0x3e, 0xd7, 0x36, 0x52, 0xba, 0xe3, 0x14, 0xb1, 0x57, + 0xf8, 0xfe, 0xb4, 0xba, 0x22, 0x6e, 0x48, 0xb3, 0x4e, 0xb7, 0x34, 0x27, 0x3f, 0x80, 0x02, 0x3f, + 0xd2, 0x0c, 0x9c, 0x50, 0x36, 0xdc, 0x1b, 0x75, 0xa5, 0xc1, 0xa7, 0xba, 0x96, 0xc1, 0x53, 0x83, + 0x33, 0xac, 0x4c, 0xa9, 0x9f, 0xf6, 0xe0, 0xa5, 0xfd, 0x21, 0x30, 0xf8, 0x89, 0x34, 0x43, 0x7c, + 0xcd, 0x65, 0x82, 0x9d, 0x7a, 0x22, 0x13, 0x34, 0x7b, 0x8e, 0xc3, 0xd2, 0xe3, 0x5e, 0xda, 0x7a, + 0x97, 0xf5, 0xa8, 0xa4, 0xc7, 0x99, 0x75, 0xe3, 0xa5, 0xe3, 0xbd, 0x0d, 0xb9, 0x24, 0xcf, 0x32, + 0x3b, 0x2f, 0x28, 0x84, 0x04, 0x28, 0x8e, 0xbe, 0xd5, 0xe4, 0x18, 0xb9, 0x44, 0xc9, 0xdb, 0xb0, + 0xd9, 0xb4, 0x6d, 0xde, 0x60, 0x4e, 0xfc, 0xa1, 0xc5, 0x48, 0x5a, 0xf9, 0x9b, 0x75, 0x31, 0x4d, + 0x4d, 0x32, 0xf1, 0xc7, 0x16, 0x23, 0x12, 0x23, 0xea, 0xa1, 0xe1, 0x85, 0x23, 0x4a, 0x08, 0x7f, + 0x69, 0xea, 0x7c, 0x58, 0xfa, 0xba, 0x35, 0x28, 0x3e, 0xa6, 0xcc, 0xf5, 0x9c, 0x27, 0xc4, 0x75, + 0x46, 0xc9, 0xa5, 0x75, 0x3c, 0x27, 0x43, 0x27, 0x50, 0x4c, 0x2d, 0x8b, 0xb7, 0xa3, 0x8b, 0xb7, + 0xf3, 0xee, 0xe5, 0xdf, 0xcd, 0x9c, 0x19, 0x3e, 0x2b, 0xd3, 0xbd, 0x9c, 0xd3, 0xd7, 0x9f, 0x1b, + 0x67, 0x38, 0x83, 0x28, 0x57, 0x1d, 0xab, 0x43, 0xed, 0x12, 0x19, 0xbf, 0x03, 0xc6, 0x11, 0x1d, + 0x12, 0x59, 0xd8, 0x5b, 0xf5, 0xec, 0x17, 0xc3, 0xa5, 0x89, 0x45, 0xde, 0x98, 0xf8, 0x4e, 0xf1, + 0xf6, 0x45, 0x36, 0xa3, 0x2f, 0xe1, 0xaa, 0x02, 0xba, 0x19, 0xa5, 0x15, 0x2d, 0x66, 0xb0, 0xa6, + 0x17, 0x63, 0xae, 0x50, 0xcc, 0x7f, 0xa7, 0x81, 0xf1, 0x98, 0x32, 0xf2, 0xaf, 0x4f, 0xb3, 0x25, + 0x2a, 0xab, 0x84, 0xf1, 0x74, 0x56, 0x8c, 0xec, 0xc9, 0x6a, 0xca, 0x93, 0xdd, 0x86, 0xf5, 0x0e, + 0x09, 0xed, 0xc0, 0xf5, 0x99, 0x4b, 0x3d, 0xf9, 0x9a, 0x55, 0x91, 0xfa, 0x97, 0xd1, 0x5f, 0xf1, + 0x97, 0x51, 0xfc, 0xfe, 0xbc, 0x0a, 0xb9, 0x96, 0x35, 0x1e, 0x53, 0x36, 0xc7, 0x07, 0xed, 0x95, + 0x7c, 0xe0, 0xac, 0xdc, 0x77, 0x3d, 0x6b, 0xec, 0x7e, 0xe3, 0x7a, 0x8e, 0xfc, 0x3d, 0x5e, 0x8d, + 0x95, 0xaa, 0x19, 0xd4, 0x86, 0x0d, 0x5f, 0xba, 0xe8, 0x33, 0x8b, 0x25, 0x1d, 0x69, 0x73, 0xf7, + 0x35, 0xe5, 0x32, 0x3c, 0xda, 0x2c, 0x22, 0x01, 0xc2, 0xf3, 0x67, 0xd0, 0xeb, 0xb0, 0xc6, 0x6b, + 0x1a, 0x96, 0xd7, 0x04, 0x01, 0x36, 0xb2, 0xc3, 0x5c, 0x8a, 0x13, 0x5d, 0xed, 0x43, 0xd8, 0x98, + 0x33, 0x82, 0x8a, 0x50, 0xe8, 0xe1, 0xe3, 0xde, 0x71, 0xbf, 0xdb, 0x29, 0xad, 0xf0, 0x5d, 0xf7, + 0xd3, 0x6e, 0xfb, 0xc4, 0xec, 0x76, 0x4a, 0x1a, 0x02, 0xc8, 0xed, 0x37, 0x0f, 0x1f, 0x76, 0x3b, + 0xa5, 0xd5, 0x56, 0xfb, 0xec, 0xa2, 0xa2, 0xfd, 0x76, 0x51, 0xd1, 0x7e, 0xbf, 0xa8, 0x68, 0x7f, + 0x5e, 0x54, 0xb4, 0x5f, 0x9e, 0x55, 0xb4, 0xb3, 0x67, 0x15, 0xed, 0xb3, 0xdb, 0x2f, 0xbf, 0x39, + 0x8b, 0xc2, 0x86, 0x8c, 0x64, 0x90, 0x13, 0xdf, 0xf5, 0xfb, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, + 0x94, 0xcd, 0x56, 0xb9, 0x0c, 0x0c, 0x00, 0x00, } func (m *Any) 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 } @@ -1114,110 +1118,146 @@ func (m *Any) Marshal() (dAtA []byte, err error) { } func (m *Any) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Any) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.CallTx != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.CallTx.Size())) - n1, err := m.CallTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.SendTx != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.SendTx.Size())) - n2, err := m.SendTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.IdentifyTx != nil { + { + size, err := m.IdentifyTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x52 } - if m.NameTx != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.NameTx.Size())) - n3, err := m.NameTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.ProposalTx != nil { + { + size, err := m.ProposalTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x4a } - if m.PermsTx != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.PermsTx.Size())) - n4, err := m.PermsTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.BatchTx != nil { + { + size, err := m.BatchTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0x42 } - if m.GovTx != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.GovTx.Size())) - n5, err := m.GovTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.UnbondTx != nil { + { + size, err := m.UnbondTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0x3a } if m.BondTx != nil { + { + size, err := m.BondTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x32 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.BondTx.Size())) - n6, err := m.BondTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + if m.GovTx != nil { + { + size, err := m.GovTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n6 + i-- + dAtA[i] = 0x2a } - if m.UnbondTx != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.UnbondTx.Size())) - n7, err := m.UnbondTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.PermsTx != nil { + { + size, err := m.PermsTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n7 + i-- + dAtA[i] = 0x22 } - if m.BatchTx != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.BatchTx.Size())) - n8, err := m.BatchTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.NameTx != nil { + { + size, err := m.NameTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n8 + i-- + dAtA[i] = 0x1a } - if m.ProposalTx != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.ProposalTx.Size())) - n9, err := m.ProposalTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.SendTx != nil { + { + size, err := m.SendTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n9 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.CallTx != nil { + { + size, err := m.CallTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *TxInput) 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 } @@ -1225,38 +1265,46 @@ func (m *TxInput) Marshal() (dAtA []byte, err error) { } func (m *TxInput) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxInput) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Address.Size())) - n10, err := m.Address.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n10 - if m.Amount != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Amount)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Sequence != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintPayload(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x18 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Amount != 0 { + i = encodeVarintPayload(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 } - return i, nil + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *TxOutput) 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 } @@ -1264,33 +1312,41 @@ func (m *TxOutput) Marshal() (dAtA []byte, err error) { } func (m *TxOutput) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxOutput) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Address.Size())) - n11, err := m.Address.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 += n11 if m.Amount != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintPayload(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPayload(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *CallTx) 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 } @@ -1298,78 +1354,99 @@ func (m *CallTx) Marshal() (dAtA []byte, err error) { } func (m *CallTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CallTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Input != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Input.Size())) - n12, err := m.Input.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 m.GasPrice != 0 { + i = encodeVarintPayload(dAtA, i, uint64(m.GasPrice)) + i-- + dAtA[i] = 0x40 + } + if len(m.ContractMeta) > 0 { + for iNdEx := len(m.ContractMeta) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ContractMeta[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a } - i += n12 } - if m.Address != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Address.Size())) - n13, err := m.Address.MarshalTo(dAtA[i:]) - if err != nil { + { + size := m.WASM.Size() + i -= size + if _, err := m.WASM.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n13 + i = encodeVarintPayload(dAtA, i, uint64(size)) } - if m.GasLimit != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x32 + { + size := m.Data.Size() + i -= size + if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPayload(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a if m.Fee != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintPayload(dAtA, i, uint64(m.Fee)) + i-- + dAtA[i] = 0x20 } - dAtA[i] = 0x2a - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Data.Size())) - n14, err := m.Data.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n14 - dAtA[i] = 0x32 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.WASM.Size())) - n15, err := m.WASM.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.GasLimit != 0 { + i = encodeVarintPayload(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x18 } - i += n15 - if len(m.ContractMeta) > 0 { - for _, msg := range m.ContractMeta { - dAtA[i] = 0x3a - i++ - i = encodeVarintPayload(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { + if m.Address != nil { + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n + i = encodeVarintPayload(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ContractMeta) 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 } @@ -1377,34 +1454,43 @@ func (m *ContractMeta) Marshal() (dAtA []byte, err error) { } func (m *ContractMeta) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContractMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.CodeHash.Size())) - n16, err := m.CodeHash.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 += n16 if len(m.Meta) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Meta) + copy(dAtA[i:], m.Meta) i = encodeVarintPayload(dAtA, i, uint64(len(m.Meta))) - i += copy(dAtA[i:], m.Meta) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size := m.CodeHash.Size() + i -= size + if _, err := m.CodeHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPayload(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *SendTx) 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 } @@ -1412,44 +1498,54 @@ func (m *SendTx) Marshal() (dAtA []byte, err error) { } func (m *SendTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SendTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Inputs) > 0 { - for _, msg := range m.Inputs { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(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.Outputs) > 0 { - for _, msg := range m.Outputs { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Outputs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Outputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(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.Inputs) > 0 { + for iNdEx := len(m.Inputs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Inputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return i, nil + return len(dAtA) - i, nil } func (m *PermsTx) 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 } @@ -1457,38 +1553,48 @@ func (m *PermsTx) Marshal() (dAtA []byte, err error) { } func (m *PermsTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PermsTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Input != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Input.Size())) - n17, err := m.Input.MarshalTo(dAtA[i:]) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.PermArgs.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n17 + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.PermArgs.Size())) - n18, err := m.PermArgs.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n18 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *NameTx) 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 } @@ -1496,47 +1602,57 @@ func (m *NameTx) Marshal() (dAtA []byte, err error) { } func (m *NameTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NameTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Input != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Input.Size())) - n19, err := m.Input.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n19 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.Fee != 0 { + i = encodeVarintPayload(dAtA, i, uint64(m.Fee)) + i-- + dAtA[i] = 0x20 } if len(m.Data) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintPayload(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + i-- + dAtA[i] = 0x1a } - if m.Fee != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Fee)) + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintPayload(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *BondTx) 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 } @@ -1544,30 +1660,38 @@ func (m *BondTx) Marshal() (dAtA []byte, err error) { } func (m *BondTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BondTx) 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 m.Input != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Input.Size())) - n20, err := m.Input.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n20 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *UnbondTx) 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 } @@ -1575,40 +1699,50 @@ func (m *UnbondTx) Marshal() (dAtA []byte, err error) { } func (m *UnbondTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnbondTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Input != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Input.Size())) - n21, err := m.Input.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n21 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Output != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Output.Size())) - n22, err := m.Output.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n22 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *GovTx) 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 } @@ -1616,44 +1750,54 @@ func (m *GovTx) Marshal() (dAtA []byte, err error) { } func (m *GovTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Inputs) > 0 { - for _, msg := range m.Inputs { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(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.AccountUpdates) > 0 { - for _, msg := range m.AccountUpdates { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.AccountUpdates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AccountUpdates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(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.Inputs) > 0 { + for iNdEx := len(m.Inputs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Inputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return i, nil + return len(dAtA) - i, nil } func (m *ProposalTx) 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 } @@ -1661,55 +1805,120 @@ func (m *ProposalTx) Marshal() (dAtA []byte, err error) { } func (m *ProposalTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProposalTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Input != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Input.Size())) - n23, err := m.Input.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 m.Proposal != nil { + { + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.ProposalHash != nil { + { + size := m.ProposalHash.Size() + i -= size + if _, err := m.ProposalHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n23 + i-- + dAtA[i] = 0x1a } if m.VotingWeight != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintPayload(dAtA, i, uint64(m.VotingWeight)) + i-- + dAtA[i] = 0x10 } - if m.ProposalHash != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.ProposalHash.Size())) - n24, err := m.ProposalHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n24 + i-- + dAtA[i] = 0xa } - if m.Proposal != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Proposal.Size())) - n25, err := m.Proposal.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n25 + return len(dAtA) - i, nil +} + +func (m *IdentifyTx) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *IdentifyTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IdentifyTx) 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) + } + if m.Node != nil { + { + size, err := m.Node.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Inputs) > 0 { + for iNdEx := len(m.Inputs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Inputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } func (m *BatchTx) 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 } @@ -1717,44 +1926,54 @@ func (m *BatchTx) Marshal() (dAtA []byte, err error) { } func (m *BatchTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Inputs) > 0 { - for _, msg := range m.Inputs { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(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.Txs) > 0 { - for _, msg := range m.Txs { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Txs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(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.Inputs) > 0 { + for iNdEx := len(m.Inputs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Inputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return i, nil + return len(dAtA) - i, nil } func (m *Vote) 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 } @@ -1762,33 +1981,41 @@ func (m *Vote) Marshal() (dAtA []byte, err error) { } func (m *Vote) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Address.Size())) - n26, err := m.Address.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 += n26 if m.VotingWeight != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintPayload(dAtA, i, uint64(m.VotingWeight)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPayload(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *Proposal) 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 } @@ -1796,42 +2023,52 @@ func (m *Proposal) Marshal() (dAtA []byte, err error) { } func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if len(m.Description) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(len(m.Description))) - i += copy(dAtA[i:], m.Description) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.BatchTx != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.BatchTx.Size())) - n27, err := m.BatchTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.BatchTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) } - i += n27 + i-- + dAtA[i] = 0x1a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintPayload(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintPayload(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Ballot) 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 } @@ -1839,61 +2076,75 @@ func (m *Ballot) Marshal() (dAtA []byte, err error) { } func (m *Ballot) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Ballot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int - _ = l - if m.Proposal != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.Proposal.Size())) - n28, err := m.Proposal.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n28 - } - if m.FinalizingTx != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintPayload(dAtA, i, uint64(m.FinalizingTx.Size())) - n29, err := m.FinalizingTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Votes) > 0 { + 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 = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - i += n29 } if m.ProposalState != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintPayload(dAtA, i, uint64(m.ProposalState)) + i-- + dAtA[i] = 0x20 } - if len(m.Votes) > 0 { - for _, msg := range m.Votes { - dAtA[i] = 0x2a - i++ - i = encodeVarintPayload(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { + if m.FinalizingTx != nil { + { + size := m.FinalizingTx.Size() + i -= size + if _, err := m.FinalizingTx.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n + i = encodeVarintPayload(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Proposal != nil { + { + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPayload(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintPayload(dAtA []byte, offset int, v uint64) int { + offset -= sovPayload(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 (m *Any) Size() (n int) { if m == nil { @@ -1937,6 +2188,10 @@ func (m *Any) Size() (n int) { l = m.ProposalTx.Size() n += 1 + l + sovPayload(uint64(l)) } + if m.IdentifyTx != nil { + l = m.IdentifyTx.Size() + n += 1 + l + sovPayload(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2010,6 +2265,9 @@ func (m *CallTx) Size() (n int) { n += 1 + l + sovPayload(uint64(l)) } } + if m.GasPrice != 0 { + n += 1 + sovPayload(uint64(m.GasPrice)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2190,6 +2448,28 @@ func (m *ProposalTx) Size() (n int) { return n } +func (m *IdentifyTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Inputs) > 0 { + for _, e := range m.Inputs { + l = e.Size() + n += 1 + l + sovPayload(uint64(l)) + } + } + if m.Node != nil { + l = m.Node.Size() + n += 1 + l + sovPayload(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *BatchTx) Size() (n int) { if m == nil { return 0 @@ -2285,14 +2565,7 @@ func (m *Ballot) Size() (n int) { } func sovPayload(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozPayload(x uint64) (n int) { return sovPayload(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -2325,6 +2598,9 @@ func (this *Any) GetValue() interface{} { if this.ProposalTx != nil { return this.ProposalTx } + if this.IdentifyTx != nil { + return this.IdentifyTx + } return nil } @@ -2348,6 +2624,8 @@ func (this *Any) SetValue(value interface{}) bool { this.BatchTx = vt case *ProposalTx: this.ProposalTx = vt + case *IdentifyTx: + this.IdentifyTx = vt default: return false } @@ -2706,16 +2984,49 @@ func (m *Any) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IdentifyTx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPayload + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPayload + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPayload + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IdentifyTx == nil { + m.IdentifyTx = &IdentifyTx{} + } + if err := m.IdentifyTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPayload(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -2837,10 +3148,7 @@ func (m *TxInput) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -2943,10 +3251,7 @@ func (m *TxOutput) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -3200,16 +3505,32 @@ func (m *CallTx) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType) + } + m.GasPrice = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPayload + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasPrice |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipPayload(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -3325,10 +3646,7 @@ func (m *ContractMeta) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -3447,10 +3765,7 @@ func (m *SendTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -3570,10 +3885,7 @@ func (m *PermsTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -3743,10 +4055,7 @@ func (m *NameTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -3833,10 +4142,7 @@ func (m *BondTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -3959,10 +4265,7 @@ func (m *UnbondTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -4081,10 +4384,7 @@ func (m *GovTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -4261,10 +4561,128 @@ func (m *ProposalTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPayload + } + 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 *IdentifyTx) 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 ErrIntOverflowPayload + } + 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: IdentifyTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IdentifyTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Inputs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPayload + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPayload + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPayload + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Inputs = append(m.Inputs, &TxInput{}) + if err := m.Inputs[len(m.Inputs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPayload + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPayload + } + postIndex := iNdEx + msglen + if postIndex < 0 { return ErrInvalidLengthPayload } - if (iNdEx + skippy) < 0 { + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Node == nil { + m.Node = ®istry.NodeIdentity{} + } + if err := m.Node.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPayload(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -4383,10 +4801,7 @@ func (m *BatchTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -4489,10 +4904,7 @@ func (m *Vote) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -4643,10 +5055,7 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -4821,10 +5230,7 @@ func (m *Ballot) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthPayload - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthPayload } if (iNdEx + skippy) > l { @@ -4843,6 +5249,7 @@ func (m *Ballot) Unmarshal(dAtA []byte) error { func skipPayload(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -4874,10 +5281,8 @@ func skipPayload(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -4898,55 +5303,30 @@ func skipPayload(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthPayload } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthPayload - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPayload - } - 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 := skipPayload(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthPayload - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPayload + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthPayload + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthPayload = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPayload = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthPayload = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPayload = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPayload = fmt.Errorf("proto: unexpected end of group") ) diff --git a/txs/payload/payload_test.go b/txs/payload/payload_test.go new file mode 100644 index 000000000..4afdab78f --- /dev/null +++ b/txs/payload/payload_test.go @@ -0,0 +1,35 @@ +package payload + +import ( + "encoding/json" + "testing" + + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestCustomTypes(t *testing.T) { + address := crypto.Address{1, 2, 3} + callTx := &CallTx{ + Input: &TxInput{ + Address: crypto.Address{1, 2}, + Amount: 2, + Sequence: 0, + }, + Address: &address, + } + bs, err := encoding.Encode(callTx) + require.NoError(t, err) + callTxOut := new(CallTx) + err = encoding.Decode(bs, callTxOut) + require.NoError(t, err) + assert.Equal(t, jsonString(t, callTx), jsonString(t, callTxOut)) +} + +func jsonString(t testing.TB, conf interface{}) string { + bs, err := json.MarshalIndent(conf, "", " ") + require.NoError(t, err, "must be able to convert interface to string for comparison") + return string(bs) +} diff --git a/txs/payload/perms_tx.go b/txs/payload/perms_tx.go index 010b407ee..d21fc99d7 100644 --- a/txs/payload/perms_tx.go +++ b/txs/payload/perms_tx.go @@ -8,7 +8,7 @@ import ( "github.com/hyperledger/burrow/permission" ) -func NewPermsTx(st acmstate.AccountGetter, from crypto.PublicKey, args permission.PermArgs) (*PermsTx, error) { +func NewPermsTx(st acmstate.AccountGetter, from *crypto.PublicKey, args permission.PermArgs) (*PermsTx, error) { addr := from.GetAddress() acc, err := st.GetAccount(addr) if err != nil { @@ -22,7 +22,7 @@ func NewPermsTx(st acmstate.AccountGetter, from crypto.PublicKey, args permissio return NewPermsTxWithSequence(from, args, sequence), nil } -func NewPermsTxWithSequence(from crypto.PublicKey, args permission.PermArgs, sequence uint64) *PermsTx { +func NewPermsTxWithSequence(from *crypto.PublicKey, args permission.PermArgs, sequence uint64) *PermsTx { input := &TxInput{ Address: from.GetAddress(), Amount: 1, // NOTE: amounts can't be 0 ... diff --git a/txs/payload/proposal_tx.go b/txs/payload/proposal_tx.go index 99c13f112..55280d8c6 100644 --- a/txs/payload/proposal_tx.go +++ b/txs/payload/proposal_tx.go @@ -1,11 +1,7 @@ package payload import ( - "crypto/sha256" "fmt" - - "github.com/golang/protobuf/proto" - "github.com/hyperledger/burrow/encoding" ) func NewProposalTx(propsal *Proposal) *ProposalTx { @@ -32,36 +28,6 @@ func (tx *ProposalTx) Any() *Any { } } -func DecodeProposal(proposalBytes []byte) (*Proposal, error) { - buf := proto.NewBuffer(proposalBytes) - proposal := new(Proposal) - err := buf.Unmarshal(proposal) - if err != nil { - return nil, err - } - return proposal, nil -} - -func (p *Proposal) Encode() ([]byte, error) { - buf := proto.NewBuffer(nil) - err := buf.Marshal(p) - if err != nil { - return nil, err - } - return buf.Bytes(), nil -} - -func (p *Proposal) Hash() []byte { - bs, err := p.Encode() - if err != nil { - panic("failed to encode Proposal") - } - - hash := sha256.Sum256(bs) - - return hash[:] -} - func (p *Proposal) String() string { return "" } @@ -69,16 +35,3 @@ func (p *Proposal) String() string { func (v *Vote) String() string { return v.Address.String() } - -func DecodeBallot(ballotBytes []byte) (*Ballot, error) { - ballot := new(Ballot) - err := encoding.Decode(ballotBytes, ballot) - if err != nil { - return nil, err - } - return ballot, nil -} - -func (p *Ballot) Encode() ([]byte, error) { - return encoding.Encode(p) -} diff --git a/txs/payload/send_tx.go b/txs/payload/send_tx.go index 8e5848e2e..a6747e9c1 100644 --- a/txs/payload/send_tx.go +++ b/txs/payload/send_tx.go @@ -26,7 +26,7 @@ func (tx *SendTx) String() string { return fmt.Sprintf("SendTx{%v -> %v}", tx.Inputs, tx.Outputs) } -func (tx *SendTx) AddInput(st acmstate.AccountGetter, pubkey crypto.PublicKey, amt uint64) error { +func (tx *SendTx) AddInput(st acmstate.AccountGetter, pubkey *crypto.PublicKey, amt uint64) error { addr := pubkey.GetAddress() acc, err := st.GetAccount(addr) if err != nil { @@ -38,7 +38,7 @@ func (tx *SendTx) AddInput(st acmstate.AccountGetter, pubkey crypto.PublicKey, a return tx.AddInputWithSequence(pubkey, amt, acc.Sequence+1) } -func (tx *SendTx) AddInputWithSequence(pubkey crypto.PublicKey, amt uint64, sequence uint64) error { +func (tx *SendTx) AddInputWithSequence(pubkey *crypto.PublicKey, amt uint64, sequence uint64) error { addr := pubkey.GetAddress() tx.Inputs = append(tx.Inputs, &TxInput{ Address: addr, diff --git a/txs/protobuf_codec_test.go b/txs/protobuf_codec_test.go index 07de91b3e..5a8a592ea 100644 --- a/txs/protobuf_codec_test.go +++ b/txs/protobuf_codec_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestAminoEncodeTxDecodeTx(t *testing.T) { +func TestTxEncoding(t *testing.T) { codec := NewProtobufCodec() inputAddress := crypto.Address{1, 2, 3, 4, 5} outputAddress := crypto.Address{5, 4, 3, 2, 1} @@ -37,7 +37,7 @@ func TestAminoEncodeTxDecodeTx(t *testing.T) { assert.Equal(t, txEnv, txEnvOut) } -func TestAminoEncodeTxDecodeTx_CallTx(t *testing.T) { +func TestTxEncoding_CallTx(t *testing.T) { codec := NewProtobufCodec() inputAccount := acm.GeneratePrivateAccountFromSecret("fooo") amount := uint64(2) @@ -64,7 +64,7 @@ func TestAminoEncodeTxDecodeTx_CallTx(t *testing.T) { assert.Equal(t, txEnv, txEnvOut) } -func TestAminoTxEnvelope(t *testing.T) { +func TestTxEnvelopeEncoding(t *testing.T) { codec := NewProtobufCodec() privAccFrom := acm.GeneratePrivateAccountFromSecret("foo") privAccTo := acm.GeneratePrivateAccountFromSecret("bar") diff --git a/txs/tx.go b/txs/tx.go index 6f99e668a..b2eec4107 100644 --- a/txs/tx.go +++ b/txs/tx.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package txs @@ -21,6 +10,7 @@ import ( "reflect" "github.com/hyperledger/burrow/acm" + "github.com/hyperledger/burrow/acm/balance" "github.com/hyperledger/burrow/binary" "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/encoding" @@ -67,7 +57,7 @@ func (tx *Tx) Sign(signingAccounts ...acm.AddressableSigner) (*Envelope, error) // Generate SignBytes, panicking on any failure func (tx *Tx) MustSignBytes() []byte { - bs, err := tx.SignBytes() + bs, err := tx.SignBytes(Envelope_JSON) if err != nil { panic(err) } @@ -75,12 +65,44 @@ func (tx *Tx) MustSignBytes() []byte { } // Produces the canonical SignBytes (the Tx message that will be signed) for a Tx -func (tx *Tx) SignBytes() ([]byte, error) { - bs, err := json.Marshal(tx) - if err != nil { - return nil, fmt.Errorf("could not generate canonical SignBytes for Payload %v: %v", tx.Payload, err) +func (tx *Tx) SignBytes(enc Envelope_EncodingType) ([]byte, error) { + switch enc { + case Envelope_JSON: + bs, err := json.Marshal(tx) + if err != nil { + return nil, fmt.Errorf("could not generate canonical SignBytes for Payload %v: %v", tx.Payload, err) + } + return bs, nil + case Envelope_RLP: + rawTx, err := tx.RLPRawTx() + if err != nil { + return nil, err + } + return rawTx.SignBytes() + default: + return nil, fmt.Errorf("encoding type %s not supported", enc.String()) + } +} + +func (tx *Tx) RLPRawTx() (*EthRawTx, error) { + switch payload := tx.Payload.(type) { + case *payload.CallTx: + var to []byte + if payload.Address != nil { + to = payload.Address.Bytes() + } + return &EthRawTx{ + Sequence: payload.Input.Sequence, + GasPrice: payload.GasPrice, + GasLimit: payload.GasLimit, + To: to, + Amount: balance.NativeToWei(payload.Input.Amount), + Data: payload.Data.Bytes(), + chainID: encoding.GetEthChainID(tx.ChainID), + }, nil + default: + return nil, fmt.Errorf("tx type %v not supported for rlp encoding", tx.Payload.Type()) } - return bs, nil } // Serialisation intermediate for switching on type @@ -168,7 +190,7 @@ func (tx *Tx) String() string { if tx == nil { return "Tx{nil}" } - return fmt.Sprintf("Tx{TxHash: %s; Payload: %v}", tx.Hash(), tx.Payload) + return fmt.Sprintf("Tx{ChainID: %s; TxHash: %s; Payload: %s}", tx.ChainID, tx.Hash(), tx.MustSignBytes()) } // Regenerate the Tx hash if it has been mutated or as called by Hash() in first instance @@ -248,5 +270,8 @@ func EnvelopeFromAny(chainID string, p *payload.Any) *Envelope { if p.UnbondTx != nil { return Enclose(chainID, p.UnbondTx) } + if p.IdentifyTx != nil { + return Enclose(chainID, p.IdentifyTx) + } return nil } diff --git a/txs/tx_test.go b/txs/tx_test.go index a2d272901..267768cdb 100644 --- a/txs/tx_test.go +++ b/txs/tx_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package txs @@ -76,7 +65,6 @@ func TestSendTx(t *testing.T) { } func TestCallTx(t *testing.T) { - toAddress := makePrivateAccount("contract1").GetAddress() callTx := &payload.CallTx{ Input: &payload.TxInput{ @@ -220,5 +208,5 @@ func testTxSignVerify(t *testing.T, tx payload.Payload) { } txEnv := Enclose(chainID, tx) require.NoError(t, txEnv.Sign(signers...), "Error signing tx: %s", debug.Stack()) - require.NoError(t, txEnv.Verify(nil, chainID), "Error verifying tx: %s", debug.Stack()) + require.NoError(t, txEnv.Verify(chainID), "Error verifying tx: %s", debug.Stack()) } diff --git a/txs/txs.pb.go b/txs/txs.pb.go index 0e9ac84c0..fe0f59ed5 100644 --- a/txs/txs.pb.go +++ b/txs/txs.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -27,16 +28,42 @@ 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 + +type Envelope_EncodingType int32 + +const ( + Envelope_JSON Envelope_EncodingType = 0 + Envelope_RLP Envelope_EncodingType = 1 +) + +var Envelope_EncodingType_name = map[int32]string{ + 0: "JSON", + 1: "RLP", +} + +var Envelope_EncodingType_value = map[string]int32{ + "JSON": 0, + "RLP": 1, +} + +func (x Envelope_EncodingType) String() string { + return proto.EnumName(Envelope_EncodingType_name, int32(x)) +} + +func (Envelope_EncodingType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_372ebcf753025bdc, []int{0, 0} +} // An envelope contains both the signable Tx and the signatures for each input (in signatories) type Envelope struct { Signatories []Signatory `protobuf:"bytes,1,rep,name=Signatories,proto3" json:"Signatories"` // Canonical bytes of the Tx ready to be signed - Tx *Tx `protobuf:"bytes,2,opt,name=Tx,proto3,customtype=Tx" json:"Tx,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Tx *Tx `protobuf:"bytes,2,opt,name=Tx,proto3,customtype=Tx" json:"Tx,omitempty"` + Encoding Envelope_EncodingType `protobuf:"varint,3,opt,name=Encoding,proto3,enum=txs.Envelope_EncodingType" json:"Encoding,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Envelope) Reset() { *m = Envelope{} } @@ -48,16 +75,12 @@ func (m *Envelope) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Envelope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Envelope.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *Envelope) XXX_Merge(src proto.Message) { xxx_messageInfo_Envelope.Merge(m, src) @@ -78,6 +101,13 @@ func (m *Envelope) GetSignatories() []Signatory { return nil } +func (m *Envelope) GetEncoding() Envelope_EncodingType { + if m != nil { + return m.Encoding + } + return Envelope_JSON +} + func (*Envelope) XXX_MessageName() string { return "txs.Envelope" } @@ -102,16 +132,12 @@ func (m *Signatory) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Signatory) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Signatory.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *Signatory) XXX_Merge(src proto.Message) { xxx_messageInfo_Signatory.Merge(m, src) @@ -168,16 +194,12 @@ func (m *Receipt) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Receipt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Receipt.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } func (m *Receipt) XXX_Merge(src proto.Message) { xxx_messageInfo_Receipt.Merge(m, src) @@ -209,6 +231,8 @@ func (*Receipt) XXX_MessageName() string { return "txs.Receipt" } func init() { + proto.RegisterEnum("txs.Envelope_EncodingType", Envelope_EncodingType_name, Envelope_EncodingType_value) + golang_proto.RegisterEnum("txs.Envelope_EncodingType", Envelope_EncodingType_name, Envelope_EncodingType_value) proto.RegisterType((*Envelope)(nil), "txs.Envelope") golang_proto.RegisterType((*Envelope)(nil), "txs.Envelope") proto.RegisterType((*Signatory)(nil), "txs.Signatory") @@ -221,40 +245,43 @@ func init() { proto.RegisterFile("txs.proto", fileDescriptor_372ebcf753025bdc) } func init() { golang_proto.RegisterFile("txs.proto", fileDescriptor_372ebcf753025bdc) } var fileDescriptor_372ebcf753025bdc = []byte{ - // 421 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xee, 0x39, 0x51, 0xda, 0x5c, 0x0a, 0x15, 0x37, 0xa0, 0xa8, 0x83, 0x1d, 0x32, 0x65, 0xa0, - 0x36, 0x0a, 0xbf, 0x24, 0x36, 0x5c, 0x21, 0x55, 0x45, 0x48, 0xe8, 0xf0, 0xc4, 0x80, 0xb0, 0x9d, - 0x87, 0x63, 0xc9, 0xf8, 0xac, 0xbb, 0x33, 0xdc, 0xfd, 0x27, 0x8c, 0xfc, 0x05, 0xec, 0x6c, 0x8c, - 0x19, 0x99, 0x33, 0x58, 0x28, 0xfd, 0x2f, 0x98, 0x90, 0xaf, 0xe7, 0xb4, 0x74, 0x08, 0x62, 0x7b, - 0x3f, 0xbe, 0xef, 0x7b, 0xdf, 0xbd, 0x77, 0x78, 0x28, 0x95, 0xf0, 0x2b, 0xce, 0x24, 0x23, 0x3d, - 0xa9, 0xc4, 0xf1, 0x49, 0x96, 0xcb, 0x65, 0x9d, 0xf8, 0x29, 0xfb, 0x18, 0x64, 0x2c, 0x63, 0x81, - 0xe9, 0x25, 0xf5, 0x07, 0x93, 0x99, 0xc4, 0x44, 0x97, 0x9c, 0xe3, 0xc3, 0x94, 0xeb, 0x4a, 0xda, - 0x6c, 0xfa, 0x1e, 0x1f, 0xbc, 0x28, 0x3f, 0x41, 0xc1, 0x2a, 0x20, 0x4f, 0xf0, 0xe8, 0x4d, 0x9e, - 0x95, 0xb1, 0x64, 0x3c, 0x07, 0x31, 0x46, 0x93, 0xde, 0x6c, 0x34, 0xbf, 0xed, 0xb7, 0xe3, 0xba, - 0xba, 0x0e, 0xfb, 0xab, 0xc6, 0xdb, 0xa3, 0xd7, 0x81, 0xe4, 0x2e, 0x76, 0x22, 0x35, 0x76, 0x26, - 0x68, 0x76, 0x18, 0x0e, 0xd6, 0x8d, 0xe7, 0x44, 0x8a, 0x3a, 0x91, 0x7a, 0xd6, 0xff, 0xf2, 0xd5, - 0xdb, 0x9b, 0x7e, 0x47, 0x78, 0xb8, 0xa5, 0x93, 0x73, 0xbc, 0xff, 0x7c, 0xb1, 0xe0, 0x20, 0x5a, - 0xfd, 0x96, 0xf0, 0x60, 0xdd, 0x78, 0xf7, 0xaf, 0xbd, 0x60, 0xa9, 0x2b, 0xe0, 0x05, 0x2c, 0x32, - 0xe0, 0x41, 0x52, 0x73, 0xce, 0x3e, 0x07, 0xd6, 0xb0, 0xe5, 0xd1, 0x4e, 0x80, 0x04, 0x78, 0xf8, - 0xba, 0x4e, 0x8a, 0x3c, 0x7d, 0x09, 0xda, 0x8c, 0x1f, 0xcd, 0xef, 0xf8, 0x16, 0xbc, 0x6d, 0xd0, - 0x2b, 0x4c, 0x4b, 0xb8, 0x74, 0x52, 0x73, 0x18, 0xf7, 0xff, 0x26, 0x6c, 0x1b, 0xf4, 0x0a, 0x33, - 0xfd, 0xe6, 0xe0, 0x7d, 0x0a, 0x29, 0xe4, 0x95, 0x24, 0xe7, 0x78, 0x10, 0xa9, 0x48, 0x57, 0x60, - 0x8c, 0xdf, 0x0a, 0xe7, 0xbf, 0x1b, 0xcf, 0xdf, 0x6d, 0x5c, 0x2a, 0x11, 0x54, 0xb1, 0x2e, 0x58, - 0xbc, 0xf0, 0x5b, 0x26, 0xb5, 0x0a, 0xe4, 0x55, 0xab, 0x75, 0x16, 0x8b, 0xa5, 0xdd, 0xda, 0xe3, - 0x76, 0xa9, 0xeb, 0xc6, 0x3b, 0xd9, 0xad, 0x97, 0xe4, 0x65, 0xcc, 0xb5, 0x7f, 0x06, 0x2a, 0xd4, - 0x12, 0x04, 0xb5, 0x22, 0x64, 0x86, 0x8f, 0x4e, 0x39, 0xc4, 0x12, 0xc4, 0x29, 0x2b, 0x25, 0x8f, - 0x53, 0x39, 0xee, 0x4d, 0xd0, 0xec, 0x80, 0xde, 0x2c, 0x93, 0x77, 0xf8, 0xa8, 0x8b, 0xbb, 0x33, - 0xf4, 0x8d, 0x83, 0x47, 0xd6, 0xc1, 0xff, 0x9d, 0xe2, 0xa6, 0x58, 0xf8, 0x74, 0xb5, 0x71, 0xd1, - 0xcf, 0x8d, 0x8b, 0x7e, 0x6d, 0x5c, 0xf4, 0xe3, 0xc2, 0x45, 0xab, 0x0b, 0x17, 0xbd, 0xbd, 0xf7, - 0xcf, 0x35, 0x25, 0x03, 0xf3, 0x1d, 0x1f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xcb, 0xe2, 0x91, - 0x22, 0xdd, 0x02, 0x00, 0x00, + // 465 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x3d, 0x6f, 0xd3, 0x40, + 0x1c, 0xc6, 0x73, 0x8e, 0x95, 0x97, 0x4b, 0x68, 0xcb, 0x09, 0xa1, 0x28, 0x83, 0x9d, 0x66, 0xca, + 0x00, 0x36, 0x0a, 0xd0, 0x01, 0x26, 0x5c, 0x21, 0x55, 0xe1, 0xad, 0xba, 0x7a, 0x62, 0x40, 0xf2, + 0xcb, 0x5f, 0x8e, 0xa5, 0xe0, 0xb3, 0xce, 0x17, 0xb0, 0xbf, 0x09, 0x23, 0x9f, 0x80, 0x1d, 0xb1, + 0x30, 0x66, 0x64, 0x44, 0x19, 0x2c, 0x94, 0x7e, 0x0b, 0x26, 0x74, 0xee, 0xd9, 0x2d, 0x1d, 0x8a, + 0xd8, 0xee, 0xee, 0x79, 0xee, 0xe7, 0xe7, 0xfe, 0x8f, 0x71, 0x5f, 0xe4, 0x99, 0x95, 0x72, 0x26, + 0x18, 0x69, 0x8b, 0x3c, 0x1b, 0xdf, 0x89, 0x58, 0xc4, 0xaa, 0xbd, 0x2d, 0x57, 0x17, 0xd2, 0x78, + 0x18, 0xf0, 0x22, 0x15, 0x6a, 0x37, 0xfd, 0x86, 0x70, 0xef, 0x79, 0xf2, 0x01, 0x56, 0x2c, 0x05, + 0x72, 0x84, 0x07, 0x67, 0x71, 0x94, 0x78, 0x82, 0xf1, 0x18, 0xb2, 0x11, 0x9a, 0xb4, 0x67, 0x83, + 0xf9, 0x9e, 0x25, 0xb1, 0xf5, 0x79, 0xe1, 0xe8, 0x9b, 0xd2, 0x6c, 0xd1, 0xab, 0x46, 0x72, 0x17, + 0x6b, 0x6e, 0x3e, 0xd2, 0x26, 0x68, 0x36, 0x74, 0x3a, 0xdb, 0xd2, 0xd4, 0xdc, 0x9c, 0x6a, 0x6e, + 0x4e, 0x8e, 0x24, 0x3b, 0x60, 0x61, 0x9c, 0x44, 0xa3, 0xf6, 0x04, 0xcd, 0xf6, 0xe6, 0xe3, 0x0a, + 0x56, 0x7f, 0xd0, 0xaa, 0x55, 0xb7, 0x48, 0x81, 0x36, 0xde, 0xe9, 0x21, 0x1e, 0x5e, 0x55, 0x48, + 0x0f, 0xeb, 0x8b, 0xb3, 0x37, 0xaf, 0x0f, 0x5a, 0xa4, 0x8b, 0xdb, 0xf4, 0xe5, 0xe9, 0x01, 0x7a, + 0xa2, 0x7f, 0xfa, 0x6c, 0xb6, 0xa6, 0x5f, 0x11, 0xee, 0x37, 0xc9, 0xc8, 0x02, 0x77, 0x9f, 0x85, + 0x21, 0x87, 0x4c, 0x46, 0x97, 0x59, 0x1e, 0x6c, 0x4b, 0xf3, 0x5e, 0x14, 0x8b, 0xe5, 0xda, 0xb7, + 0x02, 0xf6, 0xde, 0x5e, 0x16, 0x29, 0xf0, 0x15, 0x84, 0x11, 0x70, 0xdb, 0x5f, 0x73, 0xce, 0x3e, + 0xda, 0x6a, 0x18, 0xea, 0x1e, 0xad, 0x01, 0xc4, 0xc6, 0xfd, 0xd3, 0xb5, 0xbf, 0x8a, 0x83, 0x17, + 0x50, 0x54, 0x2f, 0x1b, 0xcc, 0x6f, 0x5b, 0xca, 0xdc, 0x08, 0xf4, 0xd2, 0x23, 0x2f, 0x5c, 0x24, + 0x59, 0x73, 0x18, 0xe9, 0x7f, 0x5f, 0x68, 0x04, 0x7a, 0xe9, 0x99, 0x7e, 0xd1, 0x70, 0x97, 0x42, + 0x00, 0x71, 0x2a, 0xc8, 0x02, 0x77, 0xdc, 0x5c, 0x3e, 0xb5, 0x0a, 0x7e, 0xcb, 0x99, 0xff, 0x2e, + 0x4d, 0xeb, 0xe6, 0xe0, 0x22, 0xcf, 0xec, 0xd4, 0x2b, 0x56, 0xcc, 0x0b, 0xad, 0x6a, 0x7c, 0x8a, + 0x40, 0x5e, 0x49, 0xd6, 0x89, 0x97, 0x2d, 0x55, 0x21, 0x8f, 0x65, 0x5f, 0xdb, 0xd2, 0xbc, 0x7f, + 0x33, 0xcf, 0x8f, 0x13, 0x8f, 0x17, 0xd6, 0x09, 0xe4, 0x4e, 0x21, 0x20, 0xa3, 0x0a, 0x42, 0x66, + 0x78, 0xff, 0x98, 0x83, 0x27, 0x20, 0x3b, 0x66, 0x89, 0xe0, 0x5e, 0x20, 0xaa, 0x2a, 0x7b, 0xf4, + 0xfa, 0x31, 0x79, 0x87, 0xf7, 0xeb, 0x75, 0x5d, 0x83, 0x5e, 0x25, 0x78, 0xa4, 0x12, 0xfc, 0x5f, + 0x15, 0xd7, 0x61, 0xce, 0xd3, 0xcd, 0xce, 0x40, 0x3f, 0x76, 0x06, 0xfa, 0xb9, 0x33, 0xd0, 0xaf, + 0x9d, 0x81, 0xbe, 0x9f, 0x1b, 0x68, 0x73, 0x6e, 0xa0, 0xb7, 0x87, 0xff, 0x1c, 0x95, 0xdf, 0xa9, + 0x7e, 0xf7, 0x87, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x9a, 0xbd, 0xcb, 0x24, 0x03, 0x00, + 0x00, } func (m *Envelope) 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 } @@ -262,42 +289,57 @@ func (m *Envelope) Marshal() (dAtA []byte, err error) { } func (m *Envelope) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Envelope) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Signatories) > 0 { - for _, msg := range m.Signatories { - dAtA[i] = 0xa - i++ - i = encodeVarintTxs(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Encoding != 0 { + i = encodeVarintTxs(dAtA, i, uint64(m.Encoding)) + i-- + dAtA[i] = 0x18 + } + if m.Tx != nil { + { + size := m.Tx.Size() + i -= size + if _, err := m.Tx.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i += n + i = encodeVarintTxs(dAtA, i, uint64(size)) } - } - if m.Tx != nil { + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintTxs(dAtA, i, uint64(m.Tx.Size())) - n1, err := m.Tx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Signatories) > 0 { + for iNdEx := len(m.Signatories) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signatories[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTxs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return i, nil + return len(dAtA) - i, nil } func (m *Signatory) 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 } @@ -305,50 +347,62 @@ func (m *Signatory) Marshal() (dAtA []byte, err error) { } func (m *Signatory) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Signatory) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Address != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTxs(dAtA, i, uint64(m.Address.Size())) - n2, err := m.Address.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 m.Signature != nil { + { + size, err := m.Signature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTxs(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x22 } if m.PublicKey != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTxs(dAtA, i, uint64(m.PublicKey.Size())) - n3, err := m.PublicKey.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTxs(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x12 } - if m.Signature != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintTxs(dAtA, i, uint64(m.Signature.Size())) - n4, err := m.Signature.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Address != nil { + { + size := m.Address.Size() + i -= size + if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTxs(dAtA, i, uint64(size)) } - i += n4 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Receipt) 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 } @@ -356,55 +410,67 @@ func (m *Receipt) Marshal() (dAtA []byte, err error) { } func (m *Receipt) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Receipt) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TxType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTxs(dAtA, i, uint64(m.TxType)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x12 - i++ - i = encodeVarintTxs(dAtA, i, uint64(m.TxHash.Size())) - n5, err := m.TxHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.ContractAddress.Size() + i -= size + if _, err := m.ContractAddress.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTxs(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0x22 if m.CreatesContract { - dAtA[i] = 0x18 - i++ + i-- if m.CreatesContract { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x18 } - dAtA[i] = 0x22 - i++ - i = encodeVarintTxs(dAtA, i, uint64(m.ContractAddress.Size())) - n6, err := m.ContractAddress.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.TxHash.Size() + i -= size + if _, err := m.TxHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTxs(dAtA, i, uint64(size)) } - i += n6 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + if m.TxType != 0 { + i = encodeVarintTxs(dAtA, i, uint64(m.TxType)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func encodeVarintTxs(dAtA []byte, offset int, v uint64) int { + offset -= sovTxs(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 (m *Envelope) Size() (n int) { if m == nil { @@ -422,6 +488,9 @@ func (m *Envelope) Size() (n int) { l = m.Tx.Size() n += 1 + l + sovTxs(uint64(l)) } + if m.Encoding != 0 { + n += 1 + sovTxs(uint64(m.Encoding)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -475,14 +544,7 @@ func (m *Receipt) Size() (n int) { } func sovTxs(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTxs(x uint64) (n int) { return sovTxs(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -585,16 +647,32 @@ func (m *Envelope) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Encoding", wireType) + } + m.Encoding = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTxs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Encoding |= Envelope_EncodingType(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTxs(dAtA[iNdEx:]) if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTxs - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTxs } if (iNdEx + skippy) > l { @@ -752,10 +830,7 @@ func (m *Signatory) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTxs - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTxs } if (iNdEx + skippy) > l { @@ -911,10 +986,7 @@ func (m *Receipt) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthTxs - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTxs } if (iNdEx + skippy) > l { @@ -933,6 +1005,7 @@ func (m *Receipt) Unmarshal(dAtA []byte) error { func skipTxs(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -964,10 +1037,8 @@ func skipTxs(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -988,55 +1059,30 @@ func skipTxs(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTxs } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTxs - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTxs - } - 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 := skipTxs(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTxs - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTxs + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTxs + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTxs = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTxs = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTxs = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTxs = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTxs = fmt.Errorf("proto: unexpected end of group") ) diff --git a/util/architecture/constants.go b/util/architecture/constants.go deleted file mode 100644 index 695a5fe16..000000000 --- a/util/architecture/constants.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build !arm - -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package architecture - -import "math" - -const ( - MaxInt32 = math.MaxUint32 -) diff --git a/util/architecture/constants_arm.go b/util/architecture/constants_arm.go deleted file mode 100644 index c677498cb..000000000 --- a/util/architecture/constants_arm.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package architecture - -import "math" - -const ( - MaxInt32 = math.MaxInt32 -) diff --git a/util/fs.go b/util/fs.go deleted file mode 100644 index f9eea8576..000000000 --- a/util/fs.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package util - -import ( - "fmt" - "io" - "os" -) - -// Ensure the directory exists or create it if needed. -func EnsureDir(dir string, mode os.FileMode) error { - if fileOptions, err := os.Stat(dir); os.IsNotExist(err) { - if errMake := os.MkdirAll(dir, mode); errMake != nil { - return fmt.Errorf("could not create directory %s. %v", dir, err) - } - } else if err != nil { - return fmt.Errorf("error asserting directory %s: %v", dir, err) - } else if !fileOptions.IsDir() { - return fmt.Errorf("path already exists as a file: %s", dir) - } - return nil -} - -// Check whether the provided directory exists -func IsDir(directory string) bool { - fileInfo, err := os.Stat(directory) - if err != nil { - return false - } - return fileInfo.IsDir() -} - -// copied from http://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang -// CopyFile copies a file from src to dst. If src and dst files exist, and are -// the same, then return success. Otherwise, attempt to create a hard link -// between the two files. If that fail, copy the file contents from src to dst. -func CopyFile(src, dst string) (err error) { - sfi, err := os.Stat(src) - if err != nil { - return - } - if !sfi.Mode().IsRegular() { - // cannot copy non-regular files (e.g., directories, - // symlinks, devices, etc.) - return fmt.Errorf("CopyFile: non-regular source file %s (%q)", sfi.Name(), sfi.Mode().String()) - } - dfi, err := os.Stat(dst) - if err != nil { - if !os.IsNotExist(err) { - return - } - } else { - if !(dfi.Mode().IsRegular()) { - return fmt.Errorf("CopyFile: non-regular destination file %s (%q)", dfi.Name(), dfi.Mode().String()) - } - if os.SameFile(sfi, dfi) { - return - } - } - // NOTE: [ben] we do not want to create a hard link currently - // if err = os.Link(src, dst); err == nil { - // return - // } - err = copyFileContents(src, dst) - return -} - -// copyFileContents copies the contents of the file named src to the file named -// by dst. The file will be created if it does not already exist. If the -// destination file exists, all its contents will be replaced by the contents -// of the source file. -func copyFileContents(src, dst string) (err error) { - in, err := os.Open(src) - if err != nil { - return - } - defer in.Close() - out, err := os.Create(dst) - if err != nil { - return - } - defer func() { - cerr := out.Close() - if err == nil { - err = cerr - } - }() - if _, err = io.Copy(out, in); err != nil { - return - } - // TODO: [ben] this blocks, so copy should be put in go-routine - err = out.Sync() - return -} diff --git a/util/logging/cmd/main.go b/util/logging/cmd/main.go deleted file mode 100644 index d0b8acda2..000000000 --- a/util/logging/cmd/main.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "fmt" - - . "github.com/hyperledger/burrow/logging/logconfig" -) - -// Dump an example logging configuration -func main() { - loggingConfig := &LoggingConfig{ - RootSink: Sink(). - AddSinks( - // Log everything to Stderr - Sink().SetOutput(StderrOutput()), - Sink().SetTransform(FilterTransform(ExcludeWhenAllMatch, - "module", "p2p", - "captured_logging_source", "tendermint_log15")). - AddSinks( - Sink().SetOutput(StdoutOutput()), - ), - ), - } - fmt.Println(loggingConfig.RootTOMLString()) -} diff --git a/util/snatives/templates/indent_writer.go b/util/natives/templates/indent_writer.go similarity index 62% rename from util/snatives/templates/indent_writer.go rename to util/natives/templates/indent_writer.go index c395f5a9f..44def9c31 100644 --- a/util/snatives/templates/indent_writer.go +++ b/util/natives/templates/indent_writer.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package templates diff --git a/util/snatives/templates/solidity_templates.go b/util/natives/templates/solidity_templates.go similarity index 66% rename from util/snatives/templates/solidity_templates.go rename to util/natives/templates/solidity_templates.go index 7b9e18a33..a70870eea 100644 --- a/util/snatives/templates/solidity_templates.go +++ b/util/natives/templates/solidity_templates.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package templates @@ -20,7 +9,7 @@ import ( "strings" "text/template" - "github.com/hyperledger/burrow/execution/evm" + "github.com/hyperledger/burrow/execution/native" "github.com/iancoleman/strcase" ) @@ -33,14 +22,14 @@ const contractTemplateText = `pragma solidity [[.SolidityPragmaVersion]]; * @dev To instantiate the contract use: * @dev [[.Name]] [[.InstanceName]] = [[.Name]](address(uint256(keccak256("[[.Name]]")))); */ -contract [[.Name]] {[[range .Functions]] +interface [[.Name]] {[[range .Functions]] [[.SolidityIndent 1]] [[end]]} ` const functionTemplateText = `/** [[.Comment]] */ -function [[.Name]]([[.ArgList]]) public view returns ([[.RetList]]);` +function [[.Name]]([[.ArgList]]) external returns ([[.RetList]]);` // Solidity style guide recommends 4 spaces per indentation level // (see: http://solidity.readthedocs.io/en/develop/style-guide.html) @@ -55,39 +44,39 @@ func init() { Delims("[[", "]]"). Parse(functionTemplateText) if err != nil { - panic(fmt.Errorf("couldn't parse SNative function template: %s", err)) + panic(fmt.Errorf("couldn't parse native function template: %s", err)) } contractTemplate, err = template.New("SolidityContractTemplate"). Delims("[[", "]]"). Parse(contractTemplateText) if err != nil { - panic(fmt.Errorf("couldn't parse SNative contract template: %s", err)) + panic(fmt.Errorf("couldn't parse native contract template: %s", err)) } } type solidityContract struct { SolidityPragmaVersion string - *evm.SNativeContractDescription + *native.Contract } type solidityFunction struct { - *evm.SNativeFunctionDescription + *native.Function } // // Contract // -// Create a templated solidityContract from an SNative contract description -func NewSolidityContract(contract *evm.SNativeContractDescription) *solidityContract { +// Create a templated solidityContract from an native contract description +func NewSolidityContract(contract *native.Contract) *solidityContract { return &solidityContract{ - SolidityPragmaVersion: ">=0.4.24", - SNativeContractDescription: contract, + SolidityPragmaVersion: ">=0.4.24", + Contract: contract, } } func (contract *solidityContract) Comment() string { - return comment(contract.SNativeContractDescription.Comment) + return comment(contract.Contract.Comment) } // Get a version of the contract name to be used for an instance of the contract @@ -103,10 +92,10 @@ func (contract *solidityContract) InstanceName() string { func (contract *solidityContract) Address() string { return fmt.Sprintf("0x%s", - contract.SNativeContractDescription.Address()) + contract.Contract.Address()) } -// Generate Solidity code for this SNative contract +// Generate Solidity code for this native contract func (contract *solidityContract) Solidity() (string, error) { buf := new(bytes.Buffer) err := contractTemplate.Execute(buf, contract) @@ -117,7 +106,7 @@ func (contract *solidityContract) Solidity() (string, error) { } func (contract *solidityContract) Functions() []*solidityFunction { - functions := contract.SNativeContractDescription.Functions() + functions := contract.Contract.Functions() solidityFunctions := make([]*solidityFunction, len(functions)) for i, function := range functions { solidityFunctions[i] = NewSolidityFunction(function) @@ -129,17 +118,18 @@ func (contract *solidityContract) Functions() []*solidityFunction { // Function // -// Create a templated solidityFunction from an SNative function description -func NewSolidityFunction(function *evm.SNativeFunctionDescription) *solidityFunction { +// Create a templated solidityFunction from an native function description +func NewSolidityFunction(function *native.Function) *solidityFunction { return &solidityFunction{function} } func (function *solidityFunction) ArgList() string { - argList := make([]string, len(function.Abi.Inputs)) - for i, arg := range function.Abi.Inputs { + abi := function.Abi() + argList := make([]string, len(abi.Inputs)) + for i, arg := range abi.Inputs { storage := "" if arg.EVM.Dynamic() { - storage = " memory" + storage = " calldata" } argList[i] = fmt.Sprintf("%s%s %s", arg.EVM.GetSignature(), storage, param(arg.Name)) } @@ -147,15 +137,16 @@ func (function *solidityFunction) ArgList() string { } func (function *solidityFunction) RetList() string { - argList := make([]string, len(function.Abi.Outputs)) - for i, arg := range function.Abi.Outputs { + abi := function.Abi() + argList := make([]string, len(abi.Outputs)) + for i, arg := range abi.Outputs { argList[i] = fmt.Sprintf("%s %s", arg.EVM.GetSignature(), param(arg.Name)) } return strings.Join(argList, ", ") } func (function *solidityFunction) Comment() string { - return comment(function.SNativeFunctionDescription.Comment) + return comment(function.Function.Comment) } func (function *solidityFunction) SolidityIndent(indentLevel uint) (string, error) { diff --git a/util/natives/templates/solidity_templates_test.go b/util/natives/templates/solidity_templates_test.go new file mode 100644 index 000000000..fcadaae60 --- /dev/null +++ b/util/natives/templates/solidity_templates_test.go @@ -0,0 +1,34 @@ +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 + +package templates + +import ( + "fmt" + "testing" + + "github.com/hyperledger/burrow/execution/native" + "github.com/stretchr/testify/assert" +) + +func TestSNativeFuncTemplate(t *testing.T) { + contract := native.MustDefaultNatives().GetContract("Permissions") + function := contract.FunctionByName("removeRole") + if function == nil { + t.Fatal("Couldn't get function") + } + solidityFunction := NewSolidityFunction(function) + solidity, err := solidityFunction.Solidity() + assert.NoError(t, err) + fmt.Println(solidity) +} + +// This test checks that we can generate the native contract interface and +// prints it to stdout +func TestSNativeContractTemplate(t *testing.T) { + contract := native.MustDefaultNatives().GetContract("Permissions") + solidityContract := NewSolidityContract(contract) + solidity, err := solidityContract.Solidity() + assert.NoError(t, err) + fmt.Println(solidity) +} diff --git a/util/os.go b/util/os.go deleted file mode 100644 index a205c1c09..000000000 --- a/util/os.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package util - -import ( - "fmt" - "os" -) - -// Prints an error message to stderr and exits with status code 1 -func Fatalf(format string, args ...interface{}) { - fmt.Fprintf(os.Stderr, format, args...) - os.Exit(1) -} diff --git a/util/slice/slice.go b/util/slice/slice.go index 945bee4e4..1218dfdeb 100644 --- a/util/slice/slice.go +++ b/util/slice/slice.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package slice diff --git a/util/slice/slice_test.go b/util/slice/slice_test.go index 8ab47c99a..ddfc4690b 100644 --- a/util/slice/slice_test.go +++ b/util/slice/slice_test.go @@ -1,16 +1,5 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright Monax Industries Limited +// SPDX-License-Identifier: Apache-2.0 package slice diff --git a/util/snatives/templates/solidity_templates_test.go b/util/snatives/templates/solidity_templates_test.go deleted file mode 100644 index 998aa11fd..000000000 --- a/util/snatives/templates/solidity_templates_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package templates - -import ( - "fmt" - "testing" - - "github.com/hyperledger/burrow/execution/evm" - "github.com/stretchr/testify/assert" -) - -func TestSNativeFuncTemplate(t *testing.T) { - contract := evm.SNativeContracts()["Permissions"] - function, err := contract.FunctionByName("removeRole") - if err != nil { - t.Fatal("Couldn't get function") - } - solidityFunction := NewSolidityFunction(function) - solidity, err := solidityFunction.Solidity() - assert.NoError(t, err) - fmt.Println(solidity) -} - -// This test checks that we can generate the SNative contract interface and -// prints it to stdout -func TestSNativeContractTemplate(t *testing.T) { - contract := evm.SNativeContracts()["Permissions"] - solidityContract := NewSolidityContract(contract) - solidity, err := solidityContract.Solidity() - assert.NoError(t, err) - fmt.Println(solidity) -} diff --git a/vent/README.md b/vent/README.md deleted file mode 100644 index 7da4cac94..000000000 --- a/vent/README.md +++ /dev/null @@ -1,159 +0,0 @@ -# Vent Component - -Vent reads sqlsol specification & abi files, parses their contents, and maps column types to corresponding sql types to create or alter database structures. It listens for a stream of block events from Burrow's GRPC service then parses, unpacks, decodes event data, and builds rows to be upserted in matching event tables, rows are upserted atomically in a single database transaction per block. - -Block height and context info are stored in Log tables in order to resume getting pending blocks or rewind to a previous state. - -## SQLSol specification -SQLSol is the name (object relational mapping between Solidity events and SQL tables) given to the configuration files that Vent uses to interpret EVM events as updates or deletion from SQL tables - -Given a sqlsol specification, like the following: - -```json -[ - { - "TableName" : "EventTest", - "Filter" : "Log1Text = 'LOGEVENT1'", - "DeleteMarkerField": "__DELETE__", - "FieldMappings" : [ - {"Field": "key", "ColumnName" : "testname", "Type": "bytes32", "Primary" : true}, - {"Field": "description", "ColumnName" : "testdescription", "Type": "bytes32", "Primary" : false, "BytesToString": true} - ] - }, - { - "TableName" : "UserAccounts", - "Filter" : "Log1Text = 'USERACCOUNTS'", - "FieldMappings" : [ - {"Field": "userAddress", "ColumnName" : "address", "Type": "address", "Primary" : true}, - {"Field": "userName", "ColumnName" : "username", "Type": "string", "Primary" : false} - ] - } -] - -``` - -Burrow can emit a JSONSchema for the sqlsol file format with `burrow vent schema`. You can use this to validate your sqlsol files using any of the [JSONSchema](https://json-schema.org/) tooling. - -### SQLSol specification -A sqlsol file is defined as a JSON array of `EventClass` objections. Each `EventClass` specifies a class of events that should be consumed (specified via a filter) in order to generate a SQL table. An `EventClass` holds `FieldMappings` that specify how to map the event fields of a matched EVM event to a destination column (identified by `ColumnName`) of the destination table (indentified by `TableName`) - -#### EventClass -| Field | Type | Required? | Description | -|-------|------|-----------|-------------| -| `TableName` | String | Required | The case-sensitive name of the destination SQL table for the `EventClass`| -| `Filter` | String | Required | A filter to be applied to EVM Log events using the [available tags](../protobuf/rpcevents.proto) written according to the event [query.peg](../event/query/query.peg) grammar | -| `FieldMappings` | array of `FieldMapping` | Required | Mappings between EVM event fields and columns see table below | -| `DeleteMarkerField` | String | Optional | Field name of an event field that when present in a matched event indicates the event should result on a deletion of a row (matched on the primary keys of that row) rather than the default upsert action | - -#### FieldMapping -| Field | Type | Required? | Description | -|-------|------|-----------|-------------| -| `Field` | String | Required | EVM field name to match exactly when creating a SQL upsert/delete | -| `Type` | String | Required | EVM type of the field (which also dictates the SQL type that will be used for table definition) | -| `ColumnName` | String | Required | The destination SQL column for the mapped value | -| `Primary` | Boolean | Optional | Whether this SQL column should be part of the primary key | -| `BytesToString` | Boolean | Optional | When type is `bytes` (for some N) indicates that the value should be interpreted as (converted to) a string | -| `Notify` | array of String | Optional | A list of notification channels on which a payload should be sent containing the value of this column when it is updated or deleted. The payload on a particular channel will be the JSON object containing all column/value pairs for which the notification channel is a member of this notify array (see [triggers](#triggers) below) | - -Vent builds dictionary, log and event database tables for the defined tables & columns and maps input types to proper sql types. - -Database structures are created or altered on the fly based on specifications (just adding new columns is supported). - -Abi files can be generated from bin files like so: - -```bash -cat *.bin | jq '.Abi[] | select(.type == "event")' > events.abi -``` - - -## Adapters: - -Adapters are database implementations, Vent can store data in different rdbms. - -In `sqldb/adapters` there's a list of supported adapters (there is also a README.md file in that folder that helps to understand how to implement a new one). - -### Notification Triggers -Notification triggers are configured with the `Notify` array of a `FieldMapping`. In a supported database (currently only postrges) they allow you to specify a set of channels on which to notify when a column changes. By including a channel in the `Notify` the column is added to the set of columns for which that channel should receive a notification payload. For example if we have the following spec: - -```json -[ - { - "TableName" : "UserAccounts", - "Filter" : "Log1Text = 'USERACCOUNTS'", - "FieldMappings" : [ - {"Field": "userAddress", "ColumnName" : "address", "Type": "address", "Notify": ["user", "address"]}, - {"Field": "userName", "ColumnName" : "username", "Type": "string", "Notify": ["user"]} - ] - } - ] -``` - -Then Vent will record a mapping `user -> username, address` and `address -> address` where the left hand side is the notification channel and the right hand side the columns included in the payload on that channel. - -For each of these mappings a notification trigger function is defined and attached as a trigger for the table to run after an insert, update, or delete. This function calls `pg_notify` (in the case of postgres, the only database for which we support notifications - this is non-standard and we may use a different mechanism in other databases if present). These notification can be consumed by any client connected to the postgres database with `LISTEN ;`, see [Postgres NOTIFY documentation](https://www.postgresql.org/docs/11/sql-notify.html). - -## Setup PostgreSQL Database with Docker: - -```bash -# Create postgres container (only once): -docker run --name postgres-local -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=vent -p 5432:5432 -d postgres:10.4-alpine - -# Start postgres container: -docker start postgres-local - -# Stop postgres container: -docker stop postgres-local - -# Delete postgres container: -docker container rm postgres-local -``` - -## Run Unit Tests: - -```bash -# From the main repo folder: -make test_integration_vent -``` - -## Run Vent Command: - -```bash -# Install vent command: -go install ./vent - -# Print command help: -vent --help - -# Run vent command with postgres adapter, spec & abi files path, also stores block & tx data: -vent --db-adapter="postgres" --db-url="postgres://user:pass@localhost:5432/vent?sslmode=disable" --db-schema="vent" --grpc-addr="localhost:10997" --http-addr="0.0.0.0:8080" --log-level="debug" --spec-file="" --abi-file="" --db-block=true - -# Run vent command with sqlite adapter, spec & abi directories path, does not store block & tx data: -vent --db-adapter="sqlite" --db-url="./vent.sqlite" --grpc-addr="localhost:10997" --http-addr="0.0.0.0:8080" --log-level="debug" --spec-dir="" --abi-dir="" -``` - -Configuration Flags: - -+ `db-adapter`: (string) Database adapter, 'postgres' or 'sqlite' are fully supported -+ `db-url`: (string) PostgreSQL database URL or SQLite db file path -+ `db-schema`: (string) PostgreSQL database schema or empty for SQLite -+ `http-addr`: (string) Address to bind the HTTP server -+ `grpc-addr`: (string) Address to listen to gRPC Hyperledger Burrow server -+ `log-level`: (string) Logging level (error, warn, info, debug) -+ `spec-file`: (string) SQLSol specification json file (full path) -+ `spec-dir`: (string) Path of a folder to look for SQLSol json specification files -+ `abi-file`: (string) Event Abi specification file full path -+ `abi-dir`: (string) Path of a folder to look for event Abi specification files -+ `db-block`: (boolean) Create block & transaction tables and persist related data (true/false) - - -NOTES: - -One of `spec-file` or `spec-dir` must be provided. -If `spec-dir` is given, vent will search for all `.json` spec files in given directory. - -Also one of `abi-file` or `abi-dir` must be provided. -If `abi-dir` is given, vent will search for all `.abi` spec files in given directory. - -if `db-block` is set to true (block explorer mode), Block and Transaction tables are created in addition to log and event tables to store block & tx raw info. - -It can be checked that vent is connected and ready sending a request to `http:///health` which will return a `200` OK response in case everything's fine. diff --git a/vent/README.md b/vent/README.md new file mode 120000 index 000000000..ae6f2f5e5 --- /dev/null +++ b/vent/README.md @@ -0,0 +1 @@ +../docs/reference/vent.md \ No newline at end of file diff --git a/vent/chain/burrow/burrow.go b/vent/chain/burrow/burrow.go new file mode 100644 index 000000000..4c67afb8a --- /dev/null +++ b/vent/chain/burrow/burrow.go @@ -0,0 +1,288 @@ +package burrow + +import ( + "context" + "encoding/json" + "fmt" + "strconv" + + "github.com/hyperledger/burrow/event" + "github.com/hyperledger/burrow/event/query" + "github.com/hyperledger/burrow/vent/chain" + + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/rpc/rpcevents" + "github.com/hyperledger/burrow/rpc/rpcquery" + "github.com/hyperledger/burrow/vent/types" + "google.golang.org/grpc" + "google.golang.org/grpc/connectivity" +) + +type Chain struct { + conn *grpc.ClientConn + filter query.Query + query rpcquery.QueryClient + exec rpcevents.ExecutionEventsClient + chainID string + version string + continuity exec.ContinuityOpt +} + +var _ chain.Chain = (*Chain)(nil) + +func New(conn *grpc.ClientConn, filter *chain.Filter) (*Chain, error) { + client := rpcquery.NewQueryClient(conn) + status, err := client.Status(context.Background(), &rpcquery.StatusParam{}) + if err != nil { + return nil, fmt.Errorf("could not get initial status from Burrow: %w", err) + } + filterQuery, err := queryFromFilter(filter) + if err != nil { + return nil, fmt.Errorf("could not build Vent filter query: %w", err) + } + continuity := exec.Continuous + if !query.IsEmpty(filterQuery) { + // Since we may skip some events + continuity = exec.NonConsecutiveEvents + } + return &Chain{ + conn: conn, + query: client, + filter: filterQuery, + exec: rpcevents.NewExecutionEventsClient(conn), + chainID: status.ChainID, + version: status.BurrowVersion, + continuity: continuity, + }, nil +} + +func (b *Chain) GetChainID() string { + return b.chainID +} + +func (b *Chain) GetVersion() string { + return b.version +} + +func (b *Chain) StatusMessage(ctx context.Context, lastProcessedHeight uint64) []interface{} { + var catchUpRatio float64 + status, err := b.query.Status(ctx, &rpcquery.StatusParam{}) + if err != nil { + err = fmt.Errorf("could not get Burrow chain status: %w", err) + return []interface{}{ + "msg", "status", + "error", err.Error(), + } + } + if status.SyncInfo.LatestBlockHeight > 0 { + catchUpRatio = float64(lastProcessedHeight) / float64(status.SyncInfo.LatestBlockHeight) + } + return []interface{}{ + "msg", "status", + "chain_type", "Burrow", + "last_processed_height", lastProcessedHeight, + "fraction_caught_up", catchUpRatio, + "burrow_latest_block_height", status.SyncInfo.LatestBlockHeight, + "burrow_latest_block_duration", status.SyncInfo.LatestBlockDuration, + "burrow_latest_block_hash", status.SyncInfo.LatestBlockHash, + "burrow_latest_app_hash", status.SyncInfo.LatestAppHash, + "burrow_latest_block_time", status.SyncInfo.LatestBlockTime, + "burrow_latest_block_seen_time", status.SyncInfo.LatestBlockSeenTime, + "burrow_node_info", status.NodeInfo, + "burrow_catching_up", status.CatchingUp, + } +} + +func (b *Chain) ConsumeBlocks(ctx context.Context, in *rpcevents.BlockRange, consumer func(chain.Block) error) error { + stream, err := b.exec.Stream(ctx, &rpcevents.BlocksRequest{ + BlockRange: in, + Query: b.filter.String(), + }) + if err != nil { + return fmt.Errorf("could not connect to block stream: %w", err) + } + + return rpcevents.ConsumeBlockExecutions(stream, func(blockExecution *exec.BlockExecution) error { + return consumer((*Block)(blockExecution)) + }, exec.Continuous) +} + +func (b *Chain) Connectivity() connectivity.State { + return b.conn.GetState() +} + +func (b *Chain) GetABI(ctx context.Context, address crypto.Address) (string, error) { + result, err := b.query.GetMetadata(ctx, &rpcquery.GetMetadataParam{ + Address: &address, + }) + if err != nil { + return "", err + } + return result.Metadata, nil +} + +func (b *Chain) Close() error { + return b.conn.Close() +} + +type Block exec.BlockExecution + +func NewBurrowBlock(block *exec.BlockExecution) *Block { + return (*Block)(block) +} + +func (b *Block) GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error) { + blockHeader, err := json.Marshal(b.Header) + if err != nil { + return nil, fmt.Errorf("could not marshal block header: %w", err) + } + + return map[string]interface{}{ + columns.Height: strconv.FormatUint(b.Height, 10), + columns.TimeStamp: b.Header.GetTime(), + columns.BlockHeader: string(blockHeader), + }, nil +} + +var _ chain.Block = (*Block)(nil) + +func (b *Block) GetHeight() uint64 { + return b.Height +} + +func (b *Block) GetTxs() []chain.Transaction { + txs := make([]chain.Transaction, len(b.TxExecutions)) + for i, tx := range b.TxExecutions { + txs[i] = (*Transaction)(tx) + } + return txs +} + +type Transaction exec.TxExecution + +var _ chain.Transaction = (*Transaction)(nil) + +func (tx *Transaction) GetOrigin() *chain.Origin { + origin := (*exec.TxExecution)(tx).GetOrigin() + if origin == nil { + return nil + } + return &chain.Origin{ + ChainID: origin.ChainID, + Height: origin.Height, + Index: origin.Index, + } +} + +func (tx *Transaction) GetException() *errors.Exception { + return tx.Exception +} + +func (tx *Transaction) GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error) { + // transaction raw data + envelope, err := json.Marshal(tx.Envelope) + if err != nil { + return nil, fmt.Errorf("couldn't marshal envelope in tx %v: %v", tx, err) + } + + events, err := json.Marshal(tx.Events) + if err != nil { + return nil, fmt.Errorf("couldn't marshal events in tx %v: %v", tx, err) + } + + result, err := json.Marshal(tx.Result) + if err != nil { + return nil, fmt.Errorf("couldn't marshal result in tx %v: %v", tx, err) + } + + receipt, err := json.Marshal(tx.Receipt) + if err != nil { + return nil, fmt.Errorf("couldn't marshal receipt in tx %v: %v", tx, err) + } + + exception, err := json.Marshal(tx.Exception) + if err != nil { + return nil, fmt.Errorf("couldn't marshal exception in tx %v: %v", tx, err) + } + + origin, err := json.Marshal(tx.Origin) + if err != nil { + return nil, fmt.Errorf("couldn't marshal origin in tx %v: %v", tx, err) + } + + return map[string]interface{}{ + columns.Height: tx.Height, + columns.TxHash: tx.TxHash.String(), + columns.TxIndex: tx.Index, + columns.TxType: tx.TxType.String(), + columns.Envelope: string(envelope), + columns.Events: string(events), + columns.Result: string(result), + columns.Receipt: string(receipt), + columns.Origin: string(origin), + columns.Exception: string(exception), + }, nil +} + +func (tx *Transaction) GetHash() binary.HexBytes { + return tx.TxHash +} + +func (tx *Transaction) GetEvents() []chain.Event { + // All txs have events, but not all have LogEvents + var events []chain.Event + for _, ev := range tx.Events { + if ev.Log != nil { + events = append(events, (*Event)(ev)) + } + } + return events +} + +type Event exec.Event + +var _ chain.Event = (*Event)(nil) + +func (ev *Event) GetTransactionHash() binary.HexBytes { + return ev.Header.TxHash +} + +func (ev *Event) GetIndex() uint64 { + return ev.Header.Index +} + +func (ev *Event) GetTopics() []binary.Word256 { + return ev.Log.Topics +} + +func (ev *Event) GetData() []byte { + return ev.Log.Data +} + +func (ev *Event) GetAddress() crypto.Address { + return ev.Log.Address +} + +// Tags +func (ev *Event) Get(key string) (value interface{}, ok bool) { + return (*exec.Event)(ev).Get(key) +} + +func queryFromFilter(filter *chain.Filter) (query.Query, error) { + if filter == nil || (len(filter.Topics) == 0 && len(filter.Addresses) == 0) { + return new(query.Empty), nil + } + matchesFilter := query.NewBuilder() + for _, address := range filter.Addresses { + matchesFilter = matchesFilter.AndEquals("Address", address) + } + for i, topic := range filter.Topics { + matchesFilter = matchesFilter.AndEquals(exec.LogNKey(i), topic) + } + // Note label vent's own EventTypeLabel has different casing! + notLog := query.NewBuilder().AndNotEquals(event.EventTypeKey, exec.TypeLog) + return matchesFilter.Or(notLog).Query() +} diff --git a/vent/chain/chain.go b/vent/chain/chain.go new file mode 100644 index 000000000..eba6d4a36 --- /dev/null +++ b/vent/chain/chain.go @@ -0,0 +1,107 @@ +// Abstracts over a Burrow GRPC connection and Ethereum json-rpc web3 connection for the purposes of vent + +package chain + +import ( + "context" + "time" + + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/event/query" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/rpc/rpcevents" + "github.com/hyperledger/burrow/vent/types" + "google.golang.org/grpc/connectivity" +) + +const ( + // Infura has free tier usage of 100,000 req/day + defaultMaxRequests = 99_990 + defaultTimeBase = time.Hour * 24 + defaultMaxRetires = 5 + defaultBackoffBase = time.Second + defaultMaxBlockBatchSize = 100 +) + +type Chain interface { + GetChainID() string + GetVersion() string + ConsumeBlocks(ctx context.Context, in *rpcevents.BlockRange, consumer func(Block) error) error + StatusMessage(ctx context.Context, lastProcessedHeight uint64) []interface{} + Connectivity() connectivity.State + GetABI(ctx context.Context, address crypto.Address) (string, error) + Close() error +} + +type Block interface { + GetHeight() uint64 + GetTxs() []Transaction + GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error) +} + +type Transaction interface { + GetHash() binary.HexBytes + GetIndex() uint64 + GetEvents() []Event + GetException() *errors.Exception + GetOrigin() *Origin + GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error) +} + +type Event interface { + query.Tagged + GetIndex() uint64 + GetTransactionHash() binary.HexBytes + GetAddress() crypto.Address + GetTopics() []binary.Word256 + GetData() []byte +} + +type Filter struct { + Addresses []crypto.Address + Topics []binary.Word256 +} + +type Origin struct { + // The original ChainID from for this transaction + ChainID string + // The original height at which this transaction was committed + Height uint64 + // The original index in the block + Index uint64 +} + +// Client-side block consumer configuration. Requests are retried subject to backoff if a non-fatal error is detected +type BlockConsumerConfig struct { + // The maximum number of requests to make per TimeBase before throttling requests + MaxRequests int + // The base duration over which to count requests to check for overage of MaxRequests + TimeBase time.Duration + // The base backoff - we wait this amount of time between each batch and we increase the backoff exponentially + // until we reach MaxRetries from BaseBackoffDuration + BaseBackoffDuration time.Duration + // The maximum number of retries before failing + MaxRetries uint64 + // The default and maximum batch size for block requests, we will reduce it logarithmically to a single block + // when backing off + MaxBlockBatchSize uint64 +} + +func (config *BlockConsumerConfig) Complete() { + if config.MaxRequests == 0 { + config.MaxRequests = defaultMaxRequests + } + if config.TimeBase == 0 { + config.TimeBase = defaultTimeBase + } + if config.MaxBlockBatchSize == 0 { + config.MaxBlockBatchSize = defaultMaxBlockBatchSize + } + if config.BaseBackoffDuration == 0 { + config.BaseBackoffDuration = defaultBackoffBase + } + if config.MaxRetries == 0 { + config.MaxRetries = defaultMaxRetires + } +} diff --git a/vent/chain/ethereum/consumer.go b/vent/chain/ethereum/consumer.go new file mode 100644 index 000000000..64d50da50 --- /dev/null +++ b/vent/chain/ethereum/consumer.go @@ -0,0 +1,214 @@ +package ethereum + +import ( + "bytes" + "fmt" + "time" + + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/logging/structure" + "github.com/hyperledger/burrow/rpc/lib/types" + "github.com/pkg/errors" + + "github.com/hyperledger/burrow/rpc/rpcevents" + "github.com/hyperledger/burrow/rpc/web3/ethclient" + "github.com/hyperledger/burrow/vent/chain" +) + +const ConsumerScope = "EthereumConsumer" + +type consumer struct { + client ThrottleClient + filter *chain.Filter + blockRange *rpcevents.BlockRange + logger *logging.Logger + consumer func(block chain.Block) error + // Next unconsumed height + nextBlockHeight uint64 + retries uint64 + baseBackoffDuration time.Duration + backoffDuration time.Duration + maxRetries uint64 + maxBlockBatchSize uint64 + blockBatchSize uint64 +} + +func Consume(client ThrottleClient, filter *chain.Filter, blockRange *rpcevents.BlockRange, config *chain.BlockConsumerConfig, + logger *logging.Logger, consume func(block chain.Block) error) error { + c := consumer{ + client: client, + filter: filter, + blockRange: blockRange, + logger: logger.WithScope(ConsumerScope), + consumer: consume, + baseBackoffDuration: config.BaseBackoffDuration, + backoffDuration: config.BaseBackoffDuration, + maxRetries: config.MaxRetries, + maxBlockBatchSize: config.MaxBlockBatchSize, + blockBatchSize: config.MaxBlockBatchSize, + } + return c.Consume() +} + +func (c *consumer) Consume() error { + start, end, streaming, err := c.bounds() + if err != nil { + return err + } + c.logger.TraceMsg("Consume", "start", start, "end", end, "streaming", streaming) + + for c.nextBlockHeight <= end || streaming { + err = c.ConsumeInBatches(start, end) + if err != nil { + return err + } + start, end, streaming, err = c.bounds() + if err != nil { + return err + } + // Avoid spinning excessively where there may be no blocks available + time.Sleep(c.backoffDuration) + } + + return nil +} + +func (c *consumer) ConsumeInBatches(start, end uint64) error { + c.logger.TraceMsg("ConsumeInBatches", "start", start, "end", end) + for batchStart := start; batchStart <= end; batchStart += c.blockBatchSize { + // Avoid breaching requests limit + c.client.Throttle() + batchEnd := batchStart + c.blockBatchSize + c.logger.TraceMsg("Consuming batch", "batch_start", batchStart, "batch_end", batchEnd) + if batchEnd > end { + batchEnd = end + } + logs, err := c.client.GetLogs(ðclient.Filter{ + BlockRange: rpcevents.AbsoluteRange(batchStart, batchEnd), + Addresses: c.filter.Addresses, + Topics: c.filter.Topics, + }) + if err != nil { + err = c.handleError(end, err) + if err != nil { + return err + } + // We managed to handle the error (a retry was successful) + return nil + } + // Request was successful + c.recover() + lastBlock, err := consumeBlocksFromLogs(c.client, logs, c.consumer) + if err != nil { + return fmt.Errorf("could not consume ethereum logs: %w", err) + } + if lastBlock != nil { + c.nextBlockHeight = lastBlock.GetHeight() + 1 + } + c.logger.TraceMsg("Finished consuming batch", "next_block_height", c.nextBlockHeight) + } + return nil +} + +func (c *consumer) bounds() (start uint64, end uint64, streaming bool, err error) { + var latestHeight uint64 + + latestHeight, err = c.client.BlockNumber() + if err != nil { + err = fmt.Errorf("could not get latest height: %w", err) + return + } + start, end, streaming = c.blockRange.Bounds(latestHeight) + + if start < c.nextBlockHeight { + start = c.nextBlockHeight + } + return +} + +func (c *consumer) handleError(end uint64, err error) error { + var rpcError *types.RPCError + if errors.As(err, &rpcError) { + // If we have a custom server error maybe our batch size is too large or maybe we should wait + if rpcError.IsServerError() { + c.retries++ + c.logger.InfoMsg("caught Ethereum server error, backing off...", + structure.ErrorKey, err, "retry", c.retries, "backoff", c.backoffDuration.String()) + if c.retries <= c.maxRetries { + // Server may throw if batch too large or request takes too long + c.backoff() + c.logger.InfoMsg("Ethereum block consumer retrying after Ethereum Server Error", + structure.ErrorKey, rpcError) + return c.ConsumeInBatches(c.nextBlockHeight, end) + } + } + } + return err +} + +// Asymptotic decrease to single block +func (c *consumer) backoff() { + c.blockBatchSize /= 2 + if c.blockBatchSize == 0 { + c.blockBatchSize = 1 + } + time.Sleep(c.backoffDuration) + c.backoffDuration *= 2 +} + +// Asymptotic increase to max blocks +func (c *consumer) recover() { + delta := (c.maxBlockBatchSize - c.blockBatchSize) / 2 + if delta == 0 { + c.blockBatchSize = c.maxBlockBatchSize + } else { + c.blockBatchSize += delta + } + // Reset retries and backoff + c.backoffDuration = c.baseBackoffDuration + c.retries = 0 +} + +func consumeBlocksFromLogs(client EthClient, logs []*ethclient.EthLog, + consumer func(block chain.Block) error) (chain.Block, error) { + if len(logs) == 0 { + return nil, nil + } + log, err := newEvent(logs[0]) + if err != nil { + return nil, fmt.Errorf("could not deserialise ethereum event: %w", err) + } + block := newBlock(client, log) + txHash := log.TransactionHash + indexInBlock := log.IndexInBlock + + for i := 1; i < len(logs); i++ { + log, err = newEvent(logs[i]) + if err != nil { + return nil, fmt.Errorf("could not deserialise ethereum event: %w", err) + } + if log.Height > block.Height { + // New block + err = consumer(block) + if err != nil { + return nil, err + } + // Establish new block + block = newBlock(client, log) + } else { + if log.IndexInBlock <= indexInBlock { + return nil, fmt.Errorf("event LogIndex is non-increasing within block, "+ + "previous LogIndex was %d but current is %d (at height %d)", indexInBlock, log.IndexInBlock, block.Height) + } + if !bytes.Equal(txHash, log.TransactionHash) { + // New Tx + block.appendTransaction(log) + } else { + block.appendEvent(log) + } + } + txHash = log.TransactionHash + indexInBlock = log.IndexInBlock + } + return block, consumer(block) +} diff --git a/vent/chain/ethereum/consumer_test.go b/vent/chain/ethereum/consumer_test.go new file mode 100644 index 000000000..f2661da61 --- /dev/null +++ b/vent/chain/ethereum/consumer_test.go @@ -0,0 +1,115 @@ +package ethereum + +import ( + "encoding/json" + "testing" + + "github.com/hyperledger/burrow/rpc/web3/ethclient" + "github.com/hyperledger/burrow/vent/chain" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConsumeBlocks(t *testing.T) { + var logs []*ethclient.EthLog + err := json.Unmarshal([]byte(ethLogsJSON), &logs) + require.NoError(t, err) + var blocks []chain.Block + lastBlock, err := consumeBlocksFromLogs(nil, logs, func(block chain.Block) error { + blocks = append(blocks, block) + return nil + }) + require.NoError(t, err) + assert.Equal(t, uint64(24), lastBlock.GetHeight()) + assert.Len(t, blocks, 3) + txs0 := blocks[0].GetTxs() + assert.Len(t, txs0, 2) + assert.Len(t, txs0[0].GetEvents(), 1) + assert.Len(t, txs0[1].GetEvents(), 2) + assert.Len(t, blocks[1].GetTxs(), 1) + assert.Len(t, blocks[2].GetTxs(), 1) +} + +func TestConsumer_ConsumeInBatches(t *testing.T) { + // TODO +} + +// From running TestGetEthLogs over in ethclient tests against truffle in vent/test/eth (and subsequently fiddled with) +// language=JSON +const ethLogsJSON = `[ + { + "topics": [ + "0x2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca", + "0x446f776e73696521000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000066", + "0x33027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d161" + ], + "transactionHash": "0x22d1cbba63e3577a5a35b02945289711e1e21a8e3d69dd2f3b05fd4619eb6b20", + "address": "0xa1e378f122fec6aa8c841397042e21bc19368768", + "blockHash": "0x434520f95c0ca8ad4b1853b6aeb748593b4e8603d923199c44c753133fa66b7b", + "blockNumber": "0x9", + "data": "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000051446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674000000000000000000000000000000", + "logIndex": "0x0", + "transactionIndex": "0x0" + }, + { + "topics": [ + "0x2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca", + "0x446f776e73696521000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000066", + "0x33027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d161" + ], + "transactionHash": "0xf1869bff3273e8a31076be06754c8d1ae2bbd38d9faf32cfeb411750878c7ee5", + "address": "0xf73aaa468496a87675d27638878a1600b0db3c71", + "blockHash": "0x9fe9d2eb6b309330c48a77793dbb98bf01faf5d3aea8e0fde60c7d548330ae74", + "blockNumber": "0x9", + "data": "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000051446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674000000000000000000000000000000", + "logIndex": "0x1", + "transactionIndex": "0x0" + }, + { + "topics": [ + "0x2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca", + "0x446f776e73696521000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000066", + "0x33027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d161" + ], + "transactionHash": "0xf1869bff3273e8a31076be06754c8d1ae2bbd38d9faf32cfeb411750878c7ee5", + "address": "0xf73aaa468496a87675d27638878a1600b0db3c71", + "blockHash": "0x9fe9d2eb6b309330c48a77793dbb98bf01faf5d3aea8e0fde60c7d548330ae74", + "blockNumber": "0x9", + "data": "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000051446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674000000000000000000000000000000", + "logIndex": "0x4", + "transactionIndex": "0x0" + }, + { + "topics": [ + "0x2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca", + "0x446f776e73696521000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000066", + "0x33027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d161" + ], + "transactionHash": "0x919b7ca6cd104bbb9cef2a5199ba8515968494474874894e426227766759d442", + "address": "0xc0eec83d13999827902ad7f2ebba38e4ce457c88", + "blockHash": "0x099fa767303fd80ae83a82d383a87c92662f5e59cf1ed87b55cf1b9c4aea9f6b", + "blockNumber": "0x13", + "data": "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000051446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674000000000000000000000000000000", + "logIndex": "0x0", + "transactionIndex": "0x0" + }, + { + "topics": [ + "0x2d989eca8871e173291c8e287f34adebef09917027f9e904c22ce459a2cff0ca", + "0x446f776e73696521000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000066", + "0x33027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d161" + ], + "transactionHash": "0x6979538ef67d056b72f62d711dc63de0b06c8d4c31e1788bed973d07719f7ee5", + "address": "0xbe6cea7a6cc115ed2c0863dc2df6b883769b2ec5", + "blockHash": "0x3f9a059783e476eea8f723179431498ad62c584c6ea02c4b3cb5b541cd3435b4", + "blockNumber": "0x18", + "data": "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000051446f6e617564616d7066736368696666666168727473656c656b7472697a6974c3a474656e686175707462657472696562737765726b626175756e7465726265616d74656e676573656c6c736368616674000000000000000000000000000000", + "logIndex": "0x0", + "transactionIndex": "0x0" + } +]` diff --git a/vent/chain/ethereum/ethereum.go b/vent/chain/ethereum/ethereum.go new file mode 100644 index 000000000..644ba930c --- /dev/null +++ b/vent/chain/ethereum/ethereum.go @@ -0,0 +1,276 @@ +package ethereum + +import ( + "context" + "encoding/json" + "fmt" + "reflect" + "strconv" + "time" + + "github.com/hyperledger/burrow/binary" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/encoding/web3hex" + "github.com/hyperledger/burrow/event" + "github.com/hyperledger/burrow/event/query" + "github.com/hyperledger/burrow/execution/errors" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/rpc/rpcevents" + "github.com/hyperledger/burrow/rpc/web3/ethclient" + "github.com/hyperledger/burrow/vent/chain" + "github.com/hyperledger/burrow/vent/types" + "google.golang.org/grpc/connectivity" +) + +const Scope = "Ethereum" + +type Chain struct { + client ThrottleClient + filter *chain.Filter + chainID string + version string + consumerConfig *chain.BlockConsumerConfig + logger *logging.Logger +} + +var _ chain.Chain = (*Chain)(nil) + +type EthClient interface { + GetLogs(filter *ethclient.Filter) ([]*ethclient.EthLog, error) + BlockNumber() (uint64, error) + GetBlockByNumber(height string) (*ethclient.Block, error) + NetVersion() (string, error) + Web3ClientVersion() (string, error) + Syncing() (bool, error) +} + +// We rely on this failing if the chain is not an Ethereum Chain +func New(client EthClient, filter *chain.Filter, consumerConfig *chain.BlockConsumerConfig, + logger *logging.Logger) (*Chain, error) { + logger = logger.WithScope(Scope) + throttleClient := NewThrottleClient(client, consumerConfig.MaxRequests, consumerConfig.TimeBase, logger) + chainID, err := throttleClient.NetVersion() + if err != nil { + return nil, fmt.Errorf("could not get Ethereum ChainID: %w", err) + } + version, err := throttleClient.Web3ClientVersion() + if err != nil { + return nil, fmt.Errorf("could not get Ethereum node version: %w", err) + } + return &Chain{ + client: throttleClient, + filter: filter, + chainID: chainID, + version: version, + consumerConfig: consumerConfig, + logger: logger, + }, nil +} + +func (c *Chain) StatusMessage(ctx context.Context, lastProcessedHeight uint64) []interface{} { + // TODO: more info is available from web3 + return []interface{}{ + "msg", "status", + "chain_type", "Ethereum", + "last_processed_height", lastProcessedHeight, + } +} + +func (c *Chain) GetABI(ctx context.Context, address crypto.Address) (string, error) { + // Unsupported by Ethereum + return "", nil +} + +func (c *Chain) GetVersion() string { + return c.version +} + +func (c *Chain) GetChainID() string { + return c.chainID +} + +func (c *Chain) ConsumeBlocks(ctx context.Context, in *rpcevents.BlockRange, consumer func(chain.Block) error) error { + return Consume(c.client, c.filter, in, c.consumerConfig, c.logger, consumer) +} + +func (c *Chain) Connectivity() connectivity.State { + // TODO: better connectivity information + _, err := c.client.Syncing() + if err != nil { + return connectivity.TransientFailure + } + return connectivity.Ready +} + +func (c *Chain) Close() error { + // just a http.Client - nothing to free + return nil +} + +type Block struct { + client EthClient + Height uint64 + Transactions []chain.Transaction +} + +func newBlock(client EthClient, log *Event) *Block { + return &Block{ + client: client, + Height: log.Height, + Transactions: []chain.Transaction{NewEthereumTransaction(log)}, + } +} + +var _ chain.Block = (*Block)(nil) + +func (b *Block) GetHeight() uint64 { + return b.Height +} + +func (b *Block) GetTxs() []chain.Transaction { + return b.Transactions +} + +func (b *Block) GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error) { + block, err := b.client.GetBlockByNumber(web3hex.Encoder.Uint64(b.Height)) + if err != nil { + return nil, err + } + d := new(web3hex.Decoder) + blockHeader, err := json.Marshal(block) + if err != nil { + return nil, fmt.Errorf("could not serialise block header: %w", err) + } + return map[string]interface{}{ + columns.Height: strconv.FormatUint(b.Height, 10), + columns.TimeStamp: time.Unix(d.Int64(block.Timestamp), 0), + columns.BlockHeader: string(blockHeader), + }, d.Err() +} + +func (b *Block) appendTransaction(log *Event) { + b.Transactions = append(b.Transactions, &Transaction{ + Index: uint64(len(b.Transactions)), + Hash: log.TransactionHash, + Events: []chain.Event{log}, + }) +} + +func (b *Block) appendEvent(log *Event) { + tx := b.Transactions[len(b.Transactions)-1].(*Transaction) + log.Index = uint64(len(tx.Events)) + tx.Events = append(tx.Events, log) +} + +type Transaction struct { + Height uint64 + Index uint64 + Hash binary.HexBytes + Events []chain.Event +} + +func NewEthereumTransaction(log *Event) *Transaction { + return &Transaction{ + Height: log.Height, + Index: 0, + Hash: log.TransactionHash, + Events: []chain.Event{log}, + } +} + +func (tx *Transaction) GetHash() binary.HexBytes { + return tx.Hash +} + +func (tx *Transaction) GetIndex() uint64 { + return tx.Index +} + +func (tx *Transaction) GetEvents() []chain.Event { + return tx.Events +} + +func (tx *Transaction) GetException() *errors.Exception { + // Ethereum does not retain an log from reverted transactions + return nil +} + +func (tx *Transaction) GetOrigin() *chain.Origin { + // Origin refers to a previous dumped chain which is not a concept in Ethereum + return nil +} + +func (tx *Transaction) GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error) { + return map[string]interface{}{ + columns.Height: tx.Height, + columns.TxHash: tx.Hash.String(), + columns.TxIndex: tx.Index, + columns.TxType: exec.TypeLog.String(), + }, nil +} + +var _ chain.Transaction = (*Transaction)(nil) + +type Event struct { + exec.LogEvent + Height uint64 + // Index of event in entire block (what ethereum provides us with + IndexInBlock uint64 + // Index of event in transaction + Index uint64 + TransactionHash binary.HexBytes +} + +var _ chain.Event = (*Event)(nil) + +func newEvent(log *ethclient.EthLog) (*Event, error) { + d := new(web3hex.Decoder) + topics := make([]binary.Word256, len(log.Topics)) + for i, t := range log.Topics { + topics[i] = binary.LeftPadWord256(d.Bytes(t)) + } + txHash := d.Bytes(log.TransactionHash) + return &Event{ + LogEvent: exec.LogEvent{ + Topics: topics, + Address: d.Address(log.Address), + Data: d.Bytes(log.Data), + }, + Height: d.Uint64(log.BlockNumber), + IndexInBlock: d.Uint64(log.LogIndex), + TransactionHash: txHash, + }, d.Err() +} + +func (ev *Event) GetIndex() uint64 { + return ev.Index +} + +func (ev *Event) GetTransactionHash() binary.HexBytes { + return ev.TransactionHash +} + +func (ev *Event) GetAddress() crypto.Address { + return ev.Address +} + +func (ev *Event) GetTopics() []binary.Word256 { + return ev.Topics +} + +func (ev *Event) GetData() []byte { + return ev.Data +} + +func (ev *Event) Get(key string) (value interface{}, ok bool) { + switch key { + case event.EventTypeKey: + return exec.TypeLog, true + } + v, ok := ev.LogEvent.Get(key) + if ok { + return v, ok + } + return query.GetReflect(reflect.ValueOf(ev), key) +} diff --git a/vent/chain/ethereum/throttle_client.go b/vent/chain/ethereum/throttle_client.go new file mode 100644 index 000000000..ac846f963 --- /dev/null +++ b/vent/chain/ethereum/throttle_client.go @@ -0,0 +1,58 @@ +package ethereum + +import ( + "time" + + "github.com/hyperledger/burrow/logging" + + "github.com/hyperledger/burrow/rpc/web3/ethclient" +) + +type ThrottleClient interface { + EthClient + Throttle() +} + +type throttleClient struct { + *Throttler + client EthClient +} + +func NewThrottleClient(client EthClient, maxRequests int, timeBase time.Duration, logger *logging.Logger) *throttleClient { + return &throttleClient{ + Throttler: NewThrottler(maxRequests, timeBase, timeBase, + logger.WithScope("ThrottleClient"). + With("max_requests", maxRequests, "time_base", timeBase.String())), + client: client, + } +} + +func (t *throttleClient) GetLogs(filter *ethclient.Filter) ([]*ethclient.EthLog, error) { + t.addNow() + return t.client.GetLogs(filter) +} + +func (t *throttleClient) BlockNumber() (uint64, error) { + t.addNow() + return t.client.BlockNumber() +} + +func (t *throttleClient) GetBlockByNumber(height string) (*ethclient.Block, error) { + t.addNow() + return t.client.GetBlockByNumber(height) +} + +func (t *throttleClient) NetVersion() (string, error) { + t.addNow() + return t.client.NetVersion() +} + +func (t *throttleClient) Web3ClientVersion() (string, error) { + t.addNow() + return t.client.Web3ClientVersion() +} + +func (t *throttleClient) Syncing() (bool, error) { + t.addNow() + return t.client.Syncing() +} diff --git a/vent/chain/ethereum/throttler.go b/vent/chain/ethereum/throttler.go new file mode 100644 index 000000000..bd705b1bd --- /dev/null +++ b/vent/chain/ethereum/throttler.go @@ -0,0 +1,70 @@ +package ethereum + +import ( + "math/big" + "time" + + "github.com/hyperledger/burrow/logging" +) + +type Throttler struct { + // Request timestamps as unix nanos (avoid space overhead of time.Time) + requests []int64 + maxRequestsPerNanosecond *big.Float + // Window over which to accumulate request times + window time.Duration + logger *logging.Logger +} + +func NewThrottler(maxRequests int, timeBase time.Duration, window time.Duration, logger *logging.Logger) *Throttler { + maxRequestsPerNanosecond := new(big.Float).SetInt64(int64(maxRequests)) + maxRequestsPerNanosecond.Quo(maxRequestsPerNanosecond, new(big.Float).SetInt64(int64(timeBase))) + return &Throttler{ + maxRequestsPerNanosecond: maxRequestsPerNanosecond, + window: window, + logger: logger, + } +} + +func (t *Throttler) Throttle() { + time.Sleep(t.calculateWait()) +} + +func (t *Throttler) calculateWait() time.Duration { + requests := len(t.requests) + if requests < 2 { + return 0 + } + delta := t.requests[requests-1] - t.requests[0] + deltaNanoseconds := new(big.Float).SetInt64(delta) + + allowedRequestsInDelta := new(big.Float).Mul(deltaNanoseconds, t.maxRequestsPerNanosecond) + + overage := allowedRequestsInDelta.Sub(new(big.Float).SetInt64(int64(requests)), allowedRequestsInDelta) + if overage.Sign() > 0 { + // Wait just long enough to eat our overage at max request rate + nanos, _ := new(big.Float).Quo(overage, t.maxRequestsPerNanosecond).Int64() + wait := time.Duration(nanos) + t.logger.InfoMsg("throttling connection", + "num_requests", requests, + "over_period", time.Duration(delta).String(), + "requests_overage", overage.String(), + "wait", wait.String(), + ) + return wait + } + return 0 +} + +func (t *Throttler) addNow() { + t.add(time.Now()) +} + +func (t *Throttler) add(now time.Time) { + cutoff := now.Add(-t.window) + // Remove expired requests + for len(t.requests) > 0 && t.requests[0] < cutoff.UnixNano() { + t.requests = t.requests[1:] + } + t.requests = append(t.requests, now.UnixNano()) +} diff --git a/vent/chain/ethereum/throttler_test.go b/vent/chain/ethereum/throttler_test.go new file mode 100644 index 000000000..d5c4fc63f --- /dev/null +++ b/vent/chain/ethereum/throttler_test.go @@ -0,0 +1,56 @@ +package ethereum + +import ( + "testing" + "time" + + "github.com/hyperledger/burrow/logging/logconfig" + + "github.com/stretchr/testify/assert" +) + +var logger = logconfig.Sink().Terminal().LoggingConfig().WithTrace().MustLogger() + +const delta = float64(time.Millisecond) + +func TestThrottler_Overage(t *testing.T) { + throttler := NewThrottler(100, time.Second, time.Minute, logger) + + now := doRequests(throttler, 100, time.Now(), time.Second) + assert.InDelta(t, time.Duration(0), throttler.calculateWait(), delta) + + doRequests(throttler, 200, now, time.Second) + assert.InDelta(t, time.Second, throttler.calculateWait(), delta) +} + +func TestThrottler_Expiry(t *testing.T) { + throttler := NewThrottler(100, time.Second, 2*time.Second, logger) + + now := doRequests(throttler, 200, time.Now(), time.Second) + assert.InDelta(t, time.Second, throttler.calculateWait(), delta) + + now = doRequests(throttler, 100, now, time.Second) + assert.InDelta(t, time.Second, throttler.calculateWait(), delta) + + now = doRequests(throttler, 100, now, time.Second) + assert.InDelta(t, time.Duration(0), throttler.calculateWait(), delta) +} + +func TestThrottler_Bursts(t *testing.T) { + throttler := NewThrottler(10_000, time.Hour, 2*time.Hour, logger) + + now := doRequests(throttler, 200, time.Now(), time.Millisecond) + assert.InDelta(t, time.Minute+12*time.Second, throttler.calculateWait(), delta) + + now = doRequests(throttler, 100, now, time.Second) + assert.InDelta(t, time.Minute+47*time.Second, throttler.calculateWait(), delta) +} + +// Do numRequests many requests from start within interval +func doRequests(throttler *Throttler, numRequests int, start time.Time, interval time.Duration) time.Time { + period := interval / time.Duration(numRequests-1) + for i := 0; i < numRequests; i++ { + throttler.add(start.Add(period * time.Duration(i))) + } + return start.Add(interval) +} diff --git a/vent/config/config.go b/vent/config/config.go index f99b967d5..2fa64fb75 100644 --- a/vent/config/config.go +++ b/vent/config/config.go @@ -3,6 +3,8 @@ package config import ( "time" + "github.com/hyperledger/burrow/crypto" + "github.com/hyperledger/burrow/vent/chain" "github.com/hyperledger/burrow/vent/sqlsol" "github.com/hyperledger/burrow/vent/types" ) @@ -11,12 +13,15 @@ const DefaultPostgresDBURL = "postgres://postgres@localhost:5432/postgres?sslmod // VentConfig is a set of configuration parameters type VentConfig struct { - DBAdapter string - DBURL string - DBSchema string - GRPCAddr string - HTTPAddr string - LogLevel string + DBAdapter string + DBURL string + DBSchema string + ChainAddress string + HTTPListenAddress string + BlockConsumerConfig chain.BlockConsumerConfig + // Global contracts to watch specified as hex + WatchAddresses []crypto.Address + MinimumHeight uint64 SpecFileOrDirs []string AbiFileOrDirs []string SpecOpt sqlsol.SpecOpt @@ -27,13 +32,12 @@ type VentConfig struct { // DefaultFlags returns a configuration with default values func DefaultVentConfig() *VentConfig { return &VentConfig{ - DBAdapter: types.PostgresDB, - DBURL: DefaultPostgresDBURL, - DBSchema: "vent", - GRPCAddr: "localhost:10997", - HTTPAddr: "0.0.0.0:8080", - LogLevel: "debug", - SpecOpt: sqlsol.None, - AnnounceEvery: time.Second * 5, + DBAdapter: types.PostgresDB, + DBURL: DefaultPostgresDBURL, + DBSchema: "vent", + ChainAddress: "localhost:10997", + HTTPListenAddress: "0.0.0.0:8080", + SpecOpt: sqlsol.None, + AnnounceEvery: time.Second * 5, } } diff --git a/vent/service/abi_provider.go b/vent/service/abi_provider.go index c339663aa..fa5b997a2 100644 --- a/vent/service/abi_provider.go +++ b/vent/service/abi_provider.go @@ -7,7 +7,7 @@ import ( "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/logging" - "github.com/hyperledger/burrow/rpc/rpcquery" + "github.com/hyperledger/burrow/vent/chain" ) type EventSpecGetter func(abi.EventID, crypto.Address) (*abi.EventSpec, error) @@ -15,14 +15,14 @@ type EventSpecGetter func(abi.EventID, crypto.Address) (*abi.EventSpec, error) // AbiProvider provides a method for loading ABIs from disk, and retrieving them from burrow on-demand type AbiProvider struct { abiSpec *abi.Spec - cli rpcquery.QueryClient + chain chain.Chain logger *logging.Logger } // NewAbiProvider loads ABIs from the filesystem. A set of zero or more files or directories can be passed in the path // argument. If an event is encountered for which no ABI is known, it is retrieved from burrow -func NewAbiProvider(paths []string, cli rpcquery.QueryClient, logger *logging.Logger) (provider *AbiProvider, err error) { - abiSpec := &abi.Spec{} +func NewAbiProvider(paths []string, chain chain.Chain, logger *logging.Logger) (provider *AbiProvider, err error) { + abiSpec := abi.NewSpec() if len(paths) > 0 { abiSpec, err = abi.LoadPath(paths...) if err != nil { @@ -32,7 +32,7 @@ func NewAbiProvider(paths []string, cli rpcquery.QueryClient, logger *logging.Lo provider = &AbiProvider{ abiSpec: abiSpec, - cli: cli, + chain: chain, logger: logger.WithScope("NewAbiProvider"), } return @@ -43,28 +43,28 @@ func NewAbiProvider(paths []string, cli rpcquery.QueryClient, logger *logging.Lo func (p *AbiProvider) GetEventAbi(eventID abi.EventID, address crypto.Address) (*abi.EventSpec, error) { evAbi, ok := p.abiSpec.EventsByID[eventID] if !ok { - resp, err := p.cli.GetMetadata(context.Background(), &rpcquery.GetMetadataParam{Address: &address}) + metadata, err := p.chain.GetABI(context.Background(), address) if err != nil { p.logger.InfoMsg("Error retrieving abi for event", "address", address.String(), "eventid", eventID.String(), "error", err) return nil, err } - if resp == nil || resp.Metadata == "" { + if metadata == "" { p.logger.InfoMsg("ABI not found for contract", "address", address.String(), "eventid", eventID.String()) return nil, fmt.Errorf("No ABI present for contract at address %v", address) } - a, err := abi.ReadSpec([]byte(resp.Metadata)) + a, err := abi.ReadSpec([]byte(metadata)) if err != nil { - p.logger.InfoMsg("Failed to parse abi", "address", address.String(), "eventid", eventID.String(), "abi", resp.Metadata) + p.logger.InfoMsg("Failed to parse abi", "address", address.String(), "eventid", eventID.String(), "abi", metadata) return nil, err } evAbi, ok = a.EventsByID[eventID] if !ok { - p.logger.InfoMsg("Event missing from ABI spec for contract", "address", address.String(), "eventid", eventID.String(), "abi", resp.Metadata) + p.logger.InfoMsg("Event missing from ABI spec for contract", "address", address.String(), "eventid", eventID.String(), "abi", metadata) return nil, fmt.Errorf("Event missing from ABI spec for contract") } p.abiSpec = abi.MergeSpec([]*abi.Spec{p.abiSpec, a}) } - return &evAbi, nil + return evAbi, nil } diff --git a/vent/service/block_consumer.go b/vent/service/block_consumer.go index b55653d47..96425b5b3 100644 --- a/vent/service/block_consumer.go +++ b/vent/service/block_consumer.go @@ -2,41 +2,42 @@ package service import ( "io" - "reflect" "github.com/hyperledger/burrow/event/query" - "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" + "github.com/hyperledger/burrow/vent/chain" "github.com/hyperledger/burrow/vent/sqlsol" "github.com/hyperledger/burrow/vent/types" "github.com/pkg/errors" ) -func NewBlockConsumer(projection *sqlsol.Projection, opt sqlsol.SpecOpt, getEventSpec EventSpecGetter, - eventCh chan<- types.EventData, doneCh chan struct{}, - logger *logging.Logger) func(blockExecution *exec.BlockExecution) error { +func NewBlockConsumer(chainID string, projection *sqlsol.Projection, opt sqlsol.SpecOpt, getEventSpec EventSpecGetter, + eventCh chan<- types.EventData, doneCh chan struct{}, logger *logging.Logger) func(block chain.Block) error { logger = logger.WithScope("makeBlockConsumer") - return func(blockExecution *exec.BlockExecution) error { + var blockHeight uint64 + + return func(block chain.Block) error { if finished(doneCh) { return io.EOF } // set new block number - fromBlock := blockExecution.Height + blockHeight = block.GetHeight() + txs := block.GetTxs() logger.TraceMsg("Block received", - "height", blockExecution.Height, - "num_txs", len(blockExecution.TxExecutions)) + "height", blockHeight, + "num_txs", len(txs)) // create a fresh new structure to store block data at this height - blockData := sqlsol.NewBlockData(fromBlock) + blockData := sqlsol.NewBlockData(blockHeight) if opt.Enabled(sqlsol.Block) { - blkRawData, err := buildBlkData(projection.Tables, blockExecution) + blkRawData, err := buildBlkData(projection.Tables, block) if err != nil { return errors.Wrapf(err, "Error building block raw data") } @@ -44,9 +45,9 @@ func NewBlockConsumer(projection *sqlsol.Projection, opt sqlsol.SpecOpt, getEven blockData.AddRow(tables.Block, blkRawData) } - // get transactions for a given block - for _, txe := range blockExecution.TxExecutions { - logger.TraceMsg("Getting transaction", "TxHash", txe.TxHash, "num_events", len(txe.Events)) + for _, txe := range txs { + events := txe.GetEvents() + logger.TraceMsg("Getting transaction", "TxHash", txe.GetHash(), "num_events", len(events)) if opt.Enabled(sqlsol.Tx) { txRawData, err := buildTxData(txe) @@ -59,33 +60,26 @@ func NewBlockConsumer(projection *sqlsol.Projection, opt sqlsol.SpecOpt, getEven // reverted transactions don't have to update event data tables // so check that condition to filter them - if txe.Exception == nil { - txOrigin := txe.Origin + if txe.GetException() == nil { + txOrigin := txe.GetOrigin() if txOrigin == nil { // This is an original transaction from the current chain so we build its origin from context - txOrigin = &exec.Origin{ - Time: blockExecution.GetHeader().GetTime(), - ChainID: blockExecution.GetHeader().GetChainID(), - Height: txe.GetHeight(), + txOrigin = &chain.Origin{ + ChainID: chainID, + Height: block.GetHeight(), Index: txe.GetIndex(), } } - // get events for a given transaction - for _, event := range txe.Events { - if event.Log == nil { - // Only EVM events are of interest - continue - } - + for _, event := range events { var tagged query.Tagged = event - eventID := event.Log.SolidityEventID() - eventSpec, eventSpecErr := getEventSpec(eventID, event.Log.Address) + eventID := exec.SolidityEventID(event.GetTopics()) + eventSpec, eventSpecErr := getEventSpec(eventID, event.GetAddress()) if eventSpecErr != nil { logger.InfoMsg("could not get ABI for solidity event", structure.ErrorKey, eventSpecErr, "event_id", eventID, - "address", event.Log.Address) + "address", event.GetAddress()) } else { // Since we have the event ABI we will allow matching on ABI fields tagged = query.TagsFor(event, query.TaggedPrefix("Event", eventSpec)) @@ -104,11 +98,10 @@ func NewBlockConsumer(projection *sqlsol.Projection, opt sqlsol.SpecOpt, getEven if eventSpecErr != nil { return errors.Wrapf(eventSpecErr, "could not get ABI for solidity event matching "+ "projection filter \"%s\" with id %v at address %v", - eventClass.Filter, eventID, event.Log.Address) + eventClass.Filter, eventID, event.GetAddress()) } - logger.InfoMsg("Matched event", "header", event.Header, - "filter", eventClass.Filter) + logger.InfoMsg("Matched event", "event_id", eventID, "filter", eventClass.Filter) // unpack, decode & build event data eventData, err := buildEventData(projection, eventClass, event, txOrigin, eventSpec, logger) @@ -126,24 +119,11 @@ func NewBlockConsumer(projection *sqlsol.Projection, opt sqlsol.SpecOpt, getEven // upsert rows in specific SQL event tables and update block number // store block data in SQL tables (if any) - if blockData.PendingRows(fromBlock) { - // gets block data to upsert - blk := blockData.Data - - for name, rows := range blk.Tables { - logger.InfoMsg("Upserting rows in SQL table", "height", fromBlock, "table", name, "action", "UPSERT", "rows", rows) - } - - eventCh <- blk + for name, rows := range blockData.Data.Tables { + logger.InfoMsg("Upserting rows in SQL table", "height", blockHeight, "table", name, "action", "UPSERT", "rows", rows) } + + eventCh <- blockData.Data return nil } } - -type eventSpecTagged struct { - Event abi.EventSpec -} - -func (e *eventSpecTagged) Get(key string) (value interface{}, ok bool) { - return query.GetReflect(reflect.ValueOf(e), key) -} diff --git a/vent/service/block_consumer_test.go b/vent/service/block_consumer_test.go index ecd546c1a..f98e75e5c 100644 --- a/vent/service/block_consumer_test.go +++ b/vent/service/block_consumer_test.go @@ -6,18 +6,23 @@ import ( "testing" "time" + "github.com/hyperledger/burrow/vent/chain/burrow" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/execution/solidity" "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/vent/chain" "github.com/hyperledger/burrow/vent/sqlsol" "github.com/hyperledger/burrow/vent/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - tmTypes "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) +const chainID = "TestChainID" + func TestBlockConsumer(t *testing.T) { doneCh := make(chan struct{}) eventCh := make(chan types.EventData, 100) @@ -46,7 +51,7 @@ func TestBlockConsumer(t *testing.T) { } direction := "frogs" copy(in.Direction, direction) - topics, data, err := abi.PackEvent(&manyTypesEventSpec, in) + topics, data, err := abi.PackEvent(manyTypesEventSpec, in) require.NoError(t, err) log := &exec.LogEvent{ Address: crypto.Address{}, @@ -78,7 +83,7 @@ func TestBlockConsumer(t *testing.T) { }, }) require.NoError(t, err) - blockConsumer := NewBlockConsumer(projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) + blockConsumer := NewBlockConsumer(chainID, projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) tables, err := consumeBlock(blockConsumer, eventCh, log) require.NoError(t, err) rows := tables[tableName] @@ -103,7 +108,7 @@ func TestBlockConsumer(t *testing.T) { }, }) require.NoError(t, err) - blockConsumer := NewBlockConsumer(projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) + blockConsumer := NewBlockConsumer(chainID, projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) _, err = consumeBlock(blockConsumer, eventCh, log) require.Error(t, err) require.Contains(t, err.Error(), "could not find ABI") @@ -126,9 +131,9 @@ func TestBlockConsumer(t *testing.T) { }, }) require.NoError(t, err) - blockConsumer := NewBlockConsumer(projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) - _, err = consumeBlock(blockConsumer, eventCh, log) - require.Equal(t, errTimeout, err) + blockConsumer := NewBlockConsumer(chainID, projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) + table, err := consumeBlock(blockConsumer, eventCh, log) + require.Len(t, table, 0, "should match no event") }) // This is possibly 'bad' behaviour - since you may be missing an ABI - but for now it is expected. On-chain ABIs @@ -150,16 +155,18 @@ func TestBlockConsumer(t *testing.T) { spec, err := abi.ReadSpec(solidity.Abi_EventEmitter) require.NoError(t, err) - blockConsumer := NewBlockConsumer(projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) - _, err = consumeBlock(blockConsumer, eventCh, log) + blockConsumer := NewBlockConsumer(chainID, projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) + table, err := consumeBlock(blockConsumer, eventCh, log) // Check matches require.NoError(t, err) - - // Now Remove the ABI - should timeout indicating we did not match the event, but it wasn't an error + require.Len(t, table, 1) + require.Len(t, table[tableName], 1) + // Now Remove the ABI - should not match the event delete(spec.EventsByID, manyTypesEventSpec.ID) - blockConsumer = NewBlockConsumer(projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) - _, err = consumeBlock(blockConsumer, eventCh, log) - require.Equal(t, errTimeout, err) + blockConsumer = NewBlockConsumer(chainID, projection, sqlsol.None, spec.GetEventAbi, eventCh, doneCh, logger) + table, err = consumeBlock(blockConsumer, eventCh, log) + require.NoError(t, err) + require.Len(t, table, 0, "should match no events") }) } @@ -167,11 +174,11 @@ const timeout = time.Second var errTimeout = fmt.Errorf("timed out after %s waiting for consumer to emit block event", timeout) -func consumeBlock(blockConsumer func(*exec.BlockExecution) error, eventCh <-chan types.EventData, +func consumeBlock(blockConsumer func(block chain.Block) error, eventCh <-chan types.EventData, logEvents ...*exec.LogEvent) (map[string]types.EventDataTable, error) { block := &exec.BlockExecution{ - Header: &tmTypes.Header{}, + Header: &tmproto.Header{}, } for _, logEvent := range logEvents { txe := &exec.TxExecution{ @@ -183,7 +190,7 @@ func consumeBlock(blockConsumer func(*exec.BlockExecution) error, eventCh <-chan } block.AppendTxs(txe) } - err := blockConsumer(block) + err := blockConsumer(burrow.NewBurrowBlock(block)) if err != nil { return nil, err } diff --git a/vent/service/consumer.go b/vent/service/consumer.go index 611ab6a1f..aba486553 100644 --- a/vent/service/consumer.go +++ b/vent/service/consumer.go @@ -7,43 +7,41 @@ import ( "sync" "time" - "github.com/hyperledger/burrow/rpc" - + "github.com/hyperledger/burrow/encoding" "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/logging/structure" + "github.com/hyperledger/burrow/rpc/lib/jsonrpc" "github.com/hyperledger/burrow/rpc/rpcevents" - "github.com/hyperledger/burrow/rpc/rpcquery" + "github.com/hyperledger/burrow/rpc/web3/ethclient" + "github.com/hyperledger/burrow/vent/chain" + "github.com/hyperledger/burrow/vent/chain/burrow" + "github.com/hyperledger/burrow/vent/chain/ethereum" "github.com/hyperledger/burrow/vent/config" "github.com/hyperledger/burrow/vent/sqldb" "github.com/hyperledger/burrow/vent/sqlsol" "github.com/hyperledger/burrow/vent/types" "github.com/pkg/errors" - "google.golang.org/grpc" "google.golang.org/grpc/connectivity" ) // Consumer contains basic configuration for consumer to run type Consumer struct { - Config *config.VentConfig - Logger *logging.Logger - DB *sqldb.SQLDB - GRPCConnection *grpc.ClientConn + Config *config.VentConfig + Logger *logging.Logger + DB *sqldb.SQLDB + Chain chain.Chain // external events channel used for when vent is leveraged as a library - EventsChannel chan types.EventData - Done chan struct{} - shutdownOnce sync.Once - Status -} - -// Status announcement -type Status struct { + EventsChannel chan types.EventData + Done chan struct{} + shutdownOnce sync.Once LastProcessedHeight uint64 - Burrow *rpc.ResultStatus } // NewConsumer constructs a new consumer configuration. // The event channel will be passed a collection of rows generated from all of the events in a single block // It will be closed by the consumer when it is finished func NewConsumer(cfg *config.VentConfig, log *logging.Logger, eventChannel chan types.EventData) *Consumer { + cfg.BlockConsumerConfig.Complete() return &Consumer{ Config: cfg, Logger: log, @@ -60,21 +58,14 @@ func (c *Consumer) Run(projection *sqlsol.Projection, stream bool) error { c.Logger.InfoMsg("Connecting to Burrow gRPC server") - c.GRPCConnection, err = grpc.Dial(c.Config.GRPCAddr, grpc.WithInsecure()) + c.Chain, err = c.connectToChain() if err != nil { - return errors.Wrapf(err, "Error connecting to Burrow gRPC server at %s", c.Config.GRPCAddr) + return errors.Wrapf(err, "Error connecting to Burrow gRPC server at %s", c.Config.ChainAddress) } - defer c.GRPCConnection.Close() + defer c.Chain.Close() defer close(c.EventsChannel) - // get the chain ID to compare with the one stored in the db - qCli := rpcquery.NewQueryClient(c.GRPCConnection) - c.Status.Burrow, err = qCli.Status(context.Background(), &rpcquery.StatusParam{}) - if err != nil { - return errors.Wrapf(err, "Error getting chain status") - } - - abiProvider, err := NewAbiProvider(c.Config.AbiFileOrDirs, rpcquery.NewQueryClient(c.GRPCConnection), c.Logger) + abiProvider, err := NewAbiProvider(c.Config.AbiFileOrDirs, c.Chain, c.Logger) if err != nil { return errors.Wrapf(err, "Error loading ABIs") } @@ -99,14 +90,14 @@ func (c *Consumer) Run(projection *sqlsol.Projection, stream bool) error { } defer c.DB.Close() - err = c.DB.Init(c.Burrow.ChainID, c.Burrow.BurrowVersion) + err = c.DB.Init(c.Chain.GetChainID(), c.Chain.GetVersion()) if err != nil { return fmt.Errorf("could not clean tables after ChainID change: %v", err) } c.Logger.InfoMsg("Synchronizing config and database projection structures") - err = c.DB.SynchronizeDB(c.Burrow.ChainID, projection.Tables) + err = c.DB.SynchronizeDB(c.Chain.GetChainID(), projection.Tables) if err != nil { return errors.Wrap(err, "Error trying to synchronize database") } @@ -124,17 +115,7 @@ func (c *Consumer) Run(projection *sqlsol.Projection, stream bool) error { c.Logger.InfoMsg("Getting last processed block number from SQL log table") - // NOTE [Silas]: I am preserving the comment below that dates from the early days of Vent. I have looked at the - // bosmarmot git history and I cannot see why the original author thought that it was the case that there was - // no way of knowing if the last block of events was committed since the block and its associated log is - // committed atomically in a transaction and this is a core part of he design of Vent - in order that it does not - // repeat - - // [ORIGINAL COMMENT] - // right now there is no way to know if the last block of events was completely read - // so we have to begin processing from the last block number stored in database - // and update event data if already present - fromBlock, err := c.DB.LastBlockHeight(c.Burrow.ChainID) + fromBlock, err := c.DB.LastBlockHeight(c.Chain.GetChainID()) if err != nil { errCh <- errors.Wrapf(err, "Error trying to get last processed block number") return @@ -147,8 +128,12 @@ func (c *Consumer) Run(projection *sqlsol.Projection, stream bool) error { startingBlock++ } + // Allows us skip historical/checkpointed state + if startingBlock < c.Config.MinimumHeight { + startingBlock = c.Config.MinimumHeight + } + // setup block range to get needed blocks server side - cli := rpcevents.NewExecutionEventsClient(c.GRPCConnection) var end *rpcevents.Bound if stream { end = rpcevents.StreamBound() @@ -160,19 +145,13 @@ func (c *Consumer) Run(projection *sqlsol.Projection, stream bool) error { BlockRange: rpcevents.NewBlockRange(rpcevents.AbsoluteBound(startingBlock), end), } - // gets blocks in given range based on last processed block taken from database - stream, err := cli.Stream(context.Background(), request) - if err != nil { - errCh <- errors.Wrapf(err, "Error connecting to block stream") - return - } - - // get blocks - c.Logger.TraceMsg("Waiting for blocks...") - err = rpcevents.ConsumeBlockExecutions(stream, - NewBlockConsumer(projection, c.Config.SpecOpt, abiProvider.GetEventAbi, eventCh, c.Done, c.Logger)) + // gets blocks in given range based on last processed block taken from database + consumer := NewBlockConsumer(c.Chain.GetChainID(), projection, c.Config.SpecOpt, abiProvider.GetEventAbi, + eventCh, c.Done, c.Logger) + + err = c.Chain.ConsumeBlocks(context.Background(), request.BlockRange, consumer) if err != nil { if err == io.EOF { @@ -192,7 +171,7 @@ func (c *Consumer) Run(projection *sqlsol.Projection, stream bool) error { select { // Process block events case blk := <-eventCh: - c.Status.LastProcessedHeight = blk.BlockHeight + c.LastProcessedHeight = blk.BlockHeight err := c.commitBlock(projection, blk) if err != nil { c.Logger.InfoMsg("error committing block", "err", err) @@ -219,7 +198,7 @@ func (c *Consumer) Run(projection *sqlsol.Projection, stream bool) error { func (c *Consumer) commitBlock(projection *sqlsol.Projection, blockEvents types.EventData) error { // upsert rows in specific SQL event tables and update block number - if err := c.DB.SetBlock(c.Burrow.ChainID, projection.Tables, blockEvents); err != nil { + if err := c.DB.SetBlock(c.Chain.GetChainID(), projection.Tables, blockEvents); err != nil { return fmt.Errorf("error upserting rows in database: %v", err) } @@ -247,11 +226,11 @@ func (c *Consumer) Health() error { } // check grpc connection status - if c.GRPCConnection == nil { + if c.Chain == nil { return errors.New("grpc disconnected") } - if grpcState := c.GRPCConnection.GetState(); grpcState != connectivity.Ready { + if grpcState := c.Chain.Connectivity(); grpcState != connectivity.Ready { return errors.New("grpc connection not ready") } @@ -263,48 +242,24 @@ func (c *Consumer) Shutdown() { c.shutdownOnce.Do(func() { c.Logger.InfoMsg("Shutting down vent consumer...") close(c.Done) - c.GRPCConnection.Close() + err := c.Chain.Close() + if err != nil { + c.Logger.InfoMsg("Could not close Chain connection", structure.ErrorKey, err) + } }) } -func (c *Consumer) updateStatus(qcli rpcquery.QueryClient) { - stat, err := qcli.Status(context.Background(), &rpcquery.StatusParam{}) - if err != nil { - c.Logger.InfoMsg("could not get blockchain status", "err", err) - return - } - c.Status.Burrow = stat -} - -func (c *Consumer) statusMessage() []interface{} { - var catchUpRatio float64 - if c.Burrow.SyncInfo.LatestBlockHeight > 0 { - catchUpRatio = float64(c.LastProcessedHeight) / float64(c.Burrow.SyncInfo.LatestBlockHeight) - } - return []interface{}{ - "msg", "status", - "last_processed_height", c.LastProcessedHeight, - "fraction_caught_up", catchUpRatio, - "burrow_latest_block_height", c.Burrow.SyncInfo.LatestBlockHeight, - "burrow_latest_block_duration", c.Burrow.SyncInfo.LatestBlockDuration, - "burrow_latest_block_hash", c.Burrow.SyncInfo.LatestBlockHash, - "burrow_latest_app_hash", c.Burrow.SyncInfo.LatestAppHash, - "burrow_latest_block_time", c.Burrow.SyncInfo.LatestBlockTime, - "burrow_latest_block_seen_time", c.Burrow.SyncInfo.LatestBlockSeenTime, - "burrow_node_info", c.Burrow.NodeInfo, - "burrow_catching_up", c.Burrow.CatchingUp, - } +func (c *Consumer) StatusMessage(ctx context.Context) []interface{} { + return c.Chain.StatusMessage(context.Background(), c.LastProcessedHeight) } func (c *Consumer) announceEvery(doneCh <-chan struct{}) { if c.Config.AnnounceEvery != 0 { - qcli := rpcquery.NewQueryClient(c.GRPCConnection) ticker := time.NewTicker(c.Config.AnnounceEvery) for { select { case <-ticker.C: - c.updateStatus(qcli) - c.Logger.InfoMsg("Announcement", c.statusMessage()...) + c.Logger.InfoMsg("Announcement", c.StatusMessage(context.Background())...) case <-doneCh: ticker.Stop() return @@ -321,3 +276,34 @@ func finished(doneCh chan struct{}) bool { return false } } + +func (c *Consumer) connectToChain() (chain.Chain, error) { + filter := &chain.Filter{ + Addresses: c.Config.WatchAddresses, + } + c.Logger.InfoMsg("Attempting to detect chain type", "chain_address", c.Config.ChainAddress) + burrowChain, burrowErr := dialBurrow(c.Config.ChainAddress, filter) + if burrowErr == nil { + return burrowChain, nil + } + ethChain, ethErr := dialEthereum(c.Config.ChainAddress, filter, &c.Config.BlockConsumerConfig, c.Logger) + if ethErr != nil { + return nil, fmt.Errorf("could not connect to either Burrow or Ethereum chain, "+ + "Burrow error: %v, Ethereum error: %v", burrowErr, ethErr) + } + return ethChain, nil +} + +func dialBurrow(chainAddress string, filter *chain.Filter) (*burrow.Chain, error) { + conn, err := encoding.GRPCDial(chainAddress) + if err != nil { + return nil, err + } + return burrow.New(conn, filter) +} + +func dialEthereum(chainAddress string, filter *chain.Filter, consumerConfig *chain.BlockConsumerConfig, + logger *logging.Logger) (*ethereum.Chain, error) { + client := ethclient.NewEthClient(jsonrpc.NewClient(chainAddress)) + return ethereum.New(client, filter, consumerConfig, logger) +} diff --git a/vent/service/consumer_ethereum_test.go b/vent/service/consumer_ethereum_test.go new file mode 100644 index 000000000..eb217ac73 --- /dev/null +++ b/vent/service/consumer_ethereum_test.go @@ -0,0 +1,20 @@ +// +build integration,ethereum + +package service_test + +import ( + "testing" + + "github.com/hyperledger/burrow/rpc/web3/ethclient" + "github.com/hyperledger/burrow/tests/web3/web3test" + "github.com/hyperledger/burrow/vent/test" + "github.com/stretchr/testify/require" +) + +func TestEthereumConsumer(t *testing.T) { + pk := web3test.GetPrivateKey(t) + tcli := ethclient.NewTransactClient(ethclient.NewEthClient(web3test.GetChainRPCClient())) + chainID, err := tcli.GetChainID() + require.NoError(t, err) + testConsumer(t, chainID, test.PostgresVentConfig(web3test.GetChainRemote()), tcli, pk.GetAddress()) +} diff --git a/vent/service/consumer_integration_test.go b/vent/service/consumer_integration_test.go index 80437cf01..9ff6d7292 100644 --- a/vent/service/consumer_integration_test.go +++ b/vent/service/consumer_integration_test.go @@ -7,11 +7,16 @@ import ( "math/rand" "path" "runtime" + "strconv" + "sync" "testing" "time" + "github.com/hyperledger/burrow/vent/chain/ethereum" + "github.com/hyperledger/burrow/crypto" - "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/logging/logconfig" "github.com/hyperledger/burrow/rpc/rpctransact" "github.com/hyperledger/burrow/vent/config" "github.com/hyperledger/burrow/vent/service" @@ -19,6 +24,7 @@ import ( "github.com/hyperledger/burrow/vent/sqlsol" "github.com/hyperledger/burrow/vent/test" "github.com/hyperledger/burrow/vent/types" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -30,10 +36,18 @@ const ( var tables = types.DefaultSQLTableNames -func testConsumer(t *testing.T, chainID string, cfg *config.VentConfig, tcli rpctransact.TransactClient, inputAddress crypto.Address) { +// Tweak logger for debug purposes here +var logger = logconfig.Sink().Terminal().FilterScope(ethereum.Scope).LoggingConfig().WithTrace().MustLogger() + +func testConsumer(t *testing.T, chainID string, cfg *config.VentConfig, tcli test.TransactClient, + inputAddress crypto.Address) { + create := test.CreateContract(t, tcli, inputAddress) - eventColumnName := "EventTest" + eventTestTableName := "EventTest" + require.True(t, create.Receipt.CreatesContract) + cfg.WatchAddresses = []crypto.Address{create.Receipt.ContractAddress} + // TODO: strengthen this test to count events in and out t.Run("view mode", func(t *testing.T) { // create test db db, closeDB := test.NewTestDB(t, cfg) @@ -60,9 +74,9 @@ func testConsumer(t *testing.T, chainID string, cfg *config.VentConfig, tcli rpc // Run the consumer runConsumer(t, cfg) - // test data stored in database for two different block ids - ensureEvents(t, db, chainID, eventColumnName, txeA.Height, 1) - eventData := ensureEvents(t, db, chainID, eventColumnName, txeB.Height, 1) + // test data stored in database for two different block heights + ensureEvents(t, db, chainID, eventTestTableName, txeA.Height, 1) + eventData := ensureEvents(t, db, chainID, eventTestTableName, txeB.Height, 1) // block & tx raw data also persisted if cfg.SpecOpt&sqlsol.Block > 0 { @@ -90,7 +104,44 @@ func testConsumer(t *testing.T, chainID string, cfg *config.VentConfig, tcli rpc description := "Description of TestEvent5" txeC := test.CallAddEvents(t, tcli, inputAddress, create.Receipt.ContractAddress, name, description) runConsumer(t, cfg) - ensureEvents(t, db, chainID, eventColumnName, txeC.Height, 2) + ensureEvents(t, db, chainID, eventTestTableName, txeC.Height, 2) + }) + + t.Run("continuity", func(t *testing.T) { + batches := 20 + batchSize := 5 + totalTx := batches * batchSize + db, closeDB := test.NewTestDB(t, cfg) + defer closeDB() + resolveSpec(cfg, testLogSpec) + + receipts := make(chan *exec.TxExecution, totalTx) + wg := new(sync.WaitGroup) + wg.Add(totalTx) + + for i := 0; i < batches; i++ { + for j := 0; j < batchSize; j++ { + name := fmt.Sprintf("Continuity_%d_%d", i, j) + go func() { + receipts <- test.CallAddEvent(t, tcli, inputAddress, create.Receipt.ContractAddress, name, "Blah") + wg.Done() + }() + } + } + + wg.Wait() + close(receipts) + runConsumer(t, cfg) + + txeByHeight := make(map[uint64][]*exec.TxExecution) + for txe := range receipts { + txeByHeight[txe.Height] = append(txeByHeight[txe.Height], txe) + } + + for height, txes := range txeByHeight { + ensureEvents(t, db, chainID, eventTestTableName, height, uint64(len(txes))) + } + }) } @@ -126,22 +177,39 @@ func testDeleteEvent(t *testing.T, chainID string, cfg *config.VentConfig, tcli // delete not allowed on log mode } -func ensureEvents(t *testing.T, db *sqldb.SQLDB, chainID, column string, height, numEvents uint64) types.EventData { +func ensureEvents(t *testing.T, db *sqldb.SQLDB, chainID, table string, height, numEvents uint64) types.EventData { eventData, err := db.GetBlock(chainID, height) require.NoError(t, err) require.Equal(t, height, eventData.BlockHeight) require.Equal(t, 3, len(eventData.Tables)) // Check the number of rows - tblData := eventData.Tables[column] - require.Equal(t, numEvents, uint64(len(tblData))) + tblData := eventData.Tables[table] + if !assert.Equal(t, numEvents, uint64(len(tblData))) { + t.Fatal(logconfig.JSONString(tblData)) + } if numEvents > 0 && len(tblData) > 0 { // Expect data in the EventTest table require.Equal(t, "LogEvent", tblData[0].RowData["_eventtype"].(string)) require.Equal(t, "UpdateTestEvents", tblData[0].RowData["_eventname"].(string)) - for i := 0; i < len(tblData); i++ { - require.Equal(t, fmt.Sprintf("%d", i), tblData[i].RowData["_eventindex"].(string)) + lastTxIndex := "" + var eventIndex uint64 + for _, datum := range tblData { + txIndex := datum.RowData["_txindex"].(string) + if lastTxIndex != txIndex { + eventIndex = 0 + lastTxIndex = txIndex + } + + good := rowEqual(t, datum.RowData, "_height", height) && + rowEqual(t, datum.RowData, "_eventindex", eventIndex) + if !good { + t.Fatal(logconfig.JSONString(tblData)) + } + + assert.Equal(t, fmt.Sprintf("%d", height), datum.RowData["_height"]) + eventIndex++ } } else if numEvents > 0 && len(tblData) == 0 { require.Failf(t, "no events found", "expected %d", numEvents) @@ -150,6 +218,10 @@ func ensureEvents(t *testing.T, db *sqldb.SQLDB, chainID, column string, height, return eventData } +func rowEqual(t *testing.T, row map[string]interface{}, key string, expectedIndex uint64) bool { + return assert.Equal(t, strconv.FormatUint(expectedIndex, 10), row[key].(string)) +} + func testResume(t *testing.T, cfg *config.VentConfig) { _, closeDB := test.NewTestDB(t, cfg) defer closeDB() @@ -159,16 +231,11 @@ func testResume(t *testing.T, cfg *config.VentConfig) { // Add some pseudo-random timings rnd := rand.New(rand.NewSource(4634653)) time.Sleep(time.Second) - var expectedHeight uint64 for i := 0; i < numRestarts; i++ { // wait up to a second time.Sleep(time.Millisecond * time.Duration(rnd.Int63n(1000))) for ed := range runConsumer(t, cfg) { - t.Logf("expecting block: %d, got block: %d", expectedHeight, ed.BlockHeight) - if expectedHeight > ed.BlockHeight { - require.Fail(t, "should get monotonic sequential sequence") - } - expectedHeight = ed.BlockHeight + t.Logf("testResume, got block: %d", ed.BlockHeight) } } } @@ -211,7 +278,7 @@ func resolveSpec(cfg *config.VentConfig, specFile string) { // Run consumer to listen to events func runConsumer(t *testing.T, cfg *config.VentConfig) chan types.EventData { ch := make(chan types.EventData, 100) - consumer := service.NewConsumer(cfg, logging.NewNoopLogger(), ch) + consumer := service.NewConsumer(cfg, logger, ch) projection, err := sqlsol.SpecLoader(cfg.SpecFileOrDirs, cfg.SpecOpt) require.NoError(t, err) diff --git a/vent/service/consumer_postgres_test.go b/vent/service/consumer_postgres_test.go index 6d7a3870f..8bba31513 100644 --- a/vent/service/consumer_postgres_test.go +++ b/vent/service/consumer_postgres_test.go @@ -1,10 +1,9 @@ -// +build integration +// +build integration,!ethereum package service_test import ( "encoding/json" - "strconv" "testing" "time" @@ -26,7 +25,7 @@ func TestPostgresConsumer(t *testing.T) { defer shutdown() inputAddress := privateAccounts[0].GetAddress() grpcAddress := kern.GRPCListenAddress().String() - tcli := test.NewTransactClient(t, grpcAddress) + tcli := test.NewBurrowTransactClient(t, grpcAddress) t.Parallel() time.Sleep(2 * time.Second) @@ -49,7 +48,7 @@ func TestPostgresConsumer(t *testing.T) { }) t.Run("PostgresTriggers", func(t *testing.T) { - tCli := test.NewTransactClient(t, kern.GRPCListenAddress().String()) + tCli := test.NewBurrowTransactClient(t, kern.GRPCListenAddress().String()) create := test.CreateContract(t, tCli, inputAddress) // generate events @@ -78,10 +77,10 @@ func TestPostgresConsumer(t *testing.T) { require.NoError(t, err) type payload struct { - Height string `json:"_height"` + Height uint64 `json:"_height"` } - var height uint64 + heightCh := make(chan uint64) notifications := make(map[string]string) go func() { for n := range listener.Notify { @@ -92,11 +91,9 @@ func TestPostgresConsumer(t *testing.T) { if err != nil { panic(err) } - if pl.Height != "" { - height, err = strconv.ParseUint(pl.Height, 10, 64) - if err != nil { - panic(err) - } + if pl.Height >= txe.Height { + heightCh <- pl.Height + return } } } @@ -105,12 +102,18 @@ func TestPostgresConsumer(t *testing.T) { runConsumer(t, cfg) // Give events a chance - time.Sleep(time.Second) - // Assert we get expected returns - t.Logf("latest height: %d, txe height: %d", height, txe.Height) - assert.True(t, height >= txe.Height) - assert.Equal(t, `{"_action" : "INSERT", "testdescription" : "\\x5472696767657220697421000000000000000000000000000000000000000000", "testname" : "TestTriggerEvent"}`, notifications["meta"]) - assert.Equal(t, `{"_action" : "INSERT", "testdescription" : "\\x5472696767657220697421000000000000000000000000000000000000000000", "testkey" : "\\x544553545f4556454e5453000000000000000000000000000000000000000000", "testname" : "TestTriggerEvent"}`, + const timeout = 3 * time.Second + select { + case <-time.After(timeout): + t.Fatalf("timed out after %v waiting for notification", timeout) + case height := <-heightCh: + // Assert we get expected returns + t.Logf("latest height: %d, txe height: %d", height, txe.Height) + assert.True(t, height >= txe.Height) + } + assert.Equal(t, `{"_action" : "INSERT", "testdescription" : "5472696767657220697421000000000000000000000000000000000000000000", "testname" : "TestTriggerEvent"}`, + notifications["meta"]) + assert.Equal(t, `{"_action" : "INSERT", "testdescription" : "5472696767657220697421000000000000000000000000000000000000000000", "testkey" : "\\x544553545f4556454e5453000000000000000000000000000000000000000000", "testname" : "TestTriggerEvent"}`, notifications["keyed_meta"]) }) }) diff --git a/vent/service/consumer_sqlite_test.go b/vent/service/consumer_sqlite_test.go index 67553f35d..de6c0d2b6 100644 --- a/vent/service/consumer_sqlite_test.go +++ b/vent/service/consumer_sqlite_test.go @@ -1,4 +1,4 @@ -// +build integration sqlite +// +build integration,sqlite package service_test @@ -18,7 +18,7 @@ func TestSqliteConsumer(t *testing.T) { defer shutdown() inputAddress := privateAccounts[0].GetAddress() grpcAddress := kern.GRPCListenAddress().String() - tcli := test.NewTransactClient(t, grpcAddress) + tcli := test.NewBurrowTransactClient(t, grpcAddress) t.Parallel() time.Sleep(2 * time.Second) diff --git a/vent/service/decoder.go b/vent/service/decoder.go index 91ad9d83a..24b1b4be4 100644 --- a/vent/service/decoder.go +++ b/vent/service/decoder.go @@ -7,29 +7,30 @@ import ( "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/execution/exec" + "github.com/hyperledger/burrow/vent/chain" "github.com/hyperledger/burrow/vent/types" "github.com/pkg/errors" ) // decodeEvent unpacks & decodes event data -func decodeEvent(eventHeader *exec.Header, log *exec.LogEvent, txOrigin *exec.Origin, evAbi *abi.EventSpec) (map[string]interface{}, error) { +func decodeEvent(log chain.Event, txOrigin *chain.Origin, evAbi *abi.EventSpec) (map[string]interface{}, error) { // to prepare decoded data and map to event item name data := make(map[string]interface{}) // decode header to get context data for each event data[types.EventNameLabel] = evAbi.Name data[types.ChainIDLabel] = txOrigin.ChainID - data[types.BlockHeightLabel] = strconv.FormatUint(txOrigin.GetHeight(), 10) - data[types.TxIndexLabel] = strconv.FormatUint(txOrigin.GetIndex(), 10) - data[types.EventIndexLabel] = strconv.FormatUint(eventHeader.GetIndex(), 10) - data[types.EventTypeLabel] = eventHeader.GetEventType().String() - data[types.TxTxHashLabel] = eventHeader.TxHash.String() + data[types.BlockHeightLabel] = strconv.FormatUint(txOrigin.Height, 10) + data[types.TxIndexLabel] = strconv.FormatUint(txOrigin.Index, 10) + data[types.EventIndexLabel] = strconv.FormatUint(log.GetIndex(), 10) + data[types.EventTypeLabel] = exec.TypeLog.String() + data[types.TxTxHashLabel] = log.GetTransactionHash().String() // build expected interface type array to get log event values unpackedData := abi.GetPackingTypes(evAbi.Inputs) // unpack event data (topics & data part) - if err := abi.UnpackEvent(evAbi, log.Topics, log.Data, unpackedData...); err != nil { + if err := abi.UnpackEvent(evAbi, log.GetTopics(), log.GetData(), unpackedData...); err != nil { return nil, errors.Wrap(err, "Could not unpack event data") } diff --git a/vent/service/rowbuilder.go b/vent/service/rowbuilder.go index 5e946beba..03e89b861 100644 --- a/vent/service/rowbuilder.go +++ b/vent/service/rowbuilder.go @@ -2,32 +2,28 @@ package service import ( "bytes" - "encoding/json" "fmt" "strings" "unicode/utf8" "github.com/hyperledger/burrow/execution/evm/abi" - "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/logging" + "github.com/hyperledger/burrow/vent/chain" "github.com/hyperledger/burrow/vent/sqlsol" "github.com/hyperledger/burrow/vent/types" "github.com/pkg/errors" + "github.com/tmthrgd/go-hex" ) // buildEventData builds event data from transactions -func buildEventData(projection *sqlsol.Projection, eventClass *types.EventClass, event *exec.Event, - txOrigin *exec.Origin, evAbi *abi.EventSpec, logger *logging.Logger) (types.EventDataRow, error) { +func buildEventData(projection *sqlsol.Projection, eventClass *types.EventClass, event chain.Event, + txOrigin *chain.Origin, evAbi *abi.EventSpec, logger *logging.Logger) (types.EventDataRow, error) { // a fresh new row to store column/value data row := make(map[string]interface{}) - // get header & log data for the given event - eventHeader := event.GetHeader() - eventLog := event.GetLog() - // decode event data using the provided abi specification - decodedData, err := decodeEvent(eventHeader, eventLog, txOrigin, evAbi) + decodedData, err := decodeEvent(event, txOrigin, evAbi) if err != nil { return types.EventDataRow{}, errors.Wrapf(err, "Error decoding event (filter: %s)", eventClass.Filter) } @@ -50,11 +46,12 @@ func buildEventData(projection *sqlsol.Projection, eventClass *types.EventClass, } column, err := projection.GetColumn(eventClass.TableName, fieldMapping.ColumnName) if err == nil { - if fieldMapping.BytesToString { - if bs, ok := value.(*[]byte); ok { + if bs, ok := value.(*[]byte); ok { + if fieldMapping.BytesToString { str := sanitiseBytesForString(*bs, logger) - row[column.Name] = interface{}(str) - continue + value = interface{}(str) + } else if fieldMapping.BytesToHex { + value = hex.EncodeUpperToString(*bs) } } row[column.Name] = value @@ -66,74 +63,29 @@ func buildEventData(projection *sqlsol.Projection, eventClass *types.EventClass, return types.EventDataRow{Action: rowAction, RowData: row, EventClass: eventClass}, nil } -// buildBlkData builds block data from block stream -func buildBlkData(tbls types.EventTables, block *exec.BlockExecution) (types.EventDataRow, error) { - // a fresh new row to store column/value data - row := make(map[string]interface{}) - +func buildBlkData(tbls types.EventTables, block chain.Block) (types.EventDataRow, error) { // block raw data if _, ok := tbls[tables.Block]; ok { - blockHeader, err := json.Marshal(block.Header) + row, err := block.GetMetadata(columns) if err != nil { - return types.EventDataRow{}, fmt.Errorf("could not marshal BlockHeader in block %v", block) + return types.EventDataRow{}, err } - - row[columns.Height] = fmt.Sprintf("%v", block.Height) - row[columns.BlockHeader] = string(blockHeader) - } else { - return types.EventDataRow{}, fmt.Errorf("table: %s not found in table structure %v", tables.Block, tbls) + return types.EventDataRow{Action: types.ActionUpsert, RowData: row}, nil } + return types.EventDataRow{}, fmt.Errorf("table: %s not found in table structure %v", tables.Block, tbls) - return types.EventDataRow{Action: types.ActionUpsert, RowData: row}, nil } // buildTxData builds transaction data from tx stream -func buildTxData(txe *exec.TxExecution) (types.EventDataRow, error) { - // transaction raw data - envelope, err := json.Marshal(txe.Envelope) - if err != nil { - return types.EventDataRow{}, fmt.Errorf("couldn't marshal envelope in tx %v: %v", txe, err) - } - - events, err := json.Marshal(txe.Events) - if err != nil { - return types.EventDataRow{}, fmt.Errorf("couldn't marshal events in tx %v: %v", txe, err) - } - - result, err := json.Marshal(txe.Result) - if err != nil { - return types.EventDataRow{}, fmt.Errorf("couldn't marshal result in tx %v: %v", txe, err) - } - - receipt, err := json.Marshal(txe.Receipt) - if err != nil { - return types.EventDataRow{}, fmt.Errorf("couldn't marshal receipt in tx %v: %v", txe, err) - } - - exception, err := json.Marshal(txe.Exception) - if err != nil { - return types.EventDataRow{}, fmt.Errorf("couldn't marshal exception in tx %v: %v", txe, err) - } - - origin, err := json.Marshal(txe.Origin) +func buildTxData(txe chain.Transaction) (types.EventDataRow, error) { + row, err := txe.GetMetadata(columns) if err != nil { - return types.EventDataRow{}, fmt.Errorf("couldn't marshal origin in tx %v: %v", txe, err) + return types.EventDataRow{}, fmt.Errorf("could not get transaction metadata: %w", err) } return types.EventDataRow{ - Action: types.ActionUpsert, - RowData: map[string]interface{}{ - columns.Height: txe.Height, - columns.TxHash: txe.TxHash.String(), - columns.TxIndex: txe.Index, - columns.TxType: txe.TxType.String(), - columns.Envelope: string(envelope), - columns.Events: string(events), - columns.Result: string(result), - columns.Receipt: string(receipt), - columns.Origin: string(origin), - columns.Exception: string(exception), - }, + Action: types.ActionUpsert, + RowData: row, }, nil } diff --git a/vent/service/server.go b/vent/service/server.go index 2bc41bc45..0ba0153c2 100644 --- a/vent/service/server.go +++ b/vent/service/server.go @@ -2,6 +2,7 @@ package service import ( "context" + "encoding/json" "net/http" "github.com/hyperledger/burrow/logging" @@ -38,10 +39,10 @@ func (s *Server) Run() { s.Log.InfoMsg("Starting HTTP Server") // start http server - httpServer := &http.Server{Addr: s.Config.HTTPAddr, Handler: s} + httpServer := &http.Server{Addr: s.Config.HTTPListenAddress, Handler: s} go func() { - s.Log.InfoMsg("HTTP Server listening", "address", s.Config.HTTPAddr) + s.Log.InfoMsg("HTTP Server listening", "address", s.Config.HTTPListenAddress) httpServer.ListenAndServe() }() @@ -70,6 +71,11 @@ func healthHandler(consumer *Consumer) func(resp http.ResponseWriter, req *http. resp.WriteHeader(http.StatusServiceUnavailable) } else { resp.WriteHeader(http.StatusOK) + bs, err := json.Marshal(consumer.StatusMessage(req.Context())) + if err == nil { + resp.Header().Set("Content-Type", "application/json") + resp.Write(bs) + } } } } diff --git a/vent/service/server_test.go b/vent/service/server_test.go index e50df96e4..27d00b2d9 100644 --- a/vent/service/server_test.go +++ b/vent/service/server_test.go @@ -38,7 +38,7 @@ func TestServer(t *testing.T) { cfg.SpecFileOrDirs = []string{os.Getenv("GOPATH") + "/src/github.com/hyperledger/burrow/vent/test/sqlsol_view.json"} cfg.AbiFileOrDirs = []string{os.Getenv("GOPATH") + "/src/github.com/hyperledger/burrow/vent/test/EventsTest.abi"} - cfg.GRPCAddr = kern.GRPCListenAddress().String() + cfg.ChainAddress = kern.GRPCListenAddress().String() log := logging.NewNoopLogger() consumer := service.NewConsumer(cfg, log, make(chan types.EventData)) diff --git a/vent/sqldb/adapters/postgres_adapter.go b/vent/sqldb/adapters/postgres_adapter.go index 7599f958e..d97e8d269 100644 --- a/vent/sqldb/adapters/postgres_adapter.go +++ b/vent/sqldb/adapters/postgres_adapter.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/lib/pq" + "github.com/pkg/errors" "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/vent/types" @@ -265,22 +266,24 @@ func (pa *PostgresAdapter) ErrorEquals(err error, sqlErrorType types.SQLErrorTyp } func errorEquals(err error, sqlErrorType types.SQLErrorType) bool { - if err, ok := err.(*pq.Error); ok { + pqErr := new(pq.Error) + + if errors.As(err, &pqErr) { switch sqlErrorType { case types.SQLErrorTypeGeneric: return true case types.SQLErrorTypeDuplicatedColumn: - return err.Code == "42701" + return pqErr.Code == "42701" case types.SQLErrorTypeDuplicatedTable: - return err.Code == "42P07" + return pqErr.Code == "42P07" case types.SQLErrorTypeDuplicatedSchema: - return err.Code == "42P06" + return pqErr.Code == "42P06" case types.SQLErrorTypeUndefinedTable: - return err.Code == "42P01" + return pqErr.Code == "42P01" case types.SQLErrorTypeUndefinedColumn: - return err.Code == "42703" + return pqErr.Code == "42703" case types.SQLErrorTypeInvalidType: - return err.Code == "42704" + return pqErr.Code == "42704" } } diff --git a/vent/sqldb/adapters/sqlite_adapter.go b/vent/sqldb/adapters/sqlite_adapter.go index 5a56137d4..449af08fb 100644 --- a/vent/sqldb/adapters/sqlite_adapter.go +++ b/vent/sqldb/adapters/sqlite_adapter.go @@ -11,6 +11,7 @@ import ( "github.com/hyperledger/burrow/vent/types" "github.com/jmoiron/sqlx" sqlite3 "github.com/mattn/go-sqlite3" + "github.com/pkg/errors" ) var sqliteDataTypes = map[types.SQLColumnType]string{ @@ -225,20 +226,21 @@ func (sla *SQLiteAdapter) InsertLogQuery() string { // ErrorEquals verify if an error is of a given SQL type func (sla *SQLiteAdapter) ErrorEquals(err error, sqlErrorType types.SQLErrorType) bool { - if err, ok := err.(sqlite3.Error); ok { + slErr := new(sqlite3.Error) + if errors.As(err, slErr) { errDescription := err.Error() switch sqlErrorType { case types.SQLErrorTypeGeneric: return true case types.SQLErrorTypeDuplicatedColumn: - return err.Code == 1 && strings.Contains(errDescription, "duplicate column") + return slErr.Code == 1 && strings.Contains(errDescription, "duplicate column") case types.SQLErrorTypeDuplicatedTable: - return err.Code == 1 && strings.Contains(errDescription, "table") && strings.Contains(errDescription, "already exists") + return slErr.Code == 1 && strings.Contains(errDescription, "table") && strings.Contains(errDescription, "already exists") case types.SQLErrorTypeUndefinedTable: - return err.Code == 1 && strings.Contains(errDescription, "no such table") + return slErr.Code == 1 && strings.Contains(errDescription, "no such table") case types.SQLErrorTypeUndefinedColumn: - return err.Code == 1 && strings.Contains(errDescription, "table") && strings.Contains(errDescription, "has no column named") + return slErr.Code == 1 && strings.Contains(errDescription, "table") && strings.Contains(errDescription, "has no column named") case types.SQLErrorTypeInvalidType: // NOT SUPPORTED return false diff --git a/vent/sqldb/sqldb.go b/vent/sqldb/sqldb.go index 063fba6ad..287bd32de 100644 --- a/vent/sqldb/sqldb.go +++ b/vent/sqldb/sqldb.go @@ -353,7 +353,9 @@ loop: // Perform row action db.Log.InfoMsg("msg", "action", row.Action, "query", sqlQuery, "value", queryVal.Values) - if _, err = tx.Exec(sqlQuery, queryVal.Pointers...); err != nil { + _, err = tx.Exec(sqlQuery, queryVal.Pointers...) + if err != nil { + err = fmt.Errorf("could not execute query '%s': %w", sqlQuery, err) db.Log.InfoMsg(fmt.Sprintf("error performing %s on row", row.Action), "err", err, "value", queryVal.Values) break loop // exits from all loops -> continue in close log stmt } diff --git a/vent/sqldb/sqldb_integration_test.go b/vent/sqldb/sqldb_integration_test.go index 11bf5fa8c..1b8441cff 100644 --- a/vent/sqldb/sqldb_integration_test.go +++ b/vent/sqldb/sqldb_integration_test.go @@ -108,20 +108,20 @@ func testSetBlock(t *testing.T, cfg *config.VentConfig) { require.NoError(t, err) // new - str, dat := getBlock() - err = db.SetBlock(test.ChainID, str, dat) + eventTables, eventData := getBlock() + err = db.SetBlock(test.ChainID, eventTables, eventData) require.NoError(t, err) // read _, err = db.LastBlockHeight(test.ChainID) require.NoError(t, err) - _, err = db.GetBlock(test.ChainID, dat.BlockHeight) + _, err = db.GetBlock(test.ChainID, eventData.BlockHeight) require.NoError(t, err) // alter - str, dat = getAlterBlock() - err = db.SetBlock(test.ChainID, str, dat) + eventTables, eventData = getAlterBlock() + err = db.SetBlock(test.ChainID, eventTables, eventData) require.NoError(t, err) //restore diff --git a/vent/sqldb/sqldb_postgres_test.go b/vent/sqldb/sqldb_postgres_test.go index 9e99ff2d9..d454ea668 100644 --- a/vent/sqldb/sqldb_postgres_test.go +++ b/vent/sqldb/sqldb_postgres_test.go @@ -47,6 +47,7 @@ func TestPostgresBlockNotification(t *testing.T) { channelName := "height_notification" pad := db.DBAdapter.(*adapters.PostgresAdapter) + // Run twice to show idempotency for i := 0; i < 2; i++ { query := pad.CreateNotifyFunctionQuery(functionName, channelName, columns.Height) _, err := db.DB.Exec(query) @@ -100,5 +101,11 @@ func TestPostgresBlockNotification(t *testing.T) { _, err = db.GetBlock(test.ChainID, dat.BlockHeight) require.NoError(t, err) - require.NoError(t, <-errCh) + const timeout = 2 * time.Second + select { + case <-time.After(timeout): + t.Fatalf("timed out waiting for notification after %s", timeout) + case err = <-errCh: + require.NoError(t, err) + } } diff --git a/vent/sqldb/sqldb_sqlite_test.go b/vent/sqldb/sqldb_sqlite_test.go index 2ea180970..a1dd43789 100644 --- a/vent/sqldb/sqldb_sqlite_test.go +++ b/vent/sqldb/sqldb_sqlite_test.go @@ -1,4 +1,4 @@ -// +build integration sqlite +// +build integration,sqlite package sqldb_test diff --git a/vent/sqldb/system_tables.go b/vent/sqldb/system_tables.go index 69786185f..c930bcd52 100644 --- a/vent/sqldb/system_tables.go +++ b/vent/sqldb/system_tables.go @@ -65,7 +65,6 @@ func (db *SQLDB) systemTablesDefinition() types.EventTables { Type: types.SQLColumnTypeText, }, }, - NotifyChannels: map[string][]string{types.BlockHeightLabel: {columns.Height}}, }, tables.Dictionary: { Name: tables.Dictionary, @@ -117,6 +116,7 @@ func (db *SQLDB) systemTablesDefinition() types.EventTables { Length: digits(maxUint64), }, }, + NotifyChannels: map[string][]string{types.BlockHeightLabel: {columns.Height}}, }, } } diff --git a/vent/sqlsol/block_data.go b/vent/sqlsol/block_data.go index d9273b3ba..9cdb9d4a2 100644 --- a/vent/sqlsol/block_data.go +++ b/vent/sqlsol/block_data.go @@ -38,13 +38,3 @@ func (b *BlockData) GetRows(tableName string) (types.EventDataTable, error) { } return nil, fmt.Errorf("GetRows: tableName does not exists as a table in data structure: %s ", tableName) } - -// PendingRows returns true if the given block has at least one pending row to upsert -func (b *BlockData) PendingRows(height uint64) bool { - hasRows := false - // TODO: understand why the guard on height is needed - what does it prevent? - if b.Data.BlockHeight == height && len(b.Data.Tables) > 0 { - hasRows = true - } - return hasRows -} diff --git a/vent/sqlsol/block_data_test.go b/vent/sqlsol/block_data_test.go index fe00959b5..84b7f2856 100644 --- a/vent/sqlsol/block_data_test.go +++ b/vent/sqlsol/block_data_test.go @@ -32,38 +32,3 @@ func TestGetBlockData(t *testing.T) { require.EqualValues(t, 2, blk.BlockHeight) }) } - -func TestPendingRows(t *testing.T) { - t.Run("successfully returns true if a given block has pending rows to upsert", func(t *testing.T) { - values := make(map[string]interface{}) - values["c1"] = "v1" - values["c2"] = "v2" - - blockData := sqlsol.NewBlockData(99) - blockData.AddRow("TEST_TABLE", types.EventDataRow{Action: types.ActionUpsert, RowData: values}) - - hasRows := blockData.PendingRows(99) - - require.Equal(t, true, hasRows) - }) - - t.Run("successfully returns false if a given block does not have pending rows to upsert", func(t *testing.T) { - values := make(map[string]interface{}) - values["c1"] = "v1" - values["c2"] = "v2" - - blockData := sqlsol.NewBlockData(99) - blockData.AddRow("TEST_TABLE", types.EventDataRow{Action: types.ActionUpsert, RowData: values}) - - hasRows := blockData.PendingRows(88) - - require.Equal(t, false, hasRows) - }) - - t.Run("successfully returns false if a given block does not exists", func(t *testing.T) { - blockData := sqlsol.NewBlockData(0) - hasRows := blockData.PendingRows(999) - - require.Equal(t, false, hasRows) - }) -} diff --git a/vent/sqlsol/projection.go b/vent/sqlsol/projection.go index 807eaf0d3..c0d7411c6 100644 --- a/vent/sqlsol/projection.go +++ b/vent/sqlsol/projection.go @@ -120,7 +120,13 @@ func NewProjection(spec types.ProjectionSpec) (*Projection, error) { i := 0 for _, mapping := range eventClass.FieldMappings { - sqlType, sqlTypeLength, err := getSQLType(mapping.Type, mapping.BytesToString) + var bytesMapping BytesMapping + if mapping.BytesToHex { + bytesMapping = BytesToHex + } else if mapping.BytesToString { + bytesMapping = BytesToString + } + sqlType, sqlTypeLength, err := getSQLType(mapping.Type, bytesMapping) if err != nil { return nil, err } @@ -220,9 +226,17 @@ func readFile(file string) ([]byte, error) { return byteValue, nil } +type BytesMapping int + +const ( + BytesToBytes = iota + BytesToString + BytesToHex +) + // getSQLType maps event input types with corresponding SQL column types // takes into account related solidity types info and element indexed or hashed -func getSQLType(evmSignature string, bytesToString bool) (types.SQLColumnType, int, error) { +func getSQLType(evmSignature string, bytesMapping BytesMapping) (types.SQLColumnType, int, error) { evmSignature = strings.ToLower(evmSignature) re := regexp.MustCompile("[0-9]+") typeSize, _ := strconv.Atoi(re.FindString(evmSignature)) @@ -237,43 +251,47 @@ func getSQLType(evmSignature string, bytesToString bool) (types.SQLColumnType, i // solidity bytes => sql bytes // bytesToString == true means there is a string in there so => sql varchar case strings.HasPrefix(evmSignature, types.EventFieldTypeBytes): - if bytesToString { - return types.SQLColumnTypeVarchar, 40, nil - } else { + switch bytesMapping { + case BytesToString: + return types.SQLColumnTypeVarchar, 32, nil + case BytesToHex: + return types.SQLColumnTypeVarchar, 64, nil + default: return types.SQLColumnTypeByteA, 0, nil } // solidity string => sql text case evmSignature == types.EventFieldTypeString: return types.SQLColumnTypeText, 0, nil - // solidity int or int256 => sql bigint - // solidity int <= 32 => sql int - // solidity int > 32 => sql numeric + case strings.HasPrefix(evmSignature, types.EventFieldTypeInt): - if typeSize == 0 || typeSize == 256 { - return types.SQLColumnTypeBigInt, 0, nil - } - if typeSize <= 32 { - return types.SQLColumnTypeInt, 0, nil - } else { - return types.SQLColumnTypeNumeric, 0, nil - } - // solidity uint or uint256 => sql bigint - // solidity uint <= 16 => sql int - // solidity uint > 16 => sql numeric + return evmIntegerSizeToSqlType(typeSize, true), 0, nil + case strings.HasPrefix(evmSignature, types.EventFieldTypeUInt): - if typeSize == 0 || typeSize == 256 { - return types.SQLColumnTypeBigInt, 0, nil - } - if typeSize <= 16 { - return types.SQLColumnTypeInt, 0, nil - } else { - return types.SQLColumnTypeNumeric, 0, nil - } + return evmIntegerSizeToSqlType(typeSize, false), 0, nil default: return -1, 0, fmt.Errorf("do not know how to map evmSignature: %s ", evmSignature) } } +func evmIntegerSizeToSqlType(size int, signed bool) types.SQLColumnType { + // Unsized ints default to 256-bit + if size == 0 { + return types.SQLColumnTypeNumeric + } + // since SQL integers are signed we need an extra bit headroom so high-order bit of a uint isn't interpreted as + // the sign bit + if !signed { + size++ + } + switch { + case size <= 32: + return types.SQLColumnTypeInt + case size <= 64: + return types.SQLColumnTypeBigInt + } + return types.SQLColumnTypeNumeric +} + // getGlobalColumns returns global columns for event table structures, // these columns will be part of every SQL event table to relate data with source events func getGlobalFieldMappings() []*types.EventFieldMapping { diff --git a/vent/sqlsol/projection_test.go b/vent/sqlsol/projection_test.go index ed9e7a439..21e4d8c39 100644 --- a/vent/sqlsol/projection_test.go +++ b/vent/sqlsol/projection_test.go @@ -83,13 +83,13 @@ func TestGetColumn(t *testing.T) { column, err := projection.GetColumn("TEST_TABLE", "Block") require.NoError(t, err) require.Equal(t, "Block", column.Name) - require.Equal(t, types.SQLColumnTypeBigInt, column.Type) + require.Equal(t, types.SQLColumnTypeNumeric, column.Type) require.Equal(t, false, column.Primary) column, err = projection.GetColumn("TEST_TABLE", "Instance") require.NoError(t, err) require.Equal(t, "Instance", column.Name) - require.Equal(t, types.SQLColumnTypeBigInt, column.Type) + require.Equal(t, types.SQLColumnTypeNumeric, column.Type) require.Equal(t, false, column.Primary) }) diff --git a/vent/sqlsol/spec_loader_test.go b/vent/sqlsol/spec_loader_test.go index 77d0367ed..b7dfedd80 100644 --- a/vent/sqlsol/spec_loader_test.go +++ b/vent/sqlsol/spec_loader_test.go @@ -2,6 +2,7 @@ package sqlsol_test import ( "os" + "path" "testing" "github.com/hyperledger/burrow/vent/sqlsol" @@ -12,7 +13,9 @@ import ( var tables = types.DefaultSQLTableNames func TestSpecLoader(t *testing.T) { - specFile := []string{os.Getenv("GOPATH") + "/src/github.com/hyperledger/burrow/vent/test/sqlsol_view.json"} + dir, err := os.Getwd() + require.NoError(t, err) + specFile := []string{path.Join(dir, "../test/sqlsol_view.json")} t.Run("successfully add block and transaction tables to event structures", func(t *testing.T) { projection, err := sqlsol.SpecLoader(specFile, sqlsol.BlockTx) require.NoError(t, err) diff --git a/vent/test/EventsTest.sol.go b/vent/test/EventsTest.sol.go index 37b406173..7edfd2b52 100644 --- a/vent/test/EventsTest.sol.go +++ b/vent/test/EventsTest.sol.go @@ -2,6 +2,6 @@ package test import hex "github.com/tmthrgd/go-hex" -var Bytecode_EventsTest = hex.MustDecodeString("608060405234801561001057600080fd5b50610d60806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806306661abd146100675780632cda56b01461008557806388255199146100fe578063c1de9c6d146101f0578063d4a0c25314610269578063dc667a6214610337575b600080fd5b61006f610405565b6040518082815260200191505060405180910390f35b6100fc6004803603602081101561009b57600080fd5b81019080803590602001906401000000008111156100b857600080fd5b8201836020820111156100ca57600080fd5b803590602001918460018302840111640100000000831117156100ec57600080fd5b909192939192939050505061040e565b005b6101756004803603602081101561011457600080fd5b810190808035906020019064010000000081111561013157600080fd5b82018360208201111561014357600080fd5b8035906020019184600183028401116401000000008311171561016557600080fd5b9091929391929390505050610612565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b557808201518184015260208101905061019a565b50505050905090810190601f1680156101e25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102676004803603602081101561020657600080fd5b810190808035906020019064010000000081111561022357600080fd5b82018360208201111561023557600080fd5b8035906020019184600183028401116401000000008311171561025757600080fd5b90919293919293905050506106df565b005b6103356004803603604081101561027f57600080fd5b810190808035906020019064010000000081111561029c57600080fd5b8201836020820111156102ae57600080fd5b803590602001918460018302840111640100000000831117156102d057600080fd5b9091929391929390803590602001906401000000008111156102f157600080fd5b82018360208201111561030357600080fd5b8035906020019184600183028401116401000000008311171561032557600080fd5b909192939192939050505061083d565b005b6104036004803603604081101561034d57600080fd5b810190808035906020019064010000000081111561036a57600080fd5b82018360208201111561037c57600080fd5b8035906020019184600183028401116401000000008311171561039e57600080fd5b9091929391929390803590602001906401000000008111156103bf57600080fd5b8201836020820111156103d157600080fd5b803590602001918460018302840111640100000000831117156103f357600080fd5b9091929391929390505050610aaa565b005b60008054905090565b600060018383604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff161561060d576000808154809291906001900391905055506001838360405180838380828437808301925050509250505090815260200160405180910390206000808201600061049a9190610c3e565b6001820160006104aa9190610c3e565b6002820160006101000a81549060ff021916905550507f544553545f4556454e545300000000000000000000000000000000000000000061052e84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a37f544553545f4556454e54530000000000000000000000000000000000000000006105d484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a35b505050565b60606001838360405180838380828437808301925050509250505090815260200160405180910390206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106d25780601f106106a7576101008083540402835291602001916106d2565b820191906000526020600020905b8154815290600101906020018083116106b557829003601f168201915b5050505050905092915050565b600060018383604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff1615610838576000808154809291906001900391905055506001838360405180838380828437808301925050509250505090815260200160405180910390206000808201600061076b9190610c3e565b60018201600061077b9190610c3e565b6002820160006101000a81549060ff021916905550507f544553545f4556454e54530000000000000000000000000000000000000000006107ff84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a35b505050565b600060018585604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff166108905760008081548092919060010191905055505b84848260000191906108a3929190610c86565b5082828260010191906108b7929190610c86565b5060018160020160006101000a81548160ff02191690831515021790555061092283838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e545300000000000000000000000000000000000000000061099087878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a4610a0983838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e5453000000000000000000000000000000000000000000610a7787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a45050505050565b600060018585604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff16610afd5760008081548092919060010191905055505b8484826000019190610b10929190610c86565b508282826001019190610b24929190610c86565b5060018160020160006101000a81548160ff021916908315150217905550610b8f83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e5453000000000000000000000000000000000000000000610bfd87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a45050505050565b600060208201519050919050565b50805460018160011615610100020316600290046000825580601f10610c645750610c83565b601f016020900490600052602060002090810190610c829190610d06565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610cc757803560ff1916838001178555610cf5565b82800160010185558215610cf5579182015b82811115610cf4578235825591602001919060010190610cd9565b5b509050610d029190610d06565b5090565b610d2891905b80821115610d24576000816000905550600101610d0c565b5090565b9056fea265627a7a72305820429a1b2031fb00f9be80be95e568f9aabac617b6b634c5d23aa72693e9ec1cbb64736f6c634300050a0032") -var DeployedBytecode_EventsTest = hex.MustDecodeString("608060405234801561001057600080fd5b50600436106100625760003560e01c806306661abd146100675780632cda56b01461008557806388255199146100fe578063c1de9c6d146101f0578063d4a0c25314610269578063dc667a6214610337575b600080fd5b61006f610405565b6040518082815260200191505060405180910390f35b6100fc6004803603602081101561009b57600080fd5b81019080803590602001906401000000008111156100b857600080fd5b8201836020820111156100ca57600080fd5b803590602001918460018302840111640100000000831117156100ec57600080fd5b909192939192939050505061040e565b005b6101756004803603602081101561011457600080fd5b810190808035906020019064010000000081111561013157600080fd5b82018360208201111561014357600080fd5b8035906020019184600183028401116401000000008311171561016557600080fd5b9091929391929390505050610612565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b557808201518184015260208101905061019a565b50505050905090810190601f1680156101e25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102676004803603602081101561020657600080fd5b810190808035906020019064010000000081111561022357600080fd5b82018360208201111561023557600080fd5b8035906020019184600183028401116401000000008311171561025757600080fd5b90919293919293905050506106df565b005b6103356004803603604081101561027f57600080fd5b810190808035906020019064010000000081111561029c57600080fd5b8201836020820111156102ae57600080fd5b803590602001918460018302840111640100000000831117156102d057600080fd5b9091929391929390803590602001906401000000008111156102f157600080fd5b82018360208201111561030357600080fd5b8035906020019184600183028401116401000000008311171561032557600080fd5b909192939192939050505061083d565b005b6104036004803603604081101561034d57600080fd5b810190808035906020019064010000000081111561036a57600080fd5b82018360208201111561037c57600080fd5b8035906020019184600183028401116401000000008311171561039e57600080fd5b9091929391929390803590602001906401000000008111156103bf57600080fd5b8201836020820111156103d157600080fd5b803590602001918460018302840111640100000000831117156103f357600080fd5b9091929391929390505050610aaa565b005b60008054905090565b600060018383604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff161561060d576000808154809291906001900391905055506001838360405180838380828437808301925050509250505090815260200160405180910390206000808201600061049a9190610c3e565b6001820160006104aa9190610c3e565b6002820160006101000a81549060ff021916905550507f544553545f4556454e545300000000000000000000000000000000000000000061052e84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a37f544553545f4556454e54530000000000000000000000000000000000000000006105d484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a35b505050565b60606001838360405180838380828437808301925050509250505090815260200160405180910390206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106d25780601f106106a7576101008083540402835291602001916106d2565b820191906000526020600020905b8154815290600101906020018083116106b557829003601f168201915b5050505050905092915050565b600060018383604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff1615610838576000808154809291906001900391905055506001838360405180838380828437808301925050509250505090815260200160405180910390206000808201600061076b9190610c3e565b60018201600061077b9190610c3e565b6002820160006101000a81549060ff021916905550507f544553545f4556454e54530000000000000000000000000000000000000000006107ff84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a35b505050565b600060018585604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff166108905760008081548092919060010191905055505b84848260000191906108a3929190610c86565b5082828260010191906108b7929190610c86565b5060018160020160006101000a81548160ff02191690831515021790555061092283838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e545300000000000000000000000000000000000000000061099087878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a4610a0983838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e5453000000000000000000000000000000000000000000610a7787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a45050505050565b600060018585604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff16610afd5760008081548092919060010191905055505b8484826000019190610b10929190610c86565b508282826001019190610b24929190610c86565b5060018160020160006101000a81548160ff021916908315150217905550610b8f83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e5453000000000000000000000000000000000000000000610bfd87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a45050505050565b600060208201519050919050565b50805460018160011615610100020316600290046000825580601f10610c645750610c83565b601f016020900490600052602060002090810190610c829190610d06565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610cc757803560ff1916838001178555610cf5565b82800160010185558215610cf5579182015b82811115610cf4578235825591602001919060010190610cd9565b5b509050610d029190610d06565b5090565b610d2891905b80821115610d24576000816000905550600101610d0c565b5090565b9056fea265627a7a72305820429a1b2031fb00f9be80be95e568f9aabac617b6b634c5d23aa72693e9ec1cbb64736f6c634300050a0032") -var Abi_EventsTest = []byte(`[{"constant":true,"inputs":[],"name":"count","outputs":[{"name":"size","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"}],"name":"removeThings","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_name","type":"string"}],"name":"description","outputs":[{"name":"_description","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"}],"name":"removeThing","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_description","type":"string"}],"name":"addThings","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_description","type":"string"}],"name":"addThing","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"name","type":"bytes32"},{"indexed":true,"name":"key","type":"bytes32"},{"indexed":true,"name":"description","type":"bytes32"}],"name":"UpdateTestEvents","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"name","type":"bytes32"},{"indexed":true,"name":"key","type":"bytes32"},{"indexed":false,"name":"__DELETE__","type":"int256"}],"name":"DeleteTestEvents","type":"event"}]`) +var Bytecode_EventsTest = hex.MustDecodeString("608060405234801561001057600080fd5b50610d60806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806306661abd146100675780632cda56b01461008557806388255199146100fe578063c1de9c6d146101f0578063d4a0c25314610269578063dc667a6214610337575b600080fd5b61006f610405565b6040518082815260200191505060405180910390f35b6100fc6004803603602081101561009b57600080fd5b81019080803590602001906401000000008111156100b857600080fd5b8201836020820111156100ca57600080fd5b803590602001918460018302840111640100000000831117156100ec57600080fd5b909192939192939050505061040e565b005b6101756004803603602081101561011457600080fd5b810190808035906020019064010000000081111561013157600080fd5b82018360208201111561014357600080fd5b8035906020019184600183028401116401000000008311171561016557600080fd5b9091929391929390505050610612565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b557808201518184015260208101905061019a565b50505050905090810190601f1680156101e25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102676004803603602081101561020657600080fd5b810190808035906020019064010000000081111561022357600080fd5b82018360208201111561023557600080fd5b8035906020019184600183028401116401000000008311171561025757600080fd5b90919293919293905050506106df565b005b6103356004803603604081101561027f57600080fd5b810190808035906020019064010000000081111561029c57600080fd5b8201836020820111156102ae57600080fd5b803590602001918460018302840111640100000000831117156102d057600080fd5b9091929391929390803590602001906401000000008111156102f157600080fd5b82018360208201111561030357600080fd5b8035906020019184600183028401116401000000008311171561032557600080fd5b909192939192939050505061083d565b005b6104036004803603604081101561034d57600080fd5b810190808035906020019064010000000081111561036a57600080fd5b82018360208201111561037c57600080fd5b8035906020019184600183028401116401000000008311171561039e57600080fd5b9091929391929390803590602001906401000000008111156103bf57600080fd5b8201836020820111156103d157600080fd5b803590602001918460018302840111640100000000831117156103f357600080fd5b9091929391929390505050610aaa565b005b60008054905090565b600060018383604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff161561060d576000808154809291906001900391905055506001838360405180838380828437808301925050509250505090815260200160405180910390206000808201600061049a9190610c3e565b6001820160006104aa9190610c3e565b6002820160006101000a81549060ff021916905550507f544553545f4556454e545300000000000000000000000000000000000000000061052e84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a37f544553545f4556454e54530000000000000000000000000000000000000000006105d484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a35b505050565b60606001838360405180838380828437808301925050509250505090815260200160405180910390206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106d25780601f106106a7576101008083540402835291602001916106d2565b820191906000526020600020905b8154815290600101906020018083116106b557829003601f168201915b5050505050905092915050565b600060018383604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff1615610838576000808154809291906001900391905055506001838360405180838380828437808301925050509250505090815260200160405180910390206000808201600061076b9190610c3e565b60018201600061077b9190610c3e565b6002820160006101000a81549060ff021916905550507f544553545f4556454e54530000000000000000000000000000000000000000006107ff84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a35b505050565b600060018585604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff166108905760008081548092919060010191905055505b84848260000191906108a3929190610c86565b5082828260010191906108b7929190610c86565b5060018160020160006101000a81548160ff02191690831515021790555061092283838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e545300000000000000000000000000000000000000000061099087878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a4610a0983838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e5453000000000000000000000000000000000000000000610a7787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a45050505050565b600060018585604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff16610afd5760008081548092919060010191905055505b8484826000019190610b10929190610c86565b508282826001019190610b24929190610c86565b5060018160020160006101000a81548160ff021916908315150217905550610b8f83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e5453000000000000000000000000000000000000000000610bfd87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a45050505050565b600060208201519050919050565b50805460018160011615610100020316600290046000825580601f10610c645750610c83565b601f016020900490600052602060002090810190610c829190610d06565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610cc757803560ff1916838001178555610cf5565b82800160010185558215610cf5579182015b82811115610cf4578235825591602001919060010190610cd9565b5b509050610d029190610d06565b5090565b610d2891905b80821115610d24576000816000905550600101610d0c565b5090565b9056fea265627a7a7231582037a3c7c8ba676a276ddc3da8ddd95f44bd6f991d5f52bb69c956d60c2eafffeb64736f6c634300050f0032") +var DeployedBytecode_EventsTest = hex.MustDecodeString("608060405234801561001057600080fd5b50600436106100625760003560e01c806306661abd146100675780632cda56b01461008557806388255199146100fe578063c1de9c6d146101f0578063d4a0c25314610269578063dc667a6214610337575b600080fd5b61006f610405565b6040518082815260200191505060405180910390f35b6100fc6004803603602081101561009b57600080fd5b81019080803590602001906401000000008111156100b857600080fd5b8201836020820111156100ca57600080fd5b803590602001918460018302840111640100000000831117156100ec57600080fd5b909192939192939050505061040e565b005b6101756004803603602081101561011457600080fd5b810190808035906020019064010000000081111561013157600080fd5b82018360208201111561014357600080fd5b8035906020019184600183028401116401000000008311171561016557600080fd5b9091929391929390505050610612565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b557808201518184015260208101905061019a565b50505050905090810190601f1680156101e25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102676004803603602081101561020657600080fd5b810190808035906020019064010000000081111561022357600080fd5b82018360208201111561023557600080fd5b8035906020019184600183028401116401000000008311171561025757600080fd5b90919293919293905050506106df565b005b6103356004803603604081101561027f57600080fd5b810190808035906020019064010000000081111561029c57600080fd5b8201836020820111156102ae57600080fd5b803590602001918460018302840111640100000000831117156102d057600080fd5b9091929391929390803590602001906401000000008111156102f157600080fd5b82018360208201111561030357600080fd5b8035906020019184600183028401116401000000008311171561032557600080fd5b909192939192939050505061083d565b005b6104036004803603604081101561034d57600080fd5b810190808035906020019064010000000081111561036a57600080fd5b82018360208201111561037c57600080fd5b8035906020019184600183028401116401000000008311171561039e57600080fd5b9091929391929390803590602001906401000000008111156103bf57600080fd5b8201836020820111156103d157600080fd5b803590602001918460018302840111640100000000831117156103f357600080fd5b9091929391929390505050610aaa565b005b60008054905090565b600060018383604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff161561060d576000808154809291906001900391905055506001838360405180838380828437808301925050509250505090815260200160405180910390206000808201600061049a9190610c3e565b6001820160006104aa9190610c3e565b6002820160006101000a81549060ff021916905550507f544553545f4556454e545300000000000000000000000000000000000000000061052e84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a37f544553545f4556454e54530000000000000000000000000000000000000000006105d484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a35b505050565b60606001838360405180838380828437808301925050509250505090815260200160405180910390206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106d25780601f106106a7576101008083540402835291602001916106d2565b820191906000526020600020905b8154815290600101906020018083116106b557829003601f168201915b5050505050905092915050565b600060018383604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff1615610838576000808154809291906001900391905055506001838360405180838380828437808301925050509250505090815260200160405180910390206000808201600061076b9190610c3e565b60018201600061077b9190610c3e565b6002820160006101000a81549060ff021916905550507f544553545f4556454e54530000000000000000000000000000000000000000006107ff84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7fb64cbe0d18263bbda93ed76420a5e44f12291ff1187828c94336f06dcb61017860006040518082815260200191505060405180910390a35b505050565b600060018585604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff166108905760008081548092919060010191905055505b84848260000191906108a3929190610c86565b5082828260010191906108b7929190610c86565b5060018160020160006101000a81548160ff02191690831515021790555061092283838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e545300000000000000000000000000000000000000000061099087878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a4610a0983838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e5453000000000000000000000000000000000000000000610a7787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a45050505050565b600060018585604051808383808284378083019250505092505050908152602001604051809103902090508060020160009054906101000a900460ff16610afd5760008081548092919060010191905055505b8484826000019190610b10929190610c86565b508282826001019190610b24929190610c86565b5060018160020160006101000a81548160ff021916908315150217905550610b8f83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f544553545f4556454e5453000000000000000000000000000000000000000000610bfd87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c30565b7f6f50070fb9de82a81ea57052fbdf4459d17a1a9d68083b6f326b47bf17441e2960405160405180910390a45050505050565b600060208201519050919050565b50805460018160011615610100020316600290046000825580601f10610c645750610c83565b601f016020900490600052602060002090810190610c829190610d06565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610cc757803560ff1916838001178555610cf5565b82800160010185558215610cf5579182015b82811115610cf4578235825591602001919060010190610cd9565b5b509050610d029190610d06565b5090565b610d2891905b80821115610d24576000816000905550600101610d0c565b5090565b9056fea265627a7a7231582037a3c7c8ba676a276ddc3da8ddd95f44bd6f991d5f52bb69c956d60c2eafffeb64736f6c634300050f0032") +var Abi_EventsTest = []byte(`[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":false,"internalType":"int256","name":"__DELETE__","type":"int256"}],"name":"DeleteTestEvents","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"description","type":"bytes32"}],"name":"UpdateTestEvents","type":"event"},{"constant":false,"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_description","type":"string"}],"name":"addThing","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_description","type":"string"}],"name":"addThings","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"count","outputs":[{"internalType":"int256","name":"size","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"description","outputs":[{"internalType":"string","name":"_description","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"removeThing","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"removeThings","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]`) diff --git a/vent/test/db.go b/vent/test/db.go index 20dc7a195..bb0d105f2 100644 --- a/vent/test/db.go +++ b/vent/test/db.go @@ -78,16 +78,16 @@ func SqliteVentConfig(grpcAddress string) *config.VentConfig { cfg.DBURL = file.Name() cfg.DBAdapter = types.SQLiteDB - cfg.GRPCAddr = grpcAddress + cfg.ChainAddress = grpcAddress return cfg } -func PostgresVentConfig(grpcAddress string) *config.VentConfig { +func PostgresVentConfig(chainAddress string) *config.VentConfig { cfg := config.DefaultVentConfig() - cfg.DBSchema = fmt.Sprintf("test_%s", randString(10)) + cfg.DBSchema = fmt.Sprintf("test_%d_%s", time.Now().Unix(), randString(10)) cfg.DBAdapter = types.PostgresDB cfg.DBURL = config.DefaultPostgresDBURL - cfg.GRPCAddr = grpcAddress + cfg.ChainAddress = chainAddress cfg.AnnounceEvery = time.Millisecond * 100 return cfg } diff --git a/vent/test/eth/.eslintrc.js b/vent/test/eth/.eslintrc.js new file mode 100644 index 000000000..d1d499b0f --- /dev/null +++ b/vent/test/eth/.eslintrc.js @@ -0,0 +1,19 @@ +module.exports = { + env: { + browser: true, + commonjs: true, + es2021: true, + mocha: true, + 'truffle/globals': true, + }, + plugins: ['prettier', 'truffle'], + extends: [ + 'airbnb-base', + ], + parserOptions: { + ecmaVersion: 12, + }, + rules: { + 'no-unused-vars': 'warn', + }, +}; diff --git a/vent/test/eth/contracts/EventEmitter.sol b/vent/test/eth/contracts/EventEmitter.sol new file mode 100644 index 000000000..f187a4f4b --- /dev/null +++ b/vent/test/eth/contracts/EventEmitter.sol @@ -0,0 +1,28 @@ +pragma solidity ^0.5; + +contract EventEmitter { + // indexed puts it in topic + event ManyTypes( + bytes32 indexed direction, + bool trueism, + string german , + int64 indexed newDepth, + int bignum, + string indexed hash); + + event ManyTypes2( + bytes32 indexed direction, + bool trueism, + string german , + int128 indexed newDepth, + int8 bignum, + string indexed hash); + + function emitOne() public { + emit ManyTypes("Downsie!", true, "Donaudampfschifffahrtselektrizitätenhauptbetriebswerkbauunterbeamtengesellschaft", 102, 42, "hash"); + } + + function emitTwo() public { + emit ManyTypes2("Downsie!", true, "Donaudampfschifffahrtselektrizitätenhauptbetriebswerkbauunterbeamtengesellschaft", 102, 42, "hash"); + } +} diff --git a/vent/test/eth/contracts/Migrations.sol b/vent/test/eth/contracts/Migrations.sol new file mode 100644 index 000000000..9aac9750f --- /dev/null +++ b/vent/test/eth/contracts/Migrations.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.4.22 <0.9.0; + +contract Migrations { + address public owner = msg.sender; + uint public last_completed_migration; + + modifier restricted() { + require( + msg.sender == owner, + "This function is restricted to the contract's owner" + ); + _; + } + + function setCompleted(uint completed) public restricted { + last_completed_migration = completed; + } +} diff --git a/vent/test/eth/migrations/1614708961_deploy_event_emitter.js b/vent/test/eth/migrations/1614708961_deploy_event_emitter.js new file mode 100644 index 000000000..c3706dffb --- /dev/null +++ b/vent/test/eth/migrations/1614708961_deploy_event_emitter.js @@ -0,0 +1,5 @@ +const EventEmitter = artifacts.require('EventEmitter'); + +module.exports = function (deployer) { + deployer.deploy(EventEmitter); +}; diff --git a/vent/test/eth/migrations/1_initial_migration.js b/vent/test/eth/migrations/1_initial_migration.js new file mode 100644 index 000000000..5ec88e464 --- /dev/null +++ b/vent/test/eth/migrations/1_initial_migration.js @@ -0,0 +1,5 @@ +const Migrations = artifacts.require('Migrations'); + +module.exports = function (deployer) { + deployer.deploy(Migrations); +}; diff --git a/vent/test/eth/package.json b/vent/test/eth/package.json new file mode 100644 index 000000000..5295931a2 --- /dev/null +++ b/vent/test/eth/package.json @@ -0,0 +1,21 @@ +{ + "name": "eth", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "scripts": { + "ganache": "ganache-cli --account=\"0xcfad15e9e8f24b5b5608cac150293fe971d23cd9168206b231c859b7974d4295,0xad78ebc5ac6200000\"" + }, + "devDependencies": { + "@types/mocha": "^8.2.1", + "eslint": "^7.21.0", + "eslint-config-airbnb-base": "^14.2.1", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-truffle": "^0.3.1", + "ganache-cli": "^6.12.2", + "ganache": "^6.4.4", + "prettier": "^2.2.1", + "truffle": "^5.2.2" + } +} diff --git a/vent/test/eth/test/.gitkeep b/vent/test/eth/test/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vent/test/eth/test/event-emitter.js b/vent/test/eth/test/event-emitter.js new file mode 100644 index 000000000..0dc7efc8d --- /dev/null +++ b/vent/test/eth/test/event-emitter.js @@ -0,0 +1,11 @@ +const EventEmitter = artifacts.require('EventEmitter'); + +contract('EventEmitter', (accounts) => { + it('emits events', async () => { + const eventEmitter = await EventEmitter.deployed(); + const { + logs: [{ args }], + } = await eventEmitter.emitTwo(); + assert.equal(args[2], 'Donaudampfschifffahrtselektrizitätenhauptbetriebswerkbauunterbeamtengesellschaft'); + }); +}); diff --git a/vent/test/eth/truffle-config.js b/vent/test/eth/truffle-config.js new file mode 100644 index 000000000..a70737728 --- /dev/null +++ b/vent/test/eth/truffle-config.js @@ -0,0 +1,106 @@ +/** + * Use this file to configure your truffle project. It's seeded with some + * common settings for different networks and features like migrations, + * compilation and testing. Uncomment the ones you need or modify + * them to suit your project as necessary. + * + * More information about configuration can be found at: + * + * trufflesuite.com/docs/advanced/configuration + * + * To deploy via Infura you'll need a wallet provider (like @truffle/hdwallet-provider) + * to sign your transactions before they're sent to a remote public node. Infura accounts + * are available for free at: infura.io/register. + * + * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate + * public/private key pairs. If you're publishing your code to GitHub make sure you load this + * phrase from a file you've .gitignored so it doesn't accidentally become public. + * + */ + +// const HDWalletProvider = require('@truffle/hdwallet-provider'); +// const infuraKey = "fj4jll3k....."; +// +// const fs = require('fs'); +// const mnemonic = fs.readFileSync(".secret").toString().trim(); + +module.exports = { + /** + * Networks define how you connect to your ethereum client and let you set the + * defaults web3 uses to send transactions. If you don't specify one truffle + * will spin up a development blockchain for you on port 9545 when you + * run `develop` or `test`. You can ask a truffle command to use a specific + * network from the command line, e.g + * + * $ truffle test --network + */ + + networks: { + // Useful for testing. The `development` name is special - truffle uses it by default + // if it's defined here and no other network is specified at the command line. + // You should run a client (like ganache-cli, geth or parity) in a separate terminal + // tab if you use this network and you must also set the `host`, `port` and `network_id` + // options below to some value. + // + // development: { + // host: "127.0.0.1", // Localhost (default: none) + // port: 8545, // Standard Ethereum port (default: none) + // network_id: "*", // Any network (default: none) + // }, + // Another network with more advanced options... + // advanced: { + // port: 8777, // Custom port + // network_id: 1342, // Custom network + // gas: 8500000, // Gas sent with each transaction (default: ~6700000) + // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) + // from:
, // Account to send txs from (default: accounts[0]) + // websocket: true // Enable EventEmitter interface for web3 (default: false) + // }, + // Useful for deploying to a public network. + // NB: It's important to wrap the provider as a function. + // ropsten: { + // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`), + // network_id: 3, // Ropsten's id + // gas: 5500000, // Ropsten has a lower block limit than mainnet + // confirmations: 2, // # of confs to wait between deployments. (default: 0) + // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) + // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) + // }, + // Useful for private networks + // private: { + // provider: () => new HDWalletProvider(mnemonic, `https://network.io`), + // network_id: 2111, // This network is yours, in the cloud. + // production: true // Treats this network as if it was a public net. (default: false) + // } + }, + + // Set default mocha options here, use special reporters etc. + mocha: { + // timeout: 100000 + }, + + // Configure your compilers + compilers: { + solc: { + // version: "0.5.1", // Fetch exact version from solc-bin (default: truffle's version) + // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) + // settings: { // See the solidity docs for advice about optimization and evmVersion + // optimizer: { + // enabled: false, + // runs: 200 + // }, + // evmVersion: "byzantium" + // } + } + }, + + // Truffle DB is currently disabled by default; to enable it, change enabled: false to enabled: true + // + // Note: if you migrated your contracts prior to enabling this field in your Truffle project and want + // those previously migrated contracts available in the .db directory, you will need to run the following: + // $ truffle migrate --reset --compile-all + + db: { + enabled: false + } +}; diff --git a/vent/test/eth/yarn.lock b/vent/test/eth/yarn.lock new file mode 100644 index 000000000..ae4fc6a8b --- /dev/null +++ b/vent/test/eth/yarn.lock @@ -0,0 +1,9836 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@apollo/client@^3.1.5": + version "3.3.11" + resolved "https://registry.npmjs.org/@apollo/client/-/client-3.3.11.tgz#125051405e83dc899d471d43b79fd6045d92a802" + integrity sha512-54+D5FB6RJlQ+g37f432gaexnyvDsG5X6L9VO5kqN54HJlbF8hCf/8CXtAQEHCWodAwZhy6kOLp2RM96829q3A== + dependencies: + "@graphql-typed-document-node/core" "^3.0.0" + "@types/zen-observable" "^0.8.0" + "@wry/context" "^0.5.2" + "@wry/equality" "^0.3.0" + fast-json-stable-stringify "^2.0.0" + graphql-tag "^2.12.0" + hoist-non-react-statics "^3.3.2" + optimism "^0.14.0" + prop-types "^15.7.2" + symbol-observable "^2.0.0" + ts-invariant "^0.6.0" + tslib "^1.10.0" + zen-observable "^0.8.14" + +"@apollo/protobufjs@^1.0.3": + version "1.0.5" + resolved "https://registry.npmjs.org/@apollo/protobufjs/-/protobufjs-1.0.5.tgz#a78b726147efc0795e74c8cb8a11aafc6e02f773" + integrity sha512-ZtyaBH1icCgqwIGb3zrtopV2D5Q8yxibkJzlaViM08eOhTQc7rACdYu0pfORFfhllvdMZ3aq69vifYHszY4gNA== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.0" + "@types/node" "^10.1.0" + long "^4.0.0" + +"@apollographql/apollo-tools@^0.4.3": + version "0.4.9" + resolved "https://registry.npmjs.org/@apollographql/apollo-tools/-/apollo-tools-0.4.9.tgz#6abeef4c4586aec8208f71254b329e48ab50c07e" + integrity sha512-M50pk8oo3CGTu4waGOklIX3YtTZoPfWG9K/G9WB8NpyQGA1OwYTiBFv94XqUtKElTDoFwoMXpMQd3Wy5dINvxA== + dependencies: + apollo-env "^0.6.6" + +"@apollographql/graphql-playground-html@1.6.27": + version "1.6.27" + resolved "https://registry.npmjs.org/@apollographql/graphql-playground-html/-/graphql-playground-html-1.6.27.tgz#bc9ab60e9445aa2a8813b4e94f152fa72b756335" + integrity sha512-tea2LweZvn6y6xFV11K0KC8ETjmm52mQrW+ezgB2O/aTQf8JGyFmMcRPFgUaQZeHbWdm8iisDC6EjOKsXu0nfw== + dependencies: + xss "^1.0.8" + +"@apollographql/graphql-upload-8-fork@^8.1.3": + version "8.1.3" + resolved "https://registry.npmjs.org/@apollographql/graphql-upload-8-fork/-/graphql-upload-8-fork-8.1.3.tgz#a0d4e0d5cec8e126d78bd915c264d6b90f5784bc" + integrity sha512-ssOPUT7euLqDXcdVv3Qs4LoL4BPtfermW1IOouaqEmj36TpHYDmYDIbKoSQxikd9vtMumFnP87OybH7sC9fJ6g== + dependencies: + "@types/express" "*" + "@types/fs-capacitor" "*" + "@types/koa" "*" + busboy "^0.3.1" + fs-capacitor "^2.0.4" + http-errors "^1.7.3" + object-path "^0.11.4" + +"@ardatan/aggregate-error@0.0.6": + version "0.0.6" + resolved "https://registry.npmjs.org/@ardatan/aggregate-error/-/aggregate-error-0.0.6.tgz#fe6924771ea40fc98dc7a7045c2e872dc8527609" + integrity sha512-vyrkEHG1jrukmzTPtyWB4NLPauUw5bQeg4uhn8f+1SSynmrOcyvlb1GKQjjgoBzElLdfXCRYX8UnBlhklOHYRQ== + dependencies: + tslib "~2.0.1" + +"@babel/code-frame@7.12.11": + version "7.12.11" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== + dependencies: + "@babel/highlight" "^7.10.4" + +"@babel/code-frame@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" + integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== + dependencies: + "@babel/highlight" "^7.12.13" + +"@babel/compat-data@^7.13.8": + version "7.13.8" + resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.13.8.tgz#5b783b9808f15cef71547f1b691f34f8ff6003a6" + integrity sha512-EaI33z19T4qN3xLXsGf48M2cDqa6ei9tPZlfLdb2HC+e/cFtREiRd8hdSqDbwdLB0/+gLwqJmCYASH0z2bUdog== + +"@babel/core@^7.0.0": + version "7.13.10" + resolved "https://registry.npmjs.org/@babel/core/-/core-7.13.10.tgz#07de050bbd8193fcd8a3c27918c0890613a94559" + integrity sha512-bfIYcT0BdKeAZrovpMqX2Mx5NrgAckGbwT982AkdS5GNfn3KMGiprlBAtmBcFZRUmpaufS6WZFP8trvx8ptFDw== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/generator" "^7.13.9" + "@babel/helper-compilation-targets" "^7.13.10" + "@babel/helper-module-transforms" "^7.13.0" + "@babel/helpers" "^7.13.10" + "@babel/parser" "^7.13.10" + "@babel/template" "^7.12.13" + "@babel/traverse" "^7.13.0" + "@babel/types" "^7.13.0" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.1.2" + lodash "^4.17.19" + semver "^6.3.0" + source-map "^0.5.0" + +"@babel/generator@^7.12.13", "@babel/generator@^7.13.0", "@babel/generator@^7.13.9", "@babel/generator@^7.5.0": + version "7.13.9" + resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.13.9.tgz#3a7aa96f9efb8e2be42d38d80e2ceb4c64d8de39" + integrity sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw== + dependencies: + "@babel/types" "^7.13.0" + jsesc "^2.5.1" + source-map "^0.5.0" + +"@babel/helper-annotate-as-pure@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz#0f58e86dfc4bb3b1fcd7db806570e177d439b6ab" + integrity sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw== + dependencies: + "@babel/types" "^7.12.13" + +"@babel/helper-compilation-targets@^7.13.10", "@babel/helper-compilation-targets@^7.13.8": + version "7.13.10" + resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.10.tgz#1310a1678cb8427c07a753750da4f8ce442bdd0c" + integrity sha512-/Xju7Qg1GQO4mHZ/Kcs6Au7gfafgZnwm+a7sy/ow/tV1sHeraRUHbjdat8/UvDor4Tez+siGKDk6zIKtCPKVJA== + dependencies: + "@babel/compat-data" "^7.13.8" + "@babel/helper-validator-option" "^7.12.17" + browserslist "^4.14.5" + semver "^6.3.0" + +"@babel/helper-create-class-features-plugin@^7.13.0": + version "7.13.10" + resolved "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.13.10.tgz#073b2bbb925a097643c6fc5770e5f13394e887c9" + integrity sha512-YV7r2YxdTUaw84EwNkyrRke/TJHR/UXGiyvACRqvdVJ2/syV2rQuJNnaRLSuYiop8cMRXOgseTGoJCWX0q2fFg== + dependencies: + "@babel/helper-function-name" "^7.12.13" + "@babel/helper-member-expression-to-functions" "^7.13.0" + "@babel/helper-optimise-call-expression" "^7.12.13" + "@babel/helper-replace-supers" "^7.13.0" + "@babel/helper-split-export-declaration" "^7.12.13" + +"@babel/helper-function-name@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz#93ad656db3c3c2232559fd7b2c3dbdcbe0eb377a" + integrity sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA== + dependencies: + "@babel/helper-get-function-arity" "^7.12.13" + "@babel/template" "^7.12.13" + "@babel/types" "^7.12.13" + +"@babel/helper-get-function-arity@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz#bc63451d403a3b3082b97e1d8b3fe5bd4091e583" + integrity sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg== + dependencies: + "@babel/types" "^7.12.13" + +"@babel/helper-member-expression-to-functions@^7.13.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.0.tgz#6aa4bb678e0f8c22f58cdb79451d30494461b091" + integrity sha512-yvRf8Ivk62JwisqV1rFRMxiSMDGnN6KH1/mDMmIrij4jztpQNRoHqqMG3U6apYbGRPJpgPalhva9Yd06HlUxJQ== + dependencies: + "@babel/types" "^7.13.0" + +"@babel/helper-module-imports@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.13.tgz#ec67e4404f41750463e455cc3203f6a32e93fcb0" + integrity sha512-NGmfvRp9Rqxy0uHSSVP+SRIW1q31a7Ji10cLBcqSDUngGentY4FRiHOFZFE1CLU5eiL0oE8reH7Tg1y99TDM/g== + dependencies: + "@babel/types" "^7.12.13" + +"@babel/helper-module-transforms@^7.13.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.13.0.tgz#42eb4bd8eea68bab46751212c357bfed8b40f6f1" + integrity sha512-Ls8/VBwH577+pw7Ku1QkUWIyRRNHpYlts7+qSqBBFCW3I8QteB9DxfcZ5YJpOwH6Ihe/wn8ch7fMGOP1OhEIvw== + dependencies: + "@babel/helper-module-imports" "^7.12.13" + "@babel/helper-replace-supers" "^7.13.0" + "@babel/helper-simple-access" "^7.12.13" + "@babel/helper-split-export-declaration" "^7.12.13" + "@babel/helper-validator-identifier" "^7.12.11" + "@babel/template" "^7.12.13" + "@babel/traverse" "^7.13.0" + "@babel/types" "^7.13.0" + lodash "^4.17.19" + +"@babel/helper-optimise-call-expression@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz#5c02d171b4c8615b1e7163f888c1c81c30a2aaea" + integrity sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA== + dependencies: + "@babel/types" "^7.12.13" + +"@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.8.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz#806526ce125aed03373bc416a828321e3a6a33af" + integrity sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ== + +"@babel/helper-replace-supers@^7.12.13", "@babel/helper-replace-supers@^7.13.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.13.0.tgz#6034b7b51943094cb41627848cb219cb02be1d24" + integrity sha512-Segd5me1+Pz+rmN/NFBOplMbZG3SqRJOBlY+mA0SxAv6rjj7zJqr1AVr3SfzUVTLCv7ZLU5FycOM/SBGuLPbZw== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.13.0" + "@babel/helper-optimise-call-expression" "^7.12.13" + "@babel/traverse" "^7.13.0" + "@babel/types" "^7.13.0" + +"@babel/helper-simple-access@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.13.tgz#8478bcc5cacf6aa1672b251c1d2dde5ccd61a6c4" + integrity sha512-0ski5dyYIHEfwpWGx5GPWhH35j342JaflmCeQmsPWcrOQDtCN6C1zKAVRFVbK53lPW2c9TsuLLSUDf0tIGJ5hA== + dependencies: + "@babel/types" "^7.12.13" + +"@babel/helper-skip-transparent-expression-wrappers@^7.12.1": + version "7.12.1" + resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.12.1.tgz#462dc63a7e435ade8468385c63d2b84cce4b3cbf" + integrity sha512-Mf5AUuhG1/OCChOJ/HcADmvcHM42WJockombn8ATJG3OnyiSxBK/Mm5x78BQWvmtXZKHgbjdGL2kin/HOLlZGA== + dependencies: + "@babel/types" "^7.12.1" + +"@babel/helper-split-export-declaration@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz#e9430be00baf3e88b0e13e6f9d4eaf2136372b05" + integrity sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg== + dependencies: + "@babel/types" "^7.12.13" + +"@babel/helper-validator-identifier@^7.12.11": + version "7.12.11" + resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" + integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== + +"@babel/helper-validator-option@^7.12.17": + version "7.12.17" + resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz#d1fbf012e1a79b7eebbfdc6d270baaf8d9eb9831" + integrity sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== + +"@babel/helpers@^7.13.10": + version "7.13.10" + resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.13.10.tgz#fd8e2ba7488533cdeac45cc158e9ebca5e3c7df8" + integrity sha512-4VO883+MWPDUVRF3PhiLBUFHoX/bsLTGFpFK/HqvvfBZz2D57u9XzPVNFVBTc0PW/CWR9BXTOKt8NF4DInUHcQ== + dependencies: + "@babel/template" "^7.12.13" + "@babel/traverse" "^7.13.0" + "@babel/types" "^7.13.0" + +"@babel/highlight@^7.10.4", "@babel/highlight@^7.12.13": + version "7.13.10" + resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz#a8b2a66148f5b27d666b15d81774347a731d52d1" + integrity sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg== + dependencies: + "@babel/helper-validator-identifier" "^7.12.11" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/parser@7.12.16": + version "7.12.16" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.12.16.tgz#cc31257419d2c3189d394081635703f549fc1ed4" + integrity sha512-c/+u9cqV6F0+4Hpq01jnJO+GLp2DdT63ppz9Xa+6cHaajM9VFzK/iDXiKK65YtpeVwu+ctfS6iqlMqRgQRzeCw== + +"@babel/parser@^7.0.0", "@babel/parser@^7.12.13", "@babel/parser@^7.13.0", "@babel/parser@^7.13.10": + version "7.13.10" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.13.10.tgz#8f8f9bf7b3afa3eabd061f7a5bcdf4fec3c48409" + integrity sha512-0s7Mlrw9uTWkYua7xWr99Wpk2bnGa0ANleKfksYAES8LpWH4gW1OUr42vqKNf0us5UQNfru2wPqMqRITzq/SIQ== + +"@babel/plugin-proposal-class-properties@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.13.0.tgz#146376000b94efd001e57a40a88a525afaab9f37" + integrity sha512-KnTDjFNC1g+45ka0myZNvSBFLhNCLN+GeGYLDEA8Oq7MZ6yMgfLoIRh86GRT0FjtJhZw8JyUskP9uvj5pHM9Zg== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.13.0" + "@babel/helper-plugin-utils" "^7.13.0" + +"@babel/plugin-proposal-object-rest-spread@^7.0.0": + version "7.13.8" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.13.8.tgz#5d210a4d727d6ce3b18f9de82cc99a3964eed60a" + integrity sha512-DhB2EuB1Ih7S3/IRX5AFVgZ16k3EzfRbq97CxAVI1KSYcW+lexV8VZb7G7L8zuPVSdQMRn0kiBpf/Yzu9ZKH0g== + dependencies: + "@babel/compat-data" "^7.13.8" + "@babel/helper-compilation-targets" "^7.13.8" + "@babel/helper-plugin-utils" "^7.13.0" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-transform-parameters" "^7.13.0" + +"@babel/plugin-syntax-class-properties@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.12.13.tgz#5df9962503c0a9c918381c929d51d4d6949e7e86" + integrity sha512-J/RYxnlSLXZLVR7wTRsozxKT8qbsx1mNKJzXEEjQ0Kjx1ZACcyHgbanNWNCFtc36IzuWhYWPpvJFFoexoOWFmA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.13.tgz#044fb81ebad6698fe62c478875575bcbb9b70f15" + integrity sha512-d4HM23Q1K7oq/SLNmG6mRt85l2csmQ0cHRaxRXjKW0YFdEXqlZ5kzFQKH5Uc3rDJECgu+yCRgPkG04Mm98R/1g== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-transform-arrow-functions@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.13.0.tgz#10a59bebad52d637a027afa692e8d5ceff5e3dae" + integrity sha512-96lgJagobeVmazXFaDrbmCLQxBysKu7U6Do3mLsx27gf5Dk85ezysrs2BZUpXD703U/Su1xTBDxxar2oa4jAGg== + dependencies: + "@babel/helper-plugin-utils" "^7.13.0" + +"@babel/plugin-transform-block-scoped-functions@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.12.13.tgz#a9bf1836f2a39b4eb6cf09967739de29ea4bf4c4" + integrity sha512-zNyFqbc3kI/fVpqwfqkg6RvBgFpC4J18aKKMmv7KdQ/1GgREapSJAykLMVNwfRGO3BtHj3YQZl8kxCXPcVMVeg== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-transform-block-scoping@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.13.tgz#f36e55076d06f41dfd78557ea039c1b581642e61" + integrity sha512-Pxwe0iqWJX4fOOM2kEZeUuAxHMWb9nK+9oh5d11bsLoB0xMg+mkDpt0eYuDZB7ETrY9bbcVlKUGTOGWy7BHsMQ== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-transform-classes@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.13.0.tgz#0265155075c42918bf4d3a4053134176ad9b533b" + integrity sha512-9BtHCPUARyVH1oXGcSJD3YpsqRLROJx5ZNP6tN5vnk17N0SVf9WCtf8Nuh1CFmgByKKAIMstitKduoCmsaDK5g== + dependencies: + "@babel/helper-annotate-as-pure" "^7.12.13" + "@babel/helper-function-name" "^7.12.13" + "@babel/helper-optimise-call-expression" "^7.12.13" + "@babel/helper-plugin-utils" "^7.13.0" + "@babel/helper-replace-supers" "^7.13.0" + "@babel/helper-split-export-declaration" "^7.12.13" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.13.0.tgz#845c6e8b9bb55376b1fa0b92ef0bdc8ea06644ed" + integrity sha512-RRqTYTeZkZAz8WbieLTvKUEUxZlUTdmL5KGMyZj7FnMfLNKV4+r5549aORG/mgojRmFlQMJDUupwAMiF2Q7OUg== + dependencies: + "@babel/helper-plugin-utils" "^7.13.0" + +"@babel/plugin-transform-destructuring@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.13.0.tgz#c5dce270014d4e1ebb1d806116694c12b7028963" + integrity sha512-zym5em7tePoNT9s964c0/KU3JPPnuq7VhIxPRefJ4/s82cD+q1mgKfuGRDMCPL0HTyKz4dISuQlCusfgCJ86HA== + dependencies: + "@babel/helper-plugin-utils" "^7.13.0" + +"@babel/plugin-transform-flow-strip-types@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.13.0.tgz#58177a48c209971e8234e99906cb6bd1122addd3" + integrity sha512-EXAGFMJgSX8gxWD7PZtW/P6M+z74jpx3wm/+9pn+c2dOawPpBkUX7BrfyPvo6ZpXbgRIEuwgwDb/MGlKvu2pOg== + dependencies: + "@babel/helper-plugin-utils" "^7.13.0" + "@babel/plugin-syntax-flow" "^7.12.13" + +"@babel/plugin-transform-for-of@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.13.0.tgz#c799f881a8091ac26b54867a845c3e97d2696062" + integrity sha512-IHKT00mwUVYE0zzbkDgNRP6SRzvfGCYsOxIRz8KsiaaHCcT9BWIkO+H9QRJseHBLOGBZkHUdHiqj6r0POsdytg== + dependencies: + "@babel/helper-plugin-utils" "^7.13.0" + +"@babel/plugin-transform-function-name@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.12.13.tgz#bb024452f9aaed861d374c8e7a24252ce3a50051" + integrity sha512-6K7gZycG0cmIwwF7uMK/ZqeCikCGVBdyP2J5SKNCXO5EOHcqi+z7Jwf8AmyDNcBgxET8DrEtCt/mPKPyAzXyqQ== + dependencies: + "@babel/helper-function-name" "^7.12.13" + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-transform-literals@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.12.13.tgz#2ca45bafe4a820197cf315794a4d26560fe4bdb9" + integrity sha512-FW+WPjSR7hiUxMcKqyNjP05tQ2kmBCdpEpZHY1ARm96tGQCCBvXKnpjILtDplUnJ/eHZ0lALLM+d2lMFSpYJrQ== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-transform-member-expression-literals@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.12.13.tgz#5ffa66cd59b9e191314c9f1f803b938e8c081e40" + integrity sha512-kxLkOsg8yir4YeEPHLuO2tXP9R/gTjpuTOjshqSpELUN3ZAg2jfDnKUvzzJxObun38sw3wm4Uu69sX/zA7iRvg== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-transform-modules-commonjs@^7.0.0": + version "7.13.8" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.13.8.tgz#7b01ad7c2dcf2275b06fa1781e00d13d420b3e1b" + integrity sha512-9QiOx4MEGglfYZ4XOnU79OHr6vIWUakIj9b4mioN8eQIoEh+pf5p/zEB36JpDFWA12nNMiRf7bfoRvl9Rn79Bw== + dependencies: + "@babel/helper-module-transforms" "^7.13.0" + "@babel/helper-plugin-utils" "^7.13.0" + "@babel/helper-simple-access" "^7.12.13" + babel-plugin-dynamic-import-node "^2.3.3" + +"@babel/plugin-transform-object-super@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.12.13.tgz#b4416a2d63b8f7be314f3d349bd55a9c1b5171f7" + integrity sha512-JzYIcj3XtYspZDV8j9ulnoMPZZnF/Cj0LUxPOjR89BdBVx+zYJI9MdMIlUZjbXDX+6YVeS6I3e8op+qQ3BYBoQ== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + "@babel/helper-replace-supers" "^7.12.13" + +"@babel/plugin-transform-parameters@^7.0.0", "@babel/plugin-transform-parameters@^7.13.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.13.0.tgz#8fa7603e3097f9c0b7ca1a4821bc2fb52e9e5007" + integrity sha512-Jt8k/h/mIwE2JFEOb3lURoY5C85ETcYPnbuAJ96zRBzh1XHtQZfs62ChZ6EP22QlC8c7Xqr9q+e1SU5qttwwjw== + dependencies: + "@babel/helper-plugin-utils" "^7.13.0" + +"@babel/plugin-transform-property-literals@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.12.13.tgz#4e6a9e37864d8f1b3bc0e2dce7bf8857db8b1a81" + integrity sha512-nqVigwVan+lR+g8Fj8Exl0UQX2kymtjcWfMOYM1vTYEKujeyv2SkMgazf2qNcK7l4SDiKyTA/nHCPqL4e2zo1A== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-transform-react-display-name@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.12.13.tgz#c28effd771b276f4647411c9733dbb2d2da954bd" + integrity sha512-MprESJzI9O5VnJZrL7gg1MpdqmiFcUv41Jc7SahxYsNP2kDkFqClxxTZq+1Qv4AFCamm+GXMRDQINNn+qrxmiA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-transform-react-jsx@^7.0.0": + version "7.12.17" + resolved "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.17.tgz#dd2c1299f5e26de584939892de3cfc1807a38f24" + integrity sha512-mwaVNcXV+l6qJOuRhpdTEj8sT/Z0owAVWf9QujTZ0d2ye9X/K+MTOTSizcgKOj18PGnTc/7g1I4+cIUjsKhBcw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.12.13" + "@babel/helper-module-imports" "^7.12.13" + "@babel/helper-plugin-utils" "^7.12.13" + "@babel/plugin-syntax-jsx" "^7.12.13" + "@babel/types" "^7.12.17" + +"@babel/plugin-transform-shorthand-properties@^7.0.0": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.12.13.tgz#db755732b70c539d504c6390d9ce90fe64aff7ad" + integrity sha512-xpL49pqPnLtf0tVluuqvzWIgLEhuPpZzvs2yabUHSKRNlN7ScYU7aMlmavOeyXJZKgZKQRBlh8rHbKiJDraTSw== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-transform-spread@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.13.0.tgz#84887710e273c1815ace7ae459f6f42a5d31d5fd" + integrity sha512-V6vkiXijjzYeFmQTr3dBxPtZYLPcUfY34DebOU27jIl2M/Y8Egm52Hw82CSjjPqd54GTlJs5x+CR7HeNr24ckg== + dependencies: + "@babel/helper-plugin-utils" "^7.13.0" + "@babel/helper-skip-transparent-expression-wrappers" "^7.12.1" + +"@babel/plugin-transform-template-literals@^7.0.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.13.0.tgz#a36049127977ad94438dee7443598d1cefdf409d" + integrity sha512-d67umW6nlfmr1iehCcBv69eSUSySk1EsIS8aTDX4Xo9qajAh6mYtcl4kJrBkGXuxZPEgVr7RVfAvNW6YQkd4Mw== + dependencies: + "@babel/helper-plugin-utils" "^7.13.0" + +"@babel/runtime@^7.0.0", "@babel/runtime@^7.11.2", "@babel/runtime@^7.6.3": + version "7.13.10" + resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d" + integrity sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw== + dependencies: + regenerator-runtime "^0.13.4" + +"@babel/template@^7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327" + integrity sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/parser" "^7.12.13" + "@babel/types" "^7.12.13" + +"@babel/traverse@7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.13.tgz#689f0e4b4c08587ad26622832632735fb8c4e0c0" + integrity sha512-3Zb4w7eE/OslI0fTp8c7b286/cQps3+vdLW3UcwC8VSJC6GbKn55aeVVu2QJNuCDoeKyptLOFrPq8WqZZBodyA== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/generator" "^7.12.13" + "@babel/helper-function-name" "^7.12.13" + "@babel/helper-split-export-declaration" "^7.12.13" + "@babel/parser" "^7.12.13" + "@babel/types" "^7.12.13" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.19" + +"@babel/traverse@^7.0.0", "@babel/traverse@^7.13.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.13.0.tgz#6d95752475f86ee7ded06536de309a65fc8966cc" + integrity sha512-xys5xi5JEhzC3RzEmSGrs/b3pJW/o87SypZ+G/PhaE7uqVQNv/jlmVIBXuoh5atqQ434LfXV+sf23Oxj0bchJQ== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/generator" "^7.13.0" + "@babel/helper-function-name" "^7.12.13" + "@babel/helper-split-export-declaration" "^7.12.13" + "@babel/parser" "^7.13.0" + "@babel/types" "^7.13.0" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.19" + +"@babel/types@7.12.13": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.12.13.tgz#8be1aa8f2c876da11a9cf650c0ecf656913ad611" + integrity sha512-oKrdZTld2im1z8bDwTOQvUbxKwE+854zc16qWZQlcTqMN00pWxHQ4ZeOq0yDMnisOpRykH2/5Qqcrk/OlbAjiQ== + dependencies: + "@babel/helper-validator-identifier" "^7.12.11" + lodash "^4.17.19" + to-fast-properties "^2.0.0" + +"@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.12.13", "@babel/types@^7.12.17", "@babel/types@^7.13.0": + version "7.13.0" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80" + integrity sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA== + dependencies: + "@babel/helper-validator-identifier" "^7.12.11" + lodash "^4.17.19" + to-fast-properties "^2.0.0" + +"@eslint/eslintrc@^0.4.0": + version "0.4.0" + resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz#99cc0a0584d72f1df38b900fb062ba995f395547" + integrity sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== + dependencies: + ajv "^6.12.4" + debug "^4.1.1" + espree "^7.3.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.2.1" + js-yaml "^3.13.1" + minimatch "^3.0.4" + strip-json-comments "^3.1.1" + +"@ethersproject/abi@5.0.0-beta.153": + version "5.0.0-beta.153" + resolved "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.0.0-beta.153.tgz#43a37172b33794e4562999f6e2d555b7599a8eee" + integrity sha512-aXweZ1Z7vMNzJdLpR1CZUAIgnwjrZeUSvN9syCwlBaEBUFJmFY+HHnfuTI5vIhVs/mRkfJVrbEyl51JZQqyjAg== + dependencies: + "@ethersproject/address" ">=5.0.0-beta.128" + "@ethersproject/bignumber" ">=5.0.0-beta.130" + "@ethersproject/bytes" ">=5.0.0-beta.129" + "@ethersproject/constants" ">=5.0.0-beta.128" + "@ethersproject/hash" ">=5.0.0-beta.128" + "@ethersproject/keccak256" ">=5.0.0-beta.127" + "@ethersproject/logger" ">=5.0.0-beta.129" + "@ethersproject/properties" ">=5.0.0-beta.131" + "@ethersproject/strings" ">=5.0.0-beta.130" + +"@ethersproject/abstract-provider@^5.0.8": + version "5.0.10" + resolved "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.0.10.tgz#a533aed39a5f27312745c8c4c40fa25fc884831c" + integrity sha512-OSReY5iz94iIaPlRvLiJP8YVIvQLx4aUvMMnHWSaA/vTU8QHZmgNlt4OBdYV1+aFY8Xl+VRYiWBHq72ZDKXXCQ== + dependencies: + "@ethersproject/bignumber" "^5.0.13" + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/logger" "^5.0.8" + "@ethersproject/networks" "^5.0.7" + "@ethersproject/properties" "^5.0.7" + "@ethersproject/transactions" "^5.0.9" + "@ethersproject/web" "^5.0.12" + +"@ethersproject/abstract-signer@^5.0.10": + version "5.0.14" + resolved "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.0.14.tgz#30ef912b0f86599d90fdffc65c110452e7b55cf1" + integrity sha512-JztBwVO7o5OHLh2vyjordlS4/1EjRyaECtc8vPdXTF1i4dXN+J0coeRoPN6ZFbBvi/YbaB6br2fvqhst1VQD/g== + dependencies: + "@ethersproject/abstract-provider" "^5.0.8" + "@ethersproject/bignumber" "^5.0.13" + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/logger" "^5.0.8" + "@ethersproject/properties" "^5.0.7" + +"@ethersproject/address@>=5.0.0-beta.128", "@ethersproject/address@^5.0.9": + version "5.0.11" + resolved "https://registry.npmjs.org/@ethersproject/address/-/address-5.0.11.tgz#12022e8c590c33939beb5ab18b401ecf585eac59" + integrity sha512-Et4GBdD8/tsBGjCEOKee9upN29qjL5kbRcmJifb4Penmiuh9GARXL2/xpXvEp5EW+EIW/rfCHFJrkYBgoQFQBw== + dependencies: + "@ethersproject/bignumber" "^5.0.13" + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/keccak256" "^5.0.7" + "@ethersproject/logger" "^5.0.8" + "@ethersproject/rlp" "^5.0.7" + +"@ethersproject/base64@^5.0.7": + version "5.0.9" + resolved "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.0.9.tgz#bb1f35d3dba92082a574d5e2418f9202a0a1a7e6" + integrity sha512-37RBz5LEZ9SlTNGiWCYFttnIN9J7qVs9Xo2EbqGqDH5LfW9EIji66S+YDMpXVo1zWDax1FkEldAoatxHK2gfgA== + dependencies: + "@ethersproject/bytes" "^5.0.9" + +"@ethersproject/bignumber@>=5.0.0-beta.130", "@ethersproject/bignumber@^5.0.13": + version "5.0.15" + resolved "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.0.15.tgz#b089b3f1e0381338d764ac1c10512f0c93b184ed" + integrity sha512-MTADqnyacvdRwtKh7o9ujwNDSM1SDJjYDMYAzjIgjoi9rh6TY4suMbhCa3i2vh3SUXiXSICyTI8ui+NPdrZ9Lw== + dependencies: + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/logger" "^5.0.8" + bn.js "^4.4.0" + +"@ethersproject/bytes@>=5.0.0-beta.129", "@ethersproject/bytes@^5.0.9": + version "5.0.11" + resolved "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.0.11.tgz#21118e75b1d00db068984c15530e316021101276" + integrity sha512-D51plLYY5qF05AsoVQwIZVLqlBkaTPVHVP/1WmmBIWyHB0cRW0C9kh0kx5Exo51rB63Hk8PfHxc7SmpoaQFEyg== + dependencies: + "@ethersproject/logger" "^5.0.8" + +"@ethersproject/constants@>=5.0.0-beta.128", "@ethersproject/constants@^5.0.8": + version "5.0.10" + resolved "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.0.10.tgz#eb0c604fbc44c53ba9641eed31a1d0c9e1ebcadc" + integrity sha512-OSo8jxkHLDXieCy8bgOFR7lMfgPxEzKvSDdP+WAWHCDM8+orwch0B6wzkTmiQFgryAtIctrBt5glAdJikZ3hGw== + dependencies: + "@ethersproject/bignumber" "^5.0.13" + +"@ethersproject/hash@>=5.0.0-beta.128": + version "5.0.12" + resolved "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.0.12.tgz#1074599f7509e2ca2bb7a3d4f4e39ab3a796da42" + integrity sha512-kn4QN+fhNFbUgX3XZTZUaQixi0oyfIEY+hfW+KtkHu+rq7dV76oAIvaLEEynu1/4npOL38E4X4YI42gGZk+C0Q== + dependencies: + "@ethersproject/abstract-signer" "^5.0.10" + "@ethersproject/address" "^5.0.9" + "@ethersproject/bignumber" "^5.0.13" + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/keccak256" "^5.0.7" + "@ethersproject/logger" "^5.0.8" + "@ethersproject/properties" "^5.0.7" + "@ethersproject/strings" "^5.0.8" + +"@ethersproject/keccak256@>=5.0.0-beta.127", "@ethersproject/keccak256@^5.0.7": + version "5.0.9" + resolved "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.0.9.tgz#ca0d86e4af56c13b1ef25e533bde3e96d28f647d" + integrity sha512-zhdUTj6RGtCJSgU+bDrWF6cGbvW453LoIC1DSNWrTlXzC7WuH4a+EiPrgc7/kNoRxerKuA/cxYlI8GwNtVtDlw== + dependencies: + "@ethersproject/bytes" "^5.0.9" + js-sha3 "0.5.7" + +"@ethersproject/logger@>=5.0.0-beta.129", "@ethersproject/logger@^5.0.8": + version "5.0.10" + resolved "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.0.10.tgz#fd884688b3143253e0356ef92d5f22d109d2e026" + integrity sha512-0y2T2NqykDrbPM3Zw9RSbPkDOxwChAL8detXaom76CfYoGxsOnRP/zTX8OUAV+x9LdwzgbWvWmeXrc0M7SuDZw== + +"@ethersproject/networks@^5.0.7": + version "5.0.9" + resolved "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.0.9.tgz#ec5da11e4d4bfd69bec4eaebc9ace33eb9569279" + integrity sha512-L8+VCQwArBLGkxZb/5Ns/OH/OxP38AcaveXIxhUTq+VWpXYjrObG3E7RDQIKkUx1S1IcQl/UWTz5w4DK0UitJg== + dependencies: + "@ethersproject/logger" "^5.0.8" + +"@ethersproject/properties@>=5.0.0-beta.131", "@ethersproject/properties@^5.0.7": + version "5.0.9" + resolved "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.0.9.tgz#d7aae634680760136ea522e25c3ef043ec15b5c2" + integrity sha512-ZCjzbHYTw+rF1Pn8FDCEmx3gQttwIHcm/6Xee8g/M3Ga3SfW4tccNMbs5zqnBH0E4RoOPaeNgyg1O68TaF0tlg== + dependencies: + "@ethersproject/logger" "^5.0.8" + +"@ethersproject/rlp@^5.0.7": + version "5.0.9" + resolved "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.0.9.tgz#da205bf8a34d3c3409eb73ddd237130a4b376aff" + integrity sha512-ns1U7ZMVeruUW6JXc4om+1w3w4ynHN/0fpwmeNTsAjwGKoF8SAUgue6ylKpHKWSti2idx7jDxbn8hNNFHk67CA== + dependencies: + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/logger" "^5.0.8" + +"@ethersproject/signing-key@^5.0.8": + version "5.0.11" + resolved "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.0.11.tgz#19fc5c4597e18ad0a5efc6417ba5b74069fdd2af" + integrity sha512-Jfcru/BGwdkXhLxT+8WCZtFy7LL0TPFZw05FAb5asxB/MyVsEfNdNxGDtjVE9zXfmRSPe/EusXYY4K7wcygOyQ== + dependencies: + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/logger" "^5.0.8" + "@ethersproject/properties" "^5.0.7" + elliptic "6.5.4" + +"@ethersproject/strings@>=5.0.0-beta.130", "@ethersproject/strings@^5.0.8": + version "5.0.10" + resolved "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.0.10.tgz#ddce1e9724f4ac4f3f67e0cac0b48748e964bfdb" + integrity sha512-KAeoS1tZ9/5ECXiIZA6S6hywbD0so2VmuW+Wfyo5EDXeyZ6Na1nxTPhTnW7voQmjbeYJffCrOc0qLFJeylyg7w== + dependencies: + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/constants" "^5.0.8" + "@ethersproject/logger" "^5.0.8" + +"@ethersproject/transactions@^5.0.0-beta.135", "@ethersproject/transactions@^5.0.9": + version "5.0.11" + resolved "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.0.11.tgz#b31df5292f47937136a45885d6ee6112477c13df" + integrity sha512-ftsRvR9+gQp7L63F6+XmstvsZ4w8GtWvQB08e/zB+oB86Fnhq8+i/tkgpJplSHC8I/qgiCisva+M3u2GVhDFPA== + dependencies: + "@ethersproject/address" "^5.0.9" + "@ethersproject/bignumber" "^5.0.13" + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/constants" "^5.0.8" + "@ethersproject/keccak256" "^5.0.7" + "@ethersproject/logger" "^5.0.8" + "@ethersproject/properties" "^5.0.7" + "@ethersproject/rlp" "^5.0.7" + "@ethersproject/signing-key" "^5.0.8" + +"@ethersproject/web@^5.0.12": + version "5.0.14" + resolved "https://registry.npmjs.org/@ethersproject/web/-/web-5.0.14.tgz#6e7bebdd9fb967cb25ee60f44d9218dc0803bac4" + integrity sha512-QpTgplslwZ0Sp9oKNLoRuS6TKxnkwfaEk3gr7zd7XLF8XBsYejsrQO/03fNfnMx/TAT/RR6WEw/mbOwpRSeVRA== + dependencies: + "@ethersproject/base64" "^5.0.7" + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/logger" "^5.0.8" + "@ethersproject/properties" "^5.0.7" + "@ethersproject/strings" "^5.0.8" + +"@graphql-tools/batch-delegate@^6.2.4", "@graphql-tools/batch-delegate@^6.2.6": + version "6.2.6" + resolved "https://registry.npmjs.org/@graphql-tools/batch-delegate/-/batch-delegate-6.2.6.tgz#fbea98dc825f87ef29ea5f3f371912c2a2aa2f2c" + integrity sha512-QUoE9pQtkdNPFdJHSnBhZtUfr3M7pIRoXoMR+TG7DK2Y62ISKbT/bKtZEUU1/2v5uqd5WVIvw9dF8gHDSJAsSA== + dependencies: + "@graphql-tools/delegate" "^6.2.4" + dataloader "2.0.0" + tslib "~2.0.1" + +"@graphql-tools/batch-execute@^7.0.0": + version "7.0.0" + resolved "https://registry.npmjs.org/@graphql-tools/batch-execute/-/batch-execute-7.0.0.tgz#e79d11bd5b39f29172f6ec2eafa71103c6a6c85b" + integrity sha512-+ywPfK6N2Ddna6oOa5Qb1Mv7EA8LOwRNOAPP9dL37FEhksJM9pYqPSceUcqMqg7S9b0+Cgr78s408rgvurV3/Q== + dependencies: + "@graphql-tools/utils" "^7.0.0" + dataloader "2.0.0" + is-promise "4.0.0" + tslib "~2.0.1" + +"@graphql-tools/code-file-loader@^6.2.4": + version "6.3.1" + resolved "https://registry.npmjs.org/@graphql-tools/code-file-loader/-/code-file-loader-6.3.1.tgz#42dfd4db5b968acdb453382f172ec684fa0c34ed" + integrity sha512-ZJimcm2ig+avgsEOWWVvAaxZrXXhiiSZyYYOJi0hk9wh5BxZcLUNKkTp6EFnZE/jmGUwuos3pIjUD3Hwi3Bwhg== + dependencies: + "@graphql-tools/graphql-tag-pluck" "^6.5.1" + "@graphql-tools/utils" "^7.0.0" + tslib "~2.1.0" + +"@graphql-tools/delegate@^6.2.4": + version "6.2.4" + resolved "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-6.2.4.tgz#db553b63eb9512d5eb5bbfdfcd8cb1e2b534699c" + integrity sha512-mXe6DfoWmq49kPcDrpKHgC2DSWcD5q0YCaHHoXYPAOlnLH8VMTY8BxcE8y/Do2eyg+GLcwAcrpffVszWMwqw0w== + dependencies: + "@ardatan/aggregate-error" "0.0.6" + "@graphql-tools/schema" "^6.2.4" + "@graphql-tools/utils" "^6.2.4" + dataloader "2.0.0" + is-promise "4.0.0" + tslib "~2.0.1" + +"@graphql-tools/delegate@^7.0.1", "@graphql-tools/delegate@^7.0.7": + version "7.0.10" + resolved "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-7.0.10.tgz#f87ac85a2dbd03b5b3aabf347f4479fabe8ceac3" + integrity sha512-6Di9ia5ohoDvrHuhj2cak1nJGhIefJmUsd3WKZcJ2nu2yZAFawWMxGvQImqv3N7iyaWKiVhrrK8Roi/JrYhdKg== + dependencies: + "@ardatan/aggregate-error" "0.0.6" + "@graphql-tools/batch-execute" "^7.0.0" + "@graphql-tools/schema" "^7.0.0" + "@graphql-tools/utils" "^7.1.6" + dataloader "2.0.0" + is-promise "4.0.0" + tslib "~2.1.0" + +"@graphql-tools/git-loader@^6.2.4": + version "6.2.6" + resolved "https://registry.npmjs.org/@graphql-tools/git-loader/-/git-loader-6.2.6.tgz#c2226f4b8f51f1c05c9ab2649ba32d49c68cd077" + integrity sha512-ooQTt2CaG47vEYPP3CPD+nbA0F+FYQXfzrB1Y1ABN9K3d3O2RK3g8qwslzZaI8VJQthvKwt0A95ZeE4XxteYfw== + dependencies: + "@graphql-tools/graphql-tag-pluck" "^6.2.6" + "@graphql-tools/utils" "^7.0.0" + tslib "~2.1.0" + +"@graphql-tools/github-loader@^6.2.4": + version "6.2.5" + resolved "https://registry.npmjs.org/@graphql-tools/github-loader/-/github-loader-6.2.5.tgz#460dff6f5bbaa26957a5ea3be4f452b89cc6a44b" + integrity sha512-DLuQmYeNNdPo8oWus8EePxWCfCAyUXPZ/p1PWqjrX/NGPyH2ZObdqtDAfRHztljt0F/qkBHbGHCEk2TKbRZTRw== + dependencies: + "@graphql-tools/graphql-tag-pluck" "^6.2.6" + "@graphql-tools/utils" "^7.0.0" + cross-fetch "3.0.6" + tslib "~2.0.1" + +"@graphql-tools/graphql-file-loader@^6.2.4": + version "6.2.7" + resolved "https://registry.npmjs.org/@graphql-tools/graphql-file-loader/-/graphql-file-loader-6.2.7.tgz#d3720f2c4f4bb90eb2a03a7869a780c61945e143" + integrity sha512-5k2SNz0W87tDcymhEMZMkd6/vs6QawDyjQXWtqkuLTBF3vxjxPD1I4dwHoxgWPIjjANhXybvulD7E+St/7s9TQ== + dependencies: + "@graphql-tools/import" "^6.2.6" + "@graphql-tools/utils" "^7.0.0" + tslib "~2.1.0" + +"@graphql-tools/graphql-tag-pluck@^6.2.4", "@graphql-tools/graphql-tag-pluck@^6.2.6", "@graphql-tools/graphql-tag-pluck@^6.5.1": + version "6.5.1" + resolved "https://registry.npmjs.org/@graphql-tools/graphql-tag-pluck/-/graphql-tag-pluck-6.5.1.tgz#5fb227dbb1e19f4b037792b50f646f16a2d4c686" + integrity sha512-7qkm82iFmcpb8M6/yRgzjShtW6Qu2OlCSZp8uatA3J0eMl87TxyJoUmL3M3UMMOSundAK8GmoyNVFUrueueV5Q== + dependencies: + "@babel/parser" "7.12.16" + "@babel/traverse" "7.12.13" + "@babel/types" "7.12.13" + "@graphql-tools/utils" "^7.0.0" + tslib "~2.1.0" + +"@graphql-tools/import@^6.2.4", "@graphql-tools/import@^6.2.6": + version "6.3.0" + resolved "https://registry.npmjs.org/@graphql-tools/import/-/import-6.3.0.tgz#171472b425ea7cba4a612ad524b96bd206ae71b6" + integrity sha512-zmaVhJ3UPjzJSb005Pjn2iWvH+9AYRXI4IUiTi14uPupiXppJP3s7S25Si3+DbHpFwurDF2nWRxBLiFPWudCqw== + dependencies: + resolve-from "5.0.0" + tslib "~2.1.0" + +"@graphql-tools/json-file-loader@^6.2.4": + version "6.2.6" + resolved "https://registry.npmjs.org/@graphql-tools/json-file-loader/-/json-file-loader-6.2.6.tgz#830482cfd3721a0799cbf2fe5b09959d9332739a" + integrity sha512-CnfwBSY5926zyb6fkDBHnlTblHnHI4hoBALFYXnrg0Ev4yWU8B04DZl/pBRUc459VNgO2x8/mxGIZj2hPJG1EA== + dependencies: + "@graphql-tools/utils" "^7.0.0" + tslib "~2.0.1" + +"@graphql-tools/links@^6.2.4": + version "6.2.5" + resolved "https://registry.npmjs.org/@graphql-tools/links/-/links-6.2.5.tgz#b172cadc4b7cbe27bfc1dc787651f92517f583bc" + integrity sha512-XeGDioW7F+HK6HHD/zCeF0HRC9s12NfOXAKv1HC0J7D50F4qqMvhdS/OkjzLoBqsgh/Gm8icRc36B5s0rOA9ig== + dependencies: + "@graphql-tools/utils" "^7.0.0" + apollo-link "1.2.14" + apollo-upload-client "14.1.2" + cross-fetch "3.0.6" + form-data "3.0.0" + is-promise "4.0.0" + tslib "~2.0.1" + +"@graphql-tools/load-files@^6.2.4": + version "6.3.1" + resolved "https://registry.npmjs.org/@graphql-tools/load-files/-/load-files-6.3.1.tgz#7d7726fcb53924ad0cfbdf3f86e7c376abf70c8e" + integrity sha512-y/qGcuKWW3mSPbIHEN5csM9xM0ow479NqtEOPeC1i9wqLml82ubaPS8BzXMhB8DJa5XmrGzIZvrt03CBkQ4aJA== + dependencies: + globby "11.0.2" + tslib "~2.1.0" + unixify "1.0.0" + +"@graphql-tools/load@^6.2.4": + version "6.2.7" + resolved "https://registry.npmjs.org/@graphql-tools/load/-/load-6.2.7.tgz#61f7909d37fb1c095e3e8d4f7a6d3b8bb011e26a" + integrity sha512-b1qWjki1y/QvGtoqW3x8bcwget7xmMfLGsvGFWOB6m38tDbzVT3GlJViAC0nGPDks9OCoJzAdi5IYEkBaqH5GQ== + dependencies: + "@graphql-tools/merge" "^6.2.9" + "@graphql-tools/utils" "^7.5.0" + globby "11.0.2" + import-from "3.0.0" + is-glob "4.0.1" + p-limit "3.1.0" + tslib "~2.1.0" + unixify "1.0.0" + valid-url "1.0.9" + +"@graphql-tools/merge@^6.2.4", "@graphql-tools/merge@^6.2.9": + version "6.2.10" + resolved "https://registry.npmjs.org/@graphql-tools/merge/-/merge-6.2.10.tgz#cadb37b1bed786cba1b3c6f728c5476a164e153d" + integrity sha512-dM3n37PcslvhOAkCz7Cwk0BfoiSVKXGmCX+VMZkATbXk/0vlxUfNEpVfA5yF4IkP27F04SzFQSaNrbD0W2Rszw== + dependencies: + "@graphql-tools/schema" "^7.0.0" + "@graphql-tools/utils" "^7.5.0" + tslib "~2.1.0" + +"@graphql-tools/mock@^6.2.4": + version "6.2.4" + resolved "https://registry.npmjs.org/@graphql-tools/mock/-/mock-6.2.4.tgz#205323c51f89dd855d345d130c7713d0420909ea" + integrity sha512-O5Zvq/mcDZ7Ptky0IZ4EK9USmxV6FEVYq0Jxv2TI80kvxbCjt0tbEpZ+r1vIt1gZOXlAvadSHYyzWnUPh+1vkQ== + dependencies: + "@graphql-tools/schema" "^6.2.4" + "@graphql-tools/utils" "^6.2.4" + tslib "~2.0.1" + +"@graphql-tools/module-loader@^6.2.4": + version "6.2.7" + resolved "https://registry.npmjs.org/@graphql-tools/module-loader/-/module-loader-6.2.7.tgz#66ab9468775fac8079ca46ea9896ceea76e4ef69" + integrity sha512-ItAAbHvwfznY9h1H9FwHYDstTcm22Dr5R9GZtrWlpwqj0jaJGcBxsMB9jnK9kFqkbtFYEe4E/NsSnxsS4/vViQ== + dependencies: + "@graphql-tools/utils" "^7.5.0" + tslib "~2.1.0" + +"@graphql-tools/relay-operation-optimizer@^6.2.4": + version "6.3.0" + resolved "https://registry.npmjs.org/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-6.3.0.tgz#f8c7f6c8aa4a9cf50ab151fbc5db4f4282a79532" + integrity sha512-Or3UgRvkY9Fq1AAx7q38oPqFmTepLz7kp6wDHKyR0ceG7AvHv5En22R12mAeISInbhff4Rpwgf6cE8zHRu6bCw== + dependencies: + "@graphql-tools/utils" "^7.1.0" + relay-compiler "10.1.0" + tslib "~2.0.1" + +"@graphql-tools/resolvers-composition@^6.2.4": + version "6.2.6" + resolved "https://registry.npmjs.org/@graphql-tools/resolvers-composition/-/resolvers-composition-6.2.6.tgz#b369cdf2772a41a7544bf3f16a794501da34c394" + integrity sha512-QO0PC5RG0SolOksupOuB4B0tuzEsQFwQrwD9xLHCrJmjaLi66lOKMFzN40IBY5rqg0k/zqPyjII8rtzcNobvIg== + dependencies: + "@graphql-tools/utils" "^7.0.0" + lodash "4.17.21" + tslib "~2.1.0" + +"@graphql-tools/schema@^6.2.4": + version "6.2.4" + resolved "https://registry.npmjs.org/@graphql-tools/schema/-/schema-6.2.4.tgz#cc4e9f5cab0f4ec48500e666719d99fc5042481d" + integrity sha512-rh+14lSY1q8IPbEv2J9x8UBFJ5NrDX9W5asXEUlPp+7vraLp/Tiox4GXdgyA92JhwpYco3nTf5Bo2JDMt1KnAQ== + dependencies: + "@graphql-tools/utils" "^6.2.4" + tslib "~2.0.1" + +"@graphql-tools/schema@^7.0.0", "@graphql-tools/schema@^7.1.2": + version "7.1.3" + resolved "https://registry.npmjs.org/@graphql-tools/schema/-/schema-7.1.3.tgz#d816400da51fbac1f0086e35540ab63b5e30e858" + integrity sha512-ZY76hmcJlF1iyg3Im0sQ3ASRkiShjgv102vLTVcH22lEGJeCaCyyS/GF1eUHom418S60bS8Th6+autRUxfBiBg== + dependencies: + "@graphql-tools/utils" "^7.1.2" + tslib "~2.1.0" + +"@graphql-tools/stitch@^6.2.4": + version "6.2.4" + resolved "https://registry.npmjs.org/@graphql-tools/stitch/-/stitch-6.2.4.tgz#acfa6a577a33c0f02e4940ffff04753b23b87fd6" + integrity sha512-0C7PNkS7v7iAc001m7c1LPm5FUB0/DYw+s3OyCii6YYYHY8NwdI0roeOyeDGFJkFubWBQfjc3hoSyueKtU73mw== + dependencies: + "@graphql-tools/batch-delegate" "^6.2.4" + "@graphql-tools/delegate" "^6.2.4" + "@graphql-tools/merge" "^6.2.4" + "@graphql-tools/schema" "^6.2.4" + "@graphql-tools/utils" "^6.2.4" + "@graphql-tools/wrap" "^6.2.4" + is-promise "4.0.0" + tslib "~2.0.1" + +"@graphql-tools/url-loader@^6.2.4": + version "6.8.1" + resolved "https://registry.npmjs.org/@graphql-tools/url-loader/-/url-loader-6.8.1.tgz#cbfbe20f1a1bdeb9a4704e37b8286026d228920b" + integrity sha512-iE/y9IAu0cZYL7o9IIDdGm5WjxacN25nGgVqjZINYlisW/wyuBxng7DMJBAp6yM6gkxkCpMno1ljA/52MXzVPQ== + dependencies: + "@graphql-tools/delegate" "^7.0.1" + "@graphql-tools/utils" "^7.1.5" + "@graphql-tools/wrap" "^7.0.4" + "@types/websocket" "1.0.1" + cross-fetch "3.0.6" + eventsource "1.0.7" + extract-files "9.0.0" + form-data "4.0.0" + graphql-upload "^11.0.0" + graphql-ws "4.1.5" + is-promise "4.0.0" + isomorphic-ws "4.0.1" + sse-z "0.3.0" + sync-fetch "0.3.0" + tslib "~2.1.0" + valid-url "1.0.9" + ws "7.4.3" + +"@graphql-tools/utils@^6.2.4": + version "6.2.4" + resolved "https://registry.npmjs.org/@graphql-tools/utils/-/utils-6.2.4.tgz#38a2314d2e5e229ad4f78cca44e1199e18d55856" + integrity sha512-ybgZ9EIJE3JMOtTrTd2VcIpTXtDrn2q6eiYkeYMKRVh3K41+LZa6YnR2zKERTXqTWqhobROwLt4BZbw2O3Aeeg== + dependencies: + "@ardatan/aggregate-error" "0.0.6" + camel-case "4.1.1" + tslib "~2.0.1" + +"@graphql-tools/utils@^7.0.0", "@graphql-tools/utils@^7.1.0", "@graphql-tools/utils@^7.1.2", "@graphql-tools/utils@^7.1.5", "@graphql-tools/utils@^7.1.6", "@graphql-tools/utils@^7.2.1", "@graphql-tools/utils@^7.5.0": + version "7.5.2" + resolved "https://registry.npmjs.org/@graphql-tools/utils/-/utils-7.5.2.tgz#34b676a734eeed6064ba598b132d8018f539501c" + integrity sha512-/ml6AUCmtjvvxR9JX9/xyV52759SqbFR74K8i+AzyOzqM3Ns0c0ZpBFdIMiKzh6UYULPsoHblzfj0ES1yrrtGw== + dependencies: + "@ardatan/aggregate-error" "0.0.6" + camel-case "4.1.2" + tslib "~2.1.0" + +"@graphql-tools/wrap@^6.2.4": + version "6.2.4" + resolved "https://registry.npmjs.org/@graphql-tools/wrap/-/wrap-6.2.4.tgz#2709817da6e469753735a9fe038c9e99736b2c57" + integrity sha512-cyQgpybolF9DjL2QNOvTS1WDCT/epgYoiA8/8b3nwv5xmMBQ6/6nYnZwityCZ7njb7MMyk7HBEDNNlP9qNJDcA== + dependencies: + "@graphql-tools/delegate" "^6.2.4" + "@graphql-tools/schema" "^6.2.4" + "@graphql-tools/utils" "^6.2.4" + is-promise "4.0.0" + tslib "~2.0.1" + +"@graphql-tools/wrap@^7.0.4": + version "7.0.5" + resolved "https://registry.npmjs.org/@graphql-tools/wrap/-/wrap-7.0.5.tgz#8659a119abef11754f712b0c202e41a484951e0b" + integrity sha512-KCWBXsDfvG46GNUawRltJL4j9BMGoOG7oo3WEyCQP+SByWXiTe5cBF45SLDVQgdjljGNZhZ4Lq/7avIkF7/zDQ== + dependencies: + "@graphql-tools/delegate" "^7.0.7" + "@graphql-tools/schema" "^7.1.2" + "@graphql-tools/utils" "^7.2.1" + is-promise "4.0.0" + tslib "~2.0.1" + +"@graphql-typed-document-node/core@^3.0.0": + version "3.1.0" + resolved "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.1.0.tgz#0eee6373e11418bfe0b5638f654df7a4ca6a3950" + integrity sha512-wYn6r8zVZyQJ6rQaALBEln5B1pzxb9shV5Ef97kTvn6yVGrqyXVnDqnU24MXnFubR+rZjBY9NWuxX3FB2sTsjg== + +"@gulp-sourcemaps/map-sources@1.X": + version "1.0.0" + resolved "https://registry.npmjs.org/@gulp-sourcemaps/map-sources/-/map-sources-1.0.0.tgz#890ae7c5d8c877f6d384860215ace9d7ec945bda" + integrity sha1-iQrnxdjId/bThIYCFazp1+yUW9o= + dependencies: + normalize-path "^2.0.1" + through2 "^2.0.3" + +"@nodelib/fs.scandir@2.1.4": + version "2.1.4" + resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz#d4b3549a5db5de2683e0c1071ab4f140904bbf69" + integrity sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA== + dependencies: + "@nodelib/fs.stat" "2.0.4" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.4", "@nodelib/fs.stat@^2.0.2": + version "2.0.4" + resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz#a3f2dd61bab43b8db8fa108a121cfffe4c676655" + integrity sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.6" + resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz#cce9396b30aa5afe9e3756608f5831adcb53d063" + integrity sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow== + dependencies: + "@nodelib/fs.scandir" "2.1.4" + fastq "^1.6.0" + +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + integrity sha1-m4sMxmPWaafY9vXQiToU00jzD78= + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + integrity sha1-NVy8mLr61ZePntCV85diHx0Ga3A= + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + integrity sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU= + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + integrity sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E= + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + integrity sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik= + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + integrity sha1-bMKyDFya1q0NzP0hynZz2Nf79o0= + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + integrity sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q= + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA= + +"@redux-saga/core@^1.0.0": + version "1.1.3" + resolved "https://registry.npmjs.org/@redux-saga/core/-/core-1.1.3.tgz#3085097b57a4ea8db5528d58673f20ce0950f6a4" + integrity sha512-8tInBftak8TPzE6X13ABmEtRJGjtK17w7VUs7qV17S8hCO5S3+aUTWZ/DBsBJPdE8Z5jOPwYALyvofgq1Ws+kg== + dependencies: + "@babel/runtime" "^7.6.3" + "@redux-saga/deferred" "^1.1.2" + "@redux-saga/delay-p" "^1.1.2" + "@redux-saga/is" "^1.1.2" + "@redux-saga/symbols" "^1.1.2" + "@redux-saga/types" "^1.1.0" + redux "^4.0.4" + typescript-tuple "^2.2.1" + +"@redux-saga/deferred@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@redux-saga/deferred/-/deferred-1.1.2.tgz#59937a0eba71fff289f1310233bc518117a71888" + integrity sha512-908rDLHFN2UUzt2jb4uOzj6afpjgJe3MjICaUNO3bvkV/kN/cNeI9PMr8BsFXB/MR8WTAZQq/PlTq8Kww3TBSQ== + +"@redux-saga/delay-p@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@redux-saga/delay-p/-/delay-p-1.1.2.tgz#8f515f4b009b05b02a37a7c3d0ca9ddc157bb355" + integrity sha512-ojc+1IoC6OP65Ts5+ZHbEYdrohmIw1j9P7HS9MOJezqMYtCDgpkoqB5enAAZrNtnbSL6gVCWPHaoaTY5KeO0/g== + dependencies: + "@redux-saga/symbols" "^1.1.2" + +"@redux-saga/is@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@redux-saga/is/-/is-1.1.2.tgz#ae6c8421f58fcba80faf7cadb7d65b303b97e58e" + integrity sha512-OLbunKVsCVNTKEf2cH4TYyNbbPgvmZ52iaxBD4I1fTif4+MTXMa4/Z07L83zW/hTCXwpSZvXogqMqLfex2Tg6w== + dependencies: + "@redux-saga/symbols" "^1.1.2" + "@redux-saga/types" "^1.1.0" + +"@redux-saga/symbols@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@redux-saga/symbols/-/symbols-1.1.2.tgz#216a672a487fc256872b8034835afc22a2d0595d" + integrity sha512-EfdGnF423glv3uMwLsGAtE6bg+R9MdqlHEzExnfagXPrIiuxwr3bdiAwz3gi+PsrQ3yBlaBpfGLtDG8rf3LgQQ== + +"@redux-saga/types@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@redux-saga/types/-/types-1.1.0.tgz#0e81ce56b4883b4b2a3001ebe1ab298b84237204" + integrity sha512-afmTuJrylUU/0OtqzaRkbyYFFNgCF73Bvel/sw90pvGrWIZ+vyoIJqA6eMSoA6+nb443kTmulmBtC9NerXboNg== + +"@sindresorhus/is@^0.14.0": + version "0.14.0" + resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" + integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== + +"@szmarczak/http-timer@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" + integrity sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA== + dependencies: + defer-to-connect "^1.0.1" + +"@truffle/abi-utils@^0.1.4", "@truffle/abi-utils@^0.1.5": + version "0.1.5" + resolved "https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-0.1.5.tgz#95b39ee0cb6baf777fdbaa2ac6d901ab8b0f8c58" + integrity sha512-PvCN/qebM0boK2YycX3sMe6CwoLtB7cpYj2ugHPtcQ+Zpg1hQRGS+GRLeBuQg3RR5X8IxzLb4YPZh5dnJxMZYA== + dependencies: + change-case "3.0.2" + faker "^5.3.1" + fast-check "^2.12.1" + source-map-support "^0.5.19" + +"@truffle/code-utils@^1.2.23", "@truffle/code-utils@^1.2.24": + version "1.2.24" + resolved "https://registry.npmjs.org/@truffle/code-utils/-/code-utils-1.2.24.tgz#8da82510e416128c45fc154e92410982ab98b426" + integrity sha512-IqpbTh4uNQueadv96GBWBaGTYTyOsLKE9Dui1wpiijON6xq2iIcTArej1vMh+nkAd5/AsP+enbBY8mksm6rFBg== + dependencies: + cbor "^5.1.0" + source-map-support "^0.5.19" + +"@truffle/codec@^0.10.1": + version "0.10.1" + resolved "https://registry.npmjs.org/@truffle/codec/-/codec-0.10.1.tgz#70df52ddf1c64781a23daaccda24e10bfb9dec9d" + integrity sha512-c1lC9Wcp+Z1DLvEYH3dkEtMKnUJx72CirO3kmi0OgFSA5QqTDCtfrVOhAugcb/iMLgqUK05/pexp2whb4oASKA== + dependencies: + big.js "^5.2.2" + bn.js "^5.1.3" + cbor "^5.1.0" + debug "^4.3.1" + lodash.clonedeep "^4.5.0" + lodash.escaperegexp "^4.1.2" + lodash.partition "^4.6.0" + lodash.sum "^4.0.2" + semver "^7.3.4" + source-map-support "^0.5.19" + utf8 "^3.0.0" + web3-utils "1.2.9" + +"@truffle/config@^1.2.35": + version "1.2.35" + resolved "https://registry.npmjs.org/@truffle/config/-/config-1.2.35.tgz#98a9ae3a964e73c33dcea4dcb172f878fdbb9bdd" + integrity sha512-ULTS9t3ldqEV1VBVNWlS9tdWJ0r637ANspzBoQd6S/Ab7CfueQhcIfp29oz6Ahcgjkl4NX+Gu/dG6/Jiys81vg== + dependencies: + "@truffle/error" "^0.0.12" + "@truffle/events" "^0.0.9" + "@truffle/provider" "^0.2.26" + configstore "^4.0.0" + find-up "^2.1.0" + lodash.assignin "^4.2.0" + lodash.merge "^4.6.2" + module "^1.2.5" + original-require "^1.0.1" + source-map-support "^0.5.19" + +"@truffle/db@^0.5.3": + version "0.5.3" + resolved "https://registry.npmjs.org/@truffle/db/-/db-0.5.3.tgz#1223ee5c9b9f112abf5883f647d46ae1e45d5dbd" + integrity sha512-cNQJgcqC77xAIvFrS9R1XHmppOnlZmVZvcEqHOv0PGzcf0XA+hUkUgiOHFYn5bwTvGxLMrBlBmAnBprKlJYsRg== + dependencies: + "@truffle/abi-utils" "^0.1.4" + "@truffle/code-utils" "^1.2.23" + "@truffle/config" "^1.2.35" + apollo-server "^2.18.2" + debug "^4.3.1" + fs-extra "^9.1.0" + graphql "^15.3.0" + graphql-tag "^2.11.0" + graphql-tools "^6.2.4" + json-stable-stringify "^1.0.1" + jsondown "^1.0.0" + pascal-case "^2.0.1" + pluralize "^8.0.0" + pouchdb "7.1.1" + pouchdb-adapter-memory "^7.1.1" + pouchdb-adapter-node-websql "^7.0.0" + pouchdb-debug "^7.1.1" + pouchdb-find "^7.0.0" + source-map-support "^0.5.19" + web3-utils "1.2.9" + +"@truffle/debugger@^8.0.17": + version "8.0.17" + resolved "https://registry.npmjs.org/@truffle/debugger/-/debugger-8.0.17.tgz#a13cd3c967bf045e71a00bd711fb371effa06752" + integrity sha512-CpxsW3edO0gPygLUmIkhFC4hgONltYuhJIM8jhdYL4KpDe8hRlFjWeiveH++iJX/1ka1A2Wbyk9G/TtCdiLY4Q== + dependencies: + "@truffle/abi-utils" "^0.1.5" + "@truffle/codec" "^0.10.1" + "@truffle/source-map-utils" "^1.3.35" + bn.js "^5.1.3" + debug "^4.3.1" + json-pointer "^0.6.0" + json-stable-stringify "^1.0.1" + lodash.flatten "^4.4.0" + lodash.merge "^4.6.2" + lodash.sum "^4.0.2" + lodash.zipwith "^4.2.0" + redux "^3.7.2" + redux-cli-logger "^2.0.1" + redux-saga "1.0.0" + remote-redux-devtools "^0.5.12" + reselect-tree "^1.3.4" + semver "^7.3.4" + source-map-support "^0.5.19" + web3 "1.2.9" + web3-eth-abi "1.2.9" + +"@truffle/error@^0.0.12": + version "0.0.12" + resolved "https://registry.npmjs.org/@truffle/error/-/error-0.0.12.tgz#83e02e6ffe1d154fe274141d90038a91fd1e186d" + integrity sha512-kZqqnPR9YDJG7KCDOcN1qH16Qs0oz1PzF0Y93AWdhXuL9S9HYo/RUUeqGKbPpRBEZldQUS8aa4EzfK08u5pu6g== + +"@truffle/events@^0.0.9": + version "0.0.9" + resolved "https://registry.npmjs.org/@truffle/events/-/events-0.0.9.tgz#460fc72a04269526cbd8ef54069d474c22b42b23" + integrity sha512-o0rS8zkjCzg2vDJymSZyyq1eKdkRbxIFnsnYQl6Bc2StK89C/ZISenxrUe2fbdeq3L9Zq+ds1mSKH/MFK0Ejkg== + dependencies: + emittery "^0.4.1" + ora "^3.4.0" + +"@truffle/interface-adapter@^0.4.19": + version "0.4.19" + resolved "https://registry.npmjs.org/@truffle/interface-adapter/-/interface-adapter-0.4.19.tgz#19248ac88099f8df34f58a3d43a95ba3470dc89a" + integrity sha512-+Zz6Fr8+I2wYSS8RM3WBOMzf22QffMQTnlsYsRgRHzv3gYoRA9ZDLb84lFRfmWyw+IdXTo90tjRHEb5krC6uxg== + dependencies: + bn.js "^5.1.3" + ethers "^4.0.32" + source-map-support "^0.5.19" + web3 "1.2.9" + +"@truffle/provider@^0.2.26": + version "0.2.26" + resolved "https://registry.npmjs.org/@truffle/provider/-/provider-0.2.26.tgz#88e31b79973c2427c4a17d9a59411e6fbc810190" + integrity sha512-YKPmhB9S9AQkT2ePGtadwjDduxU23DXXy+5zyM5fevw5GCbXSnf+jG6rICXjPkVFjuKBlXuq5JbuERZn43522Q== + dependencies: + "@truffle/error" "^0.0.12" + "@truffle/interface-adapter" "^0.4.19" + web3 "1.2.9" + +"@truffle/source-map-utils@^1.3.35": + version "1.3.35" + resolved "https://registry.npmjs.org/@truffle/source-map-utils/-/source-map-utils-1.3.35.tgz#aa40422a05e2727254665ee2c23659d01230eb8f" + integrity sha512-j3PHac4g/yQwxSB899lkal/YMuIXLNNlDGfCog2QrWqdtK7HJhx6X2tftwqrZzO4JTKc1Cs8KOCPOndx9W2xeQ== + dependencies: + "@truffle/code-utils" "^1.2.24" + "@truffle/codec" "^0.10.1" + debug "^4.3.1" + json-pointer "^0.6.0" + node-interval-tree "^1.3.3" + web3-utils "1.2.9" + +"@types/accepts@*", "@types/accepts@^1.3.5": + version "1.3.5" + resolved "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz#c34bec115cfc746e04fe5a059df4ce7e7b391575" + integrity sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ== + dependencies: + "@types/node" "*" + +"@types/bn.js@^4.11.3", "@types/bn.js@^4.11.4": + version "4.11.6" + resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" + integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== + dependencies: + "@types/node" "*" + +"@types/body-parser@*", "@types/body-parser@1.19.0": + version "1.19.0" + resolved "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz#0685b3c47eb3006ffed117cdd55164b61f80538f" + integrity sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ== + dependencies: + "@types/connect" "*" + "@types/node" "*" + +"@types/connect@*": + version "3.4.34" + resolved "https://registry.npmjs.org/@types/connect/-/connect-3.4.34.tgz#170a40223a6d666006d93ca128af2beb1d9b1901" + integrity sha512-ePPA/JuI+X0vb+gSWlPKOY0NdNAie/rPUqX2GUPpbZwiKTkSPhjXWuee47E4MtE54QVzGCQMQkAL6JhV2E1+cQ== + dependencies: + "@types/node" "*" + +"@types/content-disposition@*": + version "0.5.3" + resolved "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.3.tgz#0aa116701955c2faa0717fc69cd1596095e49d96" + integrity sha512-P1bffQfhD3O4LW0ioENXUhZ9OIa0Zn+P7M+pWgkCKaT53wVLSq0mrKksCID/FGHpFhRSxRGhgrQmfhRuzwtKdg== + +"@types/cookies@*": + version "0.7.6" + resolved "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.6.tgz#71212c5391a976d3bae57d4b09fac20fc6bda504" + integrity sha512-FK4U5Qyn7/Sc5ih233OuHO0qAkOpEcD/eG6584yEiLKizTFRny86qHLe/rej3HFQrkBuUjF4whFliAdODbVN/w== + dependencies: + "@types/connect" "*" + "@types/express" "*" + "@types/keygrip" "*" + "@types/node" "*" + +"@types/cors@2.8.8": + version "2.8.8" + resolved "https://registry.npmjs.org/@types/cors/-/cors-2.8.8.tgz#317a8d8561995c60e35b9e0fcaa8d36660c98092" + integrity sha512-fO3gf3DxU2Trcbr75O7obVndW/X5k8rJNZkLXlQWStTHhP71PkRqjwPIEI0yMnJdg9R9OasjU+Bsr+Hr1xy/0w== + dependencies: + "@types/express" "*" + +"@types/express-serve-static-core@*", "@types/express-serve-static-core@4.17.18", "@types/express-serve-static-core@^4.17.18": + version "4.17.18" + resolved "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.18.tgz#8371e260f40e0e1ca0c116a9afcd9426fa094c40" + integrity sha512-m4JTwx5RUBNZvky/JJ8swEJPKFd8si08pPF2PfizYjGZOKr/svUWPcoUmLow6MmPzhasphB7gSTINY67xn3JNA== + dependencies: + "@types/node" "*" + "@types/qs" "*" + "@types/range-parser" "*" + +"@types/express@*": + version "4.17.11" + resolved "https://registry.npmjs.org/@types/express/-/express-4.17.11.tgz#debe3caa6f8e5fcda96b47bd54e2f40c4ee59545" + integrity sha512-no+R6rW60JEc59977wIxreQVsIEOAYwgCqldrA/vkpCnbD7MqTefO97lmoBe4WE0F156bC4uLSP1XHDOySnChg== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "^4.17.18" + "@types/qs" "*" + "@types/serve-static" "*" + +"@types/express@4.17.7": + version "4.17.7" + resolved "https://registry.npmjs.org/@types/express/-/express-4.17.7.tgz#42045be6475636d9801369cd4418ef65cdb0dd59" + integrity sha512-dCOT5lcmV/uC2J9k0rPafATeeyz+99xTt54ReX11/LObZgfzJqZNcW27zGhYyX+9iSEGXGt5qLPwRSvBZcLvtQ== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "*" + "@types/qs" "*" + "@types/serve-static" "*" + +"@types/fs-capacitor@*": + version "2.0.0" + resolved "https://registry.npmjs.org/@types/fs-capacitor/-/fs-capacitor-2.0.0.tgz#17113e25817f584f58100fb7a08eed288b81956e" + integrity sha512-FKVPOCFbhCvZxpVAMhdBdTfVfXUpsh15wFHgqOKxh9N9vzWZVuWCSijZ5T4U34XYNnuj2oduh6xcs1i+LPI+BQ== + dependencies: + "@types/node" "*" + +"@types/http-assert@*": + version "1.5.1" + resolved "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.1.tgz#d775e93630c2469c2f980fc27e3143240335db3b" + integrity sha512-PGAK759pxyfXE78NbKxyfRcWYA/KwW17X290cNev/qAsn9eQIxkH4shoNBafH37wewhDG/0p1cHPbK6+SzZjWQ== + +"@types/http-errors@*": + version "1.8.0" + resolved "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.0.tgz#682477dbbbd07cd032731cb3b0e7eaee3d026b69" + integrity sha512-2aoSC4UUbHDj2uCsCxcG/vRMXey/m17bC7UwitVm5hn22nI8O8Y9iDpA76Orc+DWkQ4zZrOKEshCqR/jSuXAHA== + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + +"@types/keygrip@*": + version "1.0.2" + resolved "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz#513abfd256d7ad0bf1ee1873606317b33b1b2a72" + integrity sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw== + +"@types/koa-compose@*": + version "3.2.5" + resolved "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz#85eb2e80ac50be95f37ccf8c407c09bbe3468e9d" + integrity sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ== + dependencies: + "@types/koa" "*" + +"@types/koa@*": + version "2.13.1" + resolved "https://registry.npmjs.org/@types/koa/-/koa-2.13.1.tgz#e29877a6b5ad3744ab1024f6ec75b8cbf6ec45db" + integrity sha512-Qbno7FWom9nNqu0yHZ6A0+RWt4mrYBhw3wpBAQ3+IuzGcLlfeYkzZrnMq5wsxulN2np8M4KKeUpTodsOsSad5Q== + dependencies: + "@types/accepts" "*" + "@types/content-disposition" "*" + "@types/cookies" "*" + "@types/http-assert" "*" + "@types/http-errors" "*" + "@types/keygrip" "*" + "@types/koa-compose" "*" + "@types/node" "*" + +"@types/long@^4.0.0": + version "4.0.1" + resolved "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" + integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== + +"@types/mime@^1": + version "1.3.2" + resolved "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" + integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== + +"@types/mocha@^8.2.1": + version "8.2.1" + resolved "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.1.tgz#f3f3ae4590c5386fc7c543aae9b78d4cf30ffee9" + integrity sha512-NysN+bNqj6E0Hv4CTGWSlPzMW6vTKjDpOteycDkV4IWBsO+PU48JonrPzV9ODjiI2XrjmA05KInLgF5ivZ/YGQ== + +"@types/node-fetch@2.5.7": + version "2.5.7" + resolved "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz#20a2afffa882ab04d44ca786449a276f9f6bbf3c" + integrity sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw== + dependencies: + "@types/node" "*" + form-data "^3.0.0" + +"@types/node@*": + version "14.14.34" + resolved "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz#07935194fc049069a1c56c0c274265abeddf88da" + integrity sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA== + +"@types/node@^10.1.0", "@types/node@^10.12.18": + version "10.17.55" + resolved "https://registry.npmjs.org/@types/node/-/node-10.17.55.tgz#a147f282edec679b894d4694edb5abeb595fecbd" + integrity sha512-koZJ89uLZufDvToeWO5BrC4CR4OUfHnUz2qoPs/daQH6qq3IN62QFxCTZ+bKaCE0xaoCAJYE4AXre8AbghCrhg== + +"@types/node@^12.6.1": + version "12.20.5" + resolved "https://registry.npmjs.org/@types/node/-/node-12.20.5.tgz#4ca82a766f05c359fd6c77505007e5a272f4bb9b" + integrity sha512-5Oy7tYZnu3a4pnJ//d4yVvOImExl4Vtwf0D40iKUlU+XlUsyV9iyFWyCFlwy489b72FMAik/EFwRkNLjjOdSPg== + +"@types/pbkdf2@^3.0.0": + version "3.1.0" + resolved "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1" + integrity sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ== + dependencies: + "@types/node" "*" + +"@types/qs@*": + version "6.9.6" + resolved "https://registry.npmjs.org/@types/qs/-/qs-6.9.6.tgz#df9c3c8b31a247ec315e6996566be3171df4b3b1" + integrity sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA== + +"@types/range-parser@*": + version "1.2.3" + resolved "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c" + integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== + +"@types/secp256k1@^4.0.1": + version "4.0.1" + resolved "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.1.tgz#fb3aa61a1848ad97d7425ff9dcba784549fca5a4" + integrity sha512-+ZjSA8ELlOp8SlKi0YLB2tz9d5iPNEmOBd+8Rz21wTMdaXQIa9b6TEnD6l5qKOCypE7FSyPyck12qZJxSDNoog== + dependencies: + "@types/node" "*" + +"@types/serve-static@*": + version "1.13.9" + resolved "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.9.tgz#aacf28a85a05ee29a11fb7c3ead935ac56f33e4e" + integrity sha512-ZFqF6qa48XsPdjXV5Gsz0Zqmux2PerNd3a/ktL45mHpa19cuMi/cL8tcxdAx497yRh+QtYPuofjT9oWw9P7nkA== + dependencies: + "@types/mime" "^1" + "@types/node" "*" + +"@types/ungap__global-this@^0.3.1": + version "0.3.1" + resolved "https://registry.npmjs.org/@types/ungap__global-this/-/ungap__global-this-0.3.1.tgz#18ce9f657da556037a29d50604335614ce703f4c" + integrity sha512-+/DsiV4CxXl6ZWefwHZDXSe1Slitz21tom38qPCaG0DYCS1NnDPIQDTKcmQ/tvK/edJUKkmuIDBJbmKDiB0r/g== + +"@types/websocket@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.1.tgz#039272c196c2c0e4868a0d8a1a27bbb86e9e9138" + integrity sha512-f5WLMpezwVxCLm1xQe/kdPpQIOmL0TXYx2O15VYfYzc7hTIdxiOoOvez+McSIw3b7z/1zGovew9YSL7+h4h7/Q== + dependencies: + "@types/node" "*" + +"@types/ws@^7.0.0": + version "7.4.0" + resolved "https://registry.npmjs.org/@types/ws/-/ws-7.4.0.tgz#499690ea08736e05a8186113dac37769ab251a0e" + integrity sha512-Y29uQ3Uy+58bZrFLhX36hcI3Np37nqWE7ky5tjiDoy1GDZnIwVxS0CgF+s+1bXMzjKBFy+fqaRfb708iNzdinw== + dependencies: + "@types/node" "*" + +"@types/zen-observable@^0.8.0": + version "0.8.2" + resolved "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71" + integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg== + +"@ungap/global-this@^0.4.2": + version "0.4.4" + resolved "https://registry.npmjs.org/@ungap/global-this/-/global-this-0.4.4.tgz#8a1b2cfcd3e26e079a847daba879308c924dd695" + integrity sha512-mHkm6FvepJECMNthFuIgpAEFmPOk71UyXuIxYfjytvFTnSDBIz7jmViO+LfHI/AjrazWije0PnSP3+/NlwzqtA== + +"@wry/context@^0.5.2": + version "0.5.4" + resolved "https://registry.npmjs.org/@wry/context/-/context-0.5.4.tgz#b6c28038872e0a0e1ff14eb40b5bf4cab2ab4e06" + integrity sha512-/pktJKHUXDr4D6TJqWgudOPJW2Z+Nb+bqk40jufA3uTkLbnCRKdJPiYDIa/c7mfcPH8Hr6O8zjCERpg5Sq04Zg== + dependencies: + tslib "^1.14.1" + +"@wry/equality@^0.1.2": + version "0.1.11" + resolved "https://registry.npmjs.org/@wry/equality/-/equality-0.1.11.tgz#35cb156e4a96695aa81a9ecc4d03787bc17f1790" + integrity sha512-mwEVBDUVODlsQQ5dfuLUS5/Tf7jqUKyhKYHmVi4fPB6bDMOfWvUPJmKgS1Z7Za/sOI3vzWt4+O7yCiL/70MogA== + dependencies: + tslib "^1.9.3" + +"@wry/equality@^0.3.0": + version "0.3.4" + resolved "https://registry.npmjs.org/@wry/equality/-/equality-0.3.4.tgz#37f101552b18a046d5c0c06da7b2021b15f72c03" + integrity sha512-1gQQhCPenzxw/1HzLlvSIs/59eBHJf9ZDIussjjZhqNSqQuPKQIzN6SWt4kemvlBPDi7RqMuUa03pId7MAE93g== + dependencies: + tslib "^1.14.1" + +"@wry/trie@^0.2.1": + version "0.2.2" + resolved "https://registry.npmjs.org/@wry/trie/-/trie-0.2.2.tgz#99f20f0fcbbcda17006069b155c826cbabfc402f" + integrity sha512-OxqBB39x6MfHaa2HpMiRMfhuUnQTddD32Ko020eBeJXq87ivX6xnSSnzKHVbA21p7iqBASz8n/07b6W5wW1BVQ== + dependencies: + tslib "^1.14.1" + +abab@^1.0.0: + version "1.0.4" + resolved "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" + integrity sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4= + +abbrev@1: + version "1.1.1" + resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + +abort-controller@3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + +abstract-leveldown@^6.2.1: + version "6.3.0" + resolved "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a" + integrity sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ== + dependencies: + buffer "^5.5.0" + immediate "^3.2.3" + level-concat-iterator "~2.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + +abstract-leveldown@~2.7.1: + version "2.7.2" + resolved "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz#87a44d7ebebc341d59665204834c8b7e0932cc93" + integrity sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w== + dependencies: + xtend "~4.0.0" + +abstract-leveldown@~6.0.0, abstract-leveldown@~6.0.1: + version "6.0.3" + resolved "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.0.3.tgz#b4b6159343c74b0c5197b2817854782d8f748c4a" + integrity sha512-jzewKKpZbaYUa6HTThnrl+GrJhzjEAeuc7hTVpZdzg7kupXZFoqQDFwyOwLNbmJKJlmzw8yiipMPkDiuKkT06Q== + dependencies: + level-concat-iterator "~2.0.0" + xtend "~4.0.0" + +abstract-leveldown@~6.2.1: + version "6.2.3" + resolved "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz#036543d87e3710f2528e47040bc3261b77a9a8eb" + integrity sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ== + dependencies: + buffer "^5.5.0" + immediate "^3.2.3" + level-concat-iterator "~2.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + +accepts@^1.3.5, accepts@~1.3.7: + version "1.3.7" + resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" + integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== + dependencies: + mime-types "~2.1.24" + negotiator "0.6.2" + +acorn-globals@^1.0.4: + version "1.0.9" + resolved "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz#55bb5e98691507b74579d0513413217c380c54cf" + integrity sha1-VbtemGkVB7dFedBRNBMhfDgMVM8= + dependencies: + acorn "^2.1.0" + +acorn-jsx@^5.3.1: + version "5.3.1" + resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" + integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== + +acorn@4.X: + version "4.0.13" + resolved "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + integrity sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c= + +acorn@^2.1.0, acorn@^2.4.0: + version "2.7.0" + resolved "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7" + integrity sha1-q259nYhqrKiwhbwzEreaGYQz8Oc= + +acorn@^7.4.0: + version "7.4.1" + resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== + +aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= + +ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ajv@^7.0.2: + version "7.2.1" + resolved "https://registry.npmjs.org/ajv/-/ajv-7.2.1.tgz#a5ac226171912447683524fa2f1248fcf8bac83d" + integrity sha512-+nu0HDv7kNSOua9apAVc979qd932rrZeb3WOvoiD31A/p1mIE5/9bN2027pE2rOPYEdS3UHzsvof4hY+lM9/WQ== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + +ansi-colors@4.1.1, ansi-colors@^4.1.1: + version "4.1.1" + resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +anymatch@~3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" + integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +apollo-cache-control@^0.11.6: + version "0.11.6" + resolved "https://registry.npmjs.org/apollo-cache-control/-/apollo-cache-control-0.11.6.tgz#f7bdf924272af47ac474cf3f3f35cfc038cc9485" + integrity sha512-YZ+uuIG+fPy+mkpBS2qKF0v1qlzZ3PW6xZVaDukeK3ed3iAs4L/2YnkTqau3OmoF/VPzX2FmSkocX/OVd59YSw== + dependencies: + apollo-server-env "^3.0.0" + apollo-server-plugin-base "^0.10.4" + +apollo-datasource@^0.7.3: + version "0.7.3" + resolved "https://registry.npmjs.org/apollo-datasource/-/apollo-datasource-0.7.3.tgz#c824eb1457bdee5a3173ced0e35e594547e687a0" + integrity sha512-PE0ucdZYjHjUyXrFWRwT02yLcx2DACsZ0jm1Mp/0m/I9nZu/fEkvJxfsryXB6JndpmQO77gQHixf/xGCN976kA== + dependencies: + apollo-server-caching "^0.5.3" + apollo-server-env "^3.0.0" + +apollo-env@^0.6.6: + version "0.6.6" + resolved "https://registry.npmjs.org/apollo-env/-/apollo-env-0.6.6.tgz#d7880805c4e96ee3d4142900a405176a04779438" + integrity sha512-hXI9PjJtzmD34XviBU+4sPMOxnifYrHVmxpjykqI/dUD2G3yTiuRaiQqwRwB2RCdwC1Ug/jBfoQ/NHDTnnjndQ== + dependencies: + "@types/node-fetch" "2.5.7" + core-js "^3.0.1" + node-fetch "^2.2.0" + sha.js "^2.4.11" + +apollo-graphql@^0.6.0: + version "0.6.1" + resolved "https://registry.npmjs.org/apollo-graphql/-/apollo-graphql-0.6.1.tgz#d0bf0aff76f445de3da10e08f6974f1bf65f5753" + integrity sha512-ZRXAV+k+hboCVS+FW86FW/QgnDR7gm/xMUwJPGXEbV53OLGuQQdIT0NCYK7AzzVkCfsbb7NJ3mmEclkZY9uuxQ== + dependencies: + apollo-env "^0.6.6" + lodash.sortby "^4.7.0" + +apollo-link@1.2.14, apollo-link@^1.2.14: + version "1.2.14" + resolved "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.14.tgz#3feda4b47f9ebba7f4160bef8b977ba725b684d9" + integrity sha512-p67CMEFP7kOG1JZ0ZkYZwRDa369w5PIjtMjvrQd/HnIV8FRsHRqLqK+oAZQnFa1DDdZtOtHTi+aMIW6EatC2jg== + dependencies: + apollo-utilities "^1.3.0" + ts-invariant "^0.4.0" + tslib "^1.9.3" + zen-observable-ts "^0.8.21" + +apollo-reporting-protobuf@^0.6.2: + version "0.6.2" + resolved "https://registry.npmjs.org/apollo-reporting-protobuf/-/apollo-reporting-protobuf-0.6.2.tgz#5572866be9b77f133916532b10e15fbaa4158304" + integrity sha512-WJTJxLM+MRHNUxt1RTl4zD0HrLdH44F2mDzMweBj1yHL0kSt8I1WwoiF/wiGVSpnG48LZrBegCaOJeuVbJTbtw== + dependencies: + "@apollo/protobufjs" "^1.0.3" + +apollo-server-caching@^0.5.3: + version "0.5.3" + resolved "https://registry.npmjs.org/apollo-server-caching/-/apollo-server-caching-0.5.3.tgz#cf42a77ad09a46290a246810075eaa029b5305e1" + integrity sha512-iMi3087iphDAI0U2iSBE9qtx9kQoMMEWr6w+LwXruBD95ek9DWyj7OeC2U/ngLjRsXM43DoBDXlu7R+uMjahrQ== + dependencies: + lru-cache "^6.0.0" + +apollo-server-core@^2.21.1: + version "2.21.1" + resolved "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.21.1.tgz#5494e558e51a64cdd63b00a762ed600c4c73ee10" + integrity sha512-aI+soLaqKMkWxH6l9xvPP1fCuZgD053SK09D79LQfMbJAHHvs3MI90UpydiY/W61K5l8ELl0YsKdqkQg8262nw== + dependencies: + "@apollographql/apollo-tools" "^0.4.3" + "@apollographql/graphql-playground-html" "1.6.27" + "@apollographql/graphql-upload-8-fork" "^8.1.3" + "@types/ws" "^7.0.0" + apollo-cache-control "^0.11.6" + apollo-datasource "^0.7.3" + apollo-graphql "^0.6.0" + apollo-reporting-protobuf "^0.6.2" + apollo-server-caching "^0.5.3" + apollo-server-env "^3.0.0" + apollo-server-errors "^2.4.2" + apollo-server-plugin-base "^0.10.4" + apollo-server-types "^0.6.3" + apollo-tracing "^0.12.2" + async-retry "^1.2.1" + fast-json-stable-stringify "^2.0.0" + graphql-extensions "^0.12.8" + graphql-tag "^2.11.0" + graphql-tools "^4.0.8" + loglevel "^1.6.7" + lru-cache "^6.0.0" + sha.js "^2.4.11" + subscriptions-transport-ws "^0.9.11" + uuid "^8.0.0" + ws "^6.0.0" + +apollo-server-env@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/apollo-server-env/-/apollo-server-env-3.0.0.tgz#0157c51f52b63aee39af190760acf789ffc744d9" + integrity sha512-tPSN+VttnPsoQAl/SBVUpGbLA97MXG990XIwq6YUnJyAixrrsjW1xYG7RlaOqetxm80y5mBZKLrRDiiSsW/vog== + dependencies: + node-fetch "^2.1.2" + util.promisify "^1.0.0" + +apollo-server-errors@^2.4.2: + version "2.4.2" + resolved "https://registry.npmjs.org/apollo-server-errors/-/apollo-server-errors-2.4.2.tgz#1128738a1d14da989f58420896d70524784eabe5" + integrity sha512-FeGxW3Batn6sUtX3OVVUm7o56EgjxDlmgpTLNyWcLb0j6P8mw9oLNyAm3B+deHA4KNdNHO5BmHS2g1SJYjqPCQ== + +apollo-server-express@^2.21.1: + version "2.21.1" + resolved "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.21.1.tgz#b11af5ca952667e07952c0e5af8a65490a26c70a" + integrity sha512-O8msL01rl1iOfx4qmgpdNDXCh2u+adis8m2pHXZJfHciOoBmAgYaLlH7AOxpW5iHK/vQIwBM0dkPpxu5SaWpag== + dependencies: + "@apollographql/graphql-playground-html" "1.6.27" + "@types/accepts" "^1.3.5" + "@types/body-parser" "1.19.0" + "@types/cors" "2.8.8" + "@types/express" "4.17.7" + "@types/express-serve-static-core" "4.17.18" + accepts "^1.3.5" + apollo-server-core "^2.21.1" + apollo-server-types "^0.6.3" + body-parser "^1.18.3" + cors "^2.8.4" + express "^4.17.1" + graphql-subscriptions "^1.0.0" + graphql-tools "^4.0.8" + parseurl "^1.3.2" + subscriptions-transport-ws "^0.9.16" + type-is "^1.6.16" + +apollo-server-plugin-base@^0.10.4: + version "0.10.4" + resolved "https://registry.npmjs.org/apollo-server-plugin-base/-/apollo-server-plugin-base-0.10.4.tgz#fbf73f64f95537ca9f9639dd7c535eb5eeb95dcd" + integrity sha512-HRhbyHgHFTLP0ImubQObYhSgpmVH4Rk1BinnceZmwudIVLKrqayIVOELdyext/QnSmmzg5W7vF3NLGBcVGMqDg== + dependencies: + apollo-server-types "^0.6.3" + +apollo-server-types@^0.6.3: + version "0.6.3" + resolved "https://registry.npmjs.org/apollo-server-types/-/apollo-server-types-0.6.3.tgz#f7aa25ff7157863264d01a77d7934aa6e13399e8" + integrity sha512-aVR7SlSGGY41E1f11YYz5bvwA89uGmkVUtzMiklDhZ7IgRJhysT5Dflt5IuwDxp+NdQkIhVCErUXakopocFLAg== + dependencies: + apollo-reporting-protobuf "^0.6.2" + apollo-server-caching "^0.5.3" + apollo-server-env "^3.0.0" + +apollo-server@^2.18.2: + version "2.21.1" + resolved "https://registry.npmjs.org/apollo-server/-/apollo-server-2.21.1.tgz#9956b5e0e1cf87c3f050efb60bdb77da889e887e" + integrity sha512-z10nghSdF9tYvmTIezQlIpO7Q94YrbAuZtIBLswVdJXijHYmAtpWdlJ3BhWDiUFVFjocrcXrXhdw2jCtyXASDQ== + dependencies: + apollo-server-core "^2.21.1" + apollo-server-express "^2.21.1" + express "^4.0.0" + graphql-subscriptions "^1.0.0" + graphql-tools "^4.0.8" + stoppable "^1.1.0" + +apollo-tracing@^0.12.2: + version "0.12.2" + resolved "https://registry.npmjs.org/apollo-tracing/-/apollo-tracing-0.12.2.tgz#a261c3970bb421b6dadf50cd85d75b2567a7e52c" + integrity sha512-SYN4o0C0wR1fyS3+P0FthyvsQVHFopdmN3IU64IaspR/RZScPxZ3Ae8uu++fTvkQflAkglnFM0aX6DkZERBp6w== + dependencies: + apollo-server-env "^3.0.0" + apollo-server-plugin-base "^0.10.4" + +apollo-upload-client@14.1.2: + version "14.1.2" + resolved "https://registry.npmjs.org/apollo-upload-client/-/apollo-upload-client-14.1.2.tgz#7a72b000f1cd67eaf8f12b4bda2796d0898c0dae" + integrity sha512-ozaW+4tnVz1rpfwiQwG3RCdCcZ93RV/37ZQbRnObcQ9mjb+zur58sGDPVg9Ef3fiujLmiE/Fe9kdgvIMA3VOjA== + dependencies: + "@apollo/client" "^3.1.5" + "@babel/runtime" "^7.11.2" + extract-files "^9.0.0" + +apollo-utilities@^1.0.1, apollo-utilities@^1.3.0: + version "1.3.4" + resolved "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.4.tgz#6129e438e8be201b6c55b0f13ce49d2c7175c9cf" + integrity sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig== + dependencies: + "@wry/equality" "^0.1.2" + fast-json-stable-stringify "^2.0.0" + ts-invariant "^0.4.0" + tslib "^1.10.0" + +app-module-path@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz#641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5" + integrity sha1-ZBqlXft9am8KgUHEucCqULbCTdU= + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +argsarray@0.0.1, argsarray@^0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/argsarray/-/argsarray-0.0.1.tgz#6e7207b4ecdb39b0af88303fa5ae22bda8df61cb" + integrity sha1-bnIHtOzbObCviDA/pa4ivajfYcs= + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= + dependencies: + arr-flatten "^1.0.1" + +arr-flatten@^1.0.1: + version "1.1.0" + resolved "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= + +array-includes@^3.1.1: + version "3.1.3" + resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.3.tgz#c7f619b382ad2afaf5326cddfdc0afc61af7690a" + integrity sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.2" + get-intrinsic "^1.1.1" + is-string "^1.0.5" + +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= + +array.prototype.flat@^1.2.3: + version "1.2.4" + resolved "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz#6ef638b43312bd401b4c6199fdec7e2dc9e9a123" + integrity sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.1" + +array.prototype.map@^1.0.1: + version "1.0.3" + resolved "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.3.tgz#1609623618d3d84134a37d4a220030c2bd18420b" + integrity sha512-nNcb30v0wfDyIe26Yif3PcV1JXQp4zEeEfupG7L4SRjnD6HLbO5b2a7eVSba53bOx4YCHYMBHt+Fp4vYstneRA== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.1" + es-array-method-boxes-properly "^1.0.0" + is-string "^1.0.5" + +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= + +asn1.js@^5.2.0: + version "5.4.1" + resolved "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" + integrity sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA== + dependencies: + bn.js "^4.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + safer-buffer "^2.1.0" + +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + +async-limiter@^1.0.0, async-limiter@~1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== + +async-retry@^1.2.1: + version "1.3.1" + resolved "https://registry.npmjs.org/async-retry/-/async-retry-1.3.1.tgz#139f31f8ddce50c0870b0ba558a6079684aaed55" + integrity sha512-aiieFW/7h3hY0Bq5d+ktDBejxuwR78vRu9hDUdR8rNhSaQ29VzPL4AoIRG7D/c7tdenwOcKvgPM6tIxB3cB6HA== + dependencies: + retry "0.12.0" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + +atob@^2.1.2: + version "2.1.2" + resolved "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.11.0" + resolved "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" + integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== + +babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-generator@6.26.1: + version "6.26.1" + resolved "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" + integrity sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA== + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.17.4" + source-map "^0.5.7" + trim-right "^1.0.1" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-dynamic-import-node@^2.3.3: + version "2.3.3" + resolved "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3" + integrity sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ== + dependencies: + object.assign "^4.1.0" + +babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" + integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ== + +babel-preset-fbjs@^3.3.0: + version "3.3.0" + resolved "https://registry.npmjs.org/babel-preset-fbjs/-/babel-preset-fbjs-3.3.0.tgz#a6024764ea86c8e06a22d794ca8b69534d263541" + integrity sha512-7QTLTCd2gwB2qGoi5epSULMHugSVgpcVt5YAeiFO9ABLrutDQzKfGwzxgZHLpugq8qMdg/DhRZDZ5CLKxBkEbw== + dependencies: + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-syntax-class-properties" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-block-scoped-functions" "^7.0.0" + "@babel/plugin-transform-block-scoping" "^7.0.0" + "@babel/plugin-transform-classes" "^7.0.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-for-of" "^7.0.0" + "@babel/plugin-transform-function-name" "^7.0.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-member-expression-literals" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/plugin-transform-object-super" "^7.0.0" + "@babel/plugin-transform-parameters" "^7.0.0" + "@babel/plugin-transform-property-literals" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-template-literals" "^7.0.0" + babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" + +babel-runtime@^6.22.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-traverse@6.26.0: + version "6.26.0" + resolved "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@6.18.0, babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== + +backo2@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947" + integrity sha1-MasayLEpNjRj41s+u2n038+6eUc= + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base-x@^3.0.2, base-x@^3.0.8: + version "3.0.8" + resolved "https://registry.npmjs.org/base-x/-/base-x-3.0.8.tgz#1e1106c2537f0162e8b52474a557ebb09000018d" + integrity sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA== + dependencies: + safe-buffer "^5.0.1" + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + +big.js@^5.2.2: + version "5.2.2" + resolved "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" + integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== + +bignumber.js@^9.0.0, bignumber.js@^9.0.1: + version "9.0.1" + resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5" + integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA== + +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + +blakejs@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz#69df92ef953aa88ca51a32df6ab1c54a155fc7a5" + integrity sha1-ad+S75U6qIylGjLfarHFShVfx6U= + +bluebird@^3.5.0: + version "3.7.2" + resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + +bn.js@4.11.6: + version "4.11.6" + resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" + integrity sha1-UzRK2xRhehP26N0s4okF0cC6MhU= + +bn.js@4.11.8: + version "4.11.8" + resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" + integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== + +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.6, bn.js@^4.11.9, bn.js@^4.4.0: + version "4.12.0" + resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.1.3: + version "5.2.0" + resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" + integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== + +body-parser@1.19.0, body-parser@^1.16.0, body-parser@^1.18.3: + version "1.19.0" + resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" + integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== + dependencies: + bytes "3.1.0" + content-type "~1.0.4" + debug "2.6.9" + depd "~1.1.2" + http-errors "1.7.2" + iconv-lite "0.4.24" + on-finished "~2.3.0" + qs "6.7.0" + raw-body "2.4.0" + type-is "~1.6.17" + +boolbase@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" + integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +braces@^3.0.1, braces@~3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +brorand@^1.0.1, brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +browserify-aes@^1.0.0, browserify-aes@^1.0.4, browserify-aes@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + dependencies: + buffer-xor "^1.0.3" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.3" + inherits "^2.0.1" + safe-buffer "^5.0.1" + +browserify-cipher@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" + integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== + dependencies: + browserify-aes "^1.0.4" + browserify-des "^1.0.0" + evp_bytestokey "^1.0.0" + +browserify-des@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" + integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== + dependencies: + cipher-base "^1.0.1" + des.js "^1.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +browserify-rsa@^4.0.0, browserify-rsa@^4.0.1: + version "4.1.0" + resolved "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d" + integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog== + dependencies: + bn.js "^5.0.0" + randombytes "^2.0.1" + +browserify-sign@^4.0.0: + version "4.2.1" + resolved "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz#eaf4add46dd54be3bb3b36c0cf15abbeba7956c3" + integrity sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg== + dependencies: + bn.js "^5.1.1" + browserify-rsa "^4.0.1" + create-hash "^1.2.0" + create-hmac "^1.1.7" + elliptic "^6.5.3" + inherits "^2.0.4" + parse-asn1 "^5.1.5" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +browserslist@^4.14.5: + version "4.16.3" + resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.16.3.tgz#340aa46940d7db878748567c5dea24a48ddf3717" + integrity sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw== + dependencies: + caniuse-lite "^1.0.30001181" + colorette "^1.2.1" + electron-to-chromium "^1.3.649" + escalade "^3.1.1" + node-releases "^1.1.70" + +bs58@^4.0.0: + version "4.0.1" + resolved "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo= + dependencies: + base-x "^3.0.2" + +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + +buffer-from@1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz#87fcaa3a298358e0ade6e442cfce840740d1ad04" + integrity sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ== + +buffer-from@1.1.1, buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +buffer-to-arraybuffer@^0.0.5: + version "0.0.5" + resolved "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz#6064a40fa76eb43c723aba9ef8f6e1216d10511a" + integrity sha1-YGSkD6dutDxyOrqe+PbhIW0QURo= + +buffer-xor@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= + +buffer@^5.0.5, buffer@^5.2.1, buffer@^5.5.0, buffer@^5.6.0, buffer@^5.7.0: + version "5.7.1" + resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +bufferutil@^4.0.1: + version "4.0.3" + resolved "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.3.tgz#66724b756bed23cd7c28c4d306d7994f9943cc6b" + integrity sha512-yEYTwGndELGvfXsImMBLop58eaGW+YdONi1fNjTINSY98tmMmFijBG6WXgdkfuLNt4imzQNtIE+eBp1PVpMCSw== + dependencies: + node-gyp-build "^4.2.0" + +busboy@^0.3.1: + version "0.3.1" + resolved "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz#170899274c5bf38aae27d5c62b71268cd585fd1b" + integrity sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw== + dependencies: + dicer "0.3.0" + +bytes@3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" + integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== + +cacheable-request@^6.0.0: + version "6.1.0" + resolved "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912" + integrity sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg== + dependencies: + clone-response "^1.0.2" + get-stream "^5.1.0" + http-cache-semantics "^4.0.0" + keyv "^3.0.0" + lowercase-keys "^2.0.0" + normalize-url "^4.1.0" + responselike "^1.0.2" + +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camel-case@4.1.1: + version "4.1.1" + resolved "https://registry.npmjs.org/camel-case/-/camel-case-4.1.1.tgz#1fc41c854f00e2f7d0139dfeba1542d6896fe547" + integrity sha512-7fa2WcG4fYFkclIvEmxBbTvmibwF2/agfEBc6q3lOpVu0A13ltLsA+Hr/8Hp6kp5f+G7hKi6t8lys6XxP+1K6Q== + dependencies: + pascal-case "^3.1.1" + tslib "^1.10.0" + +camel-case@4.1.2: + version "4.1.2" + resolved "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz#9728072a954f805228225a6deea6b38461e1bd5a" + integrity sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw== + dependencies: + pascal-case "^3.1.2" + tslib "^2.0.3" + +camel-case@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" + integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M= + dependencies: + no-case "^2.2.0" + upper-case "^1.1.1" + +camelcase@^2.0.1: + version "2.1.1" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" + integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= + +camelcase@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= + +camelcase@^5.0.0, camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +caniuse-lite@^1.0.30001181: + version "1.0.30001199" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001199.tgz#062afccaad21023e2e647d767bac4274b8b8fd7f" + integrity sha512-ifbK2eChUCFUwGhlEzIoVwzFt1+iriSjyKKFYNfv6hN34483wyWpLLavYQXhnR036LhkdUYaSDpHg1El++VgHQ== + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +cbor@^5.1.0: + version "5.2.0" + resolved "https://registry.npmjs.org/cbor/-/cbor-5.2.0.tgz#4cca67783ccd6de7b50ab4ed62636712f287a67c" + integrity sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A== + dependencies: + bignumber.js "^9.0.1" + nofilter "^1.0.4" + +chalk@1.1.3, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.0.0: + version "4.1.0" + resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +change-case@3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/change-case/-/change-case-3.0.2.tgz#fd48746cce02f03f0a672577d1d3a8dc2eceb037" + integrity sha512-Mww+SLF6MZ0U6kdg11algyKd5BARbyM4TbFBepwowYSR5ClfQGCGtxNXgykpN0uF/bstWeaGDT4JWaDh8zWAHA== + dependencies: + camel-case "^3.0.0" + constant-case "^2.0.0" + dot-case "^2.1.0" + header-case "^1.0.0" + is-lower-case "^1.1.0" + is-upper-case "^1.1.0" + lower-case "^1.1.1" + lower-case-first "^1.0.0" + no-case "^2.3.2" + param-case "^2.1.0" + pascal-case "^2.0.0" + path-case "^2.1.0" + sentence-case "^2.1.0" + snake-case "^2.1.0" + swap-case "^1.1.0" + title-case "^2.1.0" + upper-case "^1.1.1" + upper-case-first "^1.1.0" + +cheerio@0.20.0: + version "0.20.0" + resolved "https://registry.npmjs.org/cheerio/-/cheerio-0.20.0.tgz#5c710f2bab95653272842ba01c6ea61b3545ec35" + integrity sha1-XHEPK6uVZTJyhCugHG6mGzVF7DU= + dependencies: + css-select "~1.2.0" + dom-serializer "~0.1.0" + entities "~1.1.1" + htmlparser2 "~3.8.1" + lodash "^4.1.0" + optionalDependencies: + jsdom "^7.0.2" + +cheerio@1.0.0-rc.2: + version "1.0.0-rc.2" + resolved "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db" + integrity sha1-S59TqBsn5NXawxwP/Qz6A8xoMNs= + dependencies: + css-select "~1.2.0" + dom-serializer "~0.1.0" + entities "~1.1.1" + htmlparser2 "^3.9.1" + lodash "^4.15.0" + parse5 "^3.0.1" + +chokidar@3.4.2: + version "3.4.2" + resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz#38dc8e658dec3809741eb3ef7bb0a47fe424232d" + integrity sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.4.0" + optionalDependencies: + fsevents "~2.1.2" + +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + +cids@^0.7.1: + version "0.7.5" + resolved "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz#60a08138a99bfb69b6be4ceb63bfef7a396b28b2" + integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== + dependencies: + buffer "^5.5.0" + class-is "^1.1.0" + multibase "~0.6.0" + multicodec "^1.0.0" + multihashes "~0.4.15" + +cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +class-is@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" + integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= + dependencies: + restore-cursor "^2.0.0" + +cli-spinners@^2.0.0: + version "2.5.0" + resolved "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.5.0.tgz#12763e47251bf951cb75c201dfa58ff1bcb2d047" + integrity sha512-PC+AmIuK04E6aeSs/pUccSujsTzBhu4HzC2dL+CfJB/Jcc2qTRbEwZQDfIUpt2Xl8BodYBEq8w4fc0kU2I9DjQ== + +cliui@^3.2.0: + version "3.2.0" + resolved "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrap-ansi "^2.0.0" + +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + +clone-buffer@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58" + integrity sha1-4+JbIHrE5wGvch4staFnksrD3Fg= + +clone-response@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b" + integrity sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws= + dependencies: + mimic-response "^1.0.0" + +clone-stats@^0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" + integrity sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE= + +clone@2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb" + integrity sha1-0hfR6WERjjrJpLi7oyhVU79kfNs= + +clone@^1.0.0, clone@^1.0.2: + version "1.0.4" + resolved "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-logger@0.0.3: + version "0.0.3" + resolved "https://registry.npmjs.org/color-logger/-/color-logger-0.0.3.tgz#d9b22dd1d973e166b18bf313f9f481bba4df2018" + integrity sha1-2bIt0dlz4Waxi/MT+fSBu6TfIBg= + +color-logger@0.0.6: + version "0.0.6" + resolved "https://registry.npmjs.org/color-logger/-/color-logger-0.0.6.tgz#e56245ef29822657110c7cb75a9cd786cb69ed1b" + integrity sha1-5WJF7ymCJlcRDHy3WpzXhstp7Rs= + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +colorette@^1.2.1: + version "1.2.2" + resolved "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" + integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== + +colors@^1.1.2: + version "1.4.0" + resolved "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" + integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== + +combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@^2.20.3: + version "2.20.3" + resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +component-emitter@1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + integrity sha1-E3kY1teCg/ffemt8WmPhQOaUJeY= + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +concat-stream@1.5.1: + version "1.5.1" + resolved "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.1.tgz#f3b80acf9e1f48e3875c0688b41b6c31602eea1c" + integrity sha1-87gKz54fSOOHXAaItBtsMWAu6hw= + dependencies: + inherits "~2.0.1" + readable-stream "~2.0.0" + typedarray "~0.0.5" + +configstore@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz#5933311e95d3687efb592c528b922d9262d227e7" + integrity sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ== + dependencies: + dot-prop "^4.1.0" + graceful-fs "^4.1.2" + make-dir "^1.0.0" + unique-string "^1.0.0" + write-file-atomic "^2.0.0" + xdg-basedir "^3.0.0" + +confusing-browser-globals@^1.0.10: + version "1.0.10" + resolved "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz#30d1e7f3d1b882b25ec4933d1d1adac353d20a59" + integrity sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA== + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +constant-case@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/constant-case/-/constant-case-2.0.0.tgz#4175764d389d3fa9c8ecd29186ed6005243b6a46" + integrity sha1-QXV2TTidP6nI7NKRhu1gBSQ7akY= + dependencies: + snake-case "^2.1.0" + upper-case "^1.1.1" + +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= + +content-disposition@0.5.3: + version "0.5.3" + resolved "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" + integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== + dependencies: + safe-buffer "5.1.2" + +content-hash@^2.5.2: + version "2.5.2" + resolved "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz#bbc2655e7c21f14fd3bfc7b7d4bfe6e454c9e211" + integrity sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw== + dependencies: + cids "^0.7.1" + multicodec "^0.5.5" + multihashes "^0.4.15" + +content-type@~1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" + integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== + +convert-source-map@1.X, convert-source-map@^1.7.0: + version "1.7.0" + resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" + integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== + dependencies: + safe-buffer "~5.1.1" + +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= + +cookie@0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" + integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== + +cookiejar@^2.1.1: + version "2.1.2" + resolved "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c" + integrity sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA== + +core-js@^2.4.0: + version "2.6.12" + resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" + integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== + +core-js@^3.0.1: + version "3.9.1" + resolved "https://registry.npmjs.org/core-js/-/core-js-3.9.1.tgz#cec8de593db8eb2a85ffb0dbdeb312cb6e5460ae" + integrity sha512-gSjRvzkxQc1zjM/5paAmL4idJBFzuJoo+jDjF1tStYFMV2ERfD02HhahhCGXUyHxQRG4yFKVSdO6g62eoRMcDg== + +core-util-is@1.0.2, core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +cors@^2.8.1, cors@^2.8.4: + version "2.8.5" + resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" + integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== + dependencies: + object-assign "^4" + vary "^1" + +create-ecdh@^4.0.0: + version "4.0.4" + resolved "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" + integrity sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A== + dependencies: + bn.js "^4.1.0" + elliptic "^6.5.3" + +create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: + version "1.1.7" + resolved "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +cross-fetch@3.0.6, cross-fetch@^3.0.4: + version "3.0.6" + resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.0.6.tgz#3a4040bc8941e653e0e9cf17f29ebcd177d3365c" + integrity sha512-KBPUbqgFjzWlVcURG+Svp9TlhA5uliYtiNx/0r8nv0pdypeQCRJ9IaSIc3q/x3q8t3F75cHuwxVql1HFGHCNJQ== + dependencies: + node-fetch "2.6.1" + +cross-spawn@^6.0.0: + version "6.0.5" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +cross-spawn@^7.0.2: + version "7.0.3" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +crypto-browserify@3.12.0: + version "3.12.0" + resolved "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" + integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== + dependencies: + browserify-cipher "^1.0.0" + browserify-sign "^4.0.0" + create-ecdh "^4.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.0" + diffie-hellman "^5.0.0" + inherits "^2.0.1" + pbkdf2 "^3.0.3" + public-encrypt "^4.0.0" + randombytes "^2.0.0" + randomfill "^1.0.3" + +crypto-random-string@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" + integrity sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4= + +css-select@~1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" + integrity sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg= + dependencies: + boolbase "~1.0.0" + css-what "2.1" + domutils "1.5.1" + nth-check "~1.0.1" + +css-what@2.1: + version "2.1.3" + resolved "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2" + integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg== + +css@2.X: + version "2.2.4" + resolved "https://registry.npmjs.org/css/-/css-2.2.4.tgz#c646755c73971f2bba6a601e2cf2fd71b1298929" + integrity sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw== + dependencies: + inherits "^2.0.3" + source-map "^0.6.1" + source-map-resolve "^0.5.2" + urix "^0.1.0" + +cssfilter@0.0.10: + version "0.0.10" + resolved "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz#c6d2672632a2e5c83e013e6864a42ce8defd20ae" + integrity sha1-xtJnJjKi5cg+AT5oZKQs6N79IK4= + +cssom@0.3.x, "cssom@>= 0.3.0 < 0.4.0": + version "0.3.8" + resolved "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +"cssstyle@>= 0.2.29 < 0.3.0": + version "0.2.37" + resolved "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" + integrity sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ= + dependencies: + cssom "0.3.x" + +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +dataloader@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/dataloader/-/dataloader-2.0.0.tgz#41eaf123db115987e21ca93c005cd7753c55fe6f" + integrity sha512-YzhyDAwA4TaQIhM5go+vCLmU0UikghC/t9DTQYZR2M/UvZ1MdOhPezSDZcjj9uqQJOMqjLcpWtyW2iNINdlatQ== + +debug-fabulous@0.0.X: + version "0.0.4" + resolved "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-0.0.4.tgz#fa071c5d87484685424807421ca4b16b0b1a0763" + integrity sha1-+gccXYdIRoVCSAdCHKSxawsaB2M= + dependencies: + debug "2.X" + lazy-debug-legacy "0.0.X" + object-assign "4.1.0" + +debug@2.6.9, debug@2.X, debug@^2.2.0, debug@^2.6.8, debug@^2.6.9: + version "2.6.9" + resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +debug@4.1.1: + version "4.1.1" + resolved "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +debug@^3.1.0, debug@^3.2.6: + version "3.2.7" + resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" + integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== + dependencies: + ms "^2.1.1" + +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: + version "4.3.1" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== + dependencies: + ms "2.1.2" + +decamelize@^1.1.1, decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +decompress-response@^3.2.0, decompress-response@^3.3.0: + version "3.3.0" + resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" + integrity sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M= + dependencies: + mimic-response "^1.0.0" + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +deep-is@^0.1.3, deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +defaults@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= + dependencies: + clone "^1.0.2" + +defer-to-connect@^1.0.1: + version "1.1.3" + resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591" + integrity sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ== + +deferred-leveldown@~5.0.0: + version "5.0.1" + resolved "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.0.1.tgz#1642eb18b535dfb2b6ac4d39fb10a9cbcfd13b09" + integrity sha512-BXohsvTedWOLkj2n/TY+yqVlrCWa2Zs8LSxh3uCAgFOru7/pjxKyZAexGa1j83BaKloER4PqUyQ9rGPJLt9bqA== + dependencies: + abstract-leveldown "~6.0.0" + inherits "^2.0.3" + +deferred-leveldown@~5.3.0: + version "5.3.0" + resolved "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz#27a997ad95408b61161aa69bd489b86c71b78058" + integrity sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw== + dependencies: + abstract-leveldown "~6.2.1" + inherits "^2.0.3" + +define-properties@^1.1.2, define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= + +deprecated-decorator@^0.1.6: + version "0.1.6" + resolved "https://registry.npmjs.org/deprecated-decorator/-/deprecated-decorator-0.1.6.tgz#00966317b7a12fe92f3cc831f7583af329b86c37" + integrity sha1-AJZjF7ehL+kvPMgx91g68ym4bDc= + +des.js@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" + integrity sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA== + dependencies: + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + +destroy@~1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" + integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= + +detect-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + integrity sha1-920GQ1LN9Docts5hnE7jqUdd4gg= + dependencies: + repeating "^2.0.0" + +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +detect-newline@2.X: + version "2.1.0" + resolved "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= + +dicer@0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz#eacd98b3bfbf92e8ab5c2fdb71aaac44bb06b872" + integrity sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA== + dependencies: + streamsearch "0.1.2" + +diff@4.0.2: + version "4.0.2" + resolved "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +diffie-hellman@^5.0.0: + version "5.0.3" + resolved "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" + integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== + dependencies: + bn.js "^4.1.0" + miller-rabin "^4.0.0" + randombytes "^2.0.0" + +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +dom-serializer@0: + version "0.2.2" + resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51" + integrity sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g== + dependencies: + domelementtype "^2.0.1" + entities "^2.0.0" + +dom-serializer@~0.1.0: + version "0.1.1" + resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0" + integrity sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA== + dependencies: + domelementtype "^1.3.0" + entities "^1.1.1" + +dom-walk@^0.1.0: + version "0.1.2" + resolved "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" + integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== + +domelementtype@1, domelementtype@^1.3.0, domelementtype@^1.3.1: + version "1.3.1" + resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" + integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w== + +domelementtype@^2.0.1: + version "2.1.0" + resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz#a851c080a6d1c3d94344aed151d99f669edf585e" + integrity sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w== + +domhandler@2.3: + version "2.3.0" + resolved "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738" + integrity sha1-LeWaCCLVAn+r/28DLCsloqir5zg= + dependencies: + domelementtype "1" + +domhandler@^2.3.0: + version "2.4.2" + resolved "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803" + integrity sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA== + dependencies: + domelementtype "1" + +domutils@1.5, domutils@1.5.1: + version "1.5.1" + resolved "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" + integrity sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8= + dependencies: + dom-serializer "0" + domelementtype "1" + +domutils@^1.5.1: + version "1.7.0" + resolved "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a" + integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg== + dependencies: + dom-serializer "0" + domelementtype "1" + +dot-case@^2.1.0: + version "2.1.1" + resolved "https://registry.npmjs.org/dot-case/-/dot-case-2.1.1.tgz#34dcf37f50a8e93c2b3bca8bb7fb9155c7da3bee" + integrity sha1-NNzzf1Co6TwrO8qLt/uRVcfaO+4= + dependencies: + no-case "^2.2.0" + +dot-prop@^4.1.0: + version "4.2.1" + resolved "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4" + integrity sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ== + dependencies: + is-obj "^1.0.0" + +double-ended-queue@2.1.0-0: + version "2.1.0-0" + resolved "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c" + integrity sha1-ED01J/0xUo9AGIEwyEHv3XgmTlw= + +duplexer3@^0.1.4: + version "0.1.4" + resolved "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" + integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= + +duplexify@^3.2.0: + version "3.7.1" + resolved "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" + integrity sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g== + dependencies: + end-of-stream "^1.0.0" + inherits "^2.0.1" + readable-stream "^2.0.0" + stream-shift "^1.0.0" + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= + +electron-to-chromium@^1.3.649: + version "1.3.687" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.687.tgz#c336184b7ab70427ffe2ee79eaeaedbc1ad8c374" + integrity sha512-IpzksdQNl3wdgkzf7dnA7/v10w0Utf1dF2L+B4+gKrloBrxCut+au+kky3PYvle3RMdSxZP+UiCZtLbcYRxSNQ== + +elliptic@6.5.3: + version "6.5.3" + resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" + integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== + dependencies: + bn.js "^4.4.0" + brorand "^1.0.1" + hash.js "^1.0.0" + hmac-drbg "^1.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.0" + +elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.3: + version "6.5.4" + resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + +emittery@^0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/emittery/-/emittery-0.4.1.tgz#abe9d3297389ba424ac87e53d1c701962ce7433d" + integrity sha512-r4eRSeStEGf6M5SKdrQhhLK5bOwOBxQhIE3YSTnZE3GpKiLfnnhE+tPtrJE79+eDJgm39BM6LSoI8SCx4HbwlQ== + +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= + +encoding-down@^6.3.0: + version "6.3.0" + resolved "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz#b1c4eb0e1728c146ecaef8e32963c549e76d082b" + integrity sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw== + dependencies: + abstract-leveldown "^6.2.1" + inherits "^2.0.3" + level-codec "^9.0.0" + level-errors "^2.0.0" + +end-of-stream@^1.0.0, end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +end-stream@~0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/end-stream/-/end-stream-0.1.0.tgz#32003f3f438a2b0143168137f8fa6e9866c81ed5" + integrity sha1-MgA/P0OKKwFDFoE3+PpumGbIHtU= + dependencies: + write-stream "~0.4.3" + +enquirer@^2.3.5: + version "2.3.6" + resolved "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" + integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== + dependencies: + ansi-colors "^4.1.1" + +entities@1.0: + version "1.0.0" + resolved "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz#b2987aa3821347fcde642b24fdfc9e4fb712bf26" + integrity sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY= + +entities@^1.1.1, entities@~1.1.1: + version "1.1.2" + resolved "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" + integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== + +entities@^2.0.0: + version "2.2.0" + resolved "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55" + integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A== + +errno@~0.1.1: + version "0.1.8" + resolved "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" + integrity sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A== + dependencies: + prr "~1.0.1" + +error-ex@^1.2.0: + version "1.3.2" + resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.17.0-next.1, es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2: + version "1.18.0" + resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz#ab80b359eecb7ede4c298000390bc5ac3ec7b5a4" + integrity sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + get-intrinsic "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.2" + is-callable "^1.2.3" + is-negative-zero "^2.0.1" + is-regex "^1.1.2" + is-string "^1.0.5" + object-inspect "^1.9.0" + object-keys "^1.1.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^1.0.0" + +es-array-method-boxes-properly@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" + integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== + +es-get-iterator@^1.0.2: + version "1.1.2" + resolved "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz#9234c54aba713486d7ebde0220864af5e2b283f7" + integrity sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.0" + has-symbols "^1.0.1" + is-arguments "^1.1.0" + is-map "^2.0.2" + is-set "^2.0.2" + is-string "^1.0.5" + isarray "^2.0.5" + +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + +es5-ext@^0.10.35, es5-ext@^0.10.50: + version "0.10.53" + resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" + integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== + dependencies: + es6-iterator "~2.0.3" + es6-symbol "~3.1.3" + next-tick "~1.0.0" + +es6-denodeify@^0.1.1: + version "0.1.5" + resolved "https://registry.npmjs.org/es6-denodeify/-/es6-denodeify-0.1.5.tgz#31d4d5fe9c5503e125460439310e16a2a3f39c1f" + integrity sha1-MdTV/pxVA+ElRgQ5MQ4WoqPznB8= + +es6-iterator@~2.0.3: + version "2.0.3" + resolved "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-symbol@^3.1.1, es6-symbol@~3.1.3: + version "3.1.3" + resolved "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + +escape-html@1.0.3, escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= + +escape-string-regexp@4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +escodegen@^1.6.1: + version "1.14.3" + resolved "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503" + integrity sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw== + dependencies: + esprima "^4.0.1" + estraverse "^4.2.0" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.6.1" + +esdoc@^1.0.4: + version "1.1.0" + resolved "https://registry.npmjs.org/esdoc/-/esdoc-1.1.0.tgz#07d40ebf791764cd537929c29111e20a857624f3" + integrity sha512-vsUcp52XJkOWg9m1vDYplGZN2iDzvmjDL5M/Mp8qkoDG3p2s0yIQCIjKR5wfPBaM3eV14a6zhQNYiNTCVzPnxA== + dependencies: + babel-generator "6.26.1" + babel-traverse "6.26.0" + babylon "6.18.0" + cheerio "1.0.0-rc.2" + color-logger "0.0.6" + escape-html "1.0.3" + fs-extra "5.0.0" + ice-cap "0.0.4" + marked "0.3.19" + minimist "1.2.0" + taffydb "2.7.3" + +eslint-config-airbnb-base@^14.2.1: + version "14.2.1" + resolved "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz#8a2eb38455dc5a312550193b319cdaeef042cd1e" + integrity sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA== + dependencies: + confusing-browser-globals "^1.0.10" + object.assign "^4.1.2" + object.entries "^1.1.2" + +eslint-import-resolver-node@^0.3.4: + version "0.3.4" + resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717" + integrity sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== + dependencies: + debug "^2.6.9" + resolve "^1.13.1" + +eslint-module-utils@^2.6.0: + version "2.6.0" + resolved "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz#579ebd094f56af7797d19c9866c9c9486629bfa6" + integrity sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== + dependencies: + debug "^2.6.9" + pkg-dir "^2.0.0" + +eslint-plugin-import@^2.22.1: + version "2.22.1" + resolved "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz#0896c7e6a0cf44109a2d97b95903c2bb689d7702" + integrity sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw== + dependencies: + array-includes "^3.1.1" + array.prototype.flat "^1.2.3" + contains-path "^0.1.0" + debug "^2.6.9" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.4" + eslint-module-utils "^2.6.0" + has "^1.0.3" + minimatch "^3.0.4" + object.values "^1.1.1" + read-pkg-up "^2.0.0" + resolve "^1.17.0" + tsconfig-paths "^3.9.0" + +eslint-plugin-prettier@^3.3.1: + version "3.3.1" + resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7" + integrity sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ== + dependencies: + prettier-linter-helpers "^1.0.0" + +eslint-plugin-truffle@^0.3.1: + version "0.3.1" + resolved "https://registry.npmjs.org/eslint-plugin-truffle/-/eslint-plugin-truffle-0.3.1.tgz#78207a015c0ffa660794907748792b5f9301d3d9" + integrity sha512-mjDM1gD96UknBUSEufgdx5m1x3jkWL3Xn/npSZhOVoTbKk/nkBL7dCcH7xsO6GyAjmjvzdev5o5IA4lKWf9b4g== + +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-utils@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" + integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== + dependencies: + eslint-visitor-keys "^1.1.0" + +eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: + version "1.3.0" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" + integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== + +eslint-visitor-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" + integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + +eslint@^7.21.0: + version "7.21.0" + resolved "https://registry.npmjs.org/eslint/-/eslint-7.21.0.tgz#4ecd5b8c5b44f5dedc9b8a110b01bbfeb15d1c83" + integrity sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg== + dependencies: + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.0" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.0.1" + doctrine "^3.0.0" + enquirer "^2.3.5" + eslint-scope "^5.1.1" + eslint-utils "^2.1.0" + eslint-visitor-keys "^2.0.0" + espree "^7.3.1" + esquery "^1.4.0" + esutils "^2.0.2" + file-entry-cache "^6.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash "^4.17.20" + minimatch "^3.0.4" + natural-compare "^1.4.0" + optionator "^0.9.1" + progress "^2.0.0" + regexpp "^3.1.0" + semver "^7.2.1" + strip-ansi "^6.0.0" + strip-json-comments "^3.1.0" + table "^6.0.4" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^7.3.0, espree@^7.3.1: + version "7.3.1" + resolved "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" + integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== + dependencies: + acorn "^7.4.0" + acorn-jsx "^5.3.1" + eslint-visitor-keys "^1.3.0" + +esprima@^4.0.0, esprima@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1, estraverse@^4.2.0: + version "4.3.0" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.2.0" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" + integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= + +eth-ens-namehash@2.0.8: + version "2.0.8" + resolved "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz#229ac46eca86d52e0c991e7cb2aef83ff0f68bcf" + integrity sha1-IprEbsqG1S4MmR58sq74P/D2i88= + dependencies: + idna-uts46-hx "^2.3.1" + js-sha3 "^0.5.7" + +eth-lib@0.2.7: + version "0.2.7" + resolved "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz#2f93f17b1e23aec3759cd4a3fe20c1286a3fc1ca" + integrity sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco= + dependencies: + bn.js "^4.11.6" + elliptic "^6.4.0" + xhr-request-promise "^0.1.2" + +eth-lib@^0.1.26: + version "0.1.29" + resolved "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.29.tgz#0c11f5060d42da9f931eab6199084734f4dbd1d9" + integrity sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ== + dependencies: + bn.js "^4.11.6" + elliptic "^6.4.0" + nano-json-stream-parser "^0.1.2" + servify "^0.1.12" + ws "^3.0.0" + xhr-request-promise "^0.1.2" + +eth-lib@^0.2.8: + version "0.2.8" + resolved "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz#b194058bef4b220ad12ea497431d6cb6aa0623c8" + integrity sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw== + dependencies: + bn.js "^4.11.6" + elliptic "^6.4.0" + xhr-request-promise "^0.1.2" + +ethereum-bloom-filters@^1.0.6: + version "1.0.9" + resolved "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.9.tgz#4a59dead803af0c9e33834170bd7695df67061ec" + integrity sha512-GiK/RQkAkcVaEdxKVkPcG07PQ5vD7v2MFSHgZmBJSfMzNRHimntdBithsHAT89tAXnIpzVDWt8iaCD1DvkaxGg== + dependencies: + js-sha3 "^0.8.0" + +ethereum-cryptography@^0.1.3: + version "0.1.3" + resolved "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" + integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== + dependencies: + "@types/pbkdf2" "^3.0.0" + "@types/secp256k1" "^4.0.1" + blakejs "^1.1.0" + browserify-aes "^1.2.0" + bs58check "^2.1.2" + create-hash "^1.2.0" + create-hmac "^1.1.7" + hash.js "^1.1.7" + keccak "^3.0.0" + pbkdf2 "^3.0.17" + randombytes "^2.1.0" + safe-buffer "^5.1.2" + scrypt-js "^3.0.0" + secp256k1 "^4.0.1" + setimmediate "^1.0.5" + +ethereumjs-common@^1.3.2, ethereumjs-common@^1.5.0: + version "1.5.2" + resolved "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.5.2.tgz#2065dbe9214e850f2e955a80e650cb6999066979" + integrity sha512-hTfZjwGX52GS2jcVO6E2sx4YuFnf0Fhp5ylo4pEPhEffNln7vS59Hr5sLnp3/QCazFLluuBZ+FZ6J5HTp0EqCA== + +ethereumjs-tx@^2.1.1: + version "2.1.2" + resolved "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-2.1.2.tgz#5dfe7688bf177b45c9a23f86cf9104d47ea35fed" + integrity sha512-zZEK1onCeiORb0wyCXUvg94Ve5It/K6GD1K+26KfFKodiBiS6d9lfCXlUKGBBdQ+bv7Day+JK0tj1K+BeNFRAw== + dependencies: + ethereumjs-common "^1.5.0" + ethereumjs-util "^6.0.0" + +ethereumjs-util@6.2.1, ethereumjs-util@^6.0.0: + version "6.2.1" + resolved "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz#fcb4e4dd5ceacb9d2305426ab1a5cd93e3163b69" + integrity sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw== + dependencies: + "@types/bn.js" "^4.11.3" + bn.js "^4.11.0" + create-hash "^1.1.2" + elliptic "^6.5.2" + ethereum-cryptography "^0.1.3" + ethjs-util "0.1.6" + rlp "^2.2.3" + +ethers@^4.0.32: + version "4.0.48" + resolved "https://registry.npmjs.org/ethers/-/ethers-4.0.48.tgz#330c65b8133e112b0613156e57e92d9009d8fbbe" + integrity sha512-sZD5K8H28dOrcidzx9f8KYh8083n5BexIO3+SbE4jK83L85FxtpXZBCQdXb8gkg+7sBqomcLhhkU7UHL+F7I2g== + dependencies: + aes-js "3.0.0" + bn.js "^4.4.0" + elliptic "6.5.3" + hash.js "1.1.3" + js-sha3 "0.5.7" + scrypt-js "2.0.4" + setimmediate "1.0.4" + uuid "2.0.1" + xmlhttprequest "1.8.0" + +ethjs-unit@0.1.6: + version "0.1.6" + resolved "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" + integrity sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk= + dependencies: + bn.js "4.11.6" + number-to-bn "1.7.0" + +ethjs-util@0.1.6: + version "0.1.6" + resolved "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" + integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== + dependencies: + is-hex-prefixed "1.0.0" + strip-hex-prefix "1.0.0" + +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +eventemitter3@3.1.2, eventemitter3@^3.1.0: + version "3.1.2" + resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" + integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== + +eventemitter3@^4.0.0: + version "4.0.7" + resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== + +eventsource@1.0.7: + version "1.0.7" + resolved "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz#8fbc72c93fcd34088090bc0a4e64f4b5cee6d8d0" + integrity sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ== + dependencies: + original "^1.0.0" + +evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== + dependencies: + md5.js "^1.3.4" + safe-buffer "^5.1.1" + +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= + dependencies: + is-posix-bracket "^0.1.0" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= + dependencies: + fill-range "^2.1.0" + +express@^4.0.0, express@^4.14.0, express@^4.17.1: + version "4.17.1" + resolved "https://registry.npmjs.org/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" + integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== + dependencies: + accepts "~1.3.7" + array-flatten "1.1.1" + body-parser "1.19.0" + content-disposition "0.5.3" + content-type "~1.0.4" + cookie "0.4.0" + cookie-signature "1.0.6" + debug "2.6.9" + depd "~1.1.2" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "~1.1.2" + fresh "0.5.2" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "~2.3.0" + parseurl "~1.3.3" + path-to-regexp "0.1.7" + proxy-addr "~2.0.5" + qs "6.7.0" + range-parser "~1.2.1" + safe-buffer "5.1.2" + send "0.17.1" + serve-static "1.14.1" + setprototypeof "1.1.1" + statuses "~1.5.0" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + +ext@^1.1.2: + version "1.4.0" + resolved "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" + integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== + dependencies: + type "^2.0.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend@^3.0.0, extend@~3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= + dependencies: + is-extglob "^1.0.0" + +extract-files@9.0.0, extract-files@^9.0.0: + version "9.0.0" + resolved "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a" + integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ== + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +faker@^5.3.1: + version "5.4.0" + resolved "https://registry.npmjs.org/faker/-/faker-5.4.0.tgz#f18e55993c6887918182b003d163df14daeb3011" + integrity sha512-Y9n/Ky/xZx/Bj8DePvXspUYRtHl/rGQytoIT5LaxmNwSe3wWyOeOXb3lT6Dpipq240PVpeFaGKzScz/5fvff2g== + +fast-check@^2.12.1: + version "2.13.0" + resolved "https://registry.npmjs.org/fast-check/-/fast-check-2.13.0.tgz#92a50a6a39b58760d4b0b52b12f98f28a9f020f6" + integrity sha512-IOfzKm/SCA+jpUEgAfqAuxHYPmgtmpnnwljQmYPRGrqYczcTKApXKHza/SNxFxYkecWfZilYa0DJdBvqz1bcSw== + dependencies: + pure-rand "^4.1.1" + +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + +fast-future@~1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/fast-future/-/fast-future-1.0.2.tgz#8435a9aaa02d79248d17d704e76259301d99280a" + integrity sha1-hDWpqqAteSSNF9cE52JZMB2ZKAo= + +fast-glob@^3.1.1: + version "3.2.5" + resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661" + integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.0" + merge2 "^1.3.0" + micromatch "^4.0.2" + picomatch "^2.2.1" + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: + version "2.0.6" + resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +fastq@^1.6.0: + version "1.11.0" + resolved "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz#bb9fb955a07130a918eb63c1f5161cc32a5d0858" + integrity sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g== + dependencies: + reusify "^1.0.4" + +fb-watchman@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" + integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg== + dependencies: + bser "2.1.1" + +fbjs-css-vars@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" + integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== + +fbjs@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/fbjs/-/fbjs-3.0.0.tgz#0907067fb3f57a78f45d95f1eacffcacd623c165" + integrity sha512-dJd4PiDOFuhe7vk4F80Mba83Vr2QuK86FoxtgPmzBqEJahncp+13YCmfoa53KHCo6OnlXLG7eeMWPfB5CrpVKg== + dependencies: + cross-fetch "^3.0.4" + fbjs-css-vars "^1.0.0" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.18" + +fetch-cookie@0.10.1: + version "0.10.1" + resolved "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.10.1.tgz#5ea88f3d36950543c87997c27ae2aeafb4b5c4d4" + integrity sha512-beB+VEd4cNeVG1PY+ee74+PkuCQnik78pgLi5Ah/7qdUfov8IctU0vLUbBT8/10Ma5GMBeI4wtxhGrEfKNYs2g== + dependencies: + tough-cookie "^2.3.3 || ^3.0.1 || ^4.0.0" + +fetch-cookie@0.7.0: + version "0.7.0" + resolved "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.7.0.tgz#a6fc137ad8363aa89125864c6451b86ecb7de802" + integrity sha512-Mm5pGlT3agW6t71xVM7vMZPIvI7T4FaTuFW4jari6dVzYHFDb3WZZsGpN22r/o3XMdkM0E7sPd1EGeyVbH2Tgg== + dependencies: + es6-denodeify "^0.1.1" + tough-cookie "^2.3.1" + +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= + +fill-range@^2.1.0: + version "2.2.4" + resolved "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^3.0.0" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +finalhandler@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" + integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== + dependencies: + debug "2.6.9" + encodeurl "~1.0.2" + escape-html "~1.0.3" + on-finished "~2.3.0" + parseurl "~1.3.3" + statuses "~1.5.0" + unpipe "~1.0.0" + +find-up@5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + dependencies: + locate-path "^2.0.0" + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +first-chunk-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz#59bfb50cd905f60d7c394cd3d9acaab4e6ad934e" + integrity sha1-Wb+1DNkF9g18OUzT2ayqtOatk04= + +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + +flat@^4.1.0: + version "4.1.1" + resolved "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz#a392059cc382881ff98642f5da4dde0a959f309b" + integrity sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA== + dependencies: + is-buffer "~2.0.3" + +flatted@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469" + integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== + +for-each@^0.3.3: + version "0.3.3" + resolved "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== + dependencies: + is-callable "^1.1.3" + +for-in@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= + dependencies: + for-in "^1.0.1" + +foreach@^2.0.4: + version "2.0.5" + resolved "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +form-data@3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz#31b7e39c85f1355b7139ee0c647cf0de7f83c682" + integrity sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +form-data@4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +forwarded@~0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" + integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= + +fs-capacitor@^2.0.4: + version "2.0.4" + resolved "https://registry.npmjs.org/fs-capacitor/-/fs-capacitor-2.0.4.tgz#5a22e72d40ae5078b4fe64fe4d08c0d3fc88ad3c" + integrity sha512-8S4f4WsCryNw2mJJchi46YgB6CR5Ze+4L1h8ewl9tEpL4SJ3ZO+c/bS4BWhB8bK+O3TMqhuZarTitd0S0eh2pA== + +fs-capacitor@^6.1.0: + version "6.2.0" + resolved "https://registry.npmjs.org/fs-capacitor/-/fs-capacitor-6.2.0.tgz#fa79ac6576629163cb84561995602d8999afb7f5" + integrity sha512-nKcE1UduoSKX27NSZlg879LdQc94OtbOsEmKMN2MBNudXREvijRKx2GEBsTMTfws+BrbkJoEuynbGSVRSpauvw== + +fs-extra@5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" + integrity sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-extra@^4.0.2: + version "4.0.3" + resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" + integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-extra@^9.1.0: + version "9.1.0" + resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +fs-minipass@^1.2.5: + version "1.2.7" + resolved "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== + dependencies: + minipass "^2.6.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@~2.1.2: + version "2.1.3" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" + integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + +ganache-cli@^6.12.2: + version "6.12.2" + resolved "https://registry.npmjs.org/ganache-cli/-/ganache-cli-6.12.2.tgz#c0920f7db0d4ac062ffe2375cb004089806f627a" + integrity sha512-bnmwnJDBDsOWBUP8E/BExWf85TsdDEFelQSzihSJm9VChVO1SHp94YXLP5BlA4j/OTxp0wR4R1Tje9OHOuAJVw== + dependencies: + ethereumjs-util "6.2.1" + source-map-support "0.5.12" + yargs "13.2.4" + +ganache@^6.4.4: + version "6.4.4" + resolved "https://registry.npmjs.org/ganache/-/ganache-6.4.4.tgz#efb3eb5157b8987e5213584f24090322827c3521" + integrity sha512-uBCxKuyj1SSjz/iONMk1ZiHr1wf0bPG5E+qSO2lxyDq+dtZ5d/VvW6iKtg9bWikhG8hd1jU7kRkoS5f4q7FrWQ== + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" + integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + +get-params@^0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/get-params/-/get-params-0.1.2.tgz#bae0dfaba588a0c60d7834c0d8dc2ff60eeef2fe" + integrity sha1-uuDfq6WIoMYNeDTA2Nwv9g7u8v4= + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= + +get-stream@^4.0.0, get-stream@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + +get-stream@^5.1.0: + version "5.2.0" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" + integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== + dependencies: + pump "^3.0.0" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= + dependencies: + is-glob "^2.0.0" + +glob-parent@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= + dependencies: + is-glob "^3.1.0" + path-dirname "^1.0.0" + +glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@~5.1.0: + version "5.1.2" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-stream@^5.3.2: + version "5.3.5" + resolved "https://registry.npmjs.org/glob-stream/-/glob-stream-5.3.5.tgz#a55665a9a8ccdc41915a87c701e32d4e016fad22" + integrity sha1-pVZlqajM3EGRWofHAeMtTgFvrSI= + dependencies: + extend "^3.0.0" + glob "^5.0.3" + glob-parent "^3.0.0" + micromatch "^2.3.7" + ordered-read-streams "^0.3.0" + through2 "^0.6.0" + to-absolute-glob "^0.1.1" + unique-stream "^2.0.2" + +glob@7.1.6, glob@^7.1.1, glob@^7.1.3: + version "7.1.6" + resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^5.0.3: + version "5.0.15" + resolved "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" + integrity sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E= + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "2 || 3" + once "^1.3.0" + path-is-absolute "^1.0.0" + +global@~4.4.0: + version "4.4.0" + resolved "https://registry.npmjs.org/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" + integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== + dependencies: + min-document "^2.19.0" + process "^0.11.10" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^12.1.0: + version "12.4.0" + resolved "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" + integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== + dependencies: + type-fest "^0.8.1" + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== + +globby@11.0.2: + version "11.0.2" + resolved "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz#1af538b766a3b540ebfb58a32b2e2d5897321d83" + integrity sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.1.1" + ignore "^5.1.4" + merge2 "^1.3.0" + slash "^3.0.0" + +got@9.6.0: + version "9.6.0" + resolved "https://registry.npmjs.org/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" + integrity sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q== + dependencies: + "@sindresorhus/is" "^0.14.0" + "@szmarczak/http-timer" "^1.1.2" + cacheable-request "^6.0.0" + decompress-response "^3.3.0" + duplexer3 "^0.1.4" + get-stream "^4.1.0" + lowercase-keys "^1.0.1" + mimic-response "^1.0.1" + p-cancelable "^1.0.0" + to-readable-stream "^1.0.0" + url-parse-lax "^3.0.0" + +got@^7.1.0: + version "7.1.0" + resolved "https://registry.npmjs.org/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a" + integrity sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw== + dependencies: + decompress-response "^3.2.0" + duplexer3 "^0.1.4" + get-stream "^3.0.0" + is-plain-obj "^1.1.0" + is-retry-allowed "^1.0.0" + is-stream "^1.0.0" + isurl "^1.0.0-alpha5" + lowercase-keys "^1.0.0" + p-cancelable "^0.3.0" + p-timeout "^1.1.1" + safe-buffer "^5.0.1" + timed-out "^4.0.0" + url-parse-lax "^1.0.0" + url-to-options "^1.0.1" + +graceful-fs@4.X, graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.6" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" + integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== + +graphql-extensions@^0.12.8: + version "0.12.8" + resolved "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.12.8.tgz#9cdc2c43d8fe5e0f6c3177a004ac011da2a8aa0f" + integrity sha512-xjsSaB6yKt9jarFNNdivl2VOx52WySYhxPgf8Y16g6GKZyAzBoIFiwyGw5PJDlOSUa6cpmzn6o7z8fVMbSAbkg== + dependencies: + "@apollographql/apollo-tools" "^0.4.3" + apollo-server-env "^3.0.0" + apollo-server-types "^0.6.3" + +graphql-subscriptions@^1.0.0: + version "1.2.1" + resolved "https://registry.npmjs.org/graphql-subscriptions/-/graphql-subscriptions-1.2.1.tgz#2142b2d729661ddf967b7388f7cf1dd4cf2e061d" + integrity sha512-95yD/tKi24q8xYa7Q9rhQN16AYj5wPbrb8tmHGM3WRc9EBmWrG/0kkMl+tQG8wcEuE9ibR4zyOM31p5Sdr2v4g== + dependencies: + iterall "^1.3.0" + +graphql-tag@^2.11.0: + version "2.11.0" + resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.11.0.tgz#1deb53a01c46a7eb401d6cb59dec86fa1cccbffd" + integrity sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA== + +graphql-tag@^2.12.0: + version "2.12.1" + resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.1.tgz#b065ef885e4800e4afd0842811b718a205f4aa58" + integrity sha512-LPewEE1vzGkHnCO8zdOGogKsHHBdtpGyihow1UuMwp6RnZa0lAS7NcbvltLOuo4pi5diQCPASAXZkQq44ffixA== + dependencies: + tslib "^1.14.1" + +graphql-tools@^4.0.8: + version "4.0.8" + resolved "https://registry.npmjs.org/graphql-tools/-/graphql-tools-4.0.8.tgz#e7fb9f0d43408fb0878ba66b522ce871bafe9d30" + integrity sha512-MW+ioleBrwhRjalKjYaLQbr+920pHBgy9vM/n47sswtns8+96sRn5M/G+J1eu7IMeKWiN/9p6tmwCHU7552VJg== + dependencies: + apollo-link "^1.2.14" + apollo-utilities "^1.0.1" + deprecated-decorator "^0.1.6" + iterall "^1.1.3" + uuid "^3.1.0" + +graphql-tools@^6.2.4: + version "6.2.6" + resolved "https://registry.npmjs.org/graphql-tools/-/graphql-tools-6.2.6.tgz#557c6d32797a02988f214bd596dec2abd12425dd" + integrity sha512-OyhSvK5ALVVD6bFiWjAqv2+lRyvjIRfb6Br5Tkjrv++rxnXDodPH/zhMbDGRw+W3SD5ioGEEz84yO48iPiN7jA== + dependencies: + "@graphql-tools/batch-delegate" "^6.2.6" + "@graphql-tools/code-file-loader" "^6.2.4" + "@graphql-tools/delegate" "^6.2.4" + "@graphql-tools/git-loader" "^6.2.4" + "@graphql-tools/github-loader" "^6.2.4" + "@graphql-tools/graphql-file-loader" "^6.2.4" + "@graphql-tools/graphql-tag-pluck" "^6.2.4" + "@graphql-tools/import" "^6.2.4" + "@graphql-tools/json-file-loader" "^6.2.4" + "@graphql-tools/links" "^6.2.4" + "@graphql-tools/load" "^6.2.4" + "@graphql-tools/load-files" "^6.2.4" + "@graphql-tools/merge" "^6.2.4" + "@graphql-tools/mock" "^6.2.4" + "@graphql-tools/module-loader" "^6.2.4" + "@graphql-tools/relay-operation-optimizer" "^6.2.4" + "@graphql-tools/resolvers-composition" "^6.2.4" + "@graphql-tools/schema" "^6.2.4" + "@graphql-tools/stitch" "^6.2.4" + "@graphql-tools/url-loader" "^6.2.4" + "@graphql-tools/utils" "^6.2.4" + "@graphql-tools/wrap" "^6.2.4" + tslib "~2.0.1" + +graphql-upload@^11.0.0: + version "11.0.0" + resolved "https://registry.npmjs.org/graphql-upload/-/graphql-upload-11.0.0.tgz#24b245ff18f353bab6715e8a055db9fd73035e10" + integrity sha512-zsrDtu5gCbQFDWsNa5bMB4nf1LpKX9KDgh+f8oL1288ijV4RxeckhVozAjqjXAfRpxOHD1xOESsh6zq8SjdgjA== + dependencies: + busboy "^0.3.1" + fs-capacitor "^6.1.0" + http-errors "^1.7.3" + isobject "^4.0.0" + object-path "^0.11.4" + +graphql-ws@4.1.5: + version "4.1.5" + resolved "https://registry.npmjs.org/graphql-ws/-/graphql-ws-4.1.5.tgz#03526b29acb54a424a9fbe300a4bd69ff65a50b3" + integrity sha512-yUQ1AjegD1Y9jDS699kyw7Mw+9H+rILm2HoS8N5a5B5YTH93xy3yifFhAJpKGc2wb/8yGdlVy8gTcud0TPqi6Q== + +graphql@^15.3.0: + version "15.5.0" + resolved "https://registry.npmjs.org/graphql/-/graphql-15.5.0.tgz#39d19494dbe69d1ea719915b578bf920344a69d5" + integrity sha512-OmaM7y0kaK31NKG31q4YbD2beNYa6jBBKtMFT6gLYJljHLJr42IqJ8KX08u3Li/0ifzTU5HjmoOOrwa5BRLeDA== + +growl@1.10.5: + version "1.10.5" + resolved "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + +gulp-sourcemaps@^1.5.2: + version "1.12.1" + resolved "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.12.1.tgz#b437d1f3d980cf26e81184823718ce15ae6597b6" + integrity sha1-tDfR89mAzyboEYSCNxjOFa5ll7Y= + dependencies: + "@gulp-sourcemaps/map-sources" "1.X" + acorn "4.X" + convert-source-map "1.X" + css "2.X" + debug-fabulous "0.0.X" + detect-newline "2.X" + graceful-fs "4.X" + source-map "~0.6.0" + strip-bom "2.X" + through2 "2.X" + vinyl "1.X" + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.3: + version "5.1.5" + resolved "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" + integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== + dependencies: + ajv "^6.12.3" + har-schema "^2.0.0" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +has-bigints@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" + integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-symbol-support-x@^1.4.1: + version "1.4.2" + resolved "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz#1409f98bc00247da45da67cee0a36f282ff26455" + integrity sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw== + +has-symbols@^1.0.0, has-symbols@^1.0.1, has-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" + integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== + +has-to-string-tag-x@^1.2.0: + version "1.4.1" + resolved "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz#a045ab383d7b4b2012a00148ab0aa5f290044d4d" + integrity sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw== + dependencies: + has-symbol-support-x "^1.4.1" + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +hash.js@1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846" + integrity sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.0" + +hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: + version "1.1.7" + resolved "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +he@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +header-case@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/header-case/-/header-case-1.0.1.tgz#9535973197c144b09613cd65d317ef19963bd02d" + integrity sha1-lTWXMZfBRLCWE81l0xfvGZY70C0= + dependencies: + no-case "^2.2.0" + upper-case "^1.1.3" + +hmac-drbg@^1.0.0, hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +hoist-non-react-statics@^3.3.2: + version "3.3.2" + resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" + integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== + dependencies: + react-is "^16.7.0" + +hosted-git-info@^2.1.4: + version "2.8.8" + resolved "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" + integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + +htmlparser2@^3.9.1: + version "3.10.1" + resolved "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f" + integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ== + dependencies: + domelementtype "^1.3.1" + domhandler "^2.3.0" + domutils "^1.5.1" + entities "^1.1.1" + inherits "^2.0.1" + readable-stream "^3.1.1" + +htmlparser2@~3.8.1: + version "3.8.3" + resolved "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz#996c28b191516a8be86501a7d79757e5c70c1068" + integrity sha1-mWwosZFRaovoZQGn15dX5ccMEGg= + dependencies: + domelementtype "1" + domhandler "2.3" + domutils "1.5" + entities "1.0" + readable-stream "1.1" + +http-cache-semantics@^4.0.0: + version "4.1.0" + resolved "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" + integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== + +http-errors@1.7.2: + version "1.7.2" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" + integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + +http-errors@^1.7.3: + version "1.8.0" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz#75d1bbe497e1044f51e4ee9e704a62f28d336507" + integrity sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A== + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + +http-errors@~1.7.2: + version "1.7.3" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" + integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + +http-https@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz#2f908dd5f1db4068c058cd6e6d4ce392c913389b" + integrity sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs= + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +ice-cap@0.0.4: + version "0.0.4" + resolved "https://registry.npmjs.org/ice-cap/-/ice-cap-0.0.4.tgz#8a6d31ab4cac8d4b56de4fa946df3352561b6e18" + integrity sha1-im0xq0ysjUtW3k+pRt8zUlYbbhg= + dependencies: + cheerio "0.20.0" + color-logger "0.0.3" + +iconv-lite@0.4.24, iconv-lite@^0.4.4: + version "0.4.24" + resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +idna-uts46-hx@^2.3.1: + version "2.3.1" + resolved "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz#a1dc5c4df37eee522bf66d969cc980e00e8711f9" + integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA== + dependencies: + punycode "2.1.0" + +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +ignore-walk@^3.0.1: + version "3.0.3" + resolved "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + dependencies: + minimatch "^3.0.4" + +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +ignore@^5.1.4: + version "5.1.8" + resolved "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" + integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== + +immediate@3.0.6: + version "3.0.6" + resolved "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps= + +immediate@3.3.0, immediate@^3.2.2, immediate@^3.2.3: + version "3.3.0" + resolved "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz#1aef225517836bcdf7f2a2de2600c79ff0269266" + integrity sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q== + +immediate@~3.2.3: + version "3.2.3" + resolved "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c" + integrity sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw= + +immutable@~3.7.6: + version "3.7.6" + resolved "https://registry.npmjs.org/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" + integrity sha1-E7TTyxK++hVIKib+Gy665kAHHks= + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +import-from@3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/import-from/-/import-from-3.0.0.tgz#055cfec38cd5a27d8057ca51376d7d3bf0891966" + integrity sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ== + dependencies: + resolve-from "^5.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + +ini@~1.3.0: + version "1.3.8" + resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + +invariant@^2.2.2: + version "2.2.4" + resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= + +invert-kv@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" + integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== + +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + +is-arguments@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.0.tgz#62353031dfbee07ceb34656a6bde59efecae8dd9" + integrity sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg== + dependencies: + call-bind "^1.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-bigint@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz#6923051dfcbc764278540b9ce0e6b3213aa5ebc2" + integrity sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg== + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-boolean-object@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.0.tgz#e2aaad3a3a8fca34c28f6eee135b156ed2587ff0" + integrity sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA== + dependencies: + call-bind "^1.0.0" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-buffer@~2.0.3: + version "2.0.5" + resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" + integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== + +is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.3: + version "1.2.3" + resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" + integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== + +is-core-module@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" + integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== + dependencies: + has "^1.0.3" + +is-date-object@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" + integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== + +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= + +is-extglob@^2.1.0, is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-finite@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz#904135c77fb42c0641d6aa1bcdbc4daa8da082f3" + integrity sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w== + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-function@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" + integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== + +is-glob@4.0.1, is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= + dependencies: + is-extglob "^1.0.0" + +is-glob@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= + dependencies: + is-extglob "^2.1.0" + +is-hex-prefixed@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" + integrity sha1-fY035q135dEnFIkTxXPggtd39VQ= + +is-lower-case@^1.1.0: + version "1.1.3" + resolved "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz#7e147be4768dc466db3bfb21cc60b31e6ad69393" + integrity sha1-fhR75HaNxGbbO/shzGCzHmrWk5M= + dependencies: + lower-case "^1.1.0" + +is-map@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" + integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg== + +is-negative-zero@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" + integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== + +is-number-object@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197" + integrity sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw== + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= + dependencies: + kind-of "^3.0.2" + +is-number@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= + +is-object@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz#a56552e1c665c9e950b4a025461da87e72f86fcf" + integrity sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA== + +is-plain-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= + +is-promise@4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" + integrity sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ== + +is-regex@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz#81c8ebde4db142f2cf1c53fc86d6a45788266251" + integrity sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg== + dependencies: + call-bind "^1.0.2" + has-symbols "^1.0.1" + +is-retry-allowed@^1.0.0: + version "1.2.0" + resolved "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4" + integrity sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg== + +is-set@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec" + integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g== + +is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-string@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" + integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== + +is-symbol@^1.0.2, is-symbol@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== + dependencies: + has-symbols "^1.0.1" + +is-typedarray@^1.0.0, is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +is-upper-case@^1.1.0: + version "1.1.2" + resolved "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz#8d0b1fa7e7933a1e58483600ec7d9661cbaf756f" + integrity sha1-jQsfp+eTOh5YSDYA7H2WYcuvdW8= + dependencies: + upper-case "^1.1.0" + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= + +is-valid-glob@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-0.3.0.tgz#d4b55c69f51886f9b65c70d6c2622d37e29f48fe" + integrity sha1-1LVcafUYhvm2XHDWwmItN+KfSP4= + +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0" + integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA== + +isomorphic-ws@4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" + integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +isurl@^1.0.0-alpha5: + version "1.0.0" + resolved "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" + integrity sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w== + dependencies: + has-to-string-tag-x "^1.2.0" + is-object "^1.0.1" + +iterall@^1.1.3, iterall@^1.2.1, iterall@^1.3.0: + version "1.3.0" + resolved "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea" + integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg== + +iterate-iterator@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz#1693a768c1ddd79c969051459453f082fe82e9f6" + integrity sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw== + +iterate-value@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz#935115bd37d006a52046535ebc8d07e9c9337f57" + integrity sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ== + dependencies: + es-get-iterator "^1.0.2" + iterate-iterator "^1.0.1" + +js-sha3@0.5.7, js-sha3@^0.5.7: + version "0.5.7" + resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" + integrity sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= + +js-sha3@^0.8.0: + version "0.8.0" + resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +js-yaml@3.14.0: + version "3.14.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsan@^3.1.13: + version "3.1.13" + resolved "https://registry.npmjs.org/jsan/-/jsan-3.1.13.tgz#4de8c7bf8d1cfcd020c313d438f930cec4b91d86" + integrity sha512-9kGpCsGHifmw6oJet+y8HaCl14y7qgAsxVdV3pCHDySNR3BfDC30zgkssd7x5LRVAT22dnpbe9JdzzmXZnq9/g== + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +jsdom@^7.0.2: + version "7.2.2" + resolved "https://registry.npmjs.org/jsdom/-/jsdom-7.2.2.tgz#40b402770c2bda23469096bee91ab675e3b1fc6e" + integrity sha1-QLQCdwwr2iNGkJa+6Rq2deOx/G4= + dependencies: + abab "^1.0.0" + acorn "^2.4.0" + acorn-globals "^1.0.4" + cssom ">= 0.3.0 < 0.4.0" + cssstyle ">= 0.2.29 < 0.3.0" + escodegen "^1.6.1" + nwmatcher ">= 1.3.7 < 2.0.0" + parse5 "^1.5.1" + request "^2.55.0" + sax "^1.1.4" + symbol-tree ">= 3.1.0 < 4.0.0" + tough-cookie "^2.2.0" + webidl-conversions "^2.0.0" + whatwg-url-compat "~0.6.5" + xml-name-validator ">= 2.0.1 < 3.0.0" + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + integrity sha1-RsP+yMGJKxKwgz25vHYiF226s0s= + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +json-buffer@3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" + integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg= + +json-pointer@^0.6.0: + version "0.6.1" + resolved "https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.1.tgz#3c6caa6ac139e2599f5a1659d39852154015054d" + integrity sha512-3OvjqKdCBvH41DLpV4iSt6v2XhZXV1bPB4OROuknvUXI7ZQNofieCPkmE26stEJ9zdQuvIxDHCuYhfgxFAAs+Q== + dependencies: + foreach "^2.0.4" + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + +json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= + dependencies: + jsonify "~0.0.0" + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +json5@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + dependencies: + minimist "^1.2.0" + +json5@^2.1.2: + version "2.2.0" + resolved "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" + integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== + dependencies: + minimist "^1.2.5" + +jsondown@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/jsondown/-/jsondown-1.0.0.tgz#c5cc5cda65f515d2376136a104b5f535534f26e3" + integrity sha512-p6XxPaq59aXwcdDQV3ISMA5xk+1z6fJuctcwwSdR9iQgbYOcIrnknNrhcMGG+0FaUfKHGkdDpQNaZrovfBoyOw== + dependencies: + memdown "1.4.1" + mkdirp "0.5.1" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +keccak@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz#ae30a0e94dbe43414f741375cff6d64c8bea0bff" + integrity sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + +keyv@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" + integrity sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA== + dependencies: + json-buffer "3.0.0" + +kind-of@^3.0.2: + version "3.2.2" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^6.0.0: + version "6.0.3" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + +lazy-debug-legacy@0.0.X: + version "0.0.1" + resolved "https://registry.npmjs.org/lazy-debug-legacy/-/lazy-debug-legacy-0.0.1.tgz#537716c0776e4cf79e3ed1b621f7658c2911b1b1" + integrity sha1-U3cWwHduTPeePtG2IfdljCkRsbE= + +lazystream@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4" + integrity sha1-9plf4PggOS9hOWvolGJAe7dxaOQ= + dependencies: + readable-stream "^2.0.5" + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= + dependencies: + invert-kv "^1.0.0" + +lcid@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" + integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== + dependencies: + invert-kv "^2.0.0" + +level-codec@9.0.1: + version "9.0.1" + resolved "https://registry.npmjs.org/level-codec/-/level-codec-9.0.1.tgz#042f4aa85e56d4328ace368c950811ba802b7247" + integrity sha512-ajFP0kJ+nyq4i6kptSM+mAvJKLOg1X5FiFPtLG9M5gCEZyBmgDi3FkDrvlMkEzrUn1cWxtvVmrvoS4ASyO/q+Q== + +level-codec@9.0.2, level-codec@^9.0.0: + version "9.0.2" + resolved "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz#fd60df8c64786a80d44e63423096ffead63d8cbc" + integrity sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ== + dependencies: + buffer "^5.6.0" + +level-concat-iterator@~2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz#1d1009cf108340252cb38c51f9727311193e6263" + integrity sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw== + +level-errors@^2.0.0, level-errors@~2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz#2132a677bf4e679ce029f517c2f17432800c05c8" + integrity sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw== + dependencies: + errno "~0.1.1" + +level-iterator-stream@~4.0.0: + version "4.0.2" + resolved "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz#7ceba69b713b0d7e22fcc0d1f128ccdc8a24f79c" + integrity sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q== + dependencies: + inherits "^2.0.4" + readable-stream "^3.4.0" + xtend "^4.0.2" + +level-js@^4.0.0: + version "4.0.2" + resolved "https://registry.npmjs.org/level-js/-/level-js-4.0.2.tgz#fa51527fa38b87c4d111b0d0334de47fcda38f21" + integrity sha512-PeGjZsyMG4O89KHiez1zoMJxStnkM+oBIqgACjoo5PJqFiSUUm3GNod/KcbqN5ktyZa8jkG7I1T0P2u6HN9lIg== + dependencies: + abstract-leveldown "~6.0.1" + immediate "~3.2.3" + inherits "^2.0.3" + ltgt "^2.1.2" + typedarray-to-buffer "~3.1.5" + +level-packager@^5.0.0: + version "5.1.1" + resolved "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz#323ec842d6babe7336f70299c14df2e329c18939" + integrity sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ== + dependencies: + encoding-down "^6.3.0" + levelup "^4.3.2" + +level-supports@~1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz#2f530a596834c7301622521988e2c36bb77d122d" + integrity sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg== + dependencies: + xtend "^4.0.2" + +level-write-stream@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/level-write-stream/-/level-write-stream-1.0.0.tgz#3f7fbb679a55137c0feb303dee766e12ee13c1dc" + integrity sha1-P3+7Z5pVE3wP6zA97nZuEu4Twdw= + dependencies: + end-stream "~0.1.0" + +level@5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/level/-/level-5.0.1.tgz#8528cc1ee37ac413270129a1eab938c610be3ccb" + integrity sha512-wcak5OQeA4rURGacqS62R/xNHjCYnJSQDBOlm4KNUGJVE9bWv2B04TclqReYejN+oD65PzD4FsqeWoI5wNC5Lg== + dependencies: + level-js "^4.0.0" + level-packager "^5.0.0" + leveldown "^5.0.0" + opencollective-postinstall "^2.0.0" + +leveldown@5.0.2: + version "5.0.2" + resolved "https://registry.npmjs.org/leveldown/-/leveldown-5.0.2.tgz#c8edc2308c8abf893ffc81e66ab6536111cae92c" + integrity sha512-Ib6ygFYBleS8x2gh3C1AkVsdrUShqXpe6jSTnZ6sRycEXKhqVf+xOSkhgSnjidpPzyv0d95LJVFrYQ4NuXAqHA== + dependencies: + abstract-leveldown "~6.0.0" + fast-future "~1.0.2" + napi-macros "~1.8.1" + node-gyp-build "~3.8.0" + +leveldown@^5.0.0: + version "5.6.0" + resolved "https://registry.npmjs.org/leveldown/-/leveldown-5.6.0.tgz#16ba937bb2991c6094e13ac5a6898ee66d3eee98" + integrity sha512-iB8O/7Db9lPaITU1aA2txU/cBEXAt4vWwKQRrrWuS6XDgbP4QZGj9BL2aNbwb002atoQ/lIotJkfyzz+ygQnUQ== + dependencies: + abstract-leveldown "~6.2.1" + napi-macros "~2.0.0" + node-gyp-build "~4.1.0" + +levelup@4.0.2: + version "4.0.2" + resolved "https://registry.npmjs.org/levelup/-/levelup-4.0.2.tgz#bcb8d28d0a82ee97f1c6d00f20ea6d32c2803c5b" + integrity sha512-cx9PmLENwbGA3svWBEbeO2HazpOSOYSXH4VA+ahVpYyurvD+SDSfURl29VBY2qgyk+Vfy2dJd71SBRckj/EZVA== + dependencies: + deferred-leveldown "~5.0.0" + level-errors "~2.0.0" + level-iterator-stream "~4.0.0" + xtend "~4.0.0" + +levelup@4.4.0, levelup@^4.3.2: + version "4.4.0" + resolved "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz#f89da3a228c38deb49c48f88a70fb71f01cafed6" + integrity sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ== + dependencies: + deferred-leveldown "~5.3.0" + level-errors "~2.0.0" + level-iterator-stream "~4.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +levn@~0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +linked-list@0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/linked-list/-/linked-list-0.1.0.tgz#798b0ff97d1b92a4fd08480f55aea4e9d49d37bf" + integrity sha1-eYsP+X0bkqT9CEgPVa6k6dSdN78= + +load-json-file@^1.0.0, load-json-file@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash-es@^4.2.1: + version "4.17.21" + resolved "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + +lodash._reinterpolate@^3.0.0, lodash._reinterpolate@~3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" + integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= + +lodash.assign@^4.0.3, lodash.assign@^4.0.6: + version "4.2.0" + resolved "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" + integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc= + +lodash.assignin@^4.2.0: + version "4.2.0" + resolved "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz#ba8df5fb841eb0a3e8044232b0e263a8dc6a28a2" + integrity sha1-uo31+4QesKPoBEIysOJjqNxqKKI= + +lodash.assigninwith@^4.0.0: + version "4.2.0" + resolved "https://registry.npmjs.org/lodash.assigninwith/-/lodash.assigninwith-4.2.0.tgz#af02c98432ac86d93da695b4be801401971736af" + integrity sha1-rwLJhDKshtk9ppW0voAUAZcXNq8= + +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= + +lodash.escaperegexp@^4.1.2: + version "4.1.2" + resolved "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347" + integrity sha1-ZHYsSGGAglGKw99Mz11YhtriA0c= + +lodash.flatten@^4.4.0: + version "4.4.0" + resolved "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" + integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= + +lodash.isequal@^4.0.0: + version "4.5.0" + resolved "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + +lodash.keys@^4.0.0: + version "4.2.0" + resolved "https://registry.npmjs.org/lodash.keys/-/lodash.keys-4.2.0.tgz#a08602ac12e4fb83f91fc1fb7a360a4d9ba35205" + integrity sha1-oIYCrBLk+4P5H8H7ejYKTZujUgU= + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.partition@^4.6.0: + version "4.6.0" + resolved "https://registry.npmjs.org/lodash.partition/-/lodash.partition-4.6.0.tgz#a38e46b73469e0420b0da1212e66d414be364ba4" + integrity sha1-o45GtzRp4EILDaEhLmbUFL42S6Q= + +lodash.rest@^4.0.0: + version "4.0.5" + resolved "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.5.tgz#954ef75049262038c96d1fc98b28fdaf9f0772aa" + integrity sha1-lU73UEkmIDjJbR/Jiyj9r58Hcqo= + +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= + +lodash.sum@^4.0.2: + version "4.0.2" + resolved "https://registry.npmjs.org/lodash.sum/-/lodash.sum-4.0.2.tgz#ad90e397965d803d4f1ff7aa5b2d0197f3b4637b" + integrity sha1-rZDjl5ZdgD1PH/eqWy0Bl/O0Y3s= + +lodash.template@4.2.4: + version "4.2.4" + resolved "https://registry.npmjs.org/lodash.template/-/lodash.template-4.2.4.tgz#d053c19e8e74e38d965bf4fb495d80f109e7f7a4" + integrity sha1-0FPBno50442WW/T7SV2A8Qnn96Q= + dependencies: + lodash._reinterpolate "~3.0.0" + lodash.assigninwith "^4.0.0" + lodash.keys "^4.0.0" + lodash.rest "^4.0.0" + lodash.templatesettings "^4.0.0" + lodash.tostring "^4.0.0" + +lodash.templatesettings@^4.0.0: + version "4.2.0" + resolved "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33" + integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ== + dependencies: + lodash._reinterpolate "^3.0.0" + +lodash.tostring@^4.0.0: + version "4.1.4" + resolved "https://registry.npmjs.org/lodash.tostring/-/lodash.tostring-4.1.4.tgz#560c27d1f8eadde03c2cce198fef5c031d8298fb" + integrity sha1-Vgwn0fjq3eA8LM4Zj+9cAx2CmPs= + +lodash.zipwith@^4.2.0: + version "4.2.0" + resolved "https://registry.npmjs.org/lodash.zipwith/-/lodash.zipwith-4.2.0.tgz#afacf03fd2f384af29e263c3c6bda3b80e3f51fd" + integrity sha1-r6zwP9LzhK8p4mPDxr2juA4/Uf0= + +lodash@4.17.21, lodash@^4.1.0, lodash@^4.15.0, lodash@^4.17.11, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.4, lodash@^4.2.1: + version "4.17.21" + resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +log-symbols@4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" + integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== + dependencies: + chalk "^4.0.0" + +log-symbols@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== + dependencies: + chalk "^2.0.1" + +loglevel@^1.6.7: + version "1.7.1" + resolved "https://registry.npmjs.org/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197" + integrity sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw== + +long@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +lower-case-first@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/lower-case-first/-/lower-case-first-1.0.2.tgz#e5da7c26f29a7073be02d52bac9980e5922adfa1" + integrity sha1-5dp8JvKacHO+AtUrrJmA5ZIq36E= + dependencies: + lower-case "^1.1.2" + +lower-case@^1.1.0, lower-case@^1.1.1, lower-case@^1.1.2: + version "1.1.4" + resolved "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" + integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= + +lower-case@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28" + integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg== + dependencies: + tslib "^2.0.3" + +lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" + integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== + +lowercase-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" + integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +ltgt@2.2.1, ltgt@^2.1.2, ltgt@~2.2.0: + version "2.2.1" + resolved "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" + integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU= + +make-dir@^1.0.0: + version "1.3.0" + resolved "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" + integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== + dependencies: + pify "^3.0.0" + +map-age-cleaner@^0.1.1: + version "0.1.3" + resolved "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== + dependencies: + p-defer "^1.0.0" + +map-stream@0.0.6: + version "0.0.6" + resolved "https://registry.npmjs.org/map-stream/-/map-stream-0.0.6.tgz#d2ef4eb811a28644c7a8989985c69c2fdd496827" + integrity sha1-0u9OuBGihkTHqJiZhcacL91JaCc= + +marked@0.3.19: + version "0.3.19" + resolved "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" + integrity sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg== + +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== + +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= + +mem@^4.0.0: + version "4.3.0" + resolved "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" + integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== + dependencies: + map-age-cleaner "^0.1.1" + mimic-fn "^2.0.0" + p-is-promise "^2.0.0" + +memdown@1.4.1: + version "1.4.1" + resolved "https://registry.npmjs.org/memdown/-/memdown-1.4.1.tgz#b4e4e192174664ffbae41361aa500f3119efe215" + integrity sha1-tOThkhdGZP+65BNhqlAPMRnv4hU= + dependencies: + abstract-leveldown "~2.7.1" + functional-red-black-tree "^1.0.1" + immediate "^3.2.3" + inherits "~2.0.1" + ltgt "~2.2.0" + safe-buffer "~5.1.1" + +merge-descriptors@1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" + integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= + +merge-stream@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" + integrity sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE= + dependencies: + readable-stream "^2.0.1" + +merge2@^1.3.0: + version "1.4.1" + resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= + +micromatch@^2.3.7: + version "2.3.11" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +micromatch@^4.0.2: + version "4.0.2" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" + integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + dependencies: + braces "^3.0.1" + picomatch "^2.0.5" + +miller-rabin@^4.0.0: + version "4.0.1" + resolved "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" + integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== + dependencies: + bn.js "^4.0.0" + brorand "^1.0.1" + +mime-db@1.46.0: + version "1.46.0" + resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz#6267748a7f799594de3cbc8cde91def349661cee" + integrity sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ== + +mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24: + version "2.1.29" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz#1d4ab77da64b91f5f72489df29236563754bb1b2" + integrity sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ== + dependencies: + mime-db "1.46.0" + +mime@1.6.0: + version "1.6.0" + resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + +mimic-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +mimic-response@^1.0.0, mimic-response@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" + integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== + +min-document@^2.19.0: + version "2.19.0" + resolved "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" + integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU= + dependencies: + dom-walk "^0.1.0" + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= + +"minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +minimist@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +minimist@^1.2.0, minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + +minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + +minizlib@^1.2.1: + version "1.3.3" + resolved "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== + dependencies: + minipass "^2.9.0" + +mkdirp-promise@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" + integrity sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE= + dependencies: + mkdirp "*" + +mkdirp@*: + version "1.0.4" + resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + +mkdirp@0.5.1: + version "0.5.1" + resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.5" + resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== + dependencies: + minimist "^1.2.5" + +mocha@8.1.2: + version "8.1.2" + resolved "https://registry.npmjs.org/mocha/-/mocha-8.1.2.tgz#d67fad13300e4f5cd48135a935ea566f96caf827" + integrity sha512-I8FRAcuACNMLQn3lS4qeWLxXqLvGf6r2CaLstDpZmMUUSmvW6Cnm1AuHxgbc7ctZVRcfwspCRbDHymPsi3dkJw== + dependencies: + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.4.2" + debug "4.1.1" + diff "4.0.2" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.1.6" + growl "1.10.5" + he "1.2.0" + js-yaml "3.14.0" + log-symbols "4.0.0" + minimatch "3.0.4" + ms "2.1.2" + object.assign "4.1.0" + promise.allsettled "1.0.2" + serialize-javascript "4.0.0" + strip-json-comments "3.0.1" + supports-color "7.1.0" + which "2.0.2" + wide-align "1.1.3" + workerpool "6.0.0" + yargs "13.3.2" + yargs-parser "13.1.2" + yargs-unparser "1.6.1" + +mock-fs@^4.1.0: + version "4.13.0" + resolved "https://registry.npmjs.org/mock-fs/-/mock-fs-4.13.0.tgz#31c02263673ec3789f90eb7b6963676aa407a598" + integrity sha512-DD0vOdofJdoaRNtnWcrXe6RQbpHkPPmtqGq14uRX0F8ZKJ5nv89CVTYl/BZdppDxBDaV0hl75htg3abpEWlPZA== + +module@^1.2.5: + version "1.2.5" + resolved "https://registry.npmjs.org/module/-/module-1.2.5.tgz#b503eb06cdc13473f56818426974cde7ec59bf15" + integrity sha1-tQPrBs3BNHP1aBhCaXTN5+xZvxU= + dependencies: + chalk "1.1.3" + concat-stream "1.5.1" + lodash.template "4.2.4" + map-stream "0.0.6" + tildify "1.2.0" + vinyl-fs "2.4.3" + yargs "4.6.0" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@^2.1.1: + version "2.1.3" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +multibase@^0.7.0: + version "0.7.0" + resolved "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" + integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== + dependencies: + base-x "^3.0.8" + buffer "^5.5.0" + +multibase@~0.6.0: + version "0.6.1" + resolved "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz#b76df6298536cc17b9f6a6db53ec88f85f8cc12b" + integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== + dependencies: + base-x "^3.0.8" + buffer "^5.5.0" + +multicodec@^0.5.5: + version "0.5.7" + resolved "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz#1fb3f9dd866a10a55d226e194abba2dcc1ee9ffd" + integrity sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA== + dependencies: + varint "^5.0.0" + +multicodec@^1.0.0: + version "1.0.4" + resolved "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz#46ac064657c40380c28367c90304d8ed175a714f" + integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== + dependencies: + buffer "^5.6.0" + varint "^5.0.0" + +multihashes@^0.4.15, multihashes@~0.4.15: + version "0.4.21" + resolved "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz#dc02d525579f334a7909ade8a122dabb58ccfcb5" + integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== + dependencies: + buffer "^5.5.0" + multibase "^0.7.0" + varint "^5.0.0" + +nan@^2.12.1: + version "2.14.2" + resolved "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" + integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== + +nano-json-stream-parser@^0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz#0cc8f6d0e2b622b479c40d499c46d64b755c6f5f" + integrity sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18= + +nanoid@^2.0.0: + version "2.1.11" + resolved "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz#ec24b8a758d591561531b4176a01e3ab4f0f0280" + integrity sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA== + +napi-macros@~1.8.1: + version "1.8.2" + resolved "https://registry.npmjs.org/napi-macros/-/napi-macros-1.8.2.tgz#299265c1d8aa401351ad0675107d751228c03eda" + integrity sha512-Tr0DNY4RzTaBG2W2m3l7ZtFuJChTH6VZhXVhkGGjF/4cZTt+i8GcM9ozD+30Lmr4mDoZ5Xx34t2o4GJqYWDGcg== + +napi-macros@~2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" + integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +needle@^2.2.1: + version "2.6.0" + resolved "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz#24dbb55f2509e2324b4a99d61f413982013ccdbe" + integrity sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg== + dependencies: + debug "^3.2.6" + iconv-lite "^0.4.4" + sax "^1.2.4" + +negotiator@0.6.2: + version "0.6.2" + resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" + integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== + +next-tick@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +no-case@^2.2.0, no-case@^2.3.2: + version "2.3.2" + resolved "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" + integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ== + dependencies: + lower-case "^1.1.1" + +no-case@^3.0.4: + version "3.0.4" + resolved "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d" + integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg== + dependencies: + lower-case "^2.0.2" + tslib "^2.0.3" + +node-addon-api@^2.0.0: + version "2.0.2" + resolved "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" + integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== + +node-fetch@2.4.1: + version "2.4.1" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.4.1.tgz#b2e38f1117b8acbedbe0524f041fb3177188255d" + integrity sha512-P9UbpFK87NyqBZzUuDBDz4f6Yiys8xm8j7ACDbi6usvFm6KItklQUKjeoqTrYS/S1k6I8oaOC2YLLDr/gg26Mw== + +node-fetch@2.6.0: + version "2.6.0" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" + integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + +node-fetch@2.6.1, node-fetch@^2.1.2, node-fetch@^2.2.0, node-fetch@^2.6.1: + version "2.6.1" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + +node-gyp-build@^4.2.0: + version "4.2.3" + resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz#ce6277f853835f718829efb47db20f3e4d9c4739" + integrity sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg== + +node-gyp-build@~3.8.0: + version "3.8.0" + resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.8.0.tgz#0f57efeb1971f404dfcbfab975c284de7c70f14a" + integrity sha512-bYbpIHyRqZ7sVWXxGpz8QIRug5JZc/hzZH4GbdT9HTZi6WmKCZ8GLvP8OZ9TTiIBvwPFKgtGrlWQSXDAvYdsPw== + +node-gyp-build@~4.1.0: + version "4.1.1" + resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz#d7270b5d86717068d114cc57fff352f96d745feb" + integrity sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ== + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +node-interval-tree@^1.3.3: + version "1.3.3" + resolved "https://registry.npmjs.org/node-interval-tree/-/node-interval-tree-1.3.3.tgz#15ffb904cde08270214acace8dc7653e89ae32b7" + integrity sha512-K9vk96HdTK5fEipJwxSvIIqwTqr4e3HRJeJrNxBSeVMNSC/JWARRaX7etOLOuTmrRMeOI/K5TCJu3aWIwZiNTw== + dependencies: + shallowequal "^1.0.2" + +node-pre-gyp@^0.11.0: + version "0.11.0" + resolved "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz#db1f33215272f692cd38f03238e3e9b47c5dd054" + integrity sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q== + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.1" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" + +node-releases@^1.1.70: + version "1.1.71" + resolved "https://registry.npmjs.org/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb" + integrity sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg== + +nofilter@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/nofilter/-/nofilter-1.0.4.tgz#78d6f4b6a613e7ced8b015cec534625f7667006e" + integrity sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA== + +noop-fn@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/noop-fn/-/noop-fn-1.0.0.tgz#5f33d47f13d2150df93e0cb036699e982f78ffbf" + integrity sha1-XzPUfxPSFQ35PgywNmmemC94/78= + +nopt@^4.0.1: + version "4.0.3" + resolved "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" + integrity sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== + dependencies: + abbrev "1" + osenv "^0.1.4" + +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.1, normalize-path@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + dependencies: + remove-trailing-separator "^1.0.1" + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +normalize-url@^4.1.0: + version "4.5.0" + resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129" + integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ== + +npm-bundled@^1.0.1: + version "1.1.1" + resolved "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" + integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== + dependencies: + npm-normalize-package-bin "^1.0.1" + +npm-normalize-package-bin@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" + integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== + +npm-packlist@^1.1.6: + version "1.4.8" + resolved "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz#56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e" + integrity sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + npm-normalize-package-bin "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= + dependencies: + path-key "^2.0.0" + +npmlog@^4.0.2: + version "4.1.2" + resolved "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +nth-check@~1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c" + integrity sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg== + dependencies: + boolbase "~1.0.0" + +nullthrows@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1" + integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw== + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +number-to-bn@1.7.0: + version "1.7.0" + resolved "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" + integrity sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA= + dependencies: + bn.js "4.11.6" + strip-hex-prefix "1.0.0" + +"nwmatcher@>= 1.3.7 < 2.0.0": + version "1.4.4" + resolved "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.4.tgz#2285631f34a95f0d0395cd900c96ed39b58f346e" + integrity sha512-3iuY4N5dhgMpCUrOVnuAdGrgxVqV2cJpM+XNccjR2DKOB1RUP0aA+wGXEiNziG/UKboFyGBIoKOaNlJxx8bciQ== + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +object-assign@4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0" + integrity sha1-ejs9DpgGPUP0wD8uiubNUahog6A= + +object-assign@^4, object-assign@^4.0.0, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-inspect@^1.9.0: + version "1.9.0" + resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz#c90521d74e1127b67266ded3394ad6116986533a" + integrity sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw== + +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object-path@^0.11.4: + version "0.11.5" + resolved "https://registry.npmjs.org/object-path/-/object-path-0.11.5.tgz#d4e3cf19601a5140a55a16ad712019a9c50b577a" + integrity sha512-jgSbThcoR/s+XumvGMTMf81QVBmah+/Q7K7YduKeKVWL7N111unR2d6pZZarSk6kY/caeNxUDyxOvMWyzoU2eg== + +object.assign@4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.assign@^4.1.0, object.assign@^4.1.2: + version "4.1.2" + resolved "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" + integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + has-symbols "^1.0.1" + object-keys "^1.1.1" + +object.entries@^1.1.2: + version "1.1.3" + resolved "https://registry.npmjs.org/object.entries/-/object.entries-1.1.3.tgz#c601c7f168b62374541a07ddbd3e2d5e4f7711a6" + integrity sha512-ym7h7OZebNS96hn5IJeyUmaWhaSM4SVtAPPfNLQEI2MYWCO2egsITb9nab2+i/Pwibx+R0mtn+ltKJXRSeTMGg== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.1" + has "^1.0.3" + +object.getownpropertydescriptors@^2.1.1: + version "2.1.2" + resolved "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.2.tgz#1bd63aeacf0d5d2d2f31b5e393b03a7c601a23f7" + integrity sha512-WtxeKSzfBjlzL+F9b7M7hewDzMwy+C8NRssHd1YrNlzHzIDrXcXiNOMrezdAEM4UXixgV+vvnyBeN7Rygl2ttQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.2" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +object.values@^1.1.1: + version "1.1.3" + resolved "https://registry.npmjs.org/object.values/-/object.values-1.1.3.tgz#eaa8b1e17589f02f698db093f7c62ee1699742ee" + integrity sha512-nkF6PfDB9alkOUxpf1HNm/QlkeW3SReqL5WXeBLpEJJnlPSvRaDQpW3gQTksTN3fgJX4hL42RzKyOin6ff3tyw== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.2" + has "^1.0.3" + +oboe@2.1.4: + version "2.1.4" + resolved "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz#20c88cdb0c15371bb04119257d4fdd34b0aa49f6" + integrity sha1-IMiM2wwVNxuwQRklfU/dNLCqSfY= + dependencies: + http-https "^1.0.0" + +on-finished@~2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" + integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= + dependencies: + ee-first "1.1.1" + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= + dependencies: + mimic-fn "^1.0.0" + +opencollective-postinstall@^2.0.0: + version "2.0.3" + resolved "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259" + integrity sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q== + +optimism@^0.14.0: + version "0.14.1" + resolved "https://registry.npmjs.org/optimism/-/optimism-0.14.1.tgz#db35a0c770e16863f6c288f7cf58341a2348db44" + integrity sha512-7+1lSN+LJEtaj3uBLLFk8uFCFKy3txLvcvln5Dh1szXjF9yghEMeWclmnk0qdtYZ+lcMNyu48RmQQRw+LRYKSQ== + dependencies: + "@wry/context" "^0.5.2" + "@wry/trie" "^0.2.1" + +optionator@^0.8.1: + version "0.8.3" + resolved "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.6" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + word-wrap "~1.2.3" + +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + +ora@^3.4.0: + version "3.4.0" + resolved "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318" + integrity sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg== + dependencies: + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-spinners "^2.0.0" + log-symbols "^2.2.0" + strip-ansi "^5.2.0" + wcwidth "^1.0.1" + +ordered-read-streams@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.3.0.tgz#7137e69b3298bb342247a1bbee3881c80e2fd78b" + integrity sha1-cTfmmzKYuzQiR6G77jiByA4v14s= + dependencies: + is-stream "^1.0.1" + readable-stream "^2.0.1" + +original-require@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/original-require/-/original-require-1.0.1.tgz#0f130471584cd33511c5ec38c8d59213f9ac5e20" + integrity sha1-DxMEcVhM0zURxew4yNWSE/msXiA= + +original@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/original/-/original-1.0.2.tgz#e442a61cffe1c5fd20a65f3261c26663b303f25f" + integrity sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg== + dependencies: + url-parse "^1.4.3" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +os-locale@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk= + dependencies: + lcid "^1.0.0" + +os-locale@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" + integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== + dependencies: + execa "^1.0.0" + lcid "^2.0.0" + mem "^4.0.0" + +os-tmpdir@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +osenv@^0.1.4: + version "0.1.5" + resolved "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +p-cancelable@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" + integrity sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw== + +p-cancelable@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc" + integrity sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw== + +p-defer@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + +p-is-promise@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" + integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== + +p-limit@3.1.0, p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + +p-limit@^2.0.0, p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + dependencies: + p-limit "^1.1.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +p-timeout@^1.1.1: + version "1.2.1" + resolved "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz#5eb3b353b7fce99f101a1038880bb054ebbea386" + integrity sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y= + dependencies: + p-finally "^1.0.0" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +param-case@^2.1.0: + version "2.1.1" + resolved "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247" + integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc= + dependencies: + no-case "^2.2.0" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-asn1@^5.0.0, parse-asn1@^5.1.5: + version "5.1.6" + resolved "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz#385080a3ec13cb62a62d39409cb3e88844cdaed4" + integrity sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw== + dependencies: + asn1.js "^5.2.0" + browserify-aes "^1.0.0" + evp_bytestokey "^1.0.0" + pbkdf2 "^3.0.3" + safe-buffer "^5.1.1" + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-headers@^2.0.0: + version "2.0.3" + resolved "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.3.tgz#5e8e7512383d140ba02f0c7aa9f49b4399c92515" + integrity sha512-QhhZ+DCCit2Coi2vmAKbq5RGTRcQUOE2+REgv8vdyu7MnYx2eZztegqtTx99TZ86GTIwqiy3+4nQTWZ2tgmdCA== + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= + dependencies: + error-ex "^1.2.0" + +parse5@^1.5.1: + version "1.5.1" + resolved "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" + integrity sha1-m387DeMr543CQBsXVzzK8Pb1nZQ= + +parse5@^3.0.1: + version "3.0.3" + resolved "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" + integrity sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA== + dependencies: + "@types/node" "*" + +parseurl@^1.3.2, parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + +pascal-case@^2.0.0, pascal-case@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/pascal-case/-/pascal-case-2.0.1.tgz#2d578d3455f660da65eca18ef95b4e0de912761e" + integrity sha1-LVeNNFX2YNpl7KGO+VtODekSdh4= + dependencies: + camel-case "^3.0.0" + upper-case-first "^1.1.0" + +pascal-case@^3.1.1, pascal-case@^3.1.2: + version "3.1.2" + resolved "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz#b48e0ef2b98e205e7c1dae747d0b1508237660eb" + integrity sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g== + dependencies: + no-case "^3.0.4" + tslib "^2.0.3" + +path-case@^2.1.0: + version "2.1.1" + resolved "https://registry.npmjs.org/path-case/-/path-case-2.1.1.tgz#94b8037c372d3fe2906e465bb45e25d226e8eea5" + integrity sha1-lLgDfDctP+KQbkZbtF4l0ibo7qU= + dependencies: + no-case "^2.2.0" + +path-dirname@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +path-to-regexp@0.1.7: + version "0.1.7" + resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" + integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= + +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= + dependencies: + pify "^2.0.0" + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +pbkdf2@^3.0.17, pbkdf2@^3.0.3: + version "3.1.1" + resolved "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz#cb8724b0fada984596856d1a6ebafd3584654b94" + integrity sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg== + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1: + version "2.2.2" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" + integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= + +pkg-conf@^1.1.2: + version "1.1.3" + resolved "https://registry.npmjs.org/pkg-conf/-/pkg-conf-1.1.3.tgz#378e56d6fd13e88bfb6f4a25df7a83faabddba5b" + integrity sha1-N45W1v0T6Iv7b0ol33qD+qvduls= + dependencies: + find-up "^1.0.0" + load-json-file "^1.1.0" + object-assign "^4.0.1" + symbol "^0.2.1" + +pkg-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= + dependencies: + find-up "^2.1.0" + +pluralize@^8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" + integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== + +pouchdb-abstract-mapreduce@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-abstract-mapreduce/-/pouchdb-abstract-mapreduce-7.2.2.tgz#dd1b10a83f8d24361dce9aaaab054614b39f766f" + integrity sha512-7HWN/2yV2JkwMnGnlp84lGvFtnm0Q55NiBUdbBcaT810+clCGKvhssBCrXnmwShD1SXTwT83aszsgiSfW+SnBA== + dependencies: + pouchdb-binary-utils "7.2.2" + pouchdb-collate "7.2.2" + pouchdb-collections "7.2.2" + pouchdb-errors "7.2.2" + pouchdb-fetch "7.2.2" + pouchdb-mapreduce-utils "7.2.2" + pouchdb-md5 "7.2.2" + pouchdb-utils "7.2.2" + +pouchdb-adapter-leveldb-core@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-adapter-leveldb-core/-/pouchdb-adapter-leveldb-core-7.2.2.tgz#e0aa6a476e2607d7ae89f4a803c9fba6e6d05a8a" + integrity sha512-K9UGf1Ivwe87mjrMqN+1D07tO/DfU7ariVDrGffuOjvl+3BcvUF25IWrxsBObd4iPOYCH7NVQWRpojhBgxULtQ== + dependencies: + argsarray "0.0.1" + buffer-from "1.1.1" + double-ended-queue "2.1.0-0" + levelup "4.4.0" + pouchdb-adapter-utils "7.2.2" + pouchdb-binary-utils "7.2.2" + pouchdb-collections "7.2.2" + pouchdb-errors "7.2.2" + pouchdb-json "7.2.2" + pouchdb-md5 "7.2.2" + pouchdb-merge "7.2.2" + pouchdb-utils "7.2.2" + sublevel-pouchdb "7.2.2" + through2 "3.0.2" + +pouchdb-adapter-memory@^7.1.1: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-adapter-memory/-/pouchdb-adapter-memory-7.2.2.tgz#c0ec2e87928d516ca9d1b5badc7269df6f95e5ea" + integrity sha512-9o+zdItPEq7rIrxdkUxgsLNaZkDJAGEqqoYgeYdrHidOCZnlhxhX3g7/R/HcpDKC513iEPqJWDJQSfeT6nVKkw== + dependencies: + memdown "1.4.1" + pouchdb-adapter-leveldb-core "7.2.2" + pouchdb-utils "7.2.2" + +pouchdb-adapter-node-websql@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-adapter-node-websql/-/pouchdb-adapter-node-websql-7.0.0.tgz#64ad88dd45b23578e454bf3032a3a79f9d1e4008" + integrity sha512-fNaOMO8bvMrRTSfmH4RSLSpgnKahRcCA7Z0jg732PwRbGvvMdGbreZwvKPPD1fg2tm2ZwwiXWK2G3+oXyoqZYw== + dependencies: + pouchdb-adapter-websql-core "7.0.0" + pouchdb-utils "7.0.0" + websql "1.0.0" + +pouchdb-adapter-utils@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-adapter-utils/-/pouchdb-adapter-utils-7.0.0.tgz#1ac8d34481911e0e9a9bf51024610a2e7351dc80" + integrity sha512-UWKPC6jkz6mHUzZefrU7P5X8ZGvBC8LSNZ7BIp0hWvJE6c20cnpDwedTVDpZORcCbVJpDmFOHBYnOqEIblPtbA== + dependencies: + pouchdb-binary-utils "7.0.0" + pouchdb-collections "7.0.0" + pouchdb-errors "7.0.0" + pouchdb-md5 "7.0.0" + pouchdb-merge "7.0.0" + pouchdb-utils "7.0.0" + +pouchdb-adapter-utils@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-adapter-utils/-/pouchdb-adapter-utils-7.2.2.tgz#c64426447d9044ba31517a18500d6d2d28abd47d" + integrity sha512-2CzZkTyTyHZkr3ePiWFMTiD5+56lnembMjaTl8ohwegM0+hYhRyJux0biAZafVxgIL4gnCUC4w2xf6WVztzKdg== + dependencies: + pouchdb-binary-utils "7.2.2" + pouchdb-collections "7.2.2" + pouchdb-errors "7.2.2" + pouchdb-md5 "7.2.2" + pouchdb-merge "7.2.2" + pouchdb-utils "7.2.2" + +pouchdb-adapter-websql-core@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-adapter-websql-core/-/pouchdb-adapter-websql-core-7.0.0.tgz#27b3e404159538e515b2567baa7869f90caac16c" + integrity sha512-NyMaH0bl20SdJdOCzd+fwXo8JZ15a48/MAwMcIbXzsRHE4DjFNlRcWAcjUP6uN4Ezc+Gx+r2tkBBMf71mIz1Aw== + dependencies: + pouchdb-adapter-utils "7.0.0" + pouchdb-binary-utils "7.0.0" + pouchdb-collections "7.0.0" + pouchdb-errors "7.0.0" + pouchdb-json "7.0.0" + pouchdb-merge "7.0.0" + pouchdb-utils "7.0.0" + +pouchdb-binary-utils@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.0.0.tgz#cb71a288b09572a231f6bab1b4aed201c4d219a7" + integrity sha512-yUktdOPIPvOVouCjJN3uop+bCcpdPwePrLm9eUAZNgEYnUFu0njdx7Q0WRsZ7UJ6l75HinL5ZHk4bnvEt86FLw== + dependencies: + buffer-from "1.1.0" + +pouchdb-binary-utils@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.2.2.tgz#0690b348052c543b1e67f032f47092ca82bcb10e" + integrity sha512-shacxlmyHbUrNfE6FGYpfyAJx7Q0m91lDdEAaPoKZM3SzAmbtB1i+OaDNtYFztXjJl16yeudkDb3xOeokVL3Qw== + dependencies: + buffer-from "1.1.1" + +pouchdb-collate@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-collate/-/pouchdb-collate-7.2.2.tgz#fc261f5ef837c437e3445fb0abc3f125d982c37c" + integrity sha512-/SMY9GGasslknivWlCVwXMRMnQ8myKHs4WryQ5535nq1Wj/ehpqWloMwxEQGvZE1Sda3LOm7/5HwLTcB8Our+w== + +pouchdb-collections@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.0.0.tgz#fd1f632337dc6301b0ff8649732ca79204e41780" + integrity sha512-DaoUr/vU24Q3gM6ghj0va9j/oBanPwkbhkvnqSyC3Dm5dgf5pculNxueLF9PKMo3ycApoWzHMh6N2N8KJbDU2Q== + +pouchdb-collections@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.2.2.tgz#aeed77f33322429e3f59d59ea233b48ff0e68572" + integrity sha512-6O9zyAYlp3UdtfneiMYuOCWdUCQNo2bgdjvNsMSacQX+3g8WvIoFQCYJjZZCpTttQGb+MHeRMr8m2U95lhJTew== + +pouchdb-debug@^7.1.1: + version "7.2.1" + resolved "https://registry.npmjs.org/pouchdb-debug/-/pouchdb-debug-7.2.1.tgz#f5f869f6113c12ccb97cddf5b0a32b6e0e67e961" + integrity sha512-eP3ht/AKavLF2RjTzBM6S9gaI2/apcW6xvaKRQhEdOfiANqerFuksFqHCal3aikVQuDO+cB/cw+a4RyJn/glBw== + dependencies: + debug "3.1.0" + +pouchdb-errors@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.0.0.tgz#4e2a5a8b82af20cbe5f9970ca90b7ec74563caa0" + integrity sha512-dTusY8nnTw4HIztCrNl7AoGgwvS1bVf/3/97hDaGc4ytn72V9/4dK8kTqlimi3UpaurohYRnqac0SGXYP8vgXA== + dependencies: + inherits "2.0.3" + +pouchdb-errors@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.2.2.tgz#80d811d65c766c9d20b755c6e6cc123f8c3c4792" + integrity sha512-6GQsiWc+7uPfgEHeavG+7wuzH3JZW29Dnrvz8eVbDFE50kVFxNDVm3EkYHskvo5isG7/IkOx7PV7RPTA3keG3g== + dependencies: + inherits "2.0.4" + +pouchdb-fetch@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-fetch/-/pouchdb-fetch-7.2.2.tgz#492791236d60c899d7e9973f9aca0d7b9cc02230" + integrity sha512-lUHmaG6U3zjdMkh8Vob9GvEiRGwJfXKE02aZfjiVQgew+9SLkuOxNw3y2q4d1B6mBd273y1k2Lm0IAziRNxQnA== + dependencies: + abort-controller "3.0.0" + fetch-cookie "0.10.1" + node-fetch "2.6.0" + +pouchdb-find@^7.0.0: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-find/-/pouchdb-find-7.2.2.tgz#1227afdd761812d508fe0794b3e904518a721089" + integrity sha512-BmFeFVQ0kHmDehvJxNZl9OmIztCjPlZlVSdpijuFbk/Fi1EFPU1BAv3kLC+6DhZuOqU/BCoaUBY9sn66pPY2ag== + dependencies: + pouchdb-abstract-mapreduce "7.2.2" + pouchdb-collate "7.2.2" + pouchdb-errors "7.2.2" + pouchdb-fetch "7.2.2" + pouchdb-md5 "7.2.2" + pouchdb-selector-core "7.2.2" + pouchdb-utils "7.2.2" + +pouchdb-json@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-json/-/pouchdb-json-7.0.0.tgz#d9860f66f27a359ac6e4b24da4f89b6909f37530" + integrity sha512-w0bNRu/7VmmCrFWMYAm62n30wvJJUT2SokyzeTyj3hRohj4GFwTRg1mSZ+iAmxgRKOFE8nzZstLG/WAB4Ymjew== + dependencies: + vuvuzela "1.0.3" + +pouchdb-json@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-json/-/pouchdb-json-7.2.2.tgz#b939be24b91a7322e9a24b8880a6e21514ec5e1f" + integrity sha512-3b2S2ynN+aoB7aCNyDZc/4c0IAdx/ir3nsHB+/RrKE9cM3QkQYbnnE3r/RvOD1Xvr6ji/KOCBie+Pz/6sxoaug== + dependencies: + vuvuzela "1.0.3" + +pouchdb-mapreduce-utils@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-mapreduce-utils/-/pouchdb-mapreduce-utils-7.2.2.tgz#13a46a3cc2a3f3b8e24861da26966904f2963146" + integrity sha512-rAllb73hIkU8rU2LJNbzlcj91KuulpwQu804/F6xF3fhZKC/4JQMClahk+N/+VATkpmLxp1zWmvmgdlwVU4HtQ== + dependencies: + argsarray "0.0.1" + inherits "2.0.4" + pouchdb-collections "7.2.2" + pouchdb-utils "7.2.2" + +pouchdb-md5@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.0.0.tgz#935dc6bb507a5f3978fb653ca5790331bae67c96" + integrity sha512-yaSJKhLA3QlgloKUQeb2hLdT3KmUmPfoYdryfwHZuPTpXIRKTnMQTR9qCIRUszc0ruBpDe53DRslCgNUhAyTNQ== + dependencies: + pouchdb-binary-utils "7.0.0" + spark-md5 "3.0.0" + +pouchdb-md5@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.2.2.tgz#415401acc5a844112d765bd1fb4e5d9f38fb0838" + integrity sha512-c/RvLp2oSh8PLAWU5vFBnp6ejJABIdKqboZwRRUrWcfGDf+oyX8RgmJFlYlzMMOh4XQLUT1IoaDV8cwlsuryZw== + dependencies: + pouchdb-binary-utils "7.2.2" + spark-md5 "3.0.1" + +pouchdb-merge@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-merge/-/pouchdb-merge-7.0.0.tgz#9f476ce7e32aae56904ad770ae8a1dfe14b57547" + integrity sha512-tci5u6NpznQhGcPv4ho1h0miky9rs+ds/T9zQ9meQeDZbUojXNaX1Jxsb0uYEQQ+HMqdcQs3Akdl0/u0mgwPGg== + +pouchdb-merge@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-merge/-/pouchdb-merge-7.2.2.tgz#940d85a2b532d6a93a6cab4b250f5648511bcc16" + integrity sha512-6yzKJfjIchBaS7Tusuk8280WJdESzFfQ0sb4jeMUNnrqs4Cx3b0DIEOYTRRD9EJDM+je7D3AZZ4AT0tFw8gb4A== + +pouchdb-selector-core@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-selector-core/-/pouchdb-selector-core-7.2.2.tgz#264d7436a8c8ac3801f39960e79875ef7f3879a0" + integrity sha512-XYKCNv9oiNmSXV5+CgR9pkEkTFqxQGWplnVhO3W9P154H08lU0ZoNH02+uf+NjZ2kjse7Q1fxV4r401LEcGMMg== + dependencies: + pouchdb-collate "7.2.2" + pouchdb-utils "7.2.2" + +pouchdb-utils@7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.0.0.tgz#48bfced6665b8f5a2b2d2317e2aa57635ed1e88e" + integrity sha512-1bnoX1KdZYHv9wicDIFdO0PLiVIMzNDUBUZ/yOJZ+6LW6niQCB8aCv09ZztmKfSQcU5nnN3fe656tScBgP6dOQ== + dependencies: + argsarray "0.0.1" + clone-buffer "1.0.0" + immediate "3.0.6" + inherits "2.0.3" + pouchdb-collections "7.0.0" + pouchdb-errors "7.0.0" + pouchdb-md5 "7.0.0" + uuid "3.2.1" + +pouchdb-utils@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.2.2.tgz#c17c4788f1d052b0daf4ef8797bbc4aaa3945aa4" + integrity sha512-XmeM5ioB4KCfyB2MGZXu1Bb2xkElNwF1qG+zVFbQsKQij0zvepdOUfGuWvLRHxTOmt4muIuSOmWZObZa3NOgzQ== + dependencies: + argsarray "0.0.1" + clone-buffer "1.0.0" + immediate "3.3.0" + inherits "2.0.4" + pouchdb-collections "7.2.2" + pouchdb-errors "7.2.2" + pouchdb-md5 "7.2.2" + uuid "8.1.0" + +pouchdb@7.1.1: + version "7.1.1" + resolved "https://registry.npmjs.org/pouchdb/-/pouchdb-7.1.1.tgz#f5f8dcd1fc440fb76651cb26f6fc5d97a39cd6ce" + integrity sha512-8bXWclixNJZqokvxGHRsG19zehSJiaZaz4dVYlhXhhUctz7gMcNTElHjPBzBdZlKKvt9aFDndmXN1VVE53Co8g== + dependencies: + argsarray "0.0.1" + buffer-from "1.1.0" + clone-buffer "1.0.0" + double-ended-queue "2.1.0-0" + fetch-cookie "0.7.0" + immediate "3.0.6" + inherits "2.0.3" + level "5.0.1" + level-codec "9.0.1" + level-write-stream "1.0.0" + leveldown "5.0.2" + levelup "4.0.2" + ltgt "2.2.1" + node-fetch "2.4.1" + readable-stream "1.0.33" + spark-md5 "3.0.0" + through2 "3.0.1" + uuid "3.2.1" + vuvuzela "1.0.3" + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +prepend-http@^1.0.1: + version "1.0.4" + resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" + integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= + +prepend-http@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" + integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= + +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + integrity sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M= + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.npmjs.org/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= + +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + +promise.allsettled@1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz#d66f78fbb600e83e863d893e98b3d4376a9c47c9" + integrity sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg== + dependencies: + array.prototype.map "^1.0.1" + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + function-bind "^1.1.1" + iterate-value "^1.0.0" + +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + +prop-types@^15.7.2: + version "15.7.2" + resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" + +proxy-addr@~2.0.5: + version "2.0.6" + resolved "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf" + integrity sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw== + dependencies: + forwarded "~0.1.2" + ipaddr.js "1.9.1" + +prr@~1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= + +psl@^1.1.28, psl@^1.1.33: + version "1.8.0" + resolved "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" + integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== + +public-encrypt@^4.0.0: + version "4.0.3" + resolved "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" + integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== + dependencies: + bn.js "^4.1.0" + browserify-rsa "^4.0.0" + create-hash "^1.1.0" + parse-asn1 "^5.0.0" + randombytes "^2.0.1" + safe-buffer "^5.1.2" + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +punycode@2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" + integrity sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0= + +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +pure-rand@^4.1.1: + version "4.1.2" + resolved "https://registry.npmjs.org/pure-rand/-/pure-rand-4.1.2.tgz#cbad2a3e3ea6df0a8d80d8ba204779b5679a5205" + integrity sha512-uLzZpQWfroIqyFWmX/pl0OL2JHJdoU3dbh0dvZ25fChHFJJi56J5oQZhW6QgbT2Llwh1upki84LnTwlZvsungA== + +qs@6.7.0: + version "6.7.0" + resolved "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" + integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +query-string@^5.0.1: + version "5.1.1" + resolved "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" + integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== + dependencies: + decode-uri-component "^0.2.0" + object-assign "^4.1.0" + strict-uri-encode "^1.0.0" + +querystring@0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= + +querystring@^0.2.0: + version "0.2.1" + resolved "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz#40d77615bb09d16902a85c3e38aa8b5ed761c2dd" + integrity sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg== + +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + +queue-microtask@^1.2.2: + version "1.2.2" + resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz#abf64491e6ecf0f38a6502403d4cda04f372dfd3" + integrity sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg== + +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== + dependencies: + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" + +randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +randomfill@^1.0.3: + version "1.0.4" + resolved "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" + integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== + dependencies: + randombytes "^2.0.5" + safe-buffer "^5.1.0" + +range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + +raw-body@2.4.0: + version "2.4.0" + resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" + integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== + dependencies: + bytes "3.1.0" + http-errors "1.7.2" + iconv-lite "0.4.24" + unpipe "1.0.0" + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +react-is@^16.7.0, react-is@^16.8.1: + version "16.13.1" + resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + +readable-stream@1.0.33: + version "1.0.33" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz#3a360dd66c1b1d7fd4705389860eda1d0f61126c" + integrity sha1-OjYN1mwbHX/UcFOJhg7aHQ9hEmw= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +readable-stream@1.1: + version "1.1.13" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e" + integrity sha1-9u73ZPUUyJ4rniMUanW6EGdW0j4= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +readable-stream@1.1.14: + version "1.1.14" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +"readable-stream@2 || 3", readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +"readable-stream@>=1.0.33-1 <1.1.0-0": + version "1.0.34" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@~2.3.6: + version "2.3.7" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@~0.0.2: + version "0.0.4" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-0.0.4.tgz#f32d76e3fb863344a548d79923007173665b3b8d" + integrity sha1-8y124/uGM0SlSNeZIwBxc2ZbO40= + +readable-stream@~2.0.0: + version "2.0.6" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" + integrity sha1-j5A0HmilPMySh4jaz80Rs265t44= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readdirp@~3.4.0: + version "3.4.0" + resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz#9fdccdf9e9155805449221ac645e8303ab5b9ada" + integrity sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ== + dependencies: + picomatch "^2.2.1" + +redux-cli-logger@^2.0.1: + version "2.1.0" + resolved "https://registry.npmjs.org/redux-cli-logger/-/redux-cli-logger-2.1.0.tgz#7e546502a4b08c7fac4fe2faee2326a6326cb4a1" + integrity sha512-75mVsggAJRSykWy2qxdGI7osocDWvc3RCMeN93hlvS/FxgdRww12NaXslez+W6gBOrSJKO7W16V0IzuISSfCxg== + dependencies: + colors "^1.1.2" + +redux-devtools-core@^0.2.1: + version "0.2.1" + resolved "https://registry.npmjs.org/redux-devtools-core/-/redux-devtools-core-0.2.1.tgz#4e43cbe590a1f18c13ee165d2d42e0bc77a164d8" + integrity sha512-RAGOxtUFdr/1USAvxrWd+Gq/Euzgw7quCZlO5TgFpDfG7rB5tMhZUrNyBjpzgzL2yMk0eHnPYIGm7NkIfRzHxQ== + dependencies: + get-params "^0.1.2" + jsan "^3.1.13" + lodash "^4.17.11" + nanoid "^2.0.0" + remotedev-serialize "^0.1.8" + +redux-devtools-instrument@^1.9.4: + version "1.10.0" + resolved "https://registry.npmjs.org/redux-devtools-instrument/-/redux-devtools-instrument-1.10.0.tgz#036caf79fa1e5f25ec4bae38a9af4f08c69e323a" + integrity sha512-X8JRBCzX2ADSMp+iiV7YQ8uoTNyEm0VPFPd4T854coz6lvRiBrFSqAr9YAS2n8Kzxx8CJQotR0QF9wsMM+3DvA== + dependencies: + lodash "^4.17.19" + symbol-observable "^1.2.0" + +redux-saga@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/redux-saga/-/redux-saga-1.0.0.tgz#acb8b3ed9180fecbe75f342011d75af3ac11045b" + integrity sha512-GvJWs/SzMvEQgeaw6sRMXnS2FghlvEGsHiEtTLpJqc/FHF3I5EE/B+Hq5lyHZ8LSoT2r/X/46uWvkdCnK9WgHA== + dependencies: + "@redux-saga/core" "^1.0.0" + +redux@^3.7.2: + version "3.7.2" + resolved "https://registry.npmjs.org/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b" + integrity sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A== + dependencies: + lodash "^4.2.1" + lodash-es "^4.2.1" + loose-envify "^1.1.0" + symbol-observable "^1.0.3" + +redux@^4.0.4: + version "4.0.5" + resolved "https://registry.npmjs.org/redux/-/redux-4.0.5.tgz#4db5de5816e17891de8a80c424232d06f051d93f" + integrity sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w== + dependencies: + loose-envify "^1.4.0" + symbol-observable "^1.2.0" + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + +regenerator-runtime@^0.13.4: + version "0.13.7" + resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" + integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew== + +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== + dependencies: + is-equal-shallow "^0.1.3" + +regexpp@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" + integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== + +relay-compiler@10.1.0: + version "10.1.0" + resolved "https://registry.npmjs.org/relay-compiler/-/relay-compiler-10.1.0.tgz#fb4672cdbe9b54869a3a79759edd8c2d91609cbe" + integrity sha512-HPqc3N3tNgEgUH5+lTr5lnLbgnsZMt+MRiyS0uAVNhuPY2It0X1ZJG+9qdA3L9IqKFUNwVn6zTO7RArjMZbARQ== + dependencies: + "@babel/core" "^7.0.0" + "@babel/generator" "^7.5.0" + "@babel/parser" "^7.0.0" + "@babel/runtime" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + babel-preset-fbjs "^3.3.0" + chalk "^4.0.0" + fb-watchman "^2.0.0" + fbjs "^3.0.0" + glob "^7.1.1" + immutable "~3.7.6" + nullthrows "^1.1.1" + relay-runtime "10.1.0" + signedsource "^1.0.0" + yargs "^15.3.1" + +relay-runtime@10.1.0: + version "10.1.0" + resolved "https://registry.npmjs.org/relay-runtime/-/relay-runtime-10.1.0.tgz#4753bf36e95e8d862cef33608e3d98b4ed730d16" + integrity sha512-bxznLnQ1ST6APN/cFi7l0FpjbZVchWQjjhj9mAuJBuUqNNCh9uV+UTRhpQF7Q8ycsPp19LHTpVyGhYb0ustuRQ== + dependencies: + "@babel/runtime" "^7.0.0" + fbjs "^3.0.0" + +remote-redux-devtools@^0.5.12: + version "0.5.16" + resolved "https://registry.npmjs.org/remote-redux-devtools/-/remote-redux-devtools-0.5.16.tgz#95b1a4a1988147ca04f3368f3573b661748b3717" + integrity sha512-xZ2D1VRIWzat5nsvcraT6fKEX9Cfi+HbQBCwzNnUAM8Uicm/anOc60XGalcaDPrVmLug7nhDl2nimEa3bL3K9w== + dependencies: + jsan "^3.1.13" + querystring "^0.2.0" + redux-devtools-core "^0.2.1" + redux-devtools-instrument "^1.9.4" + rn-host-detect "^1.1.5" + socketcluster-client "^14.2.1" + +remotedev-serialize@^0.1.8: + version "0.1.9" + resolved "https://registry.npmjs.org/remotedev-serialize/-/remotedev-serialize-0.1.9.tgz#5e67e05cbca75d408d769d057dc59d0f56cd2c43" + integrity sha512-5tFdZg9mSaAWTv6xmQ7HtHjKMLSFQFExEZOtJe10PLsv1wb7cy7kYHtBvTYRro27/3fRGEcQBRNKSaixOpb69w== + dependencies: + jsan "^3.1.13" + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= + dependencies: + is-finite "^1.0.0" + +replace-ext@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" + integrity sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ= + +request@^2.55.0, request@^2.79.0: + version "2.88.2" + resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= + +reselect-tree@^1.3.4: + version "1.3.4" + resolved "https://registry.npmjs.org/reselect-tree/-/reselect-tree-1.3.4.tgz#449629728e2dc79bf0602571ec8859ac34737089" + integrity sha512-1OgNq1IStyJFqIqOoD3k3Ge4SsYCMP9W88VQOfvgyLniVKLfvbYO1Vrl92SyEK5021MkoBX6tWb381VxTDyPBQ== + dependencies: + debug "^3.1.0" + esdoc "^1.0.4" + json-pointer "^0.6.0" + reselect "^4.0.0" + source-map-support "^0.5.3" + +reselect@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7" + integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA== + +resolve-from@5.0.0, resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +resolve@^1.10.0, resolve@^1.13.1, resolve@^1.17.0: + version "1.20.0" + resolved "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" + integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== + dependencies: + is-core-module "^2.2.0" + path-parse "^1.0.6" + +responselike@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" + integrity sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec= + dependencies: + lowercase-keys "^1.0.0" + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +retry@0.12.0: + version "0.12.0" + resolved "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" + integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^2.6.1: + version "2.7.1" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rlp@^2.2.3: + version "2.2.6" + resolved "https://registry.npmjs.org/rlp/-/rlp-2.2.6.tgz#c80ba6266ac7a483ef1e69e8e2f056656de2fb2c" + integrity sha512-HAfAmL6SDYNWPUOJNrM500x4Thn4PZsEy5pijPh40U9WfNk0z15hUYzO9xVIMAdIHdFtD8CBDHd75Td1g36Mjg== + dependencies: + bn.js "^4.11.1" + +rn-host-detect@^1.1.5: + version "1.2.0" + resolved "https://registry.npmjs.org/rn-host-detect/-/rn-host-detect-1.2.0.tgz#8b0396fc05631ec60c1cb8789e5070cdb04d0da0" + integrity sha512-btNg5kzHcjZZ7t7mvvV/4wNJ9e3MPgrWivkRgWURzXL0JJ0pwWlU4zrbmdlz3HHzHOxhBhHB4D+/dbMFfu4/4A== + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sax@^1.1.4, sax@^1.2.4: + version "1.2.4" + resolved "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + +sc-channel@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/sc-channel/-/sc-channel-1.2.0.tgz#d9209f3a91e3fa694c66b011ce55c4ad8c3087d9" + integrity sha512-M3gdq8PlKg0zWJSisWqAsMmTVxYRTpVRqw4CWAdKBgAfVKumFcTjoCV0hYu7lgUXccCtCD8Wk9VkkE+IXCxmZA== + dependencies: + component-emitter "1.2.1" + +sc-errors@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/sc-errors/-/sc-errors-2.0.1.tgz#3af2d934dfd82116279a4b2c1552c1e021ddcb03" + integrity sha512-JoVhq3Ud+3Ujv2SIG7W0XtjRHsrNgl6iXuHHsh0s+Kdt5NwI6N2EGAZD4iteitdDv68ENBkpjtSvN597/wxPSQ== + +sc-formatter@^3.0.1: + version "3.0.2" + resolved "https://registry.npmjs.org/sc-formatter/-/sc-formatter-3.0.2.tgz#9abdb14e71873ce7157714d3002477bbdb33c4e6" + integrity sha512-9PbqYBpCq+OoEeRQ3QfFIGE6qwjjBcd2j7UjgDlhnZbtSnuGgHdcRklPKYGuYFH82V/dwd+AIpu8XvA1zqTd+A== + +scrypt-js@2.0.4: + version "2.0.4" + resolved "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" + integrity sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw== + +scrypt-js@^3.0.0, scrypt-js@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + +secp256k1@^4.0.1: + version "4.0.2" + resolved "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz#15dd57d0f0b9fdb54ac1fa1694f40e5e9a54f4a1" + integrity sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg== + dependencies: + elliptic "^6.5.2" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0: + version "5.7.1" + resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@^6.3.0: + version "6.3.0" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +semver@^7.2.1, semver@^7.3.4: + version "7.3.4" + resolved "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" + integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + dependencies: + lru-cache "^6.0.0" + +send@0.17.1: + version "0.17.1" + resolved "https://registry.npmjs.org/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" + integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== + dependencies: + debug "2.6.9" + depd "~1.1.2" + destroy "~1.0.4" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "~1.7.2" + mime "1.6.0" + ms "2.1.1" + on-finished "~2.3.0" + range-parser "~1.2.1" + statuses "~1.5.0" + +sentence-case@^2.1.0: + version "2.1.1" + resolved "https://registry.npmjs.org/sentence-case/-/sentence-case-2.1.1.tgz#1f6e2dda39c168bf92d13f86d4a918933f667ed4" + integrity sha1-H24t2jnBaL+S0T+G1KkYkz9mftQ= + dependencies: + no-case "^2.2.0" + upper-case-first "^1.1.2" + +serialize-javascript@4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" + integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw== + dependencies: + randombytes "^2.1.0" + +serve-static@1.14.1: + version "1.14.1" + resolved "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" + integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.17.1" + +servify@^0.1.12: + version "0.1.12" + resolved "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz#142ab7bee1f1d033b66d0707086085b17c06db95" + integrity sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw== + dependencies: + body-parser "^1.16.0" + cors "^2.8.1" + express "^4.14.0" + request "^2.79.0" + xhr "^2.3.3" + +set-blocking@^2.0.0, set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +setimmediate@1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz#20e81de622d4a02588ce0c8da8973cbcf1d3138f" + integrity sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48= + +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= + +setprototypeof@1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" + integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== + +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + +sha.js@^2.4.0, sha.js@^2.4.11, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +shallowequal@^1.0.2: + version "1.1.0" + resolved "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" + integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +signal-exit@^3.0.0, signal-exit@^3.0.2: + version "3.0.3" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" + integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== + +signedsource@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a" + integrity sha1-HdrOSYF5j5O9gzlzgD2A1S6TrWo= + +simple-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" + integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== + +simple-get@^2.7.0: + version "2.8.1" + resolved "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz#0e22e91d4575d87620620bc91308d57a77f44b5d" + integrity sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw== + dependencies: + decompress-response "^3.3.0" + once "^1.3.1" + simple-concat "^1.0.0" + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + +snake-case@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz#41bdb1b73f30ec66a04d4e2cad1b76387d4d6d9f" + integrity sha1-Qb2xtz8w7GagTU4srRt2OH1NbZ8= + dependencies: + no-case "^2.2.0" + +socketcluster-client@^14.2.1: + version "14.3.1" + resolved "https://registry.npmjs.org/socketcluster-client/-/socketcluster-client-14.3.1.tgz#bfc3591c0cad2668e7b3512a102f3844f5f2e84d" + integrity sha512-Sd/T0K/9UlqTfz+HUuFq90dshA5OBJPQbdkRzGtcKIOm52fkdsBTt0FYpiuzzxv5VrU7PWpRm6KIfNXyPwlLpw== + dependencies: + buffer "^5.2.1" + clone "2.1.1" + component-emitter "1.2.1" + linked-list "0.1.0" + querystring "0.2.0" + sc-channel "^1.2.0" + sc-errors "^2.0.1" + sc-formatter "^3.0.1" + uuid "3.2.1" + ws "7.1.0" + +source-map-resolve@^0.5.2: + version "0.5.3" + resolved "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" + integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw== + dependencies: + atob "^2.1.2" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-support@0.5.12: + version "0.5.12" + resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" + integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-support@^0.5.19, source-map-support@^0.5.3: + version "0.5.19" + resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" + integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-url@^0.4.0: + version "0.4.1" + resolved "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" + integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw== + +source-map@^0.5.0, source-map@^0.5.7: + version "0.5.7" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +spark-md5@3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/spark-md5/-/spark-md5-3.0.0.tgz#3722227c54e2faf24b1dc6d933cc144e6f71bfef" + integrity sha1-NyIifFTi+vJLHcbZM8wUTm9xv+8= + +spark-md5@3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/spark-md5/-/spark-md5-3.0.1.tgz#83a0e255734f2ab4e5c466e5a2cfc9ba2aa2124d" + integrity sha512-0tF3AGSD1ppQeuffsLDIOWlKUd3lS92tFxcsrh5Pe3ZphhnoK+oXIBTzOAThZCiuINZLvpiLH/1VS1/ANEJVig== + +spdx-correct@^3.0.0: + version "3.1.1" + resolved "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" + integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.3.0" + resolved "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.7" + resolved "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz#e9c18a410e5ed7e12442a549fbd8afa767038d65" + integrity sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ== + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +sqlite3@^4.0.0: + version "4.2.0" + resolved "https://registry.npmjs.org/sqlite3/-/sqlite3-4.2.0.tgz#49026d665e9fc4f922e56fb9711ba5b4c85c4901" + integrity sha512-roEOz41hxui2Q7uYnWsjMOTry6TcNUNmp8audCx18gF10P2NknwdpF+E+HKvz/F2NvPKGGBF4NGc+ZPQ+AABwg== + dependencies: + nan "^2.12.1" + node-pre-gyp "^0.11.0" + +sse-z@0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/sse-z/-/sse-z-0.3.0.tgz#e215db7c303d6c4a4199d80cb63811cc28fa55b9" + integrity sha512-jfcXynl9oAOS9YJ7iqS2JMUEHOlvrRAD+54CENiWnc4xsuVLQVSgmwf7cwOTcBd/uq3XkQKBGojgvEtVXcJ/8w== + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +"statuses@>= 1.5.0 < 2", statuses@~1.5.0: + version "1.5.0" + resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= + +stoppable@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz#32da568e83ea488b08e4d7ea2c3bcc9d75015d5b" + integrity sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw== + +stream-shift@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" + integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== + +streamsearch@0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a" + integrity sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo= + +strict-uri-encode@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" + integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2": + version "2.1.1" + resolved "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.2" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" + integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + +string.prototype.trimend@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" + integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + +string.prototype.trimstart@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" + integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + +strip-bom-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/strip-bom-stream/-/strip-bom-stream-1.0.0.tgz#e7144398577d51a6bed0fa1994fa05f43fd988ee" + integrity sha1-5xRDmFd9Uaa+0PoZlPoF9D/ZiO4= + dependencies: + first-chunk-stream "^1.0.0" + strip-bom "^2.0.0" + +strip-bom@2.X, strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= + dependencies: + is-utf8 "^0.2.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-hex-prefix@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" + integrity sha1-DF8VX+8RUTczd96du1iNoFUA428= + dependencies: + is-hex-prefixed "1.0.0" + +strip-json-comments@3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +sublevel-pouchdb@7.2.2: + version "7.2.2" + resolved "https://registry.npmjs.org/sublevel-pouchdb/-/sublevel-pouchdb-7.2.2.tgz#49e46cd37883bf7ff5006d7c5b9bcc7bcc1f422f" + integrity sha512-y5uYgwKDgXVyPZceTDGWsSFAhpSddY29l9PJbXqMJLfREdPmQTY8InpatohlEfCXX7s1LGcrfYAhxPFZaJOLnQ== + dependencies: + inherits "2.0.4" + level-codec "9.0.2" + ltgt "2.2.1" + readable-stream "1.1.14" + +subscriptions-transport-ws@^0.9.11, subscriptions-transport-ws@^0.9.16: + version "0.9.18" + resolved "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.18.tgz#bcf02320c911fbadb054f7f928e51c6041a37b97" + integrity sha512-tztzcBTNoEbuErsVQpTN2xUNN/efAZXyCyL5m3x4t6SKrEiTL2N8SaKWBFWM4u56pL79ULif3zjyeq+oV+nOaA== + dependencies: + backo2 "^1.0.2" + eventemitter3 "^3.1.0" + iterall "^1.2.1" + symbol-observable "^1.0.4" + ws "^5.2.0" + +supports-color@7.1.0: + version "7.1.0" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" + integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== + dependencies: + has-flag "^4.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +swap-case@^1.1.0: + version "1.1.2" + resolved "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz#c39203a4587385fad3c850a0bd1bcafa081974e3" + integrity sha1-w5IDpFhzhfrTyFCgvRvK+ggZdOM= + dependencies: + lower-case "^1.1.1" + upper-case "^1.1.1" + +swarm-js@^0.1.40: + version "0.1.40" + resolved "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.40.tgz#b1bc7b6dcc76061f6c772203e004c11997e06b99" + integrity sha512-yqiOCEoA4/IShXkY3WKwP5PvZhmoOOD8clsKA7EEcRILMkTEYHCQ21HDCAcVpmIxZq4LyZvWeRJ6quIyHk1caA== + dependencies: + bluebird "^3.5.0" + buffer "^5.0.5" + eth-lib "^0.1.26" + fs-extra "^4.0.2" + got "^7.1.0" + mime-types "^2.1.16" + mkdirp-promise "^5.0.1" + mock-fs "^4.1.0" + setimmediate "^1.0.5" + tar "^4.0.2" + xhr-request "^1.0.1" + +symbol-observable@^1.0.3, symbol-observable@^1.0.4, symbol-observable@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== + +symbol-observable@^2.0.0: + version "2.0.3" + resolved "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz#5b521d3d07a43c351055fa43b8355b62d33fd16a" + integrity sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA== + +"symbol-tree@>= 3.1.0 < 4.0.0": + version "3.2.4" + resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +symbol@^0.2.1: + version "0.2.3" + resolved "https://registry.npmjs.org/symbol/-/symbol-0.2.3.tgz#3b9873b8a901e47c6efe21526a3ac372ef28bbc7" + integrity sha1-O5hzuKkB5Hxu/iFSajrDcu8ou8c= + +sync-fetch@0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/sync-fetch/-/sync-fetch-0.3.0.tgz#77246da949389310ad978ab26790bb05f88d1335" + integrity sha512-dJp4qg+x4JwSEW1HibAuMi0IIrBI3wuQr2GimmqB7OXR50wmwzfdusG+p39R9w3R6aFtZ2mzvxvWKQ3Bd/vx3g== + dependencies: + buffer "^5.7.0" + node-fetch "^2.6.1" + +table@^6.0.4: + version "6.0.7" + resolved "https://registry.npmjs.org/table/-/table-6.0.7.tgz#e45897ffbcc1bcf9e8a87bf420f2c9e5a7a52a34" + integrity sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g== + dependencies: + ajv "^7.0.2" + lodash "^4.17.20" + slice-ansi "^4.0.0" + string-width "^4.2.0" + +taffydb@2.7.3: + version "2.7.3" + resolved "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz#2ad37169629498fca5bc84243096d3cde0ec3a34" + integrity sha1-KtNxaWKUmPylvIQkMJbTzeDsOjQ= + +tar@^4, tar@^4.0.2: + version "4.4.13" + resolved "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + dependencies: + chownr "^1.1.1" + fs-minipass "^1.2.5" + minipass "^2.8.6" + minizlib "^1.2.1" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.3" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +through2-filter@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz#60bc55a0dacb76085db1f9dae99ab43f83d622ec" + integrity sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw= + dependencies: + through2 "~2.0.0" + xtend "~4.0.0" + +through2-filter@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz#700e786df2367c2c88cd8aa5be4cf9c1e7831254" + integrity sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA== + dependencies: + through2 "~2.0.0" + xtend "~4.0.0" + +through2@2.X, through2@^2.0.0, through2@^2.0.3, through2@~2.0.0: + version "2.0.5" + resolved "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + dependencies: + readable-stream "~2.3.6" + xtend "~4.0.1" + +through2@3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz#39276e713c3302edf9e388dd9c812dd3b825bd5a" + integrity sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww== + dependencies: + readable-stream "2 || 3" + +through2@3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz#99f88931cfc761ec7678b41d5d7336b5b6a07bf4" + integrity sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ== + dependencies: + inherits "^2.0.4" + readable-stream "2 || 3" + +through2@^0.6.0: + version "0.6.5" + resolved "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48" + integrity sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg= + dependencies: + readable-stream ">=1.0.33-1 <1.1.0-0" + xtend ">=4.0.0 <4.1.0-0" + +tildify@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz#dcec03f55dca9b7aa3e5b04f21817eb56e63588a" + integrity sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo= + dependencies: + os-homedir "^1.0.0" + +timed-out@^4.0.0, timed-out@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" + integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= + +tiny-queue@^0.2.1: + version "0.2.1" + resolved "https://registry.npmjs.org/tiny-queue/-/tiny-queue-0.2.1.tgz#25a67f2c6e253b2ca941977b5ef7442ef97a6046" + integrity sha1-JaZ/LG4lOyypQZd7XvdELvl6YEY= + +title-case@^2.1.0: + version "2.1.1" + resolved "https://registry.npmjs.org/title-case/-/title-case-2.1.1.tgz#3e127216da58d2bc5becf137ab91dae3a7cd8faa" + integrity sha1-PhJyFtpY0rxb7PE3q5Ha46fNj6o= + dependencies: + no-case "^2.2.0" + upper-case "^1.0.3" + +to-absolute-glob@^0.1.1: + version "0.1.1" + resolved "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-0.1.1.tgz#1cdfa472a9ef50c239ee66999b662ca0eb39937f" + integrity sha1-HN+kcqnvUMI57maZm2YsoOs5k38= + dependencies: + extend-shallow "^2.0.1" + +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + +to-readable-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz#ce0aa0c2f3df6adf852efb404a783e77c0475771" + integrity sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +toidentifier@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" + integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== + +tough-cookie@^2.2.0, tough-cookie@^2.3.1, tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +"tough-cookie@^2.3.3 || ^3.0.1 || ^4.0.0": + version "4.0.0" + resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz#d822234eeca882f991f0f908824ad2622ddbece4" + integrity sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.1.2" + +tr46@~0.0.1: + version "0.0.3" + resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= + +truffle@^5.2.2: + version "5.2.3" + resolved "https://registry.npmjs.org/truffle/-/truffle-5.2.3.tgz#6c1585da56b704397017833ea6b62e18303b924f" + integrity sha512-iOeOSaCZtQ+TWsEh6yc6Al+RVkWTsJQnceXNYSCYR86QcXssGY5CqDQ2JwIxwAN4YMRf4GZ/LRAPul6qX36b6A== + dependencies: + "@truffle/debugger" "^8.0.17" + app-module-path "^2.2.0" + mocha "8.1.2" + original-require "^1.0.1" + optionalDependencies: + "@truffle/db" "^0.5.3" + +ts-invariant@^0.4.0: + version "0.4.4" + resolved "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz#97a523518688f93aafad01b0e80eb803eb2abd86" + integrity sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA== + dependencies: + tslib "^1.9.3" + +ts-invariant@^0.6.0: + version "0.6.1" + resolved "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.6.1.tgz#eb4c52b45daaca8367abbfd6cff998ea871d592d" + integrity sha512-QQgN33g8E8yrdDuH29HASveLtbzMnRRgWh0i/JNTW4+zcLsdIOnfsgEDi/NKx4UckQyuMFt9Ujm6TWLWQ58Kvg== + dependencies: + "@types/ungap__global-this" "^0.3.1" + "@ungap/global-this" "^0.4.2" + tslib "^1.9.3" + +tsconfig-paths@^3.9.0: + version "3.9.0" + resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" + integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + +tslib@^1.10.0, tslib@^1.14.1, tslib@^1.9.3: + version "1.14.1" + resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tslib@^2.0.3, tslib@~2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" + integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== + +tslib@~2.0.1: + version "2.0.3" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz#8e0741ac45fc0c226e58a17bfc3e64b9bc6ca61c" + integrity sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ== + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + +type-is@^1.6.16, type-is@~1.6.17, type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + +type@^1.0.1: + version "1.2.0" + resolved "https://registry.npmjs.org/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.0.0: + version "2.5.0" + resolved "https://registry.npmjs.org/type/-/type-2.5.0.tgz#0a2e78c2e77907b252abe5f298c1b01c63f0db3d" + integrity sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw== + +typedarray-to-buffer@^3.1.5, typedarray-to-buffer@~3.1.5: + version "3.1.5" + resolved "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + +typedarray@~0.0.5: + version "0.0.6" + resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + +typescript-compare@^0.0.2: + version "0.0.2" + resolved "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz#7ee40a400a406c2ea0a7e551efd3309021d5f425" + integrity sha512-8ja4j7pMHkfLJQO2/8tut7ub+J3Lw2S3061eJLFQcvs3tsmJKp8KG5NtpLn7KcY2w08edF74BSVN7qJS0U6oHA== + dependencies: + typescript-logic "^0.0.0" + +typescript-logic@^0.0.0: + version "0.0.0" + resolved "https://registry.npmjs.org/typescript-logic/-/typescript-logic-0.0.0.tgz#66ebd82a2548f2b444a43667bec120b496890196" + integrity sha512-zXFars5LUkI3zP492ls0VskH3TtdeHCqu0i7/duGt60i5IGPIpAHE/DWo5FqJ6EjQ15YKXrt+AETjv60Dat34Q== + +typescript-tuple@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/typescript-tuple/-/typescript-tuple-2.2.1.tgz#7d9813fb4b355f69ac55032e0363e8bb0f04dad2" + integrity sha512-Zcr0lbt8z5ZdEzERHAMAniTiIKerFCMgd7yjq1fPnDJ43et/k9twIFQMUYff9k5oXcsQ0WpvFcgzK2ZKASoW6Q== + dependencies: + typescript-compare "^0.0.2" + +ua-parser-js@^0.7.18: + version "0.7.24" + resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.24.tgz#8d3ecea46ed4f1f1d63ec25f17d8568105dc027c" + integrity sha512-yo+miGzQx5gakzVK3QFfN0/L9uVhosXBBO7qmnk7c2iw1IhL212wfA3zbnI54B0obGwC/5NWub/iT9sReMx+Fw== + +ultron@~1.1.0: + version "1.1.1" + resolved "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" + integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== + +unbox-primitive@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz#eeacbc4affa28e9b3d36b5eaeccc50b3251b1d3f" + integrity sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA== + dependencies: + function-bind "^1.1.1" + has-bigints "^1.0.0" + has-symbols "^1.0.0" + which-boxed-primitive "^1.0.1" + +underscore@1.9.1: + version "1.9.1" + resolved "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz#06dce34a0e68a7babc29b365b8e74b8925203961" + integrity sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg== + +unique-stream@^2.0.2: + version "2.3.1" + resolved "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz#c65d110e9a4adf9a6c5948b28053d9a8d04cbeac" + integrity sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A== + dependencies: + json-stable-stringify-without-jsonify "^1.0.1" + through2-filter "^3.0.0" + +unique-string@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz#9e1057cca851abb93398f8b33ae187b99caec11a" + integrity sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo= + dependencies: + crypto-random-string "^1.0.0" + +universalify@^0.1.0, universalify@^0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +universalify@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" + integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== + +unixify@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/unixify/-/unixify-1.0.0.tgz#3a641c8c2ffbce4da683a5c70f03a462940c2090" + integrity sha1-OmQcjC/7zk2mg6XHDwOkYpQMIJA= + dependencies: + normalize-path "^2.1.1" + +unpipe@1.0.0, unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= + +upper-case-first@^1.1.0, upper-case-first@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/upper-case-first/-/upper-case-first-1.1.2.tgz#5d79bedcff14419518fd2edb0a0507c9b6859115" + integrity sha1-XXm+3P8UQZUY/S7bCgUHybaFkRU= + dependencies: + upper-case "^1.1.1" + +upper-case@^1.0.3, upper-case@^1.1.0, upper-case@^1.1.1, upper-case@^1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" + integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg= + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +url-parse-lax@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" + integrity sha1-evjzA2Rem9eaJy56FKxovAYJ2nM= + dependencies: + prepend-http "^1.0.1" + +url-parse-lax@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c" + integrity sha1-FrXK/Afb42dsGxmZF3gj1lA6yww= + dependencies: + prepend-http "^2.0.0" + +url-parse@^1.4.3: + version "1.5.1" + resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz#d5fa9890af8a5e1f274a2c98376510f6425f6e3b" + integrity sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + +url-set-query@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" + integrity sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk= + +url-to-options@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9" + integrity sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k= + +utf-8-validate@^5.0.2: + version "5.0.4" + resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.4.tgz#72a1735983ddf7a05a43a9c6b67c5ce1c910f9b8" + integrity sha512-MEF05cPSq3AwJ2C7B7sHAA6i53vONoZbMGX8My5auEVm6W+dJ2Jd/TZPyGJ5CH42V2XtbI5FD28HeHeqlPzZ3Q== + dependencies: + node-gyp-build "^4.2.0" + +utf8@3.0.0, utf8@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +util.promisify@^1.0.0: + version "1.1.1" + resolved "https://registry.npmjs.org/util.promisify/-/util.promisify-1.1.1.tgz#77832f57ced2c9478174149cae9b96e9918cd54b" + integrity sha512-/s3UsZUrIfa6xDhr7zZhnE9SLQ5RIXyYfiVnMMyMDzOc8WhWN4Nbh36H842OyurKbCDAesZOJaVyvmSl6fhGQw== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + for-each "^0.3.3" + has-symbols "^1.0.1" + object.getownpropertydescriptors "^2.1.1" + +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= + +uuid@2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz#c2a30dedb3e535d72ccf82e343941a50ba8533ac" + integrity sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w= + +uuid@3.2.1: + version "3.2.1" + resolved "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" + integrity sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA== + +uuid@3.3.2: + version "3.3.2" + resolved "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== + +uuid@8.1.0: + version "8.1.0" + resolved "https://registry.npmjs.org/uuid/-/uuid-8.1.0.tgz#6f1536eb43249f473abc6bd58ff983da1ca30d8d" + integrity sha512-CI18flHDznR0lq54xBycOVmphdCYnQLKn8abKn7PXUiKUGdEd+/l9LWNJmugXel4hXq7S+RMNl34ecyC9TntWg== + +uuid@^3.1.0, uuid@^3.3.2: + version "3.4.0" + resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + +uuid@^8.0.0: + version "8.3.2" + resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + +v8-compile-cache@^2.0.3: + version "2.3.0" + resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" + integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== + +vali-date@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz#1b904a59609fb328ef078138420934f6b86709a6" + integrity sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY= + +valid-url@1.0.9: + version "1.0.9" + resolved "https://registry.npmjs.org/valid-url/-/valid-url-1.0.9.tgz#1c14479b40f1397a75782f115e4086447433a200" + integrity sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA= + +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +varint@^5.0.0: + version "5.0.2" + resolved "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" + integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== + +vary@^1, vary@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +vinyl-fs@2.4.3: + version "2.4.3" + resolved "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-2.4.3.tgz#3d97e562ebfdd4b66921dea70626b84bde9d2d07" + integrity sha1-PZflYuv91LZpId6nBia4S96dLQc= + dependencies: + duplexify "^3.2.0" + glob-stream "^5.3.2" + graceful-fs "^4.0.0" + gulp-sourcemaps "^1.5.2" + is-valid-glob "^0.3.0" + lazystream "^1.0.0" + lodash.isequal "^4.0.0" + merge-stream "^1.0.0" + mkdirp "^0.5.0" + object-assign "^4.0.0" + readable-stream "^2.0.4" + strip-bom "^2.0.0" + strip-bom-stream "^1.0.0" + through2 "^2.0.0" + through2-filter "^2.0.0" + vali-date "^1.0.0" + vinyl "^1.0.0" + +vinyl@1.X, vinyl@^1.0.0: + version "1.2.0" + resolved "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz#5c88036cf565e5df05558bfc911f8656df218884" + integrity sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ= + dependencies: + clone "^1.0.0" + clone-stats "^0.0.1" + replace-ext "0.0.1" + +vuvuzela@1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/vuvuzela/-/vuvuzela-1.0.3.tgz#3be145e58271c73ca55279dd851f12a682114b0b" + integrity sha1-O+FF5YJxxzylUnndhR8SpoIRSws= + +wcwidth@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= + dependencies: + defaults "^1.0.3" + +web3-bzz@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.2.9.tgz#25f8a373bc2dd019f47bf80523546f98b93c8790" + integrity sha512-ogVQr9jHodu9HobARtvUSmWG22cv2EUQzlPeejGWZ7j5h20HX40EDuWyomGY5VclIj5DdLY76Tmq88RTf/6nxA== + dependencies: + "@types/node" "^10.12.18" + got "9.6.0" + swarm-js "^0.1.40" + underscore "1.9.1" + +web3-core-helpers@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.2.9.tgz#6381077c3e01c127018cb9e9e3d1422697123315" + integrity sha512-t0WAG3orLCE3lqi77ZoSRNFok3VQWZXTniZigDQjyOJYMAX7BU3F3js8HKbjVnAxlX3tiKoDxI0KBk9F3AxYuw== + dependencies: + underscore "1.9.1" + web3-eth-iban "1.2.9" + web3-utils "1.2.9" + +web3-core-method@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.2.9.tgz#3fb538751029bea570e4f86731e2fa5e4945e462" + integrity sha512-bjsIoqP3gs7A/gP8+QeLUCyOKJ8bopteCSNbCX36Pxk6TYfYWNuC6hP+2GzUuqdP3xaZNe+XEElQFUNpR3oyAg== + dependencies: + "@ethersproject/transactions" "^5.0.0-beta.135" + underscore "1.9.1" + web3-core-helpers "1.2.9" + web3-core-promievent "1.2.9" + web3-core-subscriptions "1.2.9" + web3-utils "1.2.9" + +web3-core-promievent@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.2.9.tgz#bb1c56aa6fac2f4b3c598510f06554d25c11c553" + integrity sha512-0eAUA2zjgXTleSrnc1wdoKQPPIHU6KHf4fAscu4W9kKrR+mqP1KsjYrxY9wUyjNnXxfQ+5M29ipvbiaK8OqdOw== + dependencies: + eventemitter3 "3.1.2" + +web3-core-requestmanager@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.2.9.tgz#dd6d855256c4dd681434fe0867f8cd742fe10503" + integrity sha512-1PwKV2m46ALUnIN5VPPgjOj8yMLJhhqZYvYJE34hTN5SErOkwhzx5zScvo5MN7v7KyQGFnpVCZKKGCiEnDmtFA== + dependencies: + underscore "1.9.1" + web3-core-helpers "1.2.9" + web3-providers-http "1.2.9" + web3-providers-ipc "1.2.9" + web3-providers-ws "1.2.9" + +web3-core-subscriptions@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.2.9.tgz#335fd7d15dfce5d78b4b7bef05ce4b3d7237b0e4" + integrity sha512-Y48TvXPSPxEM33OmXjGVDMzTd0j8X0t2+sDw66haeBS8eYnrEzasWuBZZXDq0zNUsqyxItgBGDn+cszkgEnFqg== + dependencies: + eventemitter3 "3.1.2" + underscore "1.9.1" + web3-core-helpers "1.2.9" + +web3-core@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-core/-/web3-core-1.2.9.tgz#2cba57aa259b6409db532d21bdf57db8d504fd3e" + integrity sha512-fSYv21IP658Ty2wAuU9iqmW7V+75DOYMVZsDH/c14jcF/1VXnedOcxzxSj3vArsCvXZNe6XC5/wAuGZyQwR9RA== + dependencies: + "@types/bn.js" "^4.11.4" + "@types/node" "^12.6.1" + bignumber.js "^9.0.0" + web3-core-helpers "1.2.9" + web3-core-method "1.2.9" + web3-core-requestmanager "1.2.9" + web3-utils "1.2.9" + +web3-eth-abi@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.2.9.tgz#14bedd7e4be04fcca35b2ac84af1400574cd8280" + integrity sha512-3YwUYbh/DMfDbhMWEebAdjSd5bj3ZQieOjLzWFHU23CaLEqT34sUix1lba+hgUH/EN6A7bKAuKOhR3p0OvTn7Q== + dependencies: + "@ethersproject/abi" "5.0.0-beta.153" + underscore "1.9.1" + web3-utils "1.2.9" + +web3-eth-accounts@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.2.9.tgz#7ec422df90fecb5243603ea49dc28726db7bdab6" + integrity sha512-jkbDCZoA1qv53mFcRHCinoCsgg8WH+M0YUO1awxmqWXRmCRws1wW0TsuSQ14UThih5Dxolgl+e+aGWxG58LMwg== + dependencies: + crypto-browserify "3.12.0" + eth-lib "^0.2.8" + ethereumjs-common "^1.3.2" + ethereumjs-tx "^2.1.1" + scrypt-js "^3.0.1" + underscore "1.9.1" + uuid "3.3.2" + web3-core "1.2.9" + web3-core-helpers "1.2.9" + web3-core-method "1.2.9" + web3-utils "1.2.9" + +web3-eth-contract@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.2.9.tgz#713d9c6d502d8c8f22b696b7ffd8e254444e6bfd" + integrity sha512-PYMvJf7EG/HyssUZa+pXrc8IB06K/YFfWYyW4R7ed3sab+9wWUys1TlWxBCBuiBXOokSAyM6H6P6/cKEx8FT8Q== + dependencies: + "@types/bn.js" "^4.11.4" + underscore "1.9.1" + web3-core "1.2.9" + web3-core-helpers "1.2.9" + web3-core-method "1.2.9" + web3-core-promievent "1.2.9" + web3-core-subscriptions "1.2.9" + web3-eth-abi "1.2.9" + web3-utils "1.2.9" + +web3-eth-ens@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.2.9.tgz#577b9358c036337833fb2bdc59c11be7f6f731b6" + integrity sha512-kG4+ZRgZ8I1WYyOBGI8QVRHfUSbbJjvJAGA1AF/NOW7JXQ+x7gBGeJw6taDWJhSshMoEKWcsgvsiuoG4870YxQ== + dependencies: + content-hash "^2.5.2" + eth-ens-namehash "2.0.8" + underscore "1.9.1" + web3-core "1.2.9" + web3-core-helpers "1.2.9" + web3-core-promievent "1.2.9" + web3-eth-abi "1.2.9" + web3-eth-contract "1.2.9" + web3-utils "1.2.9" + +web3-eth-iban@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.2.9.tgz#4ebf3d8783f34d04c4740dc18938556466399f7a" + integrity sha512-RtdVvJE0pyg9dHLy0GzDiqgnLnssSzfz/JYguhC1wsj9+Gnq1M6Diy3NixACWUAp6ty/zafyOaZnNQ+JuH9TjQ== + dependencies: + bn.js "4.11.8" + web3-utils "1.2.9" + +web3-eth-personal@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.2.9.tgz#9b95eb159b950b83cd8ae15873e1d57711b7a368" + integrity sha512-cFiNrktxZ1C/rIdJFzQTvFn3/0zcsR3a+Jf8Y3KxeQDHszQtosjLWptP7bsUmDwEh4hzh0Cy3KpOxlYBWB8bJQ== + dependencies: + "@types/node" "^12.6.1" + web3-core "1.2.9" + web3-core-helpers "1.2.9" + web3-core-method "1.2.9" + web3-net "1.2.9" + web3-utils "1.2.9" + +web3-eth@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-eth/-/web3-eth-1.2.9.tgz#e40e7b88baffc9b487193211c8b424dc944977b3" + integrity sha512-sIKO4iE9FEBa/CYUd6GdPd7GXt/wISqxUd8PlIld6+hvMJj02lgO7Z7p5T9mZIJcIZJGvZX81ogx8oJ9yif+Ag== + dependencies: + underscore "1.9.1" + web3-core "1.2.9" + web3-core-helpers "1.2.9" + web3-core-method "1.2.9" + web3-core-subscriptions "1.2.9" + web3-eth-abi "1.2.9" + web3-eth-accounts "1.2.9" + web3-eth-contract "1.2.9" + web3-eth-ens "1.2.9" + web3-eth-iban "1.2.9" + web3-eth-personal "1.2.9" + web3-net "1.2.9" + web3-utils "1.2.9" + +web3-net@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-net/-/web3-net-1.2.9.tgz#51d248ed1bc5c37713c4ac40c0073d9beacd87d3" + integrity sha512-d2mTn8jPlg+SI2hTj2b32Qan6DmtU9ap/IUlJTeQbZQSkTLf0u9suW8Vjwyr4poJYXTurdSshE7OZsPNn30/ZA== + dependencies: + web3-core "1.2.9" + web3-core-method "1.2.9" + web3-utils "1.2.9" + +web3-providers-http@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.2.9.tgz#e698aa5377e2019c24c5a1e6efa0f51018728934" + integrity sha512-F956tCIj60Ttr0UvEHWFIhx+be3He8msoPzyA44/kfzzYoMAsCFRn5cf0zQG6al0znE75g6HlWVSN6s3yAh51A== + dependencies: + web3-core-helpers "1.2.9" + xhr2-cookies "1.1.0" + +web3-providers-ipc@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.2.9.tgz#6159eacfcd7ac31edc470d93ef10814fe874763b" + integrity sha512-NQ8QnBleoHA2qTJlqoWu7EJAD/FR5uimf7Ielzk4Z2z+m+6UAuJdJMSuQNj+Umhz9L/Ys6vpS1vHx9NizFl+aQ== + dependencies: + oboe "2.1.4" + underscore "1.9.1" + web3-core-helpers "1.2.9" + +web3-providers-ws@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.2.9.tgz#22c2006655ec44b4ad2b41acae62741a6ae7a88c" + integrity sha512-6+UpvINeI//dglZoAKStUXqxDOXJy6Iitv2z3dbgInG4zb8tkYl/VBDL80UjUg3ZvzWG0g7EKY2nRPEpON2TFA== + dependencies: + eventemitter3 "^4.0.0" + underscore "1.9.1" + web3-core-helpers "1.2.9" + websocket "^1.0.31" + +web3-shh@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-shh/-/web3-shh-1.2.9.tgz#c4ba70d6142cfd61341a50752d8cace9a0370911" + integrity sha512-PWa8b/EaxaMinFaxy6cV0i0EOi2M7a/ST+9k9nhyhCjVa2vzXuNoBNo2IUOmeZ0WP2UQB8ByJ2+p4htlJaDOjA== + dependencies: + web3-core "1.2.9" + web3-core-method "1.2.9" + web3-core-subscriptions "1.2.9" + web3-net "1.2.9" + +web3-utils@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.9.tgz#abe11735221627da943971ef1a630868fb9c61f3" + integrity sha512-9hcpuis3n/LxFzEVjwnVgvJzTirS2S9/MiNAa7l4WOEoywY+BSNwnRX4MuHnjkh9NY25B6QOjuNG6FNnSjTw1w== + dependencies: + bn.js "4.11.8" + eth-lib "0.2.7" + ethereum-bloom-filters "^1.0.6" + ethjs-unit "0.1.6" + number-to-bn "1.7.0" + randombytes "^2.1.0" + underscore "1.9.1" + utf8 "3.0.0" + +web3@1.2.9: + version "1.2.9" + resolved "https://registry.npmjs.org/web3/-/web3-1.2.9.tgz#cbcf1c0fba5e213a6dfb1f2c1f4b37062e4ce337" + integrity sha512-Mo5aBRm0JrcNpN/g4VOrDzudymfOnHRC3s2VarhYxRA8aWgF5rnhQ0ziySaugpic1gksbXPe105pUWyRqw8HUA== + dependencies: + web3-bzz "1.2.9" + web3-core "1.2.9" + web3-eth "1.2.9" + web3-eth-personal "1.2.9" + web3-net "1.2.9" + web3-shh "1.2.9" + web3-utils "1.2.9" + +webidl-conversions@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-2.0.1.tgz#3bf8258f7d318c7443c36f2e169402a1a6703506" + integrity sha1-O/glj30xjHRDw28uFpQCoaZwNQY= + +websocket@^1.0.31: + version "1.0.33" + resolved "https://registry.npmjs.org/websocket/-/websocket-1.0.33.tgz#407f763fc58e74a3fa41ca3ae5d78d3f5e3b82a5" + integrity sha512-XwNqM2rN5eh3G2CUQE3OHZj+0xfdH42+OFK6LdC2yqiC0YU8e5UK0nYre220T0IyyN031V/XOvtHvXozvJYFWA== + dependencies: + bufferutil "^4.0.1" + debug "^2.2.0" + es5-ext "^0.10.50" + typedarray-to-buffer "^3.1.5" + utf-8-validate "^5.0.2" + yaeti "^0.0.6" + +websql@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/websql/-/websql-1.0.0.tgz#1bd00b27392893134715d5dd6941fd89e730bab5" + integrity sha512-7iZ+u28Ljw5hCnMiq0BCOeSYf0vCFQe/ORY0HgscTiKjQed8WqugpBUggJ2NTnB9fahn1kEnPRX2jf8Px5PhJw== + dependencies: + argsarray "^0.0.1" + immediate "^3.2.2" + noop-fn "^1.0.0" + sqlite3 "^4.0.0" + tiny-queue "^0.2.1" + +whatwg-url-compat@~0.6.5: + version "0.6.5" + resolved "https://registry.npmjs.org/whatwg-url-compat/-/whatwg-url-compat-0.6.5.tgz#00898111af689bb097541cd5a45ca6c8798445bf" + integrity sha1-AImBEa9om7CXVBzVpFymyHmERb8= + dependencies: + tr46 "~0.0.1" + +which-boxed-primitive@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@2.0.2, which@^2.0.1: + version "2.0.2" + resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +which@^1.2.9: + version "1.3.1" + resolved "https://registry.npmjs.org/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +wide-align@1.1.3, wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + +window-size@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" + integrity sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU= + +word-wrap@^1.2.3, word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + +workerpool@6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz#85aad67fa1a2c8ef9386a1b43539900f61d03d58" + integrity sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA== + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write-file-atomic@^2.0.0: + version "2.4.3" + resolved "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" + integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write-stream@~0.4.3: + version "0.4.3" + resolved "https://registry.npmjs.org/write-stream/-/write-stream-0.4.3.tgz#83cc8c0347d0af6057a93862b4e3ae01de5c81c1" + integrity sha1-g8yMA0fQr2BXqThitOOuAd5cgcE= + dependencies: + readable-stream "~0.0.2" + +ws@7.1.0: + version "7.1.0" + resolved "https://registry.npmjs.org/ws/-/ws-7.1.0.tgz#0395646c6fcc3ac56abf61ce1a42039637a6bd98" + integrity sha512-Swie2C4fs7CkwlHu1glMePLYJJsWjzhl1vm3ZaLplD0h7OMkZyZ6kLTB/OagiU923bZrPFXuDTeEqaEN4NWG4g== + dependencies: + async-limiter "^1.0.0" + +ws@7.4.3: + version "7.4.3" + resolved "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz#1f9643de34a543b8edb124bdcbc457ae55a6e5cd" + integrity sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA== + +ws@^3.0.0: + version "3.3.3" + resolved "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" + integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== + dependencies: + async-limiter "~1.0.0" + safe-buffer "~5.1.0" + ultron "~1.1.0" + +ws@^5.2.0: + version "5.2.2" + resolved "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== + dependencies: + async-limiter "~1.0.0" + +ws@^6.0.0: + version "6.2.1" + resolved "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" + integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== + dependencies: + async-limiter "~1.0.0" + +xdg-basedir@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" + integrity sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ= + +xhr-request-promise@^0.1.2: + version "0.1.3" + resolved "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c" + integrity sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg== + dependencies: + xhr-request "^1.1.0" + +xhr-request@^1.0.1, xhr-request@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz#f4a7c1868b9f198723444d82dcae317643f2e2ed" + integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== + dependencies: + buffer-to-arraybuffer "^0.0.5" + object-assign "^4.1.1" + query-string "^5.0.1" + simple-get "^2.7.0" + timed-out "^4.0.1" + url-set-query "^1.0.0" + xhr "^2.0.4" + +xhr2-cookies@1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" + integrity sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg= + dependencies: + cookiejar "^2.1.1" + +xhr@^2.0.4, xhr@^2.3.3: + version "2.6.0" + resolved "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz#b69d4395e792b4173d6b7df077f0fc5e4e2b249d" + integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== + dependencies: + global "~4.4.0" + is-function "^1.0.1" + parse-headers "^2.0.0" + xtend "^4.0.0" + +"xml-name-validator@>= 2.0.1 < 3.0.0": + version "2.0.1" + resolved "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" + integrity sha1-TYuPHszTQZqjYgYb7O9RXh5VljU= + +xmlhttprequest@1.8.0: + version "1.8.0" + resolved "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" + integrity sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw= + +xss@^1.0.8: + version "1.0.8" + resolved "https://registry.npmjs.org/xss/-/xss-1.0.8.tgz#32feb87feb74b3dcd3d404b7a68ababf10700535" + integrity sha512-3MgPdaXV8rfQ/pNn16Eio6VXYPTkqwa0vc7GkiymmY/DqR1SE/7VPAAVZz1GJsJFrllMYO3RHfEaiUGjab6TNw== + dependencies: + commander "^2.20.3" + cssfilter "0.0.10" + +"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.2, xtend@~4.0.0, xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^3.2.1: + version "3.2.2" + resolved "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz#85c901bd6470ce71fc4bb723ad209b70f7f28696" + integrity sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ== + +y18n@^4.0.0: + version "4.0.1" + resolved "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" + integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== + +yaeti@^0.0.6: + version "0.0.6" + resolved "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + integrity sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc= + +yallist@^3.0.0, yallist@^3.0.3: + version "3.1.1" + resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yargs-parser@13.1.2, yargs-parser@^13.1.0, yargs-parser@^13.1.2: + version "13.1.2" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" + integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^15.0.1: + version "15.0.1" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz#54786af40b820dcb2fb8025b11b4d659d76323b3" + integrity sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^2.4.0: + version "2.4.1" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz#85568de3cf150ff49fa51825f03a8c880ddcc5c4" + integrity sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ= + dependencies: + camelcase "^3.0.0" + lodash.assign "^4.0.6" + +yargs-unparser@1.6.1: + version "1.6.1" + resolved "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.1.tgz#bd4b0ee05b4c94d058929c32cb09e3fce71d3c5f" + integrity sha512-qZV14lK9MWsGCmcr7u5oXGH0dbGqZAIxTDrWXZDo5zUr6b6iUmelNKO6x6R1dQT24AH3LgRxJpr8meWy2unolA== + dependencies: + camelcase "^5.3.1" + decamelize "^1.2.0" + flat "^4.1.0" + is-plain-obj "^1.1.0" + yargs "^14.2.3" + +yargs@13.2.4: + version "13.2.4" + resolved "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz#0b562b794016eb9651b98bd37acf364aa5d6dc83" + integrity sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + os-locale "^3.1.0" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.0" + +yargs@13.3.2: + version "13.3.2" + resolved "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.2" + +yargs@4.6.0: + version "4.6.0" + resolved "https://registry.npmjs.org/yargs/-/yargs-4.6.0.tgz#cb4050c0159bfb6bb649c0f4af550526a84619dc" + integrity sha1-y0BQwBWb+2u2ScD0r1UFJqhGGdw= + dependencies: + camelcase "^2.0.1" + cliui "^3.2.0" + decamelize "^1.1.1" + lodash.assign "^4.0.3" + os-locale "^1.4.0" + pkg-conf "^1.1.2" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + string-width "^1.0.1" + window-size "^0.2.0" + y18n "^3.2.1" + yargs-parser "^2.4.0" + +yargs@^14.2.3: + version "14.2.3" + resolved "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz#1a1c3edced1afb2a2fea33604bc6d1d8d688a414" + integrity sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg== + dependencies: + cliui "^5.0.0" + decamelize "^1.2.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^15.0.1" + +yargs@^15.3.1: + version "15.4.1" + resolved "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +zen-observable-ts@^0.8.21: + version "0.8.21" + resolved "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz#85d0031fbbde1eba3cd07d3ba90da241215f421d" + integrity sha512-Yj3yXweRc8LdRMrCC8nIc4kkjWecPAUVh0TI0OUrWXx6aX790vLcDlWca6I4vsyCGH3LpWxq0dJRcMOFoVqmeg== + dependencies: + tslib "^1.9.3" + zen-observable "^0.8.0" + +zen-observable@^0.8.0, zen-observable@^0.8.14: + version "0.8.15" + resolved "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" + integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== diff --git a/vent/test/events.go b/vent/test/events.go index 34955d697..ab9a65df3 100644 --- a/vent/test/events.go +++ b/vent/test/events.go @@ -4,35 +4,42 @@ import ( "context" "testing" + "github.com/hyperledger/burrow/encoding" + "github.com/hyperledger/burrow/rpc/web3/ethclient" + "google.golang.org/grpc" + "github.com/hyperledger/burrow/crypto" "github.com/hyperledger/burrow/execution/evm/abi" "github.com/hyperledger/burrow/execution/exec" "github.com/hyperledger/burrow/rpc/rpctransact" "github.com/hyperledger/burrow/txs/payload" "github.com/stretchr/testify/require" - "google.golang.org/grpc" ) -func NewTransactClient(t testing.TB, listenAddress string) rpctransact.TransactClient { +const gasLimit = ethclient.BasicGasLimit * 100 + +type TransactClient interface { + CallTxSync(ctx context.Context, in *payload.CallTx, opts ...grpc.CallOption) (*exec.TxExecution, error) +} + +func NewBurrowTransactClient(t testing.TB, listenAddress string) rpctransact.TransactClient { t.Helper() - conn, err := grpc.Dial(listenAddress, grpc.WithInsecure()) + conn, err := encoding.GRPCDial(listenAddress) require.NoError(t, err) return rpctransact.NewTransactClient(conn) } -func CreateContract(t testing.TB, cli rpctransact.TransactClient, inputAddress crypto.Address) *exec.TxExecution { +func CreateContract(t testing.TB, cli TransactClient, inputAddress crypto.Address) *exec.TxExecution { t.Helper() txe, err := cli.CallTxSync(context.Background(), &payload.CallTx{ Input: &payload.TxInput{ Address: inputAddress, - Amount: 2, }, Address: nil, Data: Bytecode_EventsTest, - Fee: 2, - GasLimit: 10000, + GasLimit: gasLimit, }) require.NoError(t, err) @@ -43,27 +50,27 @@ func CreateContract(t testing.TB, cli rpctransact.TransactClient, inputAddress c return txe } -func CallRemoveEvent(t testing.TB, cli rpctransact.TransactClient, inputAddress, contractAddress crypto.Address, +func CallRemoveEvent(t testing.TB, cli TransactClient, inputAddress, contractAddress crypto.Address, name string) *exec.TxExecution { return Call(t, cli, inputAddress, contractAddress, "removeThing", name) } -func CallRemoveEvents(t testing.TB, cli rpctransact.TransactClient, inputAddress, contractAddress crypto.Address, +func CallRemoveEvents(t testing.TB, cli TransactClient, inputAddress, contractAddress crypto.Address, name string) *exec.TxExecution { return Call(t, cli, inputAddress, contractAddress, "removeThings", name) } -func CallAddEvent(t testing.TB, cli rpctransact.TransactClient, inputAddress, contractAddress crypto.Address, +func CallAddEvent(t testing.TB, cli TransactClient, inputAddress, contractAddress crypto.Address, name, description string) *exec.TxExecution { return Call(t, cli, inputAddress, contractAddress, "addThing", name, description) } -func CallAddEvents(t testing.TB, cli rpctransact.TransactClient, inputAddress, contractAddress crypto.Address, +func CallAddEvents(t testing.TB, cli TransactClient, inputAddress, contractAddress crypto.Address, name, description string) *exec.TxExecution { return Call(t, cli, inputAddress, contractAddress, "addThings", name, description) } -func Call(t testing.TB, cli rpctransact.TransactClient, inputAddress, contractAddress crypto.Address, +func Call(t testing.TB, cli TransactClient, inputAddress, contractAddress crypto.Address, functionName string, args ...interface{}) *exec.TxExecution { t.Helper() @@ -76,12 +83,10 @@ func Call(t testing.TB, cli rpctransact.TransactClient, inputAddress, contractAd txe, err := cli.CallTxSync(context.Background(), &payload.CallTx{ Input: &payload.TxInput{ Address: inputAddress, - Amount: 2, }, Address: &contractAddress, Data: data, - Fee: 2, - GasLimit: 1000000, + GasLimit: gasLimit, }) require.NoError(t, err) diff --git a/vent/test/sqlsol.go b/vent/test/sqlsol.go index 058fa4090..84d112b2b 100644 --- a/vent/test/sqlsol.go +++ b/vent/test/sqlsol.go @@ -109,7 +109,7 @@ func UnknownTypeJSONConfFile(t *testing.T) string { }, "Fields" , "ColumnName" , "ColumnName" : "testname", "Primary" : true}, - "description", "ColumnName" : "testdescription", "Primary" : false} + "description", "ColumnName" : "testdescription", "Primary" : false, "BytesToHex": true} } } ]` diff --git a/vent/test/sqlsol_log.json b/vent/test/sqlsol_log.json index bb11812d9..c2aad97d8 100644 --- a/vent/test/sqlsol_log.json +++ b/vent/test/sqlsol_log.json @@ -23,6 +23,7 @@ "ColumnName": "testdescription", "Type": "bytes32", "Primary": false, + "BytesToHex": true, "Notify": ["meta", "keyed_meta"] } ] diff --git a/vent/test/sqlsol_view.json b/vent/test/sqlsol_view.json index 4f7c94621..480f76c99 100644 --- a/vent/test/sqlsol_view.json +++ b/vent/test/sqlsol_view.json @@ -24,6 +24,7 @@ "ColumnName": "testdescription", "Type": "bytes32", "Primary": false, + "BytesToHex": true, "Notify": ["meta", "keyed_meta"] } ] diff --git a/vent/test/test.sh b/vent/test/test.sh deleted file mode 100755 index 30bb06989..000000000 --- a/vent/test/test.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# This script provides a simple running test chain that will generate height notification events -# Run postgres in background with: docker run -p 5432:5432 postgres - -REPO=${REPO:-"$PWD"} -vent_test_dir="$REPO/vent/test" -[[ ! -f burrow.toml ]] && burrow spec -f1 | burrow configure -s- > burrow.toml && rm -rf .burrow -burrow start -v0 &> burrow.log & -sleep 2s -burrow vent start --db-block --abi "$vent_test_dir/EventsTest.abi" --spec "$vent_test_dir/sqlsol_view.json" -# Now: -# psql -h 127.0.0.1 -p 5432 -U postgres -# LISTEN height; -# -- run any command to see notifications: -# SELECT true; -# -- run it some more - -# Generate some other events (on channels meta and keyed_meta) with: -# addr=$(curl -s localhost:26658/validators | jq -r '.result.BondedValidators[0].Address') -# burrow deploy -a $addr - -trap "killall burrow" EXIT diff --git a/vent/types/event_class.go b/vent/types/event_class.go index ae28c4b9e..92f3ee814 100644 --- a/vent/types/event_class.go +++ b/vent/types/event_class.go @@ -79,6 +79,8 @@ type EventFieldMapping struct { Primary bool `json:",omitempty"` // Whether to convert this event field from bytes32 to string BytesToString bool `json:",omitempty"` + // Whether to convert this event field from bytes32 to hex-encoded string + BytesToHex bool `json:",omitempty"` // Notification channels on which submit (via a trigger) a payload that contains this column's new value (upsert) or // old value (delete). The payload will contain all other values with the same channel set as a JSON object. Notify []string `json:",omitempty"`