From 2423af77b9dbae1175512823c37c804ba069db82 Mon Sep 17 00:00:00 2001 From: ouziel-slama Date: Wed, 18 Mar 2015 10:45:51 +0100 Subject: [PATCH 1/2] Hotfix: Global Integer Overflow * Update location of `protocol_changes.json` --- ChangeLog.md | 2 + counterpartylib/lib/check.py | 4 +- counterpartylib/lib/config.py | 4 +- .../lib/messages/versions/send1.py | 6 ++- counterpartylib/protocol_changes.json | 7 ++++ protocol_changes.json | 39 ------------------- setup.py | 2 +- version.json | 7 ---- 8 files changed, 18 insertions(+), 53 deletions(-) delete mode 100644 protocol_changes.json delete mode 100644 version.json diff --git a/ChangeLog.md b/ChangeLog.md index a7b2d79c31..441752288e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,6 @@ ## Client Versions ## +* v9.50.0 (2014-03-18) + * hotfix: global integer overflow * v9.49.4 (2014-02-05) * reconceived this package as a libary * moved CLI to new repository: `counterparty-cli` diff --git a/counterpartylib/lib/check.py b/counterpartylib/lib/check.py index 260912902b..88eb58efdf 100644 --- a/counterpartylib/lib/check.py +++ b/counterpartylib/lib/check.py @@ -128,11 +128,11 @@ def software_version(): logger.debug('Checking version.') try: - host = 'https://counterpartyxcp.github.io/counterparty-lib/protocol_changes.json' + host = 'https://counterpartyxcp.github.io/counterparty-lib/counterpartylib/protocol_changes.json' response = requests.get(host, headers={'cache-control': 'no-cache'}) # TODO: Temporary if response.status_code != 200: - host = 'https://counterpartyxcp.github.io/counterpartyd/protocol_changes.json' # Old Location + host = 'https://counterpartyxcp.github.io/counterpartyd/counterpartylib/protocol_changes.json' # Old Location response = requests.get(host, headers={'cache-control': 'no-cache'}) versions = json.loads(response.text) except (requests.exceptions.ConnectionError, ConnectionRefusedError, ValueError): diff --git a/counterpartylib/lib/config.py b/counterpartylib/lib/config.py index 55a58dc337..b912b7f86a 100644 --- a/counterpartylib/lib/config.py +++ b/counterpartylib/lib/config.py @@ -6,8 +6,8 @@ # Versions VERSION_MAJOR = 9 -VERSION_MINOR = 49 -VERSION_REVISION = 4 +VERSION_MINOR = 50 +VERSION_REVISION = 0 VERSION_STRING = str(VERSION_MAJOR) + '.' + str(VERSION_MINOR) + '.' + str(VERSION_REVISION) diff --git a/counterpartylib/lib/messages/versions/send1.py b/counterpartylib/lib/messages/versions/send1.py index b671701893..5be6f83f43 100644 --- a/counterpartylib/lib/messages/versions/send1.py +++ b/counterpartylib/lib/messages/versions/send1.py @@ -97,9 +97,11 @@ def parse (db, tx, message): elif balances[0]['quantity'] < quantity: quantity = min(balances[0]['quantity'], quantity) - if status == 'valid': - # For SQLite3 + # For SQLite3 + if quantity: quantity = min(quantity, config.MAX_INT) + + if status == 'valid': problems = validate(db, tx['source'], tx['destination'], asset, quantity, tx['block_index']) if problems: status = 'invalid: ' + '; '.join(problems) diff --git a/counterpartylib/protocol_changes.json b/counterpartylib/protocol_changes.json index 20dff2a8f6..d6b0300a55 100644 --- a/counterpartylib/protocol_changes.json +++ b/counterpartylib/protocol_changes.json @@ -34,5 +34,12 @@ "minimum_version_minor": 49, "minimum_version_revision": 0, "block_index": 334000 + }, + "hotfix_integer_overflow": { + "minimum_version_major": 9, + "minimum_version_minor": 50, + "minimum_version_revision": 0, + "block_index": 0 } + } diff --git a/protocol_changes.json b/protocol_changes.json deleted file mode 100644 index f49894c74b..0000000000 --- a/protocol_changes.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "numeric_asset_names": { - "minimum_version_major": 9, - "minimum_version_minor": 47, - "minimum_version_revision": 1, - "block_index": 333500 - }, - "multisig_addresses": { - "minimum_version_major": 9, - "minimum_version_minor": 47, - "minimum_version_revision": 1, - "block_index": 333500 - }, - "send_destination_required": { - "minimum_version_major": 9, - "minimum_version_minor": 47, - "minimum_version_revision": 1, - "block_index": 333500 - }, - "contracts_only_xcp_balances": { - "minimum_version_major": 9, - "minimum_version_minor": 47, - "minimum_version_revision": 1, - "block_index": 333500 - }, - "better_single_source_destination": { - "minimum_version_major": 9, - "minimum_version_minor": 48, - "minimum_version_revision": 0, - "block_index": 335000 - }, - "hotfix_numeric_assets": { - "minimum_version_major": 9, - "minimum_version_minor": 49, - "minimum_version_revision": 0, - "block_index": 334000 - } -} - diff --git a/setup.py b/setup.py index 5fc371f06a..e4da780700 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ import sys import shutil -CURRENT_VERSION = '9.49.4' +CURRENT_VERSION = '9.50.0' # NOTE: Why we don’t use the the PyPi package: # diff --git a/version.json b/version.json deleted file mode 100644 index d10c958d40..0000000000 --- a/version.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "minimum_version_major": 9, - "minimum_version_minor": 49, - "minimum_version_revision": 0, - "reason": "hotfix: numeric asset names", - "block_index": 334000 -} From 6acb8315f70c325423aa347920ddac8325f2ebde Mon Sep 17 00:00:00 2001 From: Adam Krellenstein Date: Wed, 18 Mar 2015 08:15:06 -0400 Subject: [PATCH 2/2] Combine Duplicate Version Strings --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index e4da780700..82a56719cd 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,9 @@ import sys import shutil -CURRENT_VERSION = '9.50.0' +from counterpartylib.lib import config + +CURRENT_VERSION = config.VERSION_STRING # NOTE: Why we don’t use the the PyPi package: # @@ -98,7 +100,6 @@ def finalize_options(self): def run(self): import appdirs - from counterpartylib.lib import config old_data_dir = appdirs.user_config_dir(appauthor='Counterparty', appname='counterpartyd', roaming=True) old_database = os.path.join(old_data_dir, 'counterpartyd.9.db')