All test passed. Acceptance tests passed too

This commit is contained in:
Sangat Das 2022-01-20 17:15:37 +00:00
parent 24f34f01cb
commit 4ddfcb0d8d
42 changed files with 182 additions and 182 deletions

View File

@ -399,7 +399,7 @@ Tag name: v1.2.0
### Added ### Added
* New and improved installation setup docs and code. Pull requests [#1775](https://github.com/planetmint/planetmint/pull/1775) and [#1785](https://github.com/planetmint/planetmint/pull/1785) * New and improved installation setup docs and code. Pull requests [#1775](https://github.com/planetmint/planetmint/pull/1775) and [#1785](https://github.com/planetmint/planetmint/pull/1785)
* New Planetmint configuration setting to set the port number of the log server: `log.port`. [Pull request #1796](https://github.com/planetmint/planetmint/pull/1796) * New Planetmint configuration setting to set the port number of the log server: `log.port`. [Pull request #1796](https://github.com/planetmint/planetmint/pull/1796)
* New secondary index on `id` in the bigchain table. That will make some queries execute faster. [Pull request #1803](https://github.com/planetmint/planetmint/pull/1803) * New secondary index on `id` in the planet table. That will make some queries execute faster. [Pull request #1803](https://github.com/planetmint/planetmint/pull/1803)
* When using MongoDB, there are some restrictions on allowed names for keys (JSON keys). Those restrictions were always there but now Planetmint checks key names explicitly, rather than leaving that to MongoDB. Pull requests [#1807](https://github.com/planetmint/planetmint/pull/1807) and [#1811](https://github.com/planetmint/planetmint/pull/1811) * When using MongoDB, there are some restrictions on allowed names for keys (JSON keys). Those restrictions were always there but now Planetmint checks key names explicitly, rather than leaving that to MongoDB. Pull requests [#1807](https://github.com/planetmint/planetmint/pull/1807) and [#1811](https://github.com/planetmint/planetmint/pull/1811)
* When using MongoDB, there are some restrictions on the allowed values of "language" (if that key is used in the values of `metadata` or `asset.data`). Those restrictions were always there but now Planetmint checks the values explicitly, rather than leaving that to MongoDB. Pull requests [#1806](https://github.com/planetmint/planetmint/pull/1806) and [#1811](https://github.com/planetmint/planetmint/pull/1811) * When using MongoDB, there are some restrictions on the allowed values of "language" (if that key is used in the values of `metadata` or `asset.data`). Those restrictions were always there but now Planetmint checks the values explicitly, rather than leaving that to MongoDB. Pull requests [#1806](https://github.com/planetmint/planetmint/pull/1806) and [#1811](https://github.com/planetmint/planetmint/pull/1811)
* There's a new page in the root docs about permissions in Planetmint. [Pull request #1788](https://github.com/planetmint/planetmint/pull/1788) * There's a new page in the root docs about permissions in Planetmint. [Pull request #1788](https://github.com/planetmint/planetmint/pull/1788)
@ -434,7 +434,7 @@ Tag name: v1.1.0
### Notes ### Notes
* New drivers & tools from our community: * New drivers & tools from our community:
* [Java driver](https://github.com/authenteq/java-planetmint-driver), by [Authenteq](https://authenteq.com/) * [Java driver](https://github.com/authenteq/java-bigchaindb-driver), by [Authenteq](https://authenteq.com/)
* [Ruby library](https://rubygems.org/gems/planetmint), by @nileshtrivedi * [Ruby library](https://rubygems.org/gems/planetmint), by @nileshtrivedi
* Many improvements to our production deployment template (which uses Kubernetes). * Many improvements to our production deployment template (which uses Kubernetes).
* The production deployment template for the multi-node case was out of date. We updated that and verified it. [Pull request #1713](https://github.com/planetmint/planetmint/pull/1713) * The production deployment template for the multi-node case was out of date. We updated that and verified it. [Pull request #1713](https://github.com/planetmint/planetmint/pull/1713)
@ -493,7 +493,7 @@ Tag name: v1.0.0rc1
* In `setup.py`, the "Development Status" (as reported on PyPI) was changed from Alpha to Beta. [Pull Request #1437](https://github.com/planetmint/planetmint/pull/1437) * In `setup.py`, the "Development Status" (as reported on PyPI) was changed from Alpha to Beta. [Pull Request #1437](https://github.com/planetmint/planetmint/pull/1437)
* If you explicitly specify a config file, e.g. `planetmint -c path/to/config start` and that file can't be found, then Planetmint Server will fail with a helpful error message. [Pull Request #1486](https://github.com/planetmint/planetmint/pull/1486) * If you explicitly specify a config file, e.g. `planetmint -c path/to/config start` and that file can't be found, then Planetmint Server will fail with a helpful error message. [Pull Request #1486](https://github.com/planetmint/planetmint/pull/1486)
* Reduced the response time on the HTTP API endpoint to get all the unspent outputs associated with a given public key (a.k.a. "fast unspents"). [Pull Request #1411](https://github.com/planetmint/planetmint/pull/1411) * Reduced the response time on the HTTP API endpoint to get all the unspent outputs associated with a given public key (a.k.a. "fast unspents"). [Pull Request #1411](https://github.com/planetmint/planetmint/pull/1411)
* Internally, the value of an asset's `"data"` is now stored in a separate assets table. This enabled the new text search. Each asset data is stored along with the associated CREATE transaction ID (asset ID). That data gets written when the containing block gets written to the bigchain table. [Pull Request #1460](https://github.com/planetmint/planetmint/pull/1460) * Internally, the value of an asset's `"data"` is now stored in a separate assets table. This enabled the new text search. Each asset data is stored along with the associated CREATE transaction ID (asset ID). That data gets written when the containing block gets written to the planet table. [Pull Request #1460](https://github.com/planetmint/planetmint/pull/1460)
* Schema validation was sped up by switching to `rapidjson-schema`. [Pull Request #1494](https://github.com/planetmint/planetmint/pull/1494) * Schema validation was sped up by switching to `rapidjson-schema`. [Pull Request #1494](https://github.com/planetmint/planetmint/pull/1494)
* If a node comes back from being down for a while, it will resume voting on blocks in the order determined by the MongoDB oplog, in the case of MongoDB. (In the case of RethinkDB, blocks missed in the changefeed will not be voted on.) [Pull Request #1389](https://github.com/planetmint/planetmint/pull/1389) * If a node comes back from being down for a while, it will resume voting on blocks in the order determined by the MongoDB oplog, in the case of MongoDB. (In the case of RethinkDB, blocks missed in the changefeed will not be voted on.) [Pull Request #1389](https://github.com/planetmint/planetmint/pull/1389)
* Parallelized transaction schema validation in the vote pipeline. [Pull Request #1492](https://github.com/planetmint/planetmint/pull/1492) * Parallelized transaction schema validation in the vote pipeline. [Pull Request #1492](https://github.com/planetmint/planetmint/pull/1492)
@ -523,7 +523,7 @@ Tag name: v1.0.0rc1
* We dropped support for Python 3.4. [Pull Request #1564](https://github.com/planetmint/planetmint/pull/1564) * We dropped support for Python 3.4. [Pull Request #1564](https://github.com/planetmint/planetmint/pull/1564)
* There were many improvements to our Kubernetes-based production deployment template (and the associated documentaiton). * There were many improvements to our Kubernetes-based production deployment template (and the associated documentaiton).
* There is now a [Planetmint Ruby driver](https://github.com/LicenseRocks/planetmint_ruby), created by @addywaddy at [license.rocks](https://github.com/planetmint/planetmint/pull/1437). * There is now a [Planetmint Ruby driver](https://github.com/LicenseRocks/planetmint_ruby), created by @addywaddy at [license.rocks](https://github.com/planetmint/planetmint/pull/1437).
* The [Planetmint JavaScript driver](https://github.com/planetmint/js-planetmint-driver) was moved to a different GitHub repo and is now officially maintained by the Planetmint team. * The [Planetmint JavaScript driver](https://github.com/planetmint/js-bigchaindb-driver) was moved to a different GitHub repo and is now officially maintained by the Planetmint team.
* We continue to recommend using MongoDB. * We continue to recommend using MongoDB.
## [0.10.3] - 2017-06-29 ## [0.10.3] - 2017-06-29
@ -996,7 +996,7 @@ committed: May 27, 2016, 1:42 PM GMT+2
- Caching of calls to `load_consensus_plugin()`, using [`@lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache). This speeds up the instantiation of `Bigchain` objects and greatly improves overall performance. [Pull Request #271](https://github.com/planetmint/planetmint/pull/271) - Caching of calls to `load_consensus_plugin()`, using [`@lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache). This speeds up the instantiation of `Bigchain` objects and greatly improves overall performance. [Pull Request #271](https://github.com/planetmint/planetmint/pull/271)
- New `Dockerfile-dev` Docker file to make it easier for developers to _develop_ Planetmint with Docker. One can run all unit tests with Docker again. [Pull Request #313](https://github.com/planetmint/planetmint/pull/313) - New `Dockerfile-dev` Docker file to make it easier for developers to _develop_ Planetmint with Docker. One can run all unit tests with Docker again. [Pull Request #313](https://github.com/planetmint/planetmint/pull/313)
- Transactions in invalid blocks are copied to the backlog: [Pull Request #221](https://github.com/planetmint/planetmint/pull/221). - Transactions in invalid blocks are copied to the backlog: [Pull Request #221](https://github.com/planetmint/planetmint/pull/221).
- Queries to the bigchain table now ignore invalid blocks: [Pull Request #324](https://github.com/planetmint/planetmint/issues/324) - Queries to the planet table now ignore invalid blocks: [Pull Request #324](https://github.com/planetmint/planetmint/issues/324)
- Use secondary index on get_transaction: [Pull Request #324](https://github.com/planetmint/planetmint/issues/324) - Use secondary index on get_transaction: [Pull Request #324](https://github.com/planetmint/planetmint/issues/324)
- New `planetmint` command to set the number of RethinkDB shards (in both tables): [Pull Request #258](https://github.com/planetmint/planetmint/pull/258) - New `planetmint` command to set the number of RethinkDB shards (in both tables): [Pull Request #258](https://github.com/planetmint/planetmint/pull/258)
- Better handling of an outdated `setuptools`: [Pull Request #279](https://github.com/planetmint/planetmint/pull/279) - Better handling of an outdated `setuptools`: [Pull Request #279](https://github.com/planetmint/planetmint/pull/279)

View File

@ -5,5 +5,5 @@ RUN pip install --upgrade \
pycco \ pycco \
websocket-client~=0.47.0 \ websocket-client~=0.47.0 \
pytest~=3.0 \ pytest~=3.0 \
planetmint-driver~=0.6.2 \ bigchaindb-driver~=0.6.2 \
blns blns

View File

@ -24,7 +24,7 @@
import os import os
# For this test case we import and use the Python Driver. # For this test case we import and use the Python Driver.
from bigchaindb_driver import Planetmint from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair from bigchaindb_driver.crypto import generate_keypair
@ -34,7 +34,7 @@ def test_basic():
# connect to localhost, but you can override this value using the env variable # connect to localhost, but you can override this value using the env variable
# called `PLANETMINT_ENDPOINT`, a valid value must include the schema: # called `PLANETMINT_ENDPOINT`, a valid value must include the schema:
# `https://example.com:9984` # `https://example.com:9984`
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT')) bdb = BigchainDB(os.environ.get('PLANETMINT_ENDPOINT'))
# ## Create keypairs # ## Create keypairs
# This test requires the interaction between two actors with their own keypair. # This test requires the interaction between two actors with their own keypair.

View File

@ -29,7 +29,7 @@ import pytest
from bigchaindb_driver.exceptions import BadRequest from bigchaindb_driver.exceptions import BadRequest
# For this test case we import and use the Python Driver. # For this test case we import and use the Python Driver.
from bigchaindb_driver import Planetmint from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair from bigchaindb_driver.crypto import generate_keypair
@ -37,7 +37,7 @@ def test_divisible_assets():
# ## Set up a connection to Planetmint # ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details # Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint. # about the endpoint.
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT')) bdb = BigchainDB(os.environ.get('PLANETMINT_ENDPOINT'))
# Oh look, it is Alice again and she brought her friend Bob along. # Oh look, it is Alice again and she brought her friend Bob along.
alice, bob = generate_keypair(), generate_keypair() alice, bob = generate_keypair(), generate_keypair()

View File

@ -12,12 +12,12 @@ from threading import Thread
import queue import queue
import bigchaindb_driver.exceptions import bigchaindb_driver.exceptions
from bigchaindb_driver import Planetmint from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair from bigchaindb_driver.crypto import generate_keypair
def test_double_create(): def test_double_create():
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT')) bdb = BigchainDB(os.environ.get('PLANETMINT_ENDPOINT'))
alice = generate_keypair() alice = generate_keypair()
results = queue.Queue() results = queue.Queue()

View File

@ -25,7 +25,7 @@
import os import os
# For this test case we import and use the Python Driver. # For this test case we import and use the Python Driver.
from bigchaindb_driver import Planetmint from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair from bigchaindb_driver.crypto import generate_keypair
@ -33,7 +33,7 @@ def test_multiple_owners():
# ## Set up a connection to Planetmint # ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details # Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint. # about the endpoint.
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT')) bdb = BigchainDB(os.environ.get('PLANETMINT_ENDPOINT'))
# Hey Alice and Bob, nice to see you again! # Hey Alice and Bob, nice to see you again!
alice, bob = generate_keypair(), generate_keypair() alice, bob = generate_keypair(), generate_keypair()

View File

@ -24,7 +24,7 @@ from blns import blns
import pytest import pytest
# For this test case we import and use the Python Driver. # For this test case we import and use the Python Driver.
from bigchaindb_driver import Planetmint from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair from bigchaindb_driver.crypto import generate_keypair
from bigchaindb_driver.exceptions import BadRequest from bigchaindb_driver.exceptions import BadRequest
@ -36,7 +36,7 @@ def send_naughty_tx(asset, metadata):
# ## Set up a connection to Planetmint # ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details # Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint. # about the endpoint.
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT')) bdb = BigchainDB(os.environ.get('PLANETMINT_ENDPOINT'))
# Here's Alice. # Here's Alice.
alice = generate_keypair() alice = generate_keypair()

View File

@ -27,7 +27,7 @@ from uuid import uuid4
# [websocket](https://github.com/websocket-client/websocket-client) module # [websocket](https://github.com/websocket-client/websocket-client) module
from websocket import create_connection from websocket import create_connection
from bigchaindb_driver import Planetmint from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair from bigchaindb_driver.crypto import generate_keypair
@ -40,7 +40,7 @@ def test_stream():
# *That's pretty bad, but let's do like this for now.* # *That's pretty bad, but let's do like this for now.*
WS_ENDPOINT = 'ws://{}:9985/api/v1/streams/valid_transactions'.format(BDB_ENDPOINT.rsplit(':')[0]) WS_ENDPOINT = 'ws://{}:9985/api/v1/streams/valid_transactions'.format(BDB_ENDPOINT.rsplit(':')[0])
bdb = Planetmint(BDB_ENDPOINT) bdb = BigchainDB(BDB_ENDPOINT)
# Hello to Alice again, she is pretty active in those tests, good job # Hello to Alice again, she is pretty active in those tests, good job
# Alice! # Alice!

View File

@ -4,12 +4,12 @@
# You can set these variables from the command line. # You can set these variables from the command line.
SPHINXOPTS = -W SPHINXOPTS = -W
SPHINXBUILD = sphinx-build SPHINXBUILD = sphinx-build
PAPER = PAPER = a4
BUILDDIR = build BUILDDIR = build
# Internal variables. # Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_a4 = -D latex_elements.papersize=a4paper
PAPEROPT_letter = -D latex_paper_size=letter PAPEROPT_letter = -D latex_elements.papersize=letterpaper
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others # the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source

View File

@ -290,7 +290,7 @@ html_static_path = ['_static']
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh' # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
# #
# html_search_language = 'en' # html_search_language = 'en's
# A dictionary with options for the search language support, empty by default. # A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value. # 'ja' uses this config value.
@ -304,14 +304,14 @@ html_static_path = ['_static']
# html_search_scorer = 'scorer.js' # html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'BigchainDBdoc' htmlhelp_basename = 'Planetmintdoc'
# -- Options for LaTeX output --------------------------------------------- # -- Options for LaTeX output ---------------------------------------------
latex_elements = { latex_elements = {
# The paper size ('letterpaper' or 'a4paper'). # The paper size ('letterpaper' or 'a4paper').
# #
# 'papersize': 'letterpaper', 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt'). # The font size ('10pt', '11pt' or '12pt').
# #

View File

@ -11,9 +11,9 @@ There are many ways you can contribute to Planetmint.
It includes several sub-projects. It includes several sub-projects.
- `Planetmint Server <https://github.com/planetmint/planetmint>`_ - `Planetmint Server <https://github.com/planetmint/planetmint>`_
- `Planetmint Python Driver <https://github.com/planetmint/planetmint-driver>`_ - `Planetmint Python Driver <https://github.com/planetmint/bigchaindb-driver>`_
- `Planetmint JavaScript Driver <https://github.com/planetmint/js-planetmint-driver>`_ - `Planetmint JavaScript Driver <https://github.com/planetmint/js-bigchaindb-driver>`_
- `Planetmint Java Driver <https://github.com/planetmint/java-planetmint-driver>`_ - `Planetmint Java Driver <https://github.com/planetmint/java-bigchaindb-driver>`_
- `cryptoconditions <https://github.com/planetmint/cryptoconditions>`_ (a Python package by us) - `cryptoconditions <https://github.com/planetmint/cryptoconditions>`_ (a Python package by us)
- `py-abci <https://github.com/davebryson/py-abci>`_ (a Python package we use) - `py-abci <https://github.com/davebryson/py-abci>`_ (a Python package we use)
- `Planetmint Enhancement Proposals (PEPs) <https://github.com/planetmint/PEPs>`_ - `Planetmint Enhancement Proposals (PEPs) <https://github.com/planetmint/PEPs>`_

View File

@ -22,7 +22,7 @@ People ask questions about Planetmint in the following places:
- Gitter - Gitter
- [planetmint/planetmint](https://gitter.im/planetmint/community) - [planetmint/planetmint](https://gitter.im/planetmint/community)
- [planetmint/js-planetmint-driver](https://gitter.im/planetmint/community)) - [planetmint/js-bigchaindb-driver](https://gitter.im/planetmint/community))
- [Twitter](https://twitter.com/planetmint) - [Twitter](https://twitter.com/planetmint)
- [Stack Overflow "planetmint"](https://stackoverflow.com/search?q=planetmint) - [Stack Overflow "planetmint"](https://stackoverflow.com/search?q=planetmint)

View File

@ -19,8 +19,8 @@ If you're writing code, you should also update any related docs. However, you mi
You can certainly do that! You can certainly do that!
- The docs for Planetmint Server live under ``planetmint/docs/`` in the ``planetmint/planetmint`` repo. - The docs for Planetmint Server live under ``planetmint/docs/`` in the ``planetmint/planetmint`` repo.
- There are docs for the Python driver under ``planetmint-driver/docs/`` in the ``planetmint/planetmint-driver`` repo. - There are docs for the Python driver under ``bigchaindb-driver/docs/`` in the ``planetmint/bigchaindb-driver`` repo.
- There are docs for the JavaScript driver under ``planetmint/js-planetmint-driver`` in the ``planetmint/js-planetmint-driver`` repo. - There are docs for the JavaScript driver under ``planetmint/js-bigchaindb-driver`` in the ``planetmint/js-bigchaindb-driver`` repo.
- The source code for the Planetmint website is in a private repo, but we can give you access if you ask. - The source code for the Planetmint website is in a private repo, but we can give you access if you ask.
The [Planetmint Transactions Specs](https://github.com/planetmint/PEPs/tree/master/tx-specs/) (one for each spec version) are in the ``planetmint/PEPs`` repo. The [Planetmint Transactions Specs](https://github.com/planetmint/PEPs/tree/master/tx-specs/) (one for each spec version) are in the ``planetmint/PEPs`` repo.

View File

@ -12,8 +12,8 @@ Connectors to Planetmint are referred to as drivers within the community. A driv
These drivers were originally created by the original Planetmint team: These drivers were originally created by the original Planetmint team:
* `Python Driver <https://docs.planetmint.com/projects/py-driver/en/latest/index.html>`_ * `Python Driver <https://docs.planetmint.com/projects/py-driver/en/latest/index.html>`_
* `JavaScript / Node.js Driver <https://github.com/planetmint/js-planetmint-driver>`_ * `JavaScript / Node.js Driver <https://github.com/planetmint/js-bigchaindb-driver>`_
* `Java Driver <https://github.com/planetmint/java-planetmint-driver>`_ * `Java Driver <https://github.com/planetmint/java-bigchaindb-driver>`_
These drivers and tools were created by the Planetmint community: These drivers and tools were created by the Planetmint community:
@ -26,6 +26,6 @@ These drivers and tools were created by the Planetmint community:
* `ANSI C driver <https://github.com/RiddleAndCode/planetmint-c-driver>`_, should also work with C++ (working as of June 2019) * `ANSI C driver <https://github.com/RiddleAndCode/planetmint-c-driver>`_, should also work with C++ (working as of June 2019)
* `C# driver <https://github.com/Omnibasis/planetmint-csharp-driver>`_ (working as of May 2019) * `C# driver <https://github.com/Omnibasis/planetmint-csharp-driver>`_ (working as of May 2019)
* `Haskell transaction builder <https://github.com/planetmint/planetmint-hs>`_ * `Haskell transaction builder <https://github.com/planetmint/planetmint-hs>`_
* `Go driver <https://github.com/zbo14/envoke/blob/master/bigchain/bigchain.go>`_ * `Go driver <https://github.com/zbo14/envoke/blob/master/bigchain/planet.go>`_
* `Ruby driver <https://github.com/LicenseRocks/planetmint_ruby>`_ * `Ruby driver <https://github.com/LicenseRocks/planetmint_ruby>`_
* `Ruby library for preparing/signing transactions and submitting them or querying a Planetmint node (MIT licensed) <https://rubygems.org/gems/planetmint>`_ * `Ruby library for preparing/signing transactions and submitting them or querying a Planetmint node (MIT licensed) <https://rubygems.org/gems/planetmint>`_

View File

@ -283,14 +283,14 @@ specified path.
**Log rotation:** Log files have a size limit of about 200 MB **Log rotation:** Log files have a size limit of about 200 MB
and will be rotated up to five times. and will be rotated up to five times.
For example, if `log.file` is set to `"~/bigchain.log"`, then For example, if `log.file` is set to `"~/planet.log"`, then
logs would always be written to `bigchain.log`. Each time the file logs would always be written to `planet.log`. Each time the file
`bigchain.log` reaches 200 MB it will be closed and renamed `planet.log` reaches 200 MB it will be closed and renamed
`bigchain.log.1`. If `bigchain.log.1` and `bigchain.log.2` already exist they `planet.log.1`. If `planet.log.1` and `planet.log.2` already exist they
would be renamed `bigchain.log.2` and `bigchain.log.3`. This pattern would be would be renamed `planet.log.2` and `planet.log.3`. This pattern would be
applied up to `bigchain.log.5` after which `bigchain.log.5` would be applied up to `planet.log.5` after which `planet.log.5` would be
overwritten by `bigchain.log.4`, thus ending the rotation cycle of whatever overwritten by `planet.log.4`, thus ending the rotation cycle of whatever
logs were in `bigchain.log.5`. logs were in `planet.log.5`.
### log.error_file ### log.error_file

View File

@ -53,7 +53,7 @@ SQL을 이용해 mongoDB 데이터베이스를 쿼리할 수 있습니다. 예
... ...
> show dbs > show dbs
admin 0.000GB admin 0.000GB
bigchain 0.000GB planet 0.000GB
config 0.000GB config 0.000GB
local 0.000GB local 0.000GB
> use bigchain > use bigchain
@ -197,6 +197,6 @@ Tendermint voting 파워가 0인 노드인 추종자 노드를 생성할 수 있
[MongoDB node.js 드라이버](https://mongodb.github.io/node-mongodb-native/?jmp=docs)와 같은 MongoDB 드라이버를 사용하여 다음 중 하나를 사용하여 노드의 MongoDB 데이터베이스에 연결할 수 있습니다. 여기 자바스크립트 쿼리 코드에 대한 링크가 있습니다. [MongoDB node.js 드라이버](https://mongodb.github.io/node-mongodb-native/?jmp=docs)와 같은 MongoDB 드라이버를 사용하여 다음 중 하나를 사용하여 노드의 MongoDB 데이터베이스에 연결할 수 있습니다. 여기 자바스크립트 쿼리 코드에 대한 링크가 있습니다.
- [The Planetmint JavaScript/Node.js driver source code](https://github.com/planetmint/js-planetmint-driver) - [The Planetmint JavaScript/Node.js driver source code](https://github.com/planetmint/js-bigchaindb-driver)
- [Example code by @manolodewiner](https://github.com/manolodewiner/query-mongodb-planetmint/blob/master/queryMongo.js) - [Example code by @manolodewiner](https://github.com/manolodewiner/query-mongodb-planetmint/blob/master/queryMongo.js)
- [More example code by @manolodewiner](https://github.com/planetmint/planetmint/issues/2315#issuecomment-392724279) - [More example code by @manolodewiner](https://github.com/planetmint/planetmint/issues/2315#issuecomment-392724279)

View File

@ -56,11 +56,11 @@ For example, if you're on a machine that's running a default Planetmint node, th
... ...
> show dbs > show dbs
admin 0.000GB admin 0.000GB
bigchain 0.000GB planet 0.000GB
config 0.000GB config 0.000GB
local 0.000GB local 0.000GB
> use bigchain > use planetmint
switched to db bigchain switched to db planetmint
> show collections > show collections
abci_chains abci_chains
assets assets
@ -75,14 +75,14 @@ For example, if you're on a machine that's running a default Planetmint node, th
The above example illustrates several things: The above example illustrates several things:
* When you don't specify the hostname or port, the Mongo Shell assumes they are ``localhost`` and ``27017``, respectively. (``localhost`` had IP address 127.0.0.1 on the machine in question, an Ubuntu machine.) * When you don't specify the hostname or port, the Mongo Shell assumes they are ``localhost`` and ``27017``, respectively. (``localhost`` had IP address 127.0.0.1 on the machine in question, an Ubuntu machine.)
* Planetmint stores its data in a database named ``bigchain``. * Planetmint stores its data in a database named ``planetmint``.
* The ``bigchain`` database contains several `collections <https://docs.mongodb.com/manual/core/databases-and-collections/>`_. * The ``planetmint`` database contains several `collections <https://docs.mongodb.com/manual/core/databases-and-collections/>`_.
* Votes aren't stored in any collection, currently. They are all handled and stored by Tendermint in its own (LevelDB) database. * Votes aren't stored in any collection, currently. They are all handled and stored by Tendermint in its own (LevelDB) database.
Example Documents from Some Collections Example Documents from Some Collections
--------------------------------------- ---------------------------------------
The most interesting collections in the ``bigchain`` database are: The most interesting collections in the ``planetmint`` database are:
- transactions - transactions
- assets - assets
@ -224,6 +224,6 @@ of the MongoDB drivers, such as `the MongoDB Node.js driver
Here are some links to example JavaScript code that queries a Here are some links to example JavaScript code that queries a
Planetmint node's MongoDB database: Planetmint node's MongoDB database:
- `The Planetmint JavaScript/Node.js driver source code <https://github.com/planetmint/js-planetmint-driver>`_ - `The Planetmint JavaScript/Node.js driver source code <https://github.com/planetmint/js-bigchaindb-driver>`_
- `Example code by @manolodewiner <https://github.com/manolodewiner/query-mongodb-planetmint/blob/master/queryMongo.js>`_ - `Example code by @manolodewiner <https://github.com/manolodewiner/query-mongodb-planetmint/blob/master/queryMongo.js>`_
- `More example code by @manolodewiner <https://github.com/planetmint/planetmint/issues/2315#issuecomment-392724279>`_ - `More example code by @manolodewiner <https://github.com/planetmint/planetmint/issues/2315#issuecomment-392724279>`_

View File

@ -9,8 +9,8 @@ WORKDIR /
RUN apk add --no-cache --update curl bind-tools python3-dev g++ \ RUN apk add --no-cache --update curl bind-tools python3-dev g++ \
libffi-dev make vim git nodejs openssl-dev \ libffi-dev make vim git nodejs openssl-dev \
&& pip3 install ipython \ && pip3 install ipython \
&& git clone https://github.com/planetmint/planetmint-driver \ && git clone https://github.com/bigchaindb/bigchaindb-driver \
&& cd planetmint-driver \ && cd bigchaindb-driver \
&& pip3 install -e . \ && pip3 install -e . \
&& npm install -g wsc && npm install -g wsc
ENTRYPOINT ["/bin/sh"] ENTRYPOINT ["/bin/sh"]

View File

@ -150,7 +150,7 @@ def get_owned_ids(connection, owner):
@singledispatch @singledispatch
def get_block(connection, block_id): def get_block(connection, block_id):
"""Get a block from the bigchain table. """Get a block from the planet table.
Args: Args:
block_id (str): block id of the block to get block_id (str): block id of the block to get

View File

@ -113,19 +113,19 @@ def run_election(args):
globals()[f'run_election_{args.action}'](args, b) globals()[f'run_election_{args.action}'](args, b)
def run_election_new(args, bigchain): def run_election_new(args, planet):
election_type = args.election_type.replace('-', '_') election_type = args.election_type.replace('-', '_')
globals()[f'run_election_new_{election_type}'](args, bigchain) globals()[f'run_election_new_{election_type}'](args, planet)
def create_new_election(sk, bigchain, election_class, data): def create_new_election(sk, planet, election_class, data):
try: try:
key = load_node_key(sk) key = load_node_key(sk)
voters = election_class.recipients(bigchain) voters = election_class.recipients(planet)
election = election_class.generate([key.public_key], election = election_class.generate([key.public_key],
voters, voters,
data, None).sign([key.private_key]) data, None).sign([key.private_key])
election.validate(bigchain) election.validate(planet)
except ValidationError as e: except ValidationError as e:
logger.error(e) logger.error(e)
return False return False
@ -133,7 +133,7 @@ def create_new_election(sk, bigchain, election_class, data):
logger.error(fd_404) logger.error(fd_404)
return False return False
resp = bigchain.write_transaction(election, BROADCAST_TX_COMMIT) resp = planet.write_transaction(election, BROADCAST_TX_COMMIT)
if resp == (202, ''): if resp == (202, ''):
logger.info('[SUCCESS] Submitted proposal with id: {}'.format(election.id)) logger.info('[SUCCESS] Submitted proposal with id: {}'.format(election.id))
return election.id return election.id
@ -142,7 +142,7 @@ def create_new_election(sk, bigchain, election_class, data):
return False return False
def run_election_new_upsert_validator(args, bigchain): def run_election_new_upsert_validator(args, planet):
"""Initiates an election to add/update/remove a validator to an existing Planetmint network """Initiates an election to add/update/remove a validator to an existing Planetmint network
:param args: dict :param args: dict
@ -152,7 +152,7 @@ def run_election_new_upsert_validator(args, bigchain):
'node_id': the node_id of the new peer (str) 'node_id': the node_id of the new peer (str)
'sk': the path to the private key of the node calling the election (str) 'sk': the path to the private key of the node calling the election (str)
} }
:param bigchain: an instance of Planetmint :param planet: an instance of Planetmint
:return: election_id or `False` in case of failure :return: election_id or `False` in case of failure
""" """
@ -163,24 +163,24 @@ def run_election_new_upsert_validator(args, bigchain):
'node_id': args.node_id 'node_id': args.node_id
} }
return create_new_election(args.sk, bigchain, ValidatorElection, new_validator) return create_new_election(args.sk, planet, ValidatorElection, new_validator)
def run_election_new_chain_migration(args, bigchain): def run_election_new_chain_migration(args, planet):
"""Initiates an election to halt block production """Initiates an election to halt block production
:param args: dict :param args: dict
args = { args = {
'sk': the path to the private key of the node calling the election (str) 'sk': the path to the private key of the node calling the election (str)
} }
:param bigchain: an instance of Planetmint :param planet: an instance of Planetmint
:return: election_id or `False` in case of failure :return: election_id or `False` in case of failure
""" """
return create_new_election(args.sk, bigchain, ChainMigrationElection, {}) return create_new_election(args.sk, planet, ChainMigrationElection, {})
def run_election_approve(args, bigchain): def run_election_approve(args, planet):
"""Approve an election """Approve an election
:param args: dict :param args: dict
@ -188,12 +188,12 @@ def run_election_approve(args, bigchain):
'election_id': the election_id of the election (str) 'election_id': the election_id of the election (str)
'sk': the path to the private key of the signer (str) 'sk': the path to the private key of the signer (str)
} }
:param bigchain: an instance of Planetmint :param planet: an instance of Planetmint
:return: success log message or `False` in case of error :return: success log message or `False` in case of error
""" """
key = load_node_key(args.sk) key = load_node_key(args.sk)
tx = bigchain.get_transaction(args.election_id) tx = planet.get_transaction(args.election_id)
voting_powers = [v.amount for v in tx.outputs if key.public_key in v.public_keys] voting_powers = [v.amount for v in tx.outputs if key.public_key in v.public_keys]
if len(voting_powers) > 0: if len(voting_powers) > 0:
voting_power = voting_powers[0] voting_power = voting_powers[0]
@ -206,9 +206,9 @@ def run_election_approve(args, bigchain):
approval = Vote.generate(inputs, approval = Vote.generate(inputs,
[([election_pub_key], voting_power)], [([election_pub_key], voting_power)],
tx.id).sign([key.private_key]) tx.id).sign([key.private_key])
approval.validate(bigchain) approval.validate(planet)
resp = bigchain.write_transaction(approval, BROADCAST_TX_COMMIT) resp = planet.write_transaction(approval, BROADCAST_TX_COMMIT)
if resp == (202, ''): if resp == (202, ''):
logger.info('[SUCCESS] Your vote has been submitted') logger.info('[SUCCESS] Your vote has been submitted')
@ -218,22 +218,22 @@ def run_election_approve(args, bigchain):
return False return False
def run_election_show(args, bigchain): def run_election_show(args, planet):
"""Retrieves information about an election """Retrieves information about an election
:param args: dict :param args: dict
args = { args = {
'election_id': the transaction_id for an election (str) 'election_id': the transaction_id for an election (str)
} }
:param bigchain: an instance of Planetmint :param planet: an instance of Planetmint
""" """
election = bigchain.get_transaction(args.election_id) election = planet.get_transaction(args.election_id)
if not election: if not election:
logger.error(f'No election found with election_id {args.election_id}') logger.error(f'No election found with election_id {args.election_id}')
return return
response = election.show_election(bigchain) response = election.show_election(planet)
logger.info(response) logger.info(response)

View File

@ -1211,13 +1211,13 @@ class Transaction(object):
tx['metadata'], tx['version'], hash_id=tx['id'], tx_dict=tx) tx['metadata'], tx['version'], hash_id=tx['id'], tx_dict=tx)
@classmethod @classmethod
def from_db(cls, bigchain, tx_dict_list): def from_db(cls, planet, tx_dict_list):
"""Helper method that reconstructs a transaction dict that was returned """Helper method that reconstructs a transaction dict that was returned
from the database. It checks what asset_id to retrieve, retrieves the from the database. It checks what asset_id to retrieve, retrieves the
asset from the asset table and reconstructs the transaction. asset from the asset table and reconstructs the transaction.
Args: Args:
bigchain (:class:`~planetmint.tendermint.Planetmint`): An instance planet (:class:`~planetmint.tendermint.Planetmint`): An instance
of Planetmint used to perform database queries. of Planetmint used to perform database queries.
tx_dict_list (:list:`dict` or :obj:`dict`): The transaction dict or tx_dict_list (:list:`dict` or :obj:`dict`): The transaction dict or
list of transaction dict as returned from the database. list of transaction dict as returned from the database.
@ -1238,7 +1238,7 @@ class Transaction(object):
tx_map[tx['id']] = tx tx_map[tx['id']] = tx
tx_ids.append(tx['id']) tx_ids.append(tx['id'])
assets = list(bigchain.get_assets(tx_ids)) assets = list(planet.get_assets(tx_ids))
for asset in assets: for asset in assets:
if asset is not None: if asset is not None:
tx = tx_map[asset['id']] tx = tx_map[asset['id']]
@ -1246,7 +1246,7 @@ class Transaction(object):
tx['asset'] = asset tx['asset'] = asset
tx_ids = list(tx_map.keys()) tx_ids = list(tx_map.keys())
metadata_list = list(bigchain.get_metadata(tx_ids)) metadata_list = list(planet.get_metadata(tx_ids))
for metadata in metadata_list: for metadata in metadata_list:
tx = tx_map[metadata['id']] tx = tx_map[metadata['id']]
tx.update({'metadata': metadata.get('metadata')}) tx.update({'metadata': metadata.get('metadata')})
@ -1276,13 +1276,13 @@ class Transaction(object):
def validate_schema(cls, tx): def validate_schema(cls, tx):
pass pass
def validate_transfer_inputs(self, bigchain, current_transactions=[]): def validate_transfer_inputs(self, planet, current_transactions=[]):
# store the inputs so that we can check if the asset ids match # store the inputs so that we can check if the asset ids match
input_txs = [] input_txs = []
input_conditions = [] input_conditions = []
for input_ in self.inputs: for input_ in self.inputs:
input_txid = input_.fulfills.txid input_txid = input_.fulfills.txid
input_tx = bigchain.get_transaction(input_txid) input_tx = planet.get_transaction(input_txid)
if input_tx is None: if input_tx is None:
for ctxn in current_transactions: for ctxn in current_transactions:
@ -1293,7 +1293,7 @@ class Transaction(object):
raise InputDoesNotExist("input `{}` doesn't exist" raise InputDoesNotExist("input `{}` doesn't exist"
.format(input_txid)) .format(input_txid))
spent = bigchain.get_spent(input_txid, input_.fulfills.output, spent = planet.get_spent(input_txid, input_.fulfills.output,
current_transactions) current_transactions)
if spent: if spent:
raise DoubleSpend('input `{}` was already spent' raise DoubleSpend('input `{}` was already spent'

View File

@ -41,7 +41,7 @@ class Election(Transaction):
ELECTION_THRESHOLD = 2 / 3 ELECTION_THRESHOLD = 2 / 3
@classmethod @classmethod
def get_validator_change(cls, bigchain): def get_validator_change(cls, planet):
"""Return the validator set from the most recent approved block """Return the validator set from the most recent approved block
:return: { :return: {
@ -49,18 +49,18 @@ class Election(Transaction):
'validators': <validator_set> 'validators': <validator_set>
} }
""" """
latest_block = bigchain.get_latest_block() latest_block = planet.get_latest_block()
if latest_block is None: if latest_block is None:
return None return None
return bigchain.get_validator_change(latest_block['height']) return planet.get_validator_change(latest_block['height'])
@classmethod @classmethod
def get_validators(cls, bigchain, height=None): def get_validators(cls, planet, height=None):
"""Return a dictionary of validators with key as `public_key` and """Return a dictionary of validators with key as `public_key` and
value as the `voting_power` value as the `voting_power`
""" """
validators = {} validators = {}
for validator in bigchain.get_validators(height): for validator in planet.get_validators(height):
# NOTE: we assume that Tendermint encodes public key in base64 # NOTE: we assume that Tendermint encodes public key in base64
public_key = public_key_from_ed25519_key(key_from_base64(validator['public_key']['value'])) public_key = public_key_from_ed25519_key(key_from_base64(validator['public_key']['value']))
validators[public_key] = validator['voting_power'] validators[public_key] = validator['voting_power']
@ -68,11 +68,11 @@ class Election(Transaction):
return validators return validators
@classmethod @classmethod
def recipients(cls, bigchain): def recipients(cls, planet):
"""Convert validator dictionary to a recipient list for `Transaction`""" """Convert validator dictionary to a recipient list for `Transaction`"""
recipients = [] recipients = []
for public_key, voting_power in cls.get_validators(bigchain).items(): for public_key, voting_power in cls.get_validators(planet).items():
recipients.append(([public_key], voting_power)) recipients.append(([public_key], voting_power))
return recipients return recipients
@ -92,7 +92,7 @@ class Election(Transaction):
# validators and their voting power in the network # validators and their voting power in the network
return current_topology == voters return current_topology == voters
def validate(self, bigchain, current_transactions=[]): def validate(self, planet, current_transactions=[]):
"""Validate election transaction """Validate election transaction
NOTE: NOTE:
@ -102,7 +102,7 @@ class Election(Transaction):
allocated according to the voting power of each validator node. allocated according to the voting power of each validator node.
Args: Args:
:param bigchain: (Planetmint) an instantiated planetmint.lib.Planetmint object. :param planet: (Planetmint) an instantiated planetmint.lib.Planetmint object.
:param current_transactions: (list) A list of transactions to be validated along with the election :param current_transactions: (list) A list of transactions to be validated along with the election
Returns: Returns:
@ -114,14 +114,14 @@ class Election(Transaction):
input_conditions = [] input_conditions = []
duplicates = any(txn for txn in current_transactions if txn.id == self.id) duplicates = any(txn for txn in current_transactions if txn.id == self.id)
if bigchain.is_committed(self.id) or duplicates: if planet.is_committed(self.id) or duplicates:
raise DuplicateTransaction('transaction `{}` already exists' raise DuplicateTransaction('transaction `{}` already exists'
.format(self.id)) .format(self.id))
if not self.inputs_valid(input_conditions): if not self.inputs_valid(input_conditions):
raise InvalidSignature('Transaction signature is invalid.') raise InvalidSignature('Transaction signature is invalid.')
current_validators = self.get_validators(bigchain) current_validators = self.get_validators(planet)
# NOTE: Proposer should be a single node # NOTE: Proposer should be a single node
if len(self.inputs) != 1 or len(self.inputs[0].owners_before) != 1: if len(self.inputs) != 1 or len(self.inputs[0].owners_before) != 1:
@ -184,15 +184,15 @@ class Election(Transaction):
votes = votes + int(getter(output, 'amount')) votes = votes + int(getter(output, 'amount'))
return votes return votes
def get_commited_votes(self, bigchain, election_pk=None): def get_commited_votes(self, planet, election_pk=None):
if election_pk is None: if election_pk is None:
election_pk = self.to_public_key(self.id) election_pk = self.to_public_key(self.id)
txns = list(backend.query.get_asset_tokens_for_public_key(bigchain.connection, txns = list(backend.query.get_asset_tokens_for_public_key(planet.connection,
self.id, self.id,
election_pk)) election_pk))
return self.count_votes(election_pk, txns, dict.get) return self.count_votes(election_pk, txns, dict.get)
def has_concluded(self, bigchain, current_votes=[]): def has_concluded(self, planet, current_votes=[]):
"""Check if the election can be concluded or not. """Check if the election can be concluded or not.
* Elections can only be concluded if the validator set has not changed * Elections can only be concluded if the validator set has not changed
@ -201,11 +201,11 @@ class Election(Transaction):
Custom elections may override this function and introduce additional checks. Custom elections may override this function and introduce additional checks.
""" """
if self.has_validator_set_changed(bigchain): if self.has_validator_set_changed(planet):
return False return False
election_pk = self.to_public_key(self.id) election_pk = self.to_public_key(self.id)
votes_committed = self.get_commited_votes(bigchain, election_pk) votes_committed = self.get_commited_votes(planet, election_pk)
votes_current = self.count_votes(election_pk, current_votes) votes_current = self.count_votes(election_pk, current_votes)
total_votes = sum(output.amount for output in self.outputs) total_votes = sum(output.amount for output in self.outputs)
@ -215,31 +215,31 @@ class Election(Transaction):
return False return False
def get_status(self, bigchain): def get_status(self, planet):
election = self.get_election(self.id, bigchain) election = self.get_election(self.id, planet)
if election and election['is_concluded']: if election and election['is_concluded']:
return self.CONCLUDED return self.CONCLUDED
return self.INCONCLUSIVE if self.has_validator_set_changed(bigchain) else self.ONGOING return self.INCONCLUSIVE if self.has_validator_set_changed(planet) else self.ONGOING
def has_validator_set_changed(self, bigchain): def has_validator_set_changed(self, planet):
latest_change = self.get_validator_change(bigchain) latest_change = self.get_validator_change(planet)
if latest_change is None: if latest_change is None:
return False return False
latest_change_height = latest_change['height'] latest_change_height = latest_change['height']
election = self.get_election(self.id, bigchain) election = self.get_election(self.id, planet)
return latest_change_height > election['height'] return latest_change_height > election['height']
def get_election(self, election_id, bigchain): def get_election(self, election_id, planet):
return bigchain.get_election(election_id) return planet.get_election(election_id)
def store(self, bigchain, height, is_concluded): def store(self, planet, height, is_concluded):
bigchain.store_election(self.id, height, is_concluded) planet.store_election(self.id, height, is_concluded)
def show_election(self, bigchain): def show_election(self, planet):
data = self.asset['data'] data = self.asset['data']
if 'public_key' in data.keys(): if 'public_key' in data.keys():
data['public_key'] = public_key_to_base64(data['public_key']['value']) data['public_key'] = public_key_to_base64(data['public_key']['value'])
@ -247,7 +247,7 @@ class Election(Transaction):
for k, v in data.items(): for k, v in data.items():
if k != 'seed': if k != 'seed':
response += f'{k}={v}\n' response += f'{k}={v}\n'
response += f'status={self.get_status(bigchain)}' response += f'status={self.get_status(planet)}'
return response return response
@ -276,7 +276,7 @@ class Election(Transaction):
return elections return elections
@classmethod @classmethod
def process_block(cls, bigchain, new_height, txns): def process_block(cls, planet, new_height, txns):
"""Looks for election and vote transactions inside the block, records """Looks for election and vote transactions inside the block, records
and processes elections. and processes elections.
@ -303,27 +303,27 @@ class Election(Transaction):
initiated_elections = cls._get_initiated_elections(new_height, txns) initiated_elections = cls._get_initiated_elections(new_height, txns)
if initiated_elections: if initiated_elections:
bigchain.store_elections(initiated_elections) planet.store_elections(initiated_elections)
# elections voted for in this block and their votes # elections voted for in this block and their votes
elections = cls._get_votes(txns) elections = cls._get_votes(txns)
validator_update = None validator_update = None
for election_id, votes in elections.items(): for election_id, votes in elections.items():
election = bigchain.get_transaction(election_id) election = planet.get_transaction(election_id)
if election is None: if election is None:
continue continue
if not election.has_concluded(bigchain, votes): if not election.has_concluded(planet, votes):
continue continue
validator_update = election.on_approval(bigchain, new_height) validator_update = election.on_approval(planet, new_height)
election.store(bigchain, new_height, is_concluded=True) election.store(planet, new_height, is_concluded=True)
return [validator_update] if validator_update else [] return [validator_update] if validator_update else []
@classmethod @classmethod
def rollback(cls, bigchain, new_height, txn_ids): def rollback(cls, planet, new_height, txn_ids):
"""Looks for election and vote transactions inside the block and """Looks for election and vote transactions inside the block and
cleans up the database artifacts possibly created in `process_blocks`. cleans up the database artifacts possibly created in `process_blocks`.
@ -332,23 +332,23 @@ class Election(Transaction):
# delete election records for elections initiated at this height and # delete election records for elections initiated at this height and
# elections concluded at this height # elections concluded at this height
bigchain.delete_elections(new_height) planet.delete_elections(new_height)
txns = [bigchain.get_transaction(tx_id) for tx_id in txn_ids] txns = [planet.get_transaction(tx_id) for tx_id in txn_ids]
elections = cls._get_votes(txns) elections = cls._get_votes(txns)
for election_id in elections: for election_id in elections:
election = bigchain.get_transaction(election_id) election = planet.get_transaction(election_id)
election.on_rollback(bigchain, new_height) election.on_rollback(planet, new_height)
def on_approval(self, bigchain, new_height): def on_approval(self, planet, new_height):
"""Override to update the database state according to the """Override to update the database state according to the
election rules. Consider the current database state to account for election rules. Consider the current database state to account for
other concluded elections, if required. other concluded elections, if required.
""" """
raise NotImplementedError raise NotImplementedError
def on_rollback(self, bigchain, new_height): def on_rollback(self, planet, new_height):
"""Override to clean up the database artifacts possibly created """Override to clean up the database artifacts possibly created
in `on_approval`. Part of the `end_block`/`commit` crash recovery. in `on_approval`. Part of the `end_block`/`commit` crash recovery.
""" """

View File

@ -20,7 +20,7 @@ class Vote(Transaction):
# Custom validation schema # Custom validation schema
TX_SCHEMA_CUSTOM = TX_SCHEMA_VOTE TX_SCHEMA_CUSTOM = TX_SCHEMA_VOTE
def validate(self, bigchain, current_transactions=[]): def validate(self, planet, current_transactions=[]):
"""Validate election vote transaction """Validate election vote transaction
NOTE: There are no additional validity conditions on casting votes i.e. NOTE: There are no additional validity conditions on casting votes i.e.
a vote is just a valid TRANFER transaction a vote is just a valid TRANFER transaction
@ -28,7 +28,7 @@ class Vote(Transaction):
For more details refer BEP-21: https://github.com/planetmint/BEPs/tree/master/21 For more details refer BEP-21: https://github.com/planetmint/BEPs/tree/master/21
Args: Args:
bigchain (Planetmint): an instantiated planetmint.lib.Planetmint object. planet (Planetmint): an instantiated planetmint.lib.Planetmint object.
Returns: Returns:
Vote: a Vote object Vote: a Vote object
@ -36,7 +36,7 @@ class Vote(Transaction):
Raises: Raises:
ValidationError: If the election vote is invalid ValidationError: If the election vote is invalid
""" """
self.validate_transfer_inputs(bigchain, current_transactions) self.validate_transfer_inputs(planet, current_transactions)
return self return self
@classmethod @classmethod

View File

@ -20,17 +20,17 @@ class ChainMigrationElection(Election):
return super().has_concluded(planetmint, *args, **kwargs) return super().has_concluded(planetmint, *args, **kwargs)
def on_approval(self, bigchain, *args, **kwargs): def on_approval(self, planet, *args, **kwargs):
bigchain.migrate_abci_chain() planet.migrate_abci_chain()
def show_election(self, bigchain): def show_election(self, planet):
output = super().show_election(bigchain) output = super().show_election(planet)
chain = bigchain.get_latest_abci_chain() chain = planet.get_latest_abci_chain()
if chain is None or chain['is_synced']: if chain is None or chain['is_synced']:
return output return output
output += f'\nchain_id={chain["chain_id"]}' output += f'\nchain_id={chain["chain_id"]}'
block = bigchain.get_latest_block() block = planet.get_latest_block()
output += f'\napp_hash={block["app_hash"]}' output += f'\napp_hash={block["app_hash"]}'
validators = [ validators = [
{ {
@ -39,10 +39,10 @@ class ChainMigrationElection(Election):
'value': k, 'value': k,
}, },
'power': v, 'power': v,
} for k, v in self.get_validators(bigchain).items() } for k, v in self.get_validators(planet).items()
] ]
output += f'\nvalidators={json.dumps(validators, indent=4)}' output += f'\nvalidators={json.dumps(validators, indent=4)}'
return output return output
def on_rollback(self, bigchain, new_height): def on_rollback(self, planet, new_height):
bigchain.delete_abci_chain(new_height) planet.delete_abci_chain(new_height)

View File

@ -16,10 +16,10 @@ class Transaction(Transaction):
METADATA = 'metadata' METADATA = 'metadata'
DATA = 'data' DATA = 'data'
def validate(self, bigchain, current_transactions=[]): def validate(self, planet, current_transactions=[]):
"""Validate transaction spend """Validate transaction spend
Args: Args:
bigchain (Planetmint): an instantiated planetmint.Planetmint object. planet (Planetmint): an instantiated planetmint.Planetmint object.
Returns: Returns:
The transaction (Transaction) if the transaction is valid else it The transaction (Transaction) if the transaction is valid else it
raises an exception describing the reason why the transaction is raises an exception describing the reason why the transaction is
@ -31,7 +31,7 @@ class Transaction(Transaction):
if self.operation == Transaction.CREATE: if self.operation == Transaction.CREATE:
duplicates = any(txn for txn in current_transactions if txn.id == self.id) duplicates = any(txn for txn in current_transactions if txn.id == self.id)
if bigchain.is_committed(self.id) or duplicates: if planet.is_committed(self.id) or duplicates:
raise DuplicateTransaction('transaction `{}` already exists' raise DuplicateTransaction('transaction `{}` already exists'
.format(self.id)) .format(self.id))
@ -39,7 +39,7 @@ class Transaction(Transaction):
raise InvalidSignature('Transaction signature is invalid.') raise InvalidSignature('Transaction signature is invalid.')
elif self.operation == Transaction.TRANSFER: elif self.operation == Transaction.TRANSFER:
self.validate_transfer_inputs(bigchain, current_transactions) self.validate_transfer_inputs(planet, current_transactions)
return self return self

View File

@ -18,13 +18,13 @@ class ValidatorElection(Election):
ALLOWED_OPERATIONS = (OPERATION,) ALLOWED_OPERATIONS = (OPERATION,)
TX_SCHEMA_CUSTOM = TX_SCHEMA_VALIDATOR_ELECTION TX_SCHEMA_CUSTOM = TX_SCHEMA_VALIDATOR_ELECTION
def validate(self, bigchain, current_transactions=[]): def validate(self, planet, current_transactions=[]):
"""For more details refer BEP-21: https://github.com/planetmint/BEPs/tree/master/21 """For more details refer BEP-21: https://github.com/planetmint/BEPs/tree/master/21
""" """
current_validators = self.get_validators(bigchain) current_validators = self.get_validators(planet)
super(ValidatorElection, self).validate(bigchain, current_transactions=current_transactions) super(ValidatorElection, self).validate(planet, current_transactions=current_transactions)
# NOTE: change more than 1/3 of the current power is not allowed # NOTE: change more than 1/3 of the current power is not allowed
if self.asset['data']['power'] >= (1/3)*sum(current_validators.values()): if self.asset['data']['power'] >= (1/3)*sum(current_validators.values()):
@ -37,22 +37,22 @@ class ValidatorElection(Election):
super(ValidatorElection, cls).validate_schema(tx) super(ValidatorElection, cls).validate_schema(tx)
validate_asset_public_key(tx['asset']['data']['public_key']) validate_asset_public_key(tx['asset']['data']['public_key'])
def has_concluded(self, bigchain, *args, **kwargs): def has_concluded(self, planet, *args, **kwargs):
latest_block = bigchain.get_latest_block() latest_block = planet.get_latest_block()
if latest_block is not None: if latest_block is not None:
latest_block_height = latest_block['height'] latest_block_height = latest_block['height']
latest_validator_change = bigchain.get_validator_change()['height'] latest_validator_change = planet.get_validator_change()['height']
# TODO change to `latest_block_height + 3` when upgrading to Tendermint 0.24.0. # TODO change to `latest_block_height + 3` when upgrading to Tendermint 0.24.0.
if latest_validator_change == latest_block_height + 2: if latest_validator_change == latest_block_height + 2:
# do not conclude the election if there is a change assigned already # do not conclude the election if there is a change assigned already
return False return False
return super().has_concluded(bigchain, *args, **kwargs) return super().has_concluded(planet, *args, **kwargs)
def on_approval(self, bigchain, new_height): def on_approval(self, planet, new_height):
validator_updates = [self.asset['data']] validator_updates = [self.asset['data']]
curr_validator_set = bigchain.get_validators(new_height) curr_validator_set = planet.get_validators(new_height)
updated_validator_set = new_validator_set(curr_validator_set, updated_validator_set = new_validator_set(curr_validator_set,
validator_updates) validator_updates)
@ -60,7 +60,7 @@ class ValidatorElection(Election):
if v['voting_power'] > 0] if v['voting_power'] > 0]
# TODO change to `new_height + 2` when upgrading to Tendermint 0.24.0. # TODO change to `new_height + 2` when upgrading to Tendermint 0.24.0.
bigchain.store_validator_set(new_height + 1, updated_validator_set) planet.store_validator_set(new_height + 1, updated_validator_set)
return encode_validator(self.asset['data']) return encode_validator(self.asset['data'])
def on_rollback(self, planetmint, new_height): def on_rollback(self, planetmint, new_height):

View File

@ -42,8 +42,8 @@ class AssetListApi(Resource):
pool = current_app.config['bigchain_pool'] pool = current_app.config['bigchain_pool']
with pool() as bigchain: with pool() as planet:
assets = bigchain.text_search(**args) assets = planet.text_search(**args)
try: try:
# This only works with MongoDB as the backend # This only works with MongoDB as the backend

View File

@ -26,8 +26,8 @@ class BlockApi(Resource):
pool = current_app.config['bigchain_pool'] pool = current_app.config['bigchain_pool']
with pool() as bigchain: with pool() as planet:
block = bigchain.get_block(block_id=block_id) block = planet.get_block(block_id=block_id)
if not block: if not block:
return make_error(404) return make_error(404)
@ -52,7 +52,7 @@ class BlockListApi(Resource):
pool = current_app.config['bigchain_pool'] pool = current_app.config['bigchain_pool']
with pool() as bigchain: with pool() as planet:
blocks = bigchain.get_block_containing_tx(tx_id) blocks = planet.get_block_containing_tx(tx_id)
return blocks return blocks

View File

@ -41,9 +41,9 @@ class MetadataApi(Resource):
pool = current_app.config['bigchain_pool'] pool = current_app.config['bigchain_pool']
with pool() as bigchain: with pool() as planet:
args['table'] = 'metadata' args['table'] = 'metadata'
metadata = bigchain.text_search(**args) metadata = planet.text_search(**args)
try: try:
# This only works with MongoDB as the backend # This only works with MongoDB as the backend

View File

@ -24,8 +24,8 @@ class OutputListApi(Resource):
args = parser.parse_args(strict=True) args = parser.parse_args(strict=True)
pool = current_app.config['bigchain_pool'] pool = current_app.config['bigchain_pool']
with pool() as bigchain: with pool() as planet:
outputs = bigchain.get_outputs_filtered(args['public_key'], outputs = planet.get_outputs_filtered(args['public_key'],
args['spent']) args['spent'])
return [{'transaction_id': output.txid, 'output_index': output.output} return [{'transaction_id': output.txid, 'output_index': output.output}
for output in outputs] for output in outputs]

View File

@ -34,8 +34,8 @@ class TransactionApi(Resource):
""" """
pool = current_app.config['bigchain_pool'] pool = current_app.config['bigchain_pool']
with pool() as bigchain: with pool() as planet:
tx = bigchain.get_transaction(tx_id) tx = planet.get_transaction(tx_id)
if not tx: if not tx:
return make_error(404) return make_error(404)
@ -52,8 +52,8 @@ class TransactionListApi(Resource):
parser.add_argument('last_tx', type=parameters.valid_bool, parser.add_argument('last_tx', type=parameters.valid_bool,
required=False) required=False)
args = parser.parse_args() args = parser.parse_args()
with current_app.config['bigchain_pool']() as bigchain: with current_app.config['bigchain_pool']() as planet:
txs = bigchain.get_transactions_filtered(**args) txs = planet.get_transactions_filtered(**args)
return [tx.to_dict() for tx in txs] return [tx.to_dict() for tx in txs]
@ -89,16 +89,16 @@ class TransactionListApi(Resource):
'Invalid transaction ({}): {}'.format(type(e).__name__, e) 'Invalid transaction ({}): {}'.format(type(e).__name__, e)
) )
with pool() as bigchain: with pool() as planet:
try: try:
bigchain.validate_transaction(tx_obj) planet.validate_transaction(tx_obj)
except ValidationError as e: except ValidationError as e:
return make_error( return make_error(
400, 400,
'Invalid transaction ({}): {}'.format(type(e).__name__, e) 'Invalid transaction ({}): {}'.format(type(e).__name__, e)
) )
else: else:
status_code, message = bigchain.write_transaction(tx_obj, mode) status_code, message = planet.write_transaction(tx_obj, mode)
if status_code == 202: if status_code == 202:
response = jsonify(tx) response = jsonify(tx)

View File

@ -17,7 +17,7 @@ class ValidatorsApi(Resource):
pool = current_app.config['bigchain_pool'] pool = current_app.config['bigchain_pool']
with pool() as bigchain: with pool() as planet:
validators = bigchain.get_validators() validators = planet.get_validators()
return validators return validators

View File

@ -69,7 +69,7 @@ def test_node_count(some_args):
### Crash components ### Crash components
- start n nodes, mongodb crashes - start n nodes, mongodb crashes
- start n nodes, tendermint crashes - start n nodes, tendermint crashes
- start n nodes, bigchain crashes - start n nodes, planet crashes
- start n nodes, connection crashes - start n nodes, connection crashes
- what else can crash? - what else can crash?
- possible crash times - possible crash times

View File

@ -38,12 +38,12 @@ def test_bigchain_class_default_initialization(config):
from planetmint import Planetmint from planetmint import Planetmint
from planetmint.validation import BaseValidationRules from planetmint.validation import BaseValidationRules
from planetmint.backend.connection import Connection from planetmint.backend.connection import Connection
bigchain = Planetmint() planet = Planetmint()
assert isinstance(bigchain.connection, Connection) assert isinstance(planet.connection, Connection)
assert bigchain.connection.host == config['database']['host'] assert planet.connection.host == config['database']['host']
assert bigchain.connection.port == config['database']['port'] assert planet.connection.port == config['database']['port']
assert bigchain.connection.dbname == config['database']['name'] assert planet.connection.dbname == config['database']['name']
assert bigchain.validation == BaseValidationRules assert planet.validation == BaseValidationRules
def test_bigchain_class_initialization_with_parameters(): def test_bigchain_class_initialization_with_parameters():
@ -57,12 +57,12 @@ def test_bigchain_class_initialization_with_parameters():
'name': 'this_is_the_db_name', 'name': 'this_is_the_db_name',
} }
connection = connect(**init_db_kwargs) connection = connect(**init_db_kwargs)
bigchain = Planetmint(connection=connection) planet = Planetmint(connection=connection)
assert bigchain.connection == connection assert planet.connection == connection
assert bigchain.connection.host == init_db_kwargs['host'] assert planet.connection.host == init_db_kwargs['host']
assert bigchain.connection.port == init_db_kwargs['port'] assert planet.connection.port == init_db_kwargs['port']
assert bigchain.connection.dbname == init_db_kwargs['name'] assert planet.connection.dbname == init_db_kwargs['name']
assert bigchain.validation == BaseValidationRules assert planet.validation == BaseValidationRules
@pytest.mark.bdb @pytest.mark.bdb

View File

@ -28,7 +28,7 @@ def flush_localmongo_db(connection, dbname):
getattr(connection.conn[dbname], t).delete_many({}) getattr(connection.conn[dbname], t).delete_many({})
def generate_block(bigchain): def generate_block(planet):
from planetmint.common.crypto import generate_key_pair from planetmint.common.crypto import generate_key_pair
from planetmint.models import Transaction from planetmint.models import Transaction
@ -38,7 +38,7 @@ def generate_block(bigchain):
asset=None)\ asset=None)\
.sign([alice.private_key]) .sign([alice.private_key])
code, message = bigchain.write_transaction(tx, BROADCAST_TX_COMMIT) code, message = planet.write_transaction(tx, BROADCAST_TX_COMMIT)
assert code == 202 assert code == 202