From 9bcefdf3e2a41ee77a3937aebddaf3f21623b426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Mon, 7 Oct 2019 16:32:35 +0200 Subject: [PATCH] Tendermint upgrade (#2666) * migrated to tendermint 0.35.1 * increased bigchaindb_abci version * fixed API adjustments due to Tendermint upgrade Signed-off-by: Juergen Eckel * migrated to bigchaindb-abci == py-abci 0.7.1 Signed-off-by: Juergen Eckel --- CHANGELOG.md | 6 +++++ Dockerfile-all-in-one | 2 +- RELEASE_PROCESS.md | 26 +++++++++---------- bigchaindb/core.py | 2 +- bigchaindb/parallel_validation.py | 2 +- .../upsert_validator/validator_utils.py | 8 +++--- bigchaindb/version.py | 6 ++--- docker-compose.yml | 2 +- .../run-node-as-processes.md | 10 +++---- .../k8s-deployment-template/workflow.rst | 4 +-- .../set-up-node-software.md | 8 +++--- .../tendermint_container/Dockerfile | 2 +- .../roles/tendermint/files/Dockerfile | 2 +- pkg/scripts/stack.sh | 2 +- pkg/scripts/unstack.sh | 2 +- setup.py | 2 +- tests/tendermint/conftest.py | 8 +++--- tests/tendermint/test_core.py | 8 +++--- tests/tendermint/test_integration.py | 2 +- 19 files changed, 52 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f59404db..16098710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,12 @@ For reference, the possible headings are: * **Known Issues** * **Notes** +## [2.0] - 2019-09-26 + +### Changed + +Migrated from Tendermint 0.22.8 to 0.31.5. + ## [2.0 Beta 9] - 2018-11-27 ### Changed diff --git a/Dockerfile-all-in-one b/Dockerfile-all-in-one index d278fe59..784b4ef1 100644 --- a/Dockerfile-all-in-one +++ b/Dockerfile-all-in-one @@ -1,7 +1,7 @@ FROM alpine:3.9 LABEL maintainer "devs@bigchaindb.com" -ARG TM_VERSION=0.22.8 +ARG TM_VERSION=v0.31.5 RUN mkdir -p /usr/src/app ENV HOME /root COPY . /usr/src/app/ diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md index 7f521717..963dbb8b 100644 --- a/RELEASE_PROCESS.md +++ b/RELEASE_PROCESS.md @@ -45,26 +45,26 @@ The following steps are what we do to release a new version of _BigchainDB Serve - In `bigchaindb/version.py`: - update `__version__` to e.g. `0.9.0` (with no `.dev` on the end) - update `__short_version__` to e.g. `0.9` (with no `.dev` on the end) - - In the docs about installing BigchainDB (and Tendermint), and in the associated scripts, recommend/install a version of Tendermint that _actually works_ with the soon-to-be-released version of BigchainDB. You can find all such references by doing a search for the previously-recommended version number, such as `0.22.8`. + - In the docs about installing BigchainDB (and Tendermint), and in the associated scripts, recommend/install a version of Tendermint that _actually works_ with the soon-to-be-released version of BigchainDB. You can find all such references by doing a search for the previously-recommended version number, such as `0.31.5`. - In `setup.py`, _maybe_ update the development status item in the `classifiers` list. For example, one allowed value is `"Development Status :: 5 - Production/Stable"`. The [allowed values are listed at pypi.python.org](https://pypi.python.org/pypi?%3Aaction=list_classifiers). -1. **Wait for all the tests to pass!** -1. Merge the pull request into the `master` branch. -1. Go to the [bigchaindb/bigchaindb Releases page on GitHub](https://github.com/bigchaindb/bigchaindb/releases) +2. **Wait for all the tests to pass!** +3. Merge the pull request into the `master` branch. +4. Go to the [bigchaindb/bigchaindb Releases page on GitHub](https://github.com/bigchaindb/bigchaindb/releases) and click the "Draft a new release" button. -1. Fill in the details: +5. Fill in the details: - **Tag version:** version number preceded by `v`, e.g. `v0.9.1` - **Target:** the last commit that was just merged. In other words, that commit will get a Git tag with the value given for tag version above. - **Title:** Same as tag version above, e.g `v0.9.1` - **Description:** The body of the changelog entry (Added, Changed, etc.) -1. Click "Publish release" to publish the release on GitHub. -1. On your local computer, make sure you're on the `master` branch and that it's up-to-date with the `master` branch in the bigchaindb/bigchaindb repository (e.g. `git pull upstream master`). We're going to use that to push a new `bigchaindb` package to PyPI. -1. Make sure you have a `~/.pypirc` file containing credentials for PyPI. -1. Do `make release` to build and publish the new `bigchaindb` package on PyPI. For this step you need to have `twine` installed. If you get an error like `Makefile:135: recipe for target 'clean-pyc' failed` then try doing +6. Click "Publish release" to publish the release on GitHub. +7. On your local computer, make sure you're on the `master` branch and that it's up-to-date with the `master` branch in the bigchaindb/bigchaindb repository (e.g. `git pull upstream master`). We're going to use that to push a new `bigchaindb` package to PyPI. +8. Make sure you have a `~/.pypirc` file containing credentials for PyPI. +9. Do `make release` to build and publish the new `bigchaindb` package on PyPI. For this step you need to have `twine` installed. If you get an error like `Makefile:135: recipe for target 'clean-pyc' failed` then try doing ```text sudo chown -R $(whoami):$(whoami) . ``` -1. [Log in to readthedocs.org](https://readthedocs.org/accounts/login/) and go to the **BigchainDB Server** project, then: +10. [Log in to readthedocs.org](https://readthedocs.org/accounts/login/) and go to the **BigchainDB Server** project, then: - Click on "Builds", select "latest" from the drop-down menu, then click the "Build Version:" button. - Wait for the build of "latest" to finish. This can take a few minutes. - Go to Admin --> Advanced Settings @@ -75,9 +75,9 @@ The following steps are what we do to release a new version of _BigchainDB Serve - Go to Admin --> Versions and under **Choose Active Versions**, do these things: 1. Make sure that the new version's tag is "Active" and "Public" - 1. Make sure the **stable** branch is _not_ active. - 1. Scroll to the bottom of the page and click "Save". -1. Go to [Docker Hub](https://hub.docker.com/) and sign in, then: + 2. Make sure the **stable** branch is _not_ active. + 3. Scroll to the bottom of the page and click "Save". +11. Go to [Docker Hub](https://hub.docker.com/) and sign in, then: - Click on "Organizations" - Click on "bigchaindb" - Click on "bigchaindb/bigchaindb" diff --git a/bigchaindb/core.py b/bigchaindb/core.py index 331cf22c..5c5f6186 100644 --- a/bigchaindb/core.py +++ b/bigchaindb/core.py @@ -9,7 +9,7 @@ import logging import sys from abci.application import BaseApplication -from abci.types_pb2 import ( +from abci import ( ResponseInitChain, ResponseInfo, ResponseCheckTx, diff --git a/bigchaindb/parallel_validation.py b/bigchaindb/parallel_validation.py index 92a4d515..8e3be2c8 100644 --- a/bigchaindb/parallel_validation.py +++ b/bigchaindb/parallel_validation.py @@ -5,7 +5,7 @@ import multiprocessing as mp from collections import defaultdict -from abci.types_pb2 import ResponseCheckTx, ResponseDeliverTx +from abci import ResponseCheckTx, ResponseDeliverTx from bigchaindb import BigchainDB, App from bigchaindb.tendermint_utils import decode_transaction diff --git a/bigchaindb/upsert_validator/validator_utils.py b/bigchaindb/upsert_validator/validator_utils.py index 61562261..5e48bc5a 100644 --- a/bigchaindb/upsert_validator/validator_utils.py +++ b/bigchaindb/upsert_validator/validator_utils.py @@ -2,8 +2,7 @@ import codecs import base64 import binascii -from abci.types_pb2 import (Validator, - PubKey) +from abci import (ValidatorUpdate, PubKey) from bigchaindb.common.exceptions import InvalidPublicKey @@ -12,9 +11,8 @@ def encode_validator(v): # NOTE: tendermint expects public to be encoded in go-amino format pub_key = PubKey(type='ed25519', data=bytes.fromhex(ed25519_public_key)) - return Validator(pub_key=pub_key, - address=b'', - power=v['power']) + return ValidatorUpdate(pub_key=pub_key, + power=v['power']) def decode_validator(v): diff --git a/bigchaindb/version.py b/bigchaindb/version.py index 8e6ea65e..9c682199 100644 --- a/bigchaindb/version.py +++ b/bigchaindb/version.py @@ -2,8 +2,8 @@ # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 -__version__ = '2.0.0b9' -__short_version__ = '2.0b9' +__version__ = '2.0.0' +__short_version__ = '2.0' # Supported Tendermint versions -__tm_supported_versions__ = ["0.22.8"] +__tm_supported_versions__ = ["0.31.5"] diff --git a/docker-compose.yml b/docker-compose.yml index 0d69aa73..960b7da4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -50,7 +50,7 @@ services: command: '.ci/entrypoint.sh' restart: always tendermint: - image: tendermint/tendermint:0.22.8 + image: tendermint/tendermint:v0.31.5 # volumes: # - ./tmdata:/tendermint entrypoint: '' diff --git a/docs/contributing/source/dev-setup-coding-and-contribution-process/run-node-as-processes.md b/docs/contributing/source/dev-setup-coding-and-contribution-process/run-node-as-processes.md index 98a5aeb8..4a4300ea 100644 --- a/docs/contributing/source/dev-setup-coding-and-contribution-process/run-node-as-processes.md +++ b/docs/contributing/source/dev-setup-coding-and-contribution-process/run-node-as-processes.md @@ -17,7 +17,7 @@ and of course you also need to install BigchainDB Sever from the local code you ## Install and Run MongoDB -MongoDB can be easily installed, just refer to their [installation documentation](https://docs.mongodb.com/manual/installation/) for your distro. +MongoDB can be easily installed, just refer to their [installation documentation](https://docs.mongodb.com/manual/installation/) for your distro. We know MongoDB 3.4 and 3.6 work with BigchainDB. After the installation of MongoDB is complete, run MongoDB using `sudo mongod` @@ -25,13 +25,13 @@ After the installation of MongoDB is complete, run MongoDB using `sudo mongod` ### Installing a Tendermint Executable -The version of BigchainDB Server described in these docs only works well with Tendermint 0.22.8 (not a higher version number). Install that: +The version of BigchainDB Server described in these docs only works well with Tendermint 0.31.5 (not a higher version number). Install that: ```bash $ sudo apt install -y unzip -$ wget https://github.com/tendermint/tendermint/releases/download/v0.22.8/tendermint_0.22.8_linux_amd64.zip -$ unzip tendermint_0.22.8_linux_amd64.zip -$ rm tendermint_0.22.8_linux_amd64.zip +$ wget https://github.com/tendermint/tendermint/releases/download/v0.31.5/tendermint_v0.31.5_linux_amd64.zip +$ unzip tendermint_v0.31.5_linux_amd64.zip +$ rm tendermint_v0.31.5_linux_amd64.zip $ sudo mv tendermint /usr/local/bin ``` diff --git a/docs/server/source/k8s-deployment-template/workflow.rst b/docs/server/source/k8s-deployment-template/workflow.rst index 5ee76809..914fc99f 100644 --- a/docs/server/source/k8s-deployment-template/workflow.rst +++ b/docs/server/source/k8s-deployment-template/workflow.rst @@ -59,7 +59,7 @@ you can do this: .. code:: $ mkdir $(pwd)/tmdata - $ docker run --rm -v $(pwd)/tmdata:/tendermint/config tendermint/tendermint:0.22.8 init + $ docker run --rm -v $(pwd)/tmdata:/tendermint/config tendermint/tendermint:v0.31.5 init $ cat $(pwd)/tmdata/genesis.json You should see something that looks like: @@ -69,7 +69,7 @@ You should see something that looks like: {"genesis_time": "0001-01-01T00:00:00Z", "chain_id": "test-chain-bGX7PM", "validators": [ - {"pub_key": + {"pub_key": {"type": "ed25519", "data": "4669C4B966EB8B99E45E40982B2716A9D3FA53B54C68088DAB2689935D7AF1A9"}, "power": 10, diff --git a/docs/server/source/simple-deployment-template/set-up-node-software.md b/docs/server/source/simple-deployment-template/set-up-node-software.md index 493a2beb..18a74d82 100644 --- a/docs/server/source/simple-deployment-template/set-up-node-software.md +++ b/docs/server/source/simple-deployment-template/set-up-node-software.md @@ -91,13 +91,13 @@ Note that installing the official package _doesn't_ also start MongoDB. ## Install Tendermint The version of BigchainDB Server described in these docs only works well -with Tendermint 0.22.8 (not a higher version number). Install that: +with Tendermint 0.31.5 (not a higher version number). Install that: ``` sudo apt install -y unzip -wget https://github.com/tendermint/tendermint/releases/download/v0.22.8/tendermint_0.22.8_linux_amd64.zip -unzip tendermint_0.22.8_linux_amd64.zip -rm tendermint_0.22.8_linux_amd64.zip +wget https://github.com/tendermint/tendermint/releases/download/v0.31.5/tendermint_v0.31.5_linux_amd64.zip +unzip tendermint_v0.31.5_linux_amd64.zip +rm tendermint_v0.31.5_linux_amd64.zip sudo mv tendermint /usr/local/bin ``` diff --git a/k8s/bigchaindb/tendermint_container/Dockerfile b/k8s/bigchaindb/tendermint_container/Dockerfile index ba5f0998..5dc71b15 100644 --- a/k8s/bigchaindb/tendermint_container/Dockerfile +++ b/k8s/bigchaindb/tendermint_container/Dockerfile @@ -1,4 +1,4 @@ -FROM tendermint/tendermint:0.22.8 +FROM tendermint/tendermint:v0.31.5 LABEL maintainer "devs@bigchaindb.com" WORKDIR / USER root diff --git a/pkg/configuration/roles/tendermint/files/Dockerfile b/pkg/configuration/roles/tendermint/files/Dockerfile index e877a0bf..40790444 100644 --- a/pkg/configuration/roles/tendermint/files/Dockerfile +++ b/pkg/configuration/roles/tendermint/files/Dockerfile @@ -1,4 +1,4 @@ -ARG tm_version=0.22.8 +ARG tm_version=v0.31.5 FROM tendermint/tendermint:${tm_version} LABEL maintainer "devs@bigchaindb.com" WORKDIR / diff --git a/pkg/scripts/stack.sh b/pkg/scripts/stack.sh index a395852c..c2858996 100755 --- a/pkg/scripts/stack.sh +++ b/pkg/scripts/stack.sh @@ -15,7 +15,7 @@ stack_repo=${STACK_REPO:="bigchaindb/bigchaindb"} stack_size=${STACK_SIZE:=4} stack_type=${STACK_TYPE:="docker"} stack_type_provider=${STACK_TYPE_PROVIDER:=""} -tm_version=${TM_VERSION:="0.22.8"} +tm_version=${TM_VERSION:="v0.31.5"} mongo_version=${MONGO_VERSION:="3.6"} stack_vm_memory=${STACK_VM_MEMORY:=2048} stack_vm_cpus=${STACK_VM_CPUS:=2} diff --git a/pkg/scripts/unstack.sh b/pkg/scripts/unstack.sh index d8176eab..e1953de7 100755 --- a/pkg/scripts/unstack.sh +++ b/pkg/scripts/unstack.sh @@ -15,7 +15,7 @@ stack_repo=${STACK_REPO:="bigchaindb/bigchaindb"} stack_size=${STACK_SIZE:=4} stack_type=${STACK_TYPE:="docker"} stack_type_provider=${STACK_TYPE_PROVIDER:=""} -tm_version=${TM_VERSION:="0.22.8"} +tm_version=${TM_VERSION:="0.31.5"} mongo_version=${MONGO_VERSION:="3.6"} stack_vm_memory=${STACK_VM_MEMORY:=2048} stack_vm_cpus=${STACK_VM_CPUS:=2} diff --git a/setup.py b/setup.py index 2c6930ba..a2ec29ab 100644 --- a/setup.py +++ b/setup.py @@ -85,7 +85,7 @@ install_requires = [ 'jsonschema~=2.5.1', 'pyyaml>=4.2b1', 'aiohttp~=3.0', - 'bigchaindb-abci==0.5.1', + 'bigchaindb-abci==0.7.1', 'setproctitle~=1.1.0', 'packaging~=18.0', ] diff --git a/tests/tendermint/conftest.py b/tests/tendermint/conftest.py index fccd2ade..6ca2f032 100644 --- a/tests/tendermint/conftest.py +++ b/tests/tendermint/conftest.py @@ -5,7 +5,7 @@ import pytest import codecs -import abci.types_pb2 as types +import abci as types @pytest.fixture @@ -15,10 +15,8 @@ def validator_pub_key(): @pytest.fixture def init_chain_request(): - addr = codecs.decode(b'9FD479C869C7D7E7605BF99293457AA5D80C3033', 'hex') pk = codecs.decode(b'VAgFZtYw8bNR5TMZHFOBDWk9cAmEu3/c6JgRBmddbbI=', 'base64') - val_a = types.Validator(address=addr, power=10, - pub_key=types.PubKey(type='ed25519', data=pk)) - + val_a = types.ValidatorUpdate(power=10, + pub_key=types.PubKey(type='ed25519', data=pk)) return types.RequestInitChain(validators=[val_a]) diff --git a/tests/tendermint/test_core.py b/tests/tendermint/test_core.py index 9605e7f1..30133b3b 100644 --- a/tests/tendermint/test_core.py +++ b/tests/tendermint/test_core.py @@ -2,19 +2,18 @@ # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 -import codecs import json import pytest import random -from abci.types_pb2 import ( +from abci import ( PubKey, ResponseInitChain, RequestInitChain, RequestInfo, RequestBeginBlock, RequestEndBlock, - Validator, + ValidatorUpdate, ) from bigchaindb import App @@ -48,10 +47,9 @@ def generate_address(): def generate_validator(): - addr = codecs.decode(generate_address(), 'hex') pk, _ = generate_key_pair() pub_key = PubKey(type='ed25519', data=pk.encode()) - val = Validator(address=addr, power=10, pub_key=pub_key) + val = ValidatorUpdate(power=10, pub_key=pub_key) return val diff --git a/tests/tendermint/test_integration.py b/tests/tendermint/test_integration.py index c9288841..5d5787f5 100644 --- a/tests/tendermint/test_integration.py +++ b/tests/tendermint/test_integration.py @@ -4,7 +4,7 @@ import codecs -import abci.types_pb2 as types +import abci as types import json import pytest