From 43345dd68f96b4df6a17ab3d7075f901612fbe08 Mon Sep 17 00:00:00 2001 From: Michael Diamant Date: Thu, 21 Apr 2022 17:35:33 -0400 Subject: [PATCH 1/9] Consistently reference `pip3` in README (#319) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41436ead..360260a4 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Alternatively, choose a [distribution file](https://pypi.org/project/py-algorand Install dependencies -- `pip install -r requirements.txt` +- `pip3 install -r requirements.txt` Run tests From 46a8d23db7d1f24161c85a1f66bcf12b039f20f9 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 26 Apr 2022 09:33:12 -0400 Subject: [PATCH 2/9] fixed typo in lsig trace (#320) --- algosdk/dryrun_results.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algosdk/dryrun_results.py b/algosdk/dryrun_results.py index 22ca905f..f0ee2eb7 100644 --- a/algosdk/dryrun_results.py +++ b/algosdk/dryrun_results.py @@ -141,7 +141,7 @@ def lsig_trace(self, spc: StackPrinterConfig = None) -> str: spc = StackPrinterConfig(top_of_stack_first=False) return self.trace( - self.logic_sig_trace, self.logic_sig_disassembly, spaces=spc + self.logic_sig_trace, self.logic_sig_disassembly, spc=spc ) From 102874957fbc6f01855c088267a1a2ca320e5c0c Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 26 Apr 2022 12:48:12 -0400 Subject: [PATCH 3/9] adding foreign-app-addr to dryrun creator (#321) --- algosdk/future/transaction.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/algosdk/future/transaction.py b/algosdk/future/transaction.py index e649537a..69b6a294 100644 --- a/algosdk/future/transaction.py +++ b/algosdk/future/transaction.py @@ -3131,6 +3131,12 @@ def create_dryrun( accts.extend(txn.accounts) if txn.foreign_apps: apps.extend(txn.foreign_apps) + accts.extend( + [ + logic.get_application_address(aidx) + for aidx in txn.foreign_apps + ] + ) if txn.foreign_assets: assets.extend(txn.foreign_assets) From ed15008c8c90509c641c67e73a2e7c3fd7bd342e Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Wed, 27 Apr 2022 10:54:56 -0400 Subject: [PATCH 4/9] adding condition for allowing rcv to be none if close to is set (#317) * adding condition for allowing rcv to be none if close to is set * use zero address from transaction package * move zero address to constants * adding extra case for if amount is non zero * set close to to the zero address if none is present * adding unit tests for zero'd rcv and arcv when a closeto is sent --- algosdk/constants.py | 3 +++ algosdk/future/transaction.py | 5 +++-- algosdk/testing/dryrun.py | 9 ++++++--- test_unit.py | 24 ++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/algosdk/constants.py b/algosdk/constants.py index 7da38403..b12a6093 100644 --- a/algosdk/constants.py +++ b/algosdk/constants.py @@ -89,6 +89,9 @@ LOGIC_SIG_MAX_SIZE = 1000 """int: max size of a teal program and its arguments in bytes""" +ZERO_ADDRESS = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ" +"""str: algorand encoded address of 32 zero bytes""" + # for backward compatibility: kmd_auth_header = KMD_AUTH_HEADER algod_auth_header = ALGOD_AUTH_HEADER diff --git a/algosdk/future/transaction.py b/algosdk/future/transaction.py index 69b6a294..6c6da6e9 100644 --- a/algosdk/future/transaction.py +++ b/algosdk/future/transaction.py @@ -394,7 +394,7 @@ def _undictify(d): "amt": d["amt"] if "amt" in d else 0, "receiver": encoding.encode_address(d["rcv"]) if "rcv" in d - else None, + else constants.ZERO_ADDRESS, } return args @@ -1348,6 +1348,7 @@ def __init__( self.receiver = receiver else: raise error.ZeroAddressError + self.amount = amt if (not isinstance(self.amount, int)) or self.amount < 0: raise error.WrongAmountType @@ -1386,7 +1387,7 @@ def _undictify(d): args = { "receiver": encoding.encode_address(d["arcv"]) if "arcv" in d - else None, + else constants.ZERO_ADDRESS, "amt": d["aamt"] if "aamt" in d else 0, "index": d["xaid"] if "xaid" in d else None, "close_assets_to": encoding.encode_address(d["aclose"]) diff --git a/algosdk/testing/dryrun.py b/algosdk/testing/dryrun.py index 2957d765..0c54a1a6 100644 --- a/algosdk/testing/dryrun.py +++ b/algosdk/testing/dryrun.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from typing import List, Union -from algosdk.constants import payment_txn, appcall_txn +from algosdk.constants import payment_txn, appcall_txn, ZERO_ADDRESS from algosdk.future import transaction from algosdk.encoding import encode_address, msgpack_encode from algosdk.v2client.models import ( @@ -18,7 +18,6 @@ ) -ZERO_ADDRESS = encode_address(bytes(32)) PRINTABLE = frozenset(string.printable) @@ -478,7 +477,11 @@ def _dryrun_request(self, prog_drr_txns, lsig, app, sender): return drr def _checked_request( - self, prog_drr_txns, lsig=None, app=None, sender=ZERO_ADDRESS + self, + prog_drr_txns, + lsig=None, + app=None, + sender=ZERO_ADDRESS, ): """ Helper function to make a dryrun request and perform basic validation diff --git a/test_unit.py b/test_unit.py index 86b6c822..3ffb7969 100644 --- a/test_unit.py +++ b/test_unit.py @@ -1942,6 +1942,30 @@ def test_payment_txn(self): paytxn, encoding.msgpack_encode(encoding.msgpack_decode(paytxn)) ) + def test_payment_txn_future(self): + paytxn = ( + "iKVjbG9zZcQgYMak0FPHfqBp4So5wS5p7g+O4rLkqwo/ILSjXWQVKpGjZmVlzQPoom" + "Z2KqNnZW6qc2FuZG5ldC12MaJnaMQgNCTHAIMgeYC+4MCSbMinkrlsgtRD6jhfJEXz" + "IP3mH9SibHbNBBKjc25kxCARM5ng7Z1RkubT9fUef5nT9w0MGQKRGbwgOva8/tx3qqR" + "0eXBlo3BheQ==" + ) + self.assertEqual( + paytxn, + encoding.msgpack_encode(encoding.future_msgpack_decode(paytxn)), + ) + + def test_asset_xfer_txn_future(self): + axfer = ( + "iaZhY2xvc2XEIGDGpNBTx36gaeEqOcEuae4PjuKy5KsKPyC0o11kFSqRo2ZlZc0D6KJmdi" + "qjZ2VuqnNhbmRuZXQtdjGiZ2jEIDQkxwCDIHmAvuDAkmzIp5K5bILUQ+o4XyRF8yD95h/U" + "omx2zQQSo3NuZMQgETOZ4O2dUZLm0/X1Hn+Z0/cNDBkCkRm8IDr2vP7cd6qkdHlwZaVheGZ" + "lcqR4YWlkCg==" + ) + self.assertEqual( + axfer, + encoding.msgpack_encode(encoding.future_msgpack_decode(axfer)), + ) + def test_multisig_txn(self): msigtxn = ( "gqRtc2lng6ZzdWJzaWeSgqJwa8Qg1ke3gkLuR0MUN/Ku0oyiRVIm9P1QFDaiEhT5v" From f0601dbd3c6f80b43913ebbd3c4415e7edd1935e Mon Sep 17 00:00:00 2001 From: Michael Diamant Date: Thu, 28 Apr 2022 12:58:22 -0400 Subject: [PATCH 5/9] Add minimum Python version policy to README (#322) --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 360260a4..f8b8417d 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,18 @@ Run `$ pip3 install py-algorand-sdk` to install the package. Alternatively, choose a [distribution file](https://pypi.org/project/py-algorand-sdk/#files), and run `$ pip3 install [file name]`. +## Supported Python versions +py-algorand-sdk's minimum Python version policy attempts to balance several constraints. +* Make it easy for the community to use py-algorand-sdk by minimizing or excluding the need to customize Python installations. +* Provide maintainers with access to newer language features that produce more robust software. + +Given these constraints, the minimum Python version policy is: +Target Python version on newest [Ubuntu LTS](https://wiki.ubuntu.com/Releases) released >= 6 months ago. + +The rationale is: +* If a major Linux OS distribution bumps a Python version, then it's sufficiently available to the community for us to upgrade. +* The 6 month time buffer ensures we delay upgrades until the community starts using a recently released LTS version. + ## SDK Development Install dependencies From 6622d8106b72a9b95c587dc53eabb62e360958fa Mon Sep 17 00:00:00 2001 From: Michael Diamant Date: Thu, 28 Apr 2022 13:24:11 -0400 Subject: [PATCH 6/9] Bump minimum Python version to 3.8 (#323) --- .circleci/config.yml | 4 ++-- .readthedocs.yaml | 15 +++++++++++++++ .travis.yml | 10 ---------- Dockerfile | 2 +- docs/conf.py | 2 +- docs/requirements.txt | 4 ++-- setup.py | 2 +- 7 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 .readthedocs.yaml delete mode 100644 .travis.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 3cf70366..fa88d663 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ workflows: jobs: unit-test: docker: - - image: python:3.7.9 + - image: python:3.8 steps: - checkout - run: pip install -r requirements.txt @@ -26,7 +26,7 @@ jobs: docset: docker: # NOTE: We might eventually need Docker authentication here. - - image: cimg/python:3.9 + - image: cimg/python:3.8 steps: - checkout - run: diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..3dd09717 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,15 @@ +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-20.04 + tools: + python: "3.8" + +sphinx: + configuration: docs/conf.py + +python: + install: + - requirements: docs/requirements.txt diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 866345de..00000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -dist: bionic -language: python -python: - - "3.7" -script: - - black --check . - - set -e - - if [ -n "$DOCKER_PASSWORD" ]; then echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin ; fi - - python3 test_unit.py - - make docker-test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 60c0721b..cf805bd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7.9 +FROM python:3.8 # Copy SDK code into the container RUN mkdir -p $HOME/py-algorand-sdk diff --git a/docs/conf.py b/docs/conf.py index 0b473fcb..7eb2d22d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,7 +19,7 @@ # -- Project information ----------------------------------------------------- project = "algosdk" -copyright = "2020 Algorand" +copyright = "2022 Algorand" author = "Algorand" diff --git a/docs/requirements.txt b/docs/requirements.txt index 3c0f2563..88b9acb6 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ -sphinx==4.0.1 -sphinx-rtd-theme +sphinx==4.2.0 +sphinx-rtd-theme==1.0.0 m2r2 diff --git a/setup.py b/setup.py index 1de3f41a..00d901ed 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ "msgpack>=1.0.0,<2", ], packages=setuptools.find_packages(), - python_requires=">=3.5", + python_requires=">=3.8", package_data={"": ["data/langspec.json"]}, include_package_data=True, ) From d79c1c129210b65c6d2062d924f76f5f921ccc68 Mon Sep 17 00:00:00 2001 From: Michael Diamant Date: Thu, 28 Apr 2022 14:11:43 -0400 Subject: [PATCH 7/9] Matrix test across Python versions for unit tests (#325) --- .circleci/config.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fa88d663..55343b4c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,14 +4,20 @@ workflows: version: 2 test: jobs: - - unit-test + - unit-test: + matrix: + parameters: + python-version: ["3.8", "3.9", "3.10"] - integration-test - docset jobs: unit-test: + parameters: + python-version: + type: string docker: - - image: python:3.8 + - image: python:<< parameters.python-version >> steps: - checkout - run: pip install -r requirements.txt From f5f004f021dabe01939de3783b670a3f763428b0 Mon Sep 17 00:00:00 2001 From: Michael Diamant Date: Thu, 28 Apr 2022 15:46:27 -0400 Subject: [PATCH 8/9] Matrix test python versions integration tests (#327) --- .circleci/config.yml | 10 ++++++++-- Dockerfile | 3 ++- Makefile | 3 ++- run_integration.sh | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 55343b4c..d327837a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,10 @@ workflows: matrix: parameters: python-version: ["3.8", "3.9", "3.10"] - - integration-test + - integration-test: + matrix: + parameters: + python-version: ["3.8", "3.9", "3.10"] - docset jobs: @@ -24,11 +27,14 @@ jobs: - run: black --check . - run: python3 test_unit.py integration-test: + parameters: + python-version: + type: string machine: image: "ubuntu-2004:202104-01" steps: - checkout - - run: make docker-test + - run: PYTHON_VERSION=<< parameters.python-version >> make docker-test docset: docker: # NOTE: We might eventually need Docker authentication here. diff --git a/Dockerfile b/Dockerfile index cf805bd4..e6c1f178 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3.8 +ARG PYTHON_VERSION +FROM python:$PYTHON_VERSION # Copy SDK code into the container RUN mkdir -p $HOME/py-algorand-sdk diff --git a/Makefile b/Makefile index c10e7d5d..8f066457 100644 --- a/Makefile +++ b/Makefile @@ -6,5 +6,6 @@ INTEGRATIONS = "@abi or @algod or @applications or @applications.verified or @as integration: behave --tags=$(INTEGRATIONS) test -f progress2 +PYTHON_VERSION ?= 3.8 docker-test: - ./run_integration.sh + PYTHON_VERSION='$(PYTHON_VERSION)' ./run_integration.sh diff --git a/run_integration.sh b/run_integration.sh index 1d4861b0..76b293e8 100755 --- a/run_integration.sh +++ b/run_integration.sh @@ -14,7 +14,7 @@ mkdir -p test/features cp -r test-harness/features/* test/features # Build SDK testing environment -docker build -t py-sdk-testing -f Dockerfile "$(pwd)" +docker build -t py-sdk-testing --build-arg PYTHON_VERSION="${PYTHON_VERSION}" -f Dockerfile "$(pwd)" # Start test harness environment ./test-harness/scripts/up.sh From 13bf253796ba50a8e08201b1224851c597013295 Mon Sep 17 00:00:00 2001 From: John Lee Date: Fri, 29 Apr 2022 13:51:33 -0400 Subject: [PATCH 9/9] Bumped to version v1.13.0 --- CHANGELOG.md | 15 ++++++++++++++- setup.py | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dc61624..db32fee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,20 @@ # Changelog +# v1.13.0 +## Added +- Adding condition for allowing rcv to be none if close to is set (#317) +- Adding foreign-app-addr to dryrun creator (#321) +## Changed +- Matrix test python versions integration tests (#327) +- Matrix test across Python versions for unit tests (#325) +- Bump minimum Python version to 3.8 (#323) +- Add minimum Python version policy to README (#322) +- Consistently reference `pip3` in README (#319) +## Fixed +- Fixed typo in lsig trace (#320) + # v1.12.0 -## Fixed +## Fixed - Catch TypeError and ValueError in verify functions (#309) ## Added - Dryrun response (#283) diff --git a/setup.py b/setup.py index 00d901ed..4aef8155 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ description="Algorand SDK in Python", author="Algorand", author_email="pypiservice@algorand.com", - version="v1.12.0", + version="v1.13.0", long_description=long_description, long_description_content_type="text/markdown", license="MIT",