Merge remote-tracking branch 'origin/master' into move-data-models-docs-page-to-root-docs

This commit is contained in:
troymc 2016-10-27 14:59:24 +02:00
commit 740cb34828
98 changed files with 2935 additions and 149 deletions

View File

@ -1,5 +1,6 @@
sudo: required
language: python
cache: pip
python:
- 3.4
- 3.5

View File

@ -8,7 +8,7 @@ import logging
import rethinkdb as r
from os.path import expanduser
from bigchaindb_common.transaction import Transaction
from bigchaindb.common.transaction import Transaction
from bigchaindb import Bigchain
from bigchaindb.util import ProcessGroup

View File

@ -13,8 +13,8 @@ import builtins
import logstats
from bigchaindb_common import crypto
from bigchaindb_common.exceptions import (StartupError,
from bigchaindb.common import crypto
from bigchaindb.common.exceptions import (StartupError,
DatabaseAlreadyExists,
KeypairNotFoundException)
import rethinkdb as r

View File

@ -3,7 +3,7 @@ for ``argparse.ArgumentParser``.
"""
import argparse
from bigchaindb_common.exceptions import StartupError
from bigchaindb.common.exceptions import StartupError
import multiprocessing as mp
import subprocess
@ -19,14 +19,9 @@ def start_rethinkdb():
"""Start RethinkDB as a child process and wait for it to be
available.
Args:
wait_for_db (bool): wait for the database to be ready
extra_opts (list): a list of extra options to be used when
starting the db
Raises:
``bigchaindb_common.exceptions.StartupError`` if RethinkDB cannot
be started.
:class:`~bigchaindb.common.exceptions.StartupError` if
RethinkDB cannot be started.
"""
proc = subprocess.Popen(['rethinkdb', '--bind', 'all'],

View File

View File

@ -0,0 +1,18 @@
# Separate all crypto code so that we can easily test several implementations
import sha3
from cryptoconditions import crypto
def hash_data(data):
"""Hash the provided data using SHA3-256"""
return sha3.sha3_256(data.encode()).hexdigest()
def generate_key_pair():
# TODO FOR CC: Adjust interface so that this function becomes unnecessary
private_key, public_key = crypto.ed25519_generate_key_pair()
return private_key.decode(), public_key.decode()
SigningKey = crypto.Ed25519SigningKey
VerifyingKey = crypto.Ed25519VerifyingKey

View File

@ -0,0 +1,82 @@
"""Custom exceptions used in the `bigchaindb` package.
"""
class ConfigurationError(Exception):
"""Raised when there is a problem with server configuration"""
class OperationError(Exception):
"""Raised when an operation cannot go through"""
class TransactionDoesNotExist(Exception):
"""Raised if the transaction is not in the database"""
class TransactionOwnerError(Exception):
"""Raised if a user tries to transfer a transaction they don't own"""
class DoubleSpend(Exception):
"""Raised if a double spend is found"""
class InvalidHash(Exception):
"""Raised if there was an error checking the hash for a particular
operation"""
class InvalidSignature(Exception):
"""Raised if there was an error checking the signature for a particular
operation"""
class DatabaseAlreadyExists(Exception):
"""Raised when trying to create the database but the db is already there"""
class DatabaseDoesNotExist(Exception):
"""Raised when trying to delete the database but the db is not there"""
class KeypairNotFoundException(Exception):
"""Raised if operation cannot proceed because the keypair was not given"""
class KeypairMismatchException(Exception):
"""Raised if the private key(s) provided for signing don't match any of the
current owner(s)"""
class StartupError(Exception):
"""Raised when there is an error starting up the system"""
class ImproperVoteError(Exception):
"""Raised if a vote is not constructed correctly, or signed incorrectly"""
class MultipleVotesError(Exception):
"""Raised if a voter has voted more than once"""
class GenesisBlockAlreadyExistsError(Exception):
"""Raised when trying to create the already existing genesis block"""
class CyclicBlockchainError(Exception):
"""Raised when there is a cycle in the blockchain"""
class FulfillmentNotInValidBlock(Exception):
"""Raised when a transaction depends on an invalid or undecided
fulfillment"""
class AssetIdMismatch(Exception):
"""Raised when multiple transaction inputs related to different assets"""
class AmountError(Exception):
"""Raised when the amount of a non-divisible asset is different then 1"""

File diff suppressed because it is too large Load Diff

48
bigchaindb/common/util.py Normal file
View File

@ -0,0 +1,48 @@
import time
import rapidjson
def gen_timestamp():
"""The Unix time, rounded to the nearest second.
See https://en.wikipedia.org/wiki/Unix_time
Returns:
str: the Unix time
"""
return str(round(time.time()))
def serialize(data):
"""Serialize a dict into a JSON formatted string.
This function enforces rules like the separator and order of keys.
This ensures that all dicts are serialized in the same way.
This is specially important for hashing data. We need to make sure that
everyone serializes their data in the same way so that we do not have
hash mismatches for the same structure due to serialization
differences.
Args:
data (dict): dict to serialize
Returns:
str: JSON formatted string
"""
return rapidjson.dumps(data, skipkeys=False, ensure_ascii=False,
sort_keys=True)
def deserialize(data):
"""Deserialize a JSON formatted string into a dict.
Args:
data (str): JSON formatted string.
Returns:
dict: dict resulting from the serialization of a JSON formatted
string.
"""
return rapidjson.loads(data)

View File

@ -17,7 +17,7 @@ import json
import logging
import collections
from bigchaindb_common import exceptions
from bigchaindb.common import exceptions
import bigchaindb

View File

@ -4,9 +4,9 @@ import collections
from time import time
from itertools import compress
from bigchaindb_common import crypto, exceptions
from bigchaindb_common.util import gen_timestamp, serialize
from bigchaindb_common.transaction import TransactionLink, Metadata
from bigchaindb.common import crypto, exceptions
from bigchaindb.common.util import gen_timestamp, serialize
from bigchaindb.common.transaction import TransactionLink, Metadata
import rethinkdb as r
@ -198,10 +198,10 @@ class Bigchain(object):
the return value is then a tuple: (tx, status)
Returns:
A dict with the transaction details if the transaction was found.
Will add the transaction status to payload ('valid', 'undecided',
or 'backlog'). If no transaction with that `txid` was found it
returns `None`
A :class:`~.models.Transaction` instance if the transaction
was found, otherwise ``None``.
If :attr:`include_status` is ``True``, also returns the
transaction's status if the transaction was found.
"""
response, tx_status = None, None
@ -412,14 +412,14 @@ class Bigchain(object):
return None
def get_owned_ids(self, owner):
"""Retrieve a list of `txids` that can we used has inputs.
"""Retrieve a list of `txid`s that can be used as inputs.
Args:
owner (str): base58 encoded public key.
Returns:
list (TransactionLink): list of `txid`s and `cid`s pointing to
another transaction's condition
:obj:`list` of TransactionLink: list of `txid`s and `cid`s
pointing to another transaction's condition
"""
# get all transactions in which owner is in the `owners_after` list
@ -587,11 +587,11 @@ class Bigchain(object):
return block
def vote(self, block_id, previous_block_id, decision, invalid_reason=None):
"""Cast your vote on the block given the previous_block_hash and the decision (valid/invalid)
return the block to the updated in the database.
"""Create a signed vote for a block given the
:attr:`previous_block_id` and the :attr:`decision` (valid/invalid).
Args:
block_id (str): The id of the block to vote.
block_id (str): The id of the block to vote on.
previous_block_id (str): The id of the previous block.
decision (bool): Whether the block is valid or invalid.
invalid_reason (Optional[str]): Reason the block is invalid

View File

@ -3,7 +3,7 @@
import time
import logging
from bigchaindb_common import exceptions
from bigchaindb.common import exceptions
import rethinkdb as r
import bigchaindb

View File

@ -1,11 +1,11 @@
from bigchaindb_common.crypto import hash_data, VerifyingKey, SigningKey
from bigchaindb_common.exceptions import (InvalidHash, InvalidSignature,
from bigchaindb.common.crypto import hash_data, VerifyingKey, SigningKey
from bigchaindb.common.exceptions import (InvalidHash, InvalidSignature,
OperationError, DoubleSpend,
TransactionDoesNotExist,
FulfillmentNotInValidBlock,
AssetIdMismatch)
from bigchaindb_common.transaction import Transaction, Asset
from bigchaindb_common.util import gen_timestamp, serialize
from bigchaindb.common.transaction import Transaction, Asset
from bigchaindb.common.util import gen_timestamp, serialize
class Asset(Asset):

View File

@ -26,8 +26,8 @@ class StaleTransactionMonitor:
Args:
timeout: how often to check for stale tx (in sec)
backlog_reassign_delay: How stale a transaction should
be before reassignment (in sec). If supplied, overrides the
Bigchain default value.
be before reassignment (in sec). If supplied, overrides
the Bigchain default value.
"""
self.bigchain = Bigchain(backlog_reassign_delay=backlog_reassign_delay)
self.timeout = timeout

View File

@ -13,16 +13,16 @@ logger = logging.getLogger(__name__)
class ChangeFeed(Node):
"""This class wraps a RethinkDB changefeed adding a `prefeed`.
"""This class wraps a RethinkDB changefeed adding a ``prefeed``.
It extends the ``multipipes::Node`` class to make it pluggable in
other Pipelines instances, and it makes usage of ``self.outqueue``
to output the data.
It extends :class:`multipipes.Node` to make it pluggable in other
Pipelines instances, and makes usage of ``self.outqueue`` to output
the data.
A changefeed is a real time feed on inserts, updates, and deletes, and
it's volatile. This class is a helper to create changefeeds. Moreover
it provides a way to specify a `prefeed`, that is a set of data (iterable)
to output before the actual changefeed.
is volatile. This class is a helper to create changefeeds. Moreover,
it provides a way to specify a ``prefeed`` of iterable data to output
before the actual changefeed.
"""
INSERT = 1
@ -35,8 +35,8 @@ class ChangeFeed(Node):
Args:
table (str): name of the table to listen to for changes.
operation (int): can be ChangeFeed.INSERT, ChangeFeed.DELETE, or
ChangeFeed.UPDATE. Combining multiple operation is possible using
the bitwise ``|`` operator
ChangeFeed.UPDATE. Combining multiple operation is possible
with the bitwise ``|`` operator
(e.g. ``ChangeFeed.INSERT | ChangeFeed.UPDATE``)
prefeed (iterable): whatever set of data you want to be published
first.

View File

@ -8,7 +8,7 @@ function.
from collections import Counter
from multipipes import Pipeline, Node
from bigchaindb_common import exceptions
from bigchaindb.common import exceptions
from bigchaindb.consensus import BaseConsensusRules
from bigchaindb.models import Transaction, Block

View File

@ -3,8 +3,8 @@ import threading
import queue
import multiprocessing as mp
from bigchaindb_common import crypto
from bigchaindb_common.util import serialize
from bigchaindb.common import crypto
from bigchaindb.common.util import serialize
class ProcessGroup(object):
@ -119,7 +119,7 @@ def condition_details_has_owner(condition_details, owner):
def verify_vote_signature(voters, signed_vote):
"""Verify the signature of a vote
A valid vote should have been signed `owner_before` corresponding private key.
A valid vote should have been signed by a voter's private key.
Args:
voters (list): voters of the block that is under election

View File

@ -1,2 +1,2 @@
__version__ = '0.6.0'
__short_version__ = '0.6'
__version__ = '0.7.0.dev'
__short_version__ = '0.7.dev'

View File

@ -6,7 +6,7 @@ For more information please refer to the documentation on ReadTheDocs:
from flask import current_app, request, Blueprint
from flask_restful import Resource, Api
from bigchaindb_common.exceptions import InvalidHash, InvalidSignature
from bigchaindb.common.exceptions import InvalidHash, InvalidSignature
import bigchaindb
from bigchaindb.models import Transaction

View File

@ -1,5 +1,5 @@
"""A Python 3 script to write a file with a specified number
of keypairs, using bigchaindb_common.crypto.generate_key_pair()
of keypairs, using bigchaindb.common.crypto.generate_key_pair()
The written file is always named keypairs.py and it should be
interpreted as a Python 2 script.
@ -16,7 +16,7 @@ Using the list in other Python scripts:
import argparse
from bigchaindb_common import crypto
from bigchaindb.common import crypto
# Parse the command-line arguments

View File

@ -10,12 +10,14 @@
# How to Generate the HTML Version of the Long-Form Documentation
If you want to generate the HTML version of the long-form documentation on your local machine, you need to have Sphinx and some Sphinx-contrib packages installed. To do that, go to the BigchainDB `docs` directory (i.e. this directory) and do:
If you want to generate the HTML version of the long-form documentation on your local machine, you need to have Sphinx and some Sphinx-contrib packages installed. To do that, go to a subdirectory of `docs` (e.g. `docs/server`) and do:
```bash
pip install -r requirements.txt
```
You can then generate the HTML documentation by doing:
You can then generate the HTML documentation _in that subdirectory_ by doing:
```bash
make html
```
The generated HTML documentation will be in the `docs/build/html` directory. You can view it by opening `docs/build/html/index.html` in your web browser.
It should tell you where the generated documentation (HTML files) can be found. You can view it in your web browser.

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,52 @@
# Template: Node Deployment on Azure
If you didn't read the introduction to the [cloud deployment starter templates](index.html), please do that now. The main point is that they're not for deploying a production node; they can be used as a starting point.
One can deploy a BigchainDB node on Azure using the template in [Microsoft's azure-quickstart-templates repository on GitHub](https://github.com/Azure/azure-quickstart-templates):
1. Go to [the /blockchain subdirectory in that repository](https://github.com/Azure/azure-quickstart-templates/tree/master/blockchain).
2. Click the button labelled **Deploy to Azure**.
3. If you're not already logged in to Microsoft Azure, then you'll be prompted to login. If you don't have an account, then you'll have to create one.
4. One you are logged in to the Microsoft Azure Portal, you should be taken to a form titled **Blockchain Template**. Below there are some notes to help with filling in that form.
5. Deployment takes a few minutes. You can follow the notifications by clicking the bell icon at the top of the screen. When done, you should see a notification saying "Deployment to resource group '[your resource group name]' was successful." The install script (`bigchaindb.sh`) installed RethinkDB, configured it using the default RethinkDB config file, and ran it. It also used pip to install [the latest `bigchaindb` from PyPI](https://pypi.python.org/pypi/BigchainDB).
6. Find out the public IP address of the virtual machine in the Azure Portal. Example: `40.69.87.250`
7. ssh in to the virtual machine at that IP address, e.g. `ssh adminusername@40.69.87.250` (where `adminusername` should be replaced by the Admin Username you entered into the form, and `40.69.87.250` should be replaced by the IP address you found in the last step).
8. You should be prompted for a password. Enter the Admin Password you entered into the form.
9. Configure BigchainDB using the default BigchainDB settings: `bigchaindb -y configure`
10. Run BigchainDB: `bigchaindb start`
BigchainDB should now be running on the Azure VM.
Remember to shut everything down when you're done (via the Azure Portal), because it generally costs money to run stuff on Azure.
## Notes on the Blockchain Template Form Fields
**Resource group** - You can use an existing resource group (if you have one) or create a new one named whatever you like, but avoid using fancy characters in the name because Azure might have problems if you do.
**Location** is the Microsoft Azure data center where you want the BigchainDB node to run. Pick one close to where you are located.
**Vm Dns Prefix** - Once your virtual machine (VM) is deployed, it will have a public IP address and a DNS name (hostname) something like `DNSprefix.northeurope.cloudapp.azure.com`. The `DNSprefix` will be whatever you enter into this field.
You can use whatever **Admin Username** and **Admin Password** you like (provided you don't get too fancy). It will complain if your password is too simple. You'll need these later to ssh into the VM.
**Blockchain Software** - Select `bigchaindb`.
For **Vm Size**, select `Standard_D1_v2` or better.
**\_artifacts Location** - Leave this alone.
**\_artifacts Location Sas Token** - Leave this alone (blank).
Don't forget to scroll down and check the box to agree to the terms and conditions.
Once you've finished the form, click the button labelled **Purchase**. (Generally speaking, it costs money to run stuff on Azure.)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# BigchainDB documentation build configuration file, created by
# BigchainDB Server documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 19 14:42:58 2016.
#
# This file is execfile()d with the current directory set to its
@ -32,7 +32,7 @@ import sphinx_rtd_theme
# get version
_version = {}
with open('../../bigchaindb/version.py') as fp:
with open('../../../bigchaindb/version.py') as fp:
exec(fp.read(), _version)

View File

@ -1,5 +0,0 @@
# Template: Node Deployment on Azure
If you didn't read the introduction to the [cloud deployment starter templates](index.html), please do that now. The main point is that they're not for deploying a production node; they can be used as a starting point.
This page is a placeholder.

View File

@ -103,7 +103,6 @@ setup(
'requests~=2.9',
'gunicorn~=19.0',
'multipipes~=0.1.0',
'bigchaindb-common==0.0.6',
],
setup_requires=['pytest-runner'],
tests_require=tests_require,

View File

@ -76,7 +76,7 @@ def test_validate_bad_asset_creation(b, user_vk):
@pytest.mark.usefixtures('inputs')
def test_validate_transfer_asset_id_mismatch(b, user_vk, user_sk):
from bigchaindb_common.exceptions import AssetIdMismatch
from bigchaindb.common.exceptions import AssetIdMismatch
from bigchaindb.models import Transaction
tx_create = b.get_owned_ids(user_vk).pop()
@ -121,7 +121,7 @@ def test_get_asset_id_transfer_transaction(b, user_vk, user_sk):
def test_asset_id_mismatch(b, user_vk):
from bigchaindb.models import Transaction, Asset
from bigchaindb_common.exceptions import AssetIdMismatch
from bigchaindb.common.exceptions import AssetIdMismatch
tx1 = Transaction.create([b.me], [user_vk])
tx2 = Transaction.create([b.me], [user_vk])

0
tests/common/__init__.py Normal file
View File

162
tests/common/conftest.py Normal file
View File

@ -0,0 +1,162 @@
import pytest
USER_PRIVATE_KEY = '8eJ8q9ZQpReWyQT5aFCiwtZ5wDZC4eDnCen88p3tQ6ie'
USER_PUBLIC_KEY = 'JEAkEJqLbbgDRAtMm8YAjGp759Aq2qTn9eaEHUj2XePE'
USER2_PRIVATE_KEY = 'F86PQPiqMTwM2Qi2Sda3U4Vdh3AgadMdX3KNVsu5wNJr'
USER2_PUBLIC_KEY = 'GDxwMFbwdATkQELZbMfW8bd9hbNYMZLyVXA3nur2aNbE'
USER3_PRIVATE_KEY = '4rNQFzWQbVwuTiDVxwuFMvLG5zd8AhrQKCtVovBvcYsB'
USER3_PUBLIC_KEY = 'Gbrg7JtxdjedQRmr81ZZbh1BozS7fBW88ZyxNDy7WLNC'
CC_FULFILLMENT_URI = 'cf:0:'
CC_CONDITION_URI = 'cc:0:3:47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU:0'
DATA = {
'msg': 'Hello BigchainDB!'
}
DATA_ID = '872fa6e6f46246cd44afdb2ee9cfae0e72885fb0910e2bcf9a5a2a4eadb417b8'
@pytest.fixture
def user_priv():
return USER_PRIVATE_KEY
@pytest.fixture
def user_pub():
return USER_PUBLIC_KEY
@pytest.fixture
def user2_priv():
return USER2_PRIVATE_KEY
@pytest.fixture
def user2_pub():
return USER2_PUBLIC_KEY
@pytest.fixture
def user3_priv():
return USER3_PRIVATE_KEY
@pytest.fixture
def user3_pub():
return USER3_PUBLIC_KEY
@pytest.fixture
def ffill_uri():
return CC_FULFILLMENT_URI
@pytest.fixture
def cond_uri():
return CC_CONDITION_URI
@pytest.fixture
def user_Ed25519(user_pub):
from cryptoconditions import Ed25519Fulfillment
return Ed25519Fulfillment(public_key=user_pub)
@pytest.fixture
def user_user2_threshold(user_pub, user2_pub):
from cryptoconditions import (ThresholdSha256Fulfillment,
Ed25519Fulfillment)
user_pub_keys = [user_pub, user2_pub]
threshold = ThresholdSha256Fulfillment(threshold=len(user_pub_keys))
for user_pub in user_pub_keys:
threshold.add_subfulfillment(Ed25519Fulfillment(public_key=user_pub))
return threshold
@pytest.fixture
def user2_Ed25519(user2_pub):
from cryptoconditions import Ed25519Fulfillment
return Ed25519Fulfillment(public_key=user2_pub)
@pytest.fixture
def user_ffill(user_Ed25519, user_pub):
from bigchaindb.common.transaction import Fulfillment
return Fulfillment(user_Ed25519, [user_pub])
@pytest.fixture
def user2_ffill(user2_Ed25519, user2_pub):
from bigchaindb.common.transaction import Fulfillment
return Fulfillment(user2_Ed25519, [user2_pub])
@pytest.fixture
def user_user2_threshold_cond(user_user2_threshold, user_pub, user2_pub):
from bigchaindb.common.transaction import Condition
return Condition(user_user2_threshold, [user_pub, user2_pub])
@pytest.fixture
def user_user2_threshold_ffill(user_user2_threshold, user_pub, user2_pub):
from bigchaindb.common.transaction import Fulfillment
return Fulfillment(user_user2_threshold, [user_pub, user2_pub])
@pytest.fixture
def user_cond(user_Ed25519, user_pub):
from bigchaindb.common.transaction import Condition
return Condition(user_Ed25519, [user_pub])
@pytest.fixture
def user2_cond(user2_Ed25519, user2_pub):
from bigchaindb.common.transaction import Condition
return Condition(user2_Ed25519, [user2_pub])
@pytest.fixture
def data():
return DATA
@pytest.fixture
def data_id():
return DATA_ID
@pytest.fixture
def metadata(data, data_id):
from bigchaindb.common.transaction import Metadata
return Metadata(data, data_id)
@pytest.fixture
def utx(user_ffill, user_cond):
from bigchaindb.common.transaction import Transaction, Asset
return Transaction(Transaction.CREATE, Asset(), [user_ffill], [user_cond])
@pytest.fixture
def tx(utx, user_priv):
return utx.sign([user_priv])
@pytest.fixture
def transfer_utx(user_cond, user2_cond, utx):
from bigchaindb.common.transaction import (Fulfillment, TransactionLink,
Transaction, Asset)
user_cond = user_cond.to_dict()
ffill = Fulfillment(utx.conditions[0].fulfillment,
user_cond['owners_after'],
TransactionLink(utx.id, 0))
return Transaction('TRANSFER', Asset(), [ffill], [user2_cond])
@pytest.fixture
def transfer_tx(transfer_utx, user_priv):
return transfer_utx.sign([user_priv])

View File

@ -0,0 +1,80 @@
from pytest import raises
def test_asset_default_values():
from bigchaindb.common.transaction import Asset
asset = Asset()
assert asset.data is None
assert asset.data_id
assert asset.divisible is False
assert asset.updatable is False
assert asset.refillable is False
def test_asset_creation_with_data(data):
from bigchaindb.common.transaction import Asset
asset = Asset(data)
assert asset.data == data
def test_asset_invalid_asset_initialization():
from bigchaindb.common.transaction import Asset
with raises(TypeError):
Asset(data='some wrong type')
with raises(TypeError):
Asset(divisible=1)
with raises(TypeError):
Asset(refillable=1)
with raises(TypeError):
Asset(updatable=1)
def test_invalid_asset_comparison(data, data_id):
from bigchaindb.common.transaction import Asset
assert Asset(data, data_id) != 'invalid comparison'
def test_asset_serialization(data, data_id):
from bigchaindb.common.transaction import Asset
expected = {
'id': data_id,
'divisible': False,
'updatable': False,
'refillable': False,
'data': data,
}
asset = Asset(data, data_id)
assert asset.to_dict() == expected
def test_asset_deserialization(data, data_id):
from bigchaindb.common.transaction import Asset
asset_dict = {
'id': data_id,
'divisible': False,
'updatable': False,
'refillable': False,
'data': data,
}
asset = Asset.from_dict(asset_dict)
expected = Asset(data, data_id)
assert asset == expected
def test_validate_asset():
from bigchaindb.common.transaction import Asset
with raises(TypeError):
Asset(divisible=1)
with raises(TypeError):
Asset(refillable=1)
with raises(TypeError):
Asset(updatable=1)
with raises(TypeError):
Asset(data='we need more lemon pledge')

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ import rethinkdb as r
from bigchaindb import Bigchain
from bigchaindb.db import get_conn
from bigchaindb_common import crypto
from bigchaindb.common import crypto
USER2_SK, USER2_VK = crypto.generate_key_pair()
@ -107,7 +107,7 @@ def cleanup_tables(request, node_config):
@pytest.fixture
def inputs(user_vk):
from bigchaindb.models import Transaction
from bigchaindb_common.exceptions import GenesisBlockAlreadyExistsError
from bigchaindb.common.exceptions import GenesisBlockAlreadyExistsError
# 1. create the genesis block
b = Bigchain()
try:
@ -144,7 +144,7 @@ def user2_vk():
@pytest.fixture
def inputs_shared(user_vk, user2_vk):
from bigchaindb.models import Transaction
from bigchaindb_common.exceptions import GenesisBlockAlreadyExistsError
from bigchaindb.common.exceptions import GenesisBlockAlreadyExistsError
# 1. create the genesis block
b = Bigchain()
try:

View File

@ -30,9 +30,9 @@ def dummy_block():
class TestBigchainApi(object):
def test_get_last_voted_block_cyclic_blockchain(self, b, monkeypatch):
from bigchaindb_common.crypto import SigningKey
from bigchaindb_common.exceptions import CyclicBlockchainError
from bigchaindb_common.util import serialize
from bigchaindb.common.crypto import SigningKey
from bigchaindb.common.exceptions import CyclicBlockchainError
from bigchaindb.common.util import serialize
from bigchaindb.models import Transaction
b.create_genesis_block()
@ -55,7 +55,7 @@ class TestBigchainApi(object):
def test_try_voting_while_constructing_cyclic_blockchain(self, b,
monkeypatch):
from bigchaindb_common.exceptions import CyclicBlockchainError
from bigchaindb.common.exceptions import CyclicBlockchainError
from bigchaindb.models import Transaction
b.create_genesis_block()
@ -94,7 +94,7 @@ class TestBigchainApi(object):
assert not matches
def test_get_spent_with_double_spend(self, b, monkeypatch):
from bigchaindb_common.exceptions import DoubleSpend
from bigchaindb.common.exceptions import DoubleSpend
from bigchaindb.models import Transaction
b.create_genesis_block()
@ -128,7 +128,7 @@ class TestBigchainApi(object):
b.get_spent(tx.id, 0)
def test_get_block_status_for_tx_with_double_spend(self, b, monkeypatch):
from bigchaindb_common.exceptions import DoubleSpend
from bigchaindb.common.exceptions import DoubleSpend
from bigchaindb.models import Transaction
b.create_genesis_block()
@ -277,7 +277,7 @@ class TestBigchainApi(object):
def test_create_genesis_block_fails_if_table_not_empty(self, b):
import rethinkdb as r
from bigchaindb_common.exceptions import GenesisBlockAlreadyExistsError
from bigchaindb.common.exceptions import GenesisBlockAlreadyExistsError
from bigchaindb.util import is_genesis_block
from bigchaindb.db.utils import get_conn
@ -333,7 +333,7 @@ class TestBigchainApi(object):
assert prev_block_id == last_block['id']
def test_create_empty_block(self, b):
from bigchaindb_common.exceptions import OperationError
from bigchaindb.common.exceptions import OperationError
with pytest.raises(OperationError) as excinfo:
b.create_block([])
@ -433,7 +433,7 @@ class TestBigchainApi(object):
def test_more_votes_than_voters(self, b):
import rethinkdb as r
from bigchaindb_common.exceptions import MultipleVotesError
from bigchaindb.common.exceptions import MultipleVotesError
from bigchaindb.db.utils import get_conn
b.create_genesis_block()
@ -453,7 +453,7 @@ class TestBigchainApi(object):
def test_multiple_votes_single_node(self, b):
import rethinkdb as r
from bigchaindb_common.exceptions import MultipleVotesError
from bigchaindb.common.exceptions import MultipleVotesError
from bigchaindb.db.utils import get_conn
genesis = b.create_genesis_block()
@ -475,7 +475,7 @@ class TestBigchainApi(object):
def test_improper_vote_error(selfs, b):
import rethinkdb as r
from bigchaindb_common.exceptions import ImproperVoteError
from bigchaindb.common.exceptions import ImproperVoteError
from bigchaindb.db.utils import get_conn
b.create_genesis_block()
@ -512,7 +512,7 @@ class TestBigchainApi(object):
@pytest.mark.usefixtures('inputs')
def test_assign_transaction_multiple_nodes(self, b, user_vk, user_sk):
import rethinkdb as r
from bigchaindb_common.crypto import generate_key_pair
from bigchaindb.common.crypto import generate_key_pair
from bigchaindb.models import Transaction
from bigchaindb.db.utils import get_conn
@ -539,8 +539,8 @@ class TestBigchainApi(object):
@pytest.mark.usefixtures('inputs')
def test_non_create_input_not_found(self, b, user_vk):
from cryptoconditions import Ed25519Fulfillment
from bigchaindb_common.exceptions import TransactionDoesNotExist
from bigchaindb_common.transaction import (Fulfillment, Asset,
from bigchaindb.common.exceptions import TransactionDoesNotExist
from bigchaindb.common.transaction import (Fulfillment, Asset,
TransactionLink)
from bigchaindb.models import Transaction
from bigchaindb import Bigchain
@ -557,7 +557,7 @@ class TestBigchainApi(object):
class TestTransactionValidation(object):
def test_create_operation_with_inputs(self, b, user_vk, create_tx):
from bigchaindb_common.transaction import TransactionLink
from bigchaindb.common.transaction import TransactionLink
# Manipulate fulfillment so that it has a `tx_input` defined even
# though it shouldn't have one
@ -575,8 +575,8 @@ class TestTransactionValidation(object):
assert excinfo.value.args[0] == 'Only `CREATE` transactions can have null inputs'
def test_non_create_input_not_found(self, b, user_vk, signed_transfer_tx):
from bigchaindb_common.exceptions import TransactionDoesNotExist
from bigchaindb_common.transaction import TransactionLink
from bigchaindb.common.exceptions import TransactionDoesNotExist
from bigchaindb.common.transaction import TransactionLink
signed_transfer_tx.fulfillments[0].tx_input = TransactionLink('c', 0)
with pytest.raises(TransactionDoesNotExist):
@ -584,8 +584,8 @@ class TestTransactionValidation(object):
@pytest.mark.usefixtures('inputs')
def test_non_create_valid_input_wrong_owner(self, b, user_vk):
from bigchaindb_common.crypto import generate_key_pair
from bigchaindb_common.exceptions import InvalidSignature
from bigchaindb.common.crypto import generate_key_pair
from bigchaindb.common.exceptions import InvalidSignature
from bigchaindb.models import Transaction
input_tx = b.get_owned_ids(user_vk).pop()
@ -602,7 +602,7 @@ class TestTransactionValidation(object):
@pytest.mark.usefixtures('inputs')
def test_non_create_double_spend(self, b, signed_create_tx,
signed_transfer_tx):
from bigchaindb_common.exceptions import DoubleSpend
from bigchaindb.common.exceptions import DoubleSpend
block1 = b.create_block([signed_create_tx])
b.write_block(block1)
@ -652,7 +652,7 @@ class TestTransactionValidation(object):
@pytest.mark.usefixtures('inputs')
def test_fulfillment_not_in_valid_block(self, b, user_vk, user_sk):
from bigchaindb.models import Transaction
from bigchaindb_common.exceptions import FulfillmentNotInValidBlock
from bigchaindb.common.exceptions import FulfillmentNotInValidBlock
input_tx = b.get_owned_ids(user_vk).pop()
input_tx = b.get_transaction(input_tx.txid)
@ -681,9 +681,9 @@ class TestBlockValidation(object):
@pytest.mark.skipif(reason='Separated tx validation from block creation.')
@pytest.mark.usefixtures('inputs')
def test_invalid_transactions_in_block(self, b, user_vk):
from bigchaindb_common import crypto
from bigchaindb_common.exceptions import TransactionOwnerError
from bigchaindb_common.util import gen_timestamp
from bigchaindb.common import crypto
from bigchaindb.common.exceptions import TransactionOwnerError
from bigchaindb.common.util import gen_timestamp
from bigchaindb import util
@ -722,8 +722,8 @@ class TestBlockValidation(object):
assert excinfo.value.args[0] == 'owner_before `a` does not own the input `{}`'.format(valid_input)
def test_invalid_signature(self, b):
from bigchaindb_common.exceptions import InvalidSignature
from bigchaindb_common import crypto
from bigchaindb.common.exceptions import InvalidSignature
from bigchaindb.common import crypto
# create a valid block
block = dummy_block()
@ -736,8 +736,8 @@ class TestBlockValidation(object):
b.validate_block(block)
def test_invalid_node_pubkey(self, b):
from bigchaindb_common.exceptions import OperationError
from bigchaindb_common import crypto
from bigchaindb.common.exceptions import OperationError
from bigchaindb.common import crypto
# blocks can only be created by a federation node
# create a valid block
@ -761,7 +761,7 @@ class TestBlockValidation(object):
class TestMultipleInputs(object):
def test_transfer_single_owner_single_input(self, b, inputs, user_vk,
user_sk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -781,7 +781,7 @@ class TestMultipleInputs(object):
'multiple assets'))
@pytest.mark.usefixtures('inputs')
def test_transfer_single_owners_multiple_inputs(self, b, user_sk, user_vk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -804,7 +804,7 @@ class TestMultipleInputs(object):
def test_transfer_single_owners_single_input_from_multiple_outputs(self, b,
user_sk,
user_vk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -843,7 +843,7 @@ class TestMultipleInputs(object):
user_sk,
user_vk,
inputs):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -866,7 +866,7 @@ class TestMultipleInputs(object):
def test_single_owner_before_multiple_owners_after_multiple_inputs(self, b,
user_sk,
user_vk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -897,7 +897,7 @@ class TestMultipleInputs(object):
def test_multiple_owners_before_single_owner_after_single_input(self, b,
user_sk,
user_vk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -930,7 +930,7 @@ class TestMultipleInputs(object):
@pytest.mark.usefixtures('inputs_shared')
def test_multiple_owners_before_single_owner_after_multiple_inputs(self, b,
user_sk, user_vk, user2_vk, user2_sk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
# create a new users
@ -951,7 +951,7 @@ class TestMultipleInputs(object):
def test_multiple_owners_before_multiple_owners_after_single_input(self, b,
user_sk,
user_vk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -985,7 +985,7 @@ class TestMultipleInputs(object):
def test_multiple_owners_before_multiple_owners_after_multiple_inputs(self, b,
user_sk, user_vk,
user2_sk, user2_vk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
# create a new users
@ -1004,8 +1004,8 @@ class TestMultipleInputs(object):
assert len(tx.conditions) == len(inputs)
def test_get_owned_ids_single_tx_single_output(self, b, user_sk, user_vk):
from bigchaindb_common import crypto
from bigchaindb_common.transaction import TransactionLink
from bigchaindb.common import crypto
from bigchaindb.common.transaction import TransactionLink
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -1033,8 +1033,8 @@ class TestMultipleInputs(object):
def test_get_owned_ids_single_tx_single_output_invalid_block(self, b,
user_sk,
user_vk):
from bigchaindb_common import crypto
from bigchaindb_common.transaction import TransactionLink
from bigchaindb.common import crypto
from bigchaindb.common.transaction import TransactionLink
from bigchaindb.models import Transaction
genesis = b.create_genesis_block()
@ -1078,8 +1078,8 @@ class TestMultipleInputs(object):
def test_get_owned_ids_single_tx_multiple_outputs(self, b, user_sk,
user_vk):
import random
from bigchaindb_common import crypto
from bigchaindb_common.transaction import TransactionLink
from bigchaindb.common import crypto
from bigchaindb.common.transaction import TransactionLink
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -1115,8 +1115,8 @@ class TestMultipleInputs(object):
TransactionLink(tx.id, 1)]
def test_get_owned_ids_multiple_owners(self, b, user_sk, user_vk):
from bigchaindb_common import crypto
from bigchaindb_common.transaction import TransactionLink
from bigchaindb.common import crypto
from bigchaindb.common.transaction import TransactionLink
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -1145,7 +1145,7 @@ class TestMultipleInputs(object):
assert owned_inputs_user1 == []
def test_get_spent_single_tx_single_output(self, b, user_sk, user_vk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()
@ -1173,7 +1173,7 @@ class TestMultipleInputs(object):
assert spent_inputs_user1 == tx
def test_get_spent_single_tx_single_output_invalid_block(self, b, user_sk, user_vk):
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
genesis = b.create_genesis_block()
@ -1219,7 +1219,7 @@ class TestMultipleInputs(object):
'multiple assets'))
def test_get_spent_single_tx_multiple_outputs(self, b, user_sk, user_vk):
import random
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
# create a new users
@ -1259,7 +1259,7 @@ class TestMultipleInputs(object):
def test_get_spent_multiple_owners(self, b, user_sk, user_vk):
import random
from bigchaindb_common import crypto
from bigchaindb.common import crypto
from bigchaindb.models import Transaction
user2_sk, user2_vk = crypto.generate_key_pair()

View File

@ -1,6 +1,6 @@
import builtins
from bigchaindb_common import exceptions
from bigchaindb.common import exceptions
import pytest
import rethinkdb as r

View File

@ -2,7 +2,7 @@ import json
from time import sleep
import cryptoconditions as cc
from bigchaindb_common.util import gen_timestamp
from bigchaindb.common.util import gen_timestamp
from bigchaindb import Bigchain, util, crypto, exceptions

View File

@ -1,7 +1,7 @@
import time
from unittest.mock import patch
from bigchaindb_common import crypto
from bigchaindb.common import crypto
import rethinkdb as r
from multipipes import Pipe, Pipeline

View File

@ -19,8 +19,8 @@ def dummy_block(b):
def test_vote_creation_valid(b):
from bigchaindb_common import crypto
from bigchaindb_common.util import serialize
from bigchaindb.common import crypto
from bigchaindb.common.util import serialize
# create valid block
block = dummy_block(b)
@ -38,8 +38,8 @@ def test_vote_creation_valid(b):
def test_vote_creation_invalid(b):
from bigchaindb_common import crypto
from bigchaindb_common.util import serialize
from bigchaindb.common import crypto
from bigchaindb.common.util import serialize
# create valid block
block = dummy_block(b)
@ -154,7 +154,7 @@ def test_vote_accumulates_transactions(b):
def test_valid_block_voting_sequential(b, monkeypatch):
from bigchaindb_common import crypto, util
from bigchaindb.common import crypto, util
from bigchaindb.pipelines import vote
monkeypatch.setattr('time.time', lambda: 1)
@ -182,7 +182,7 @@ def test_valid_block_voting_sequential(b, monkeypatch):
def test_valid_block_voting_multiprocessing(b, monkeypatch):
from bigchaindb_common import crypto, util
from bigchaindb.common import crypto, util
from bigchaindb.pipelines import vote
inpipe = Pipe()
@ -216,7 +216,7 @@ def test_valid_block_voting_multiprocessing(b, monkeypatch):
def test_valid_block_voting_with_create_transaction(b, monkeypatch):
from bigchaindb_common import crypto, util
from bigchaindb.common import crypto, util
from bigchaindb.models import Transaction
from bigchaindb.pipelines import vote
@ -257,7 +257,7 @@ def test_valid_block_voting_with_create_transaction(b, monkeypatch):
def test_valid_block_voting_with_transfer_transactions(monkeypatch, b):
from bigchaindb_common import crypto, util
from bigchaindb.common import crypto, util
from bigchaindb.models import Transaction
from bigchaindb.pipelines import vote
@ -325,7 +325,7 @@ def test_valid_block_voting_with_transfer_transactions(monkeypatch, b):
def test_unsigned_tx_in_block_voting(monkeypatch, b, user_vk):
from bigchaindb_common import crypto, util
from bigchaindb.common import crypto, util
from bigchaindb.models import Transaction
from bigchaindb.pipelines import vote
@ -362,7 +362,7 @@ def test_unsigned_tx_in_block_voting(monkeypatch, b, user_vk):
def test_invalid_id_tx_in_block_voting(monkeypatch, b, user_vk):
from bigchaindb_common import crypto, util
from bigchaindb.common import crypto, util
from bigchaindb.models import Transaction
from bigchaindb.pipelines import vote
@ -401,7 +401,7 @@ def test_invalid_id_tx_in_block_voting(monkeypatch, b, user_vk):
def test_invalid_content_in_tx_in_block_voting(monkeypatch, b, user_vk):
from bigchaindb_common import crypto, util
from bigchaindb.common import crypto, util
from bigchaindb.models import Transaction
from bigchaindb.pipelines import vote
@ -440,7 +440,7 @@ def test_invalid_content_in_tx_in_block_voting(monkeypatch, b, user_vk):
def test_invalid_block_voting(monkeypatch, b, user_vk):
from bigchaindb_common import crypto, util
from bigchaindb.common import crypto, util
from bigchaindb.pipelines import vote
inpipe = Pipe()

View File

@ -22,7 +22,7 @@ def mock_write_config(monkeypatch):
@pytest.fixture
def mock_db_init_with_existing_db(monkeypatch):
from bigchaindb import db
from bigchaindb_common.exceptions import DatabaseAlreadyExists
from bigchaindb.common.exceptions import DatabaseAlreadyExists
def mockreturn():
raise DatabaseAlreadyExists
@ -48,7 +48,7 @@ def mock_rethink_db_drop(monkeypatch):
@pytest.fixture
def mock_generate_key_pair(monkeypatch):
monkeypatch.setattr('bigchaindb_common.crypto.generate_key_pair', lambda: ('privkey', 'pubkey'))
monkeypatch.setattr('bigchaindb.common.crypto.generate_key_pair', lambda: ('privkey', 'pubkey'))
@pytest.fixture
@ -283,14 +283,14 @@ def test_start_rethinkdb_returns_a_process_when_successful(mock_popen):
@patch('subprocess.Popen')
def test_start_rethinkdb_exits_when_cannot_start(mock_popen):
from bigchaindb_common import exceptions
from bigchaindb.common import exceptions
from bigchaindb.commands import utils
mock_popen.return_value = Mock(stdout=['Nopety nope'])
with pytest.raises(exceptions.StartupError):
utils.start_rethinkdb()
@patch('bigchaindb_common.crypto.generate_key_pair',
@patch('bigchaindb.common.crypto.generate_key_pair',
return_value=('private_key', 'public_key'))
def test_allow_temp_keypair_generates_one_on_the_fly(mock_gen_keypair,
mock_processes_start,
@ -307,7 +307,7 @@ def test_allow_temp_keypair_generates_one_on_the_fly(mock_gen_keypair,
assert bigchaindb.config['keypair']['public'] == 'public_key'
@patch('bigchaindb_common.crypto.generate_key_pair',
@patch('bigchaindb.common.crypto.generate_key_pair',
return_value=('private_key', 'public_key'))
def test_allow_temp_keypair_doesnt_override_if_keypair_found(mock_gen_keypair,
mock_processes_start,

View File

@ -42,7 +42,7 @@ def test_bigchain_instance_is_initialized_when_conf_provided():
def test_bigchain_instance_raises_when_not_configured(monkeypatch):
from bigchaindb import config_utils
from bigchaindb_common import exceptions
from bigchaindb.common import exceptions
assert 'CONFIGURED' not in bigchaindb.config
# We need to disable ``bigchaindb.config_utils.autoconfigure`` to avoid reading
@ -204,7 +204,7 @@ def test_file_config():
def test_invalid_file_config():
from bigchaindb.config_utils import file_config
from bigchaindb_common import exceptions
from bigchaindb.common import exceptions
with patch('builtins.open', mock_open(read_data='{_INVALID_JSON_}')):
with pytest.raises(exceptions.ConfigurationError):
file_config()

View File

@ -37,8 +37,8 @@ class TestBlockModel(object):
'not a list or None')
def test_block_serialization(self, b):
from bigchaindb_common.crypto import hash_data
from bigchaindb_common.util import gen_timestamp, serialize
from bigchaindb.common.crypto import hash_data
from bigchaindb.common.util import gen_timestamp, serialize
from bigchaindb.models import Block, Transaction
transactions = [Transaction.create([b.me], [b.me])]
@ -61,7 +61,7 @@ class TestBlockModel(object):
assert block.to_dict() == expected
def test_block_invalid_serializaton(self):
from bigchaindb_common.exceptions import OperationError
from bigchaindb.common.exceptions import OperationError
from bigchaindb.models import Block
block = Block([])
@ -69,8 +69,8 @@ class TestBlockModel(object):
block.to_dict()
def test_block_deserialization(self, b):
from bigchaindb_common.crypto import hash_data
from bigchaindb_common.util import gen_timestamp, serialize
from bigchaindb.common.crypto import hash_data
from bigchaindb.common.util import gen_timestamp, serialize
from bigchaindb.models import Block, Transaction
transactions = [Transaction.create([b.me], [b.me])]
@ -94,7 +94,7 @@ class TestBlockModel(object):
assert expected == Block.from_dict(block_body)
def test_block_invalid_id_deserialization(self, b):
from bigchaindb_common.exceptions import InvalidHash
from bigchaindb.common.exceptions import InvalidHash
from bigchaindb.models import Block
block = {
@ -108,9 +108,9 @@ class TestBlockModel(object):
Block.from_dict(block)
def test_block_invalid_signature_deserialization(self, b):
from bigchaindb_common.crypto import hash_data
from bigchaindb_common.exceptions import InvalidSignature
from bigchaindb_common.util import gen_timestamp, serialize
from bigchaindb.common.crypto import hash_data
from bigchaindb.common.exceptions import InvalidSignature
from bigchaindb.common.util import gen_timestamp, serialize
from bigchaindb.models import Block, Transaction
transactions = [Transaction.create([b.me], [b.me])]
@ -142,8 +142,8 @@ class TestBlockModel(object):
assert Block(transactions) == Block(transactions)
def test_sign_block(self, b):
from bigchaindb_common.crypto import SigningKey, VerifyingKey
from bigchaindb_common.util import gen_timestamp, serialize
from bigchaindb.common.crypto import SigningKey, VerifyingKey
from bigchaindb.common.util import gen_timestamp, serialize
from bigchaindb.models import Block, Transaction
transactions = [Transaction.create([b.me], [b.me])]

View File

@ -1,7 +1,7 @@
import json
import pytest
from bigchaindb_common import crypto
from bigchaindb.common import crypto
TX_ENDPOINT = '/api/v1/transactions/'