79 hotfix election validation bckwrd compat (#319)

* 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 <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2023-02-15 09:19:17 +01:00 committed by GitHub
parent 2bb0539b78
commit 811f89e5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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

View File

@ -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(