From 811f89e5a67692ceb5fc6377b5ae66fb312fab3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Wed, 15 Feb 2023 09:19:17 +0100 Subject: [PATCH] 79 hotfix election validation bckwrd compat (#319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fixed election and voting backward compatibility issues * bumped version! * fixed changed testcases and a bug * blackified * blackified with newest verion to satisfy CI * fix dependency management issue --------- Signed-off-by: Jürgen Eckel --- CHANGELOG.md | 6 ++++++ planetmint/lib.py | 6 ++---- planetmint/version.py | 2 +- setup.py | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71bfe01..69ac112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ For reference, the possible headings are: * **Known Issues** * **Notes** +## [2.2.3] - 2023-14-02 +* **fixed** fixed voting/election backward compatibility issue (using planetmint-transactions >= 0.7.0) on the 2.2 main branch + ## [2.2.2] - 2023-31-01 * **Fixed** catching tarantool exceptions in case tarantool drivers throw execeptions due to concurrency issues. This issue got idenitfied during the testing of the planetmint-driver-ts. @@ -39,6 +42,9 @@ For reference, the possible headings are: * **Removed** removed text_search routes * **Added** metadata / asset cid route for fetching transactions +## [1.4.2] - 2023-14-02 +* **fixed** fixed voting/election backward compatibility issue (using planetmint-transactions >= 0.7.0) + ## [1.4.1] - 2022-21-12 * **fixed** inconsistent cryptocondition keyring tag handling. Using cryptoconditions > 1.1.0 from now on. diff --git a/planetmint/lib.py b/planetmint/lib.py index 33dd8d4..eb1cc4c 100644 --- a/planetmint/lib.py +++ b/planetmint/lib.py @@ -676,7 +676,7 @@ class Planetmint(object): current_validators = self.get_validators_dict() # NOTE: change more than 1/3 of the current power is not allowed - if transaction.assets[0]["data"]["power"] >= (1 / 3) * sum(current_validators.values()): + if transaction.get_assets()[0]["data"]["power"] >= (1 / 3) * sum(current_validators.values()): raise InvalidPowerChange("`power` change must be less than 1/3 of total power") def get_election_status(self, transaction): @@ -734,7 +734,6 @@ class Planetmint(object): def show_election_status(self, transaction): data = transaction.assets[0] data = data.to_dict()["data"] - if "public_key" in data.keys(): data["public_key"] = public_key_to_base64(data["public_key"]["value"]) response = "" @@ -815,8 +814,7 @@ class Planetmint(object): for tx in txns: if not isinstance(tx, Vote): continue - - election_id = tx.assets[0]["id"] + election_id = Transaction.read_out_asset_id(tx) if election_id not in elections: elections[election_id] = [] elections[election_id].append(tx) diff --git a/planetmint/version.py b/planetmint/version.py index 0c3bc4d..ba50c8b 100644 --- a/planetmint/version.py +++ b/planetmint/version.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 -__version__ = "2.2.2" +__version__ = "2.2.3" __short_version__ = "2.2" # Supported Tendermint versions diff --git a/setup.py b/setup.py index e17bd51..411f423 100644 --- a/setup.py +++ b/setup.py @@ -66,7 +66,7 @@ docs_require = [ "pyparsing==3.0.8", "pytz==2022.1", "PyYAML>=5.4.0", - "requests>=2.25i.1", + "requests>=2.25.1", "six==1.16.0", "snowballstemmer==2.2.0", "Sphinx==4.5.0", @@ -129,7 +129,7 @@ install_requires = [ "planetmint-ipld>=0.0.3", "pyasn1>=0.4.8", "python-decouple", - "planetmint-transactions>=0.6.0", + "planetmint-transactions>=0.7.0", ] setup(