Compare commits

...

7 Commits

Author SHA1 Message Date
Scott Sadler
f8bc0ea65b bump version and update changelog for 0.8.2 2017-01-27 10:58:54 +01:00
Troy McConaghy
e2fadb2df8 Fixed minor error in changelog for 0.8.0
v0.8.0 doesn't actually do transaction schema validation. That got merged shortly _after_ the v0.8.0 release, in PR #880
2017-01-27 10:55:02 +01:00
Scott Sadler
27dbf6157d fix spend input twice bug (https://github.com/bigchaindb/bigchaindb/issues/1099) 0.8.2 2017-01-27 10:53:41 +01:00
Sylvain Bellemare
c4cf0a5231 Add changes for 0.8.1 release to changelog 2017-01-27 10:49:01 +01:00
Sylvain Bellemare
9307ef413e Increase maintenance version 2017-01-16 19:53:02 +01:00
Jody Winston
001ccf7f85 Fix use of locales for python et al 2017-01-16 19:16:19 +01:00
Sylvain Bellemare
388c179517 Upgrade pysha3 2017-01-16 18:38:42 +01:00
6 changed files with 71 additions and 4 deletions

View File

@ -16,6 +16,27 @@ For reference, the possible headings are:
* **Notes** * **Notes**
## [0.8.2] - 2017-01-27
Tag name: v0.8.2
### Fixed
- Fix spend input twice in same transaction
(https://github.com/bigchaindb/bigchaindb/issues/1099).
## [0.8.1] - 2017-01-16
Tag name: v0.8.1
= commit:
committed:
### Changed
- Upgrade pysha3 to 1.0.0 (supports official NIST standard).
### Fixed
- Workaround for rapidjson problem with package metadata extraction
(https://github.com/kenrobbins/python-rapidjson/pull/52).
## [0.8.0] - 2016-11-29 ## [0.8.0] - 2016-11-29
Tag name: v0.8.0 Tag name: v0.8.0
= commit: = commit:
@ -23,7 +44,7 @@ committed:
### Added ### Added
- The big new thing in version 0.8.0 is support for divisible assets, i.e. assets like carrots or thumbtacks, where the initial CREATE transaction can register/create some amount (e.g. 542 carrots), the first TRANSFER transaction can split that amount across multiple owners, and so on. [Pull Request #794](https://github.com/bigchaindb/bigchaindb/pull/794) - The big new thing in version 0.8.0 is support for divisible assets, i.e. assets like carrots or thumbtacks, where the initial CREATE transaction can register/create some amount (e.g. 542 carrots), the first TRANSFER transaction can split that amount across multiple owners, and so on. [Pull Request #794](https://github.com/bigchaindb/bigchaindb/pull/794)
- Wrote a formal schema for the JSON structure of transactions. Transactions are now checked against that schema. [Pull Request #798](https://github.com/bigchaindb/bigchaindb/pull/798) - Wrote a formal schema for the JSON structure of transactions. [Pull Request #798](https://github.com/bigchaindb/bigchaindb/pull/798)
- New configuration parameter: `backlog_reassign_delay`. [Pull Request #883](https://github.com/bigchaindb/bigchaindb/pull/883) - New configuration parameter: `backlog_reassign_delay`. [Pull Request #883](https://github.com/bigchaindb/bigchaindb/pull/883)
### Changed ### Changed

View File

@ -1,6 +1,16 @@
FROM rethinkdb:2.3 FROM rethinkdb:2.3
RUN apt-get update # From http://stackoverflow.com/a/38553499
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get -y install python3 python3-pip libffi-dev RUN apt-get -y install python3 python3-pip libffi-dev
RUN pip3 install --upgrade pip RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools RUN pip3 install --upgrade setuptools

View File

@ -79,6 +79,11 @@ class Transaction(Transaction):
raise AmountError('`amount` needs to be greater than zero') raise AmountError('`amount` needs to be greater than zero')
input_amount += input_tx.conditions[input_cid].amount input_amount += input_tx.conditions[input_cid].amount
# Validate that all inputs are distinct
links = [(f.tx_input.txid, f.tx_input.cid) for f in self.fulfillments]
if len(links) != len(set(links)):
raise DoubleSpend('tx "{}" spends inputs twice'.format(self.id))
# validate asset id # validate asset id
asset_id = Asset.get_asset_id(input_txs) asset_id = Asset.get_asset_id(input_txs)
if asset_id != self.asset.data_id: if asset_id != self.asset.data_id:

View File

@ -1,2 +1,2 @@
__version__ = '0.8.0' __version__ = '0.8.2'
__short_version__ = '0.8' __short_version__ = '0.8'

View File

@ -58,7 +58,7 @@ benchmarks_require = [
install_requires = [ install_requires = [
'rethinkdb~=2.3', # i.e. a version between 2.3 and 3.0 'rethinkdb~=2.3', # i.e. a version between 2.3 and 3.0
'pysha3>=0.3', 'pysha3~=1.0.0',
'cryptoconditions>=0.5.0', 'cryptoconditions>=0.5.0',
'statsd>=3.2.1', 'statsd>=3.2.1',
'python-rapidjson>=0.0.6', 'python-rapidjson>=0.0.6',

View File

@ -1178,3 +1178,34 @@ class TestMultipleInputs(object):
# check that the other remain marked as unspent # check that the other remain marked as unspent
for unspent in transactions[1:]: for unspent in transactions[1:]:
assert b.get_spent(unspent.id, 0) is None assert b.get_spent(unspent.id, 0) is None
def test_cant_spend_same_input_twice_in_tx(b):
"""
Recreate duplicated fulfillments bug
https://github.com/bigchaindb/bigchaindb/issues/1099
"""
from bigchaindb.models import Asset, Transaction
from bigchaindb.common.exceptions import DoubleSpend
# create a divisible asset
tx_create = Transaction.create([b.me], [([b.me], 100)],
asset=Asset(divisible=True))
tx_create_signed = tx_create.sign([b.me_private])
assert b.validate_transaction(tx_create_signed) == tx_create_signed
## create a block and valid vote
b.create_genesis_block()
block = b.create_block([tx_create_signed])
b.write_block(block, durability='hard')
vote = b.vote(block.id, b.get_last_voted_block().id, True)
b.write_vote(vote)
# Create a transfer transaction with duplicated fulfillments
dup_inputs = tx_create.to_inputs() + tx_create.to_inputs()
tx_transfer = Transaction.transfer(dup_inputs, [([b.me], 200)],
asset=tx_create_signed.asset)
tx_transfer_signed = tx_transfer.sign([b.me_private])
assert b.is_valid_transaction(tx_transfer_signed) is False
with pytest.raises(DoubleSpend):
tx_transfer_signed.validate(b)