Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abi subroutine feature merge #315

Merged
merged 29 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
12d4603
Add readthedocs config file (#276)
jasonpaulos Apr 14, 2022
b37b4b5
Pin versions of docs dependencies (#279)
jasonpaulos Apr 14, 2022
a8f7bb6
Prep CHANGELOG for v0.11.1 (#281)
michaeldiamant Apr 15, 2022
a464b5c
Flake & Make (#273)
tzaffi Apr 19, 2022
8aafebb
Use absolute imports (#283)
jasonpaulos Apr 20, 2022
850c2ca
Fix typo: "mircoAlgos" => "microAlgos" (#291)
ChrisAntaki Apr 21, 2022
7db0d62
Reword account and assert Transaction field references (#295)
michaeldiamant Apr 25, 2022
a4f42b6
Utility for increasing budget during execution of PyTeal applications…
algoidurovic Apr 26, 2022
11f970a
Fix abi import (#303)
jasonpaulos Apr 27, 2022
95513a3
Add creator to AssetParam documentation (#301)
Curtis-D Apr 27, 2022
cc86572
Semantic Blackbox Testing (#249)
tzaffi Apr 28, 2022
cda0a51
no utils pls (#314)
tzaffi May 2, 2022
33c565d
Feature/abi merge master again (#310)
tzaffi May 2, 2022
bf1a49b
Merge remote-tracking branch 'origin' into abi-subroutine-feature-merge
May 2, 2022
23789a3
Prep CHANGELOG for v0.12.0 (#309)
michaeldiamant May 2, 2022
9b4e72f
De emojify (#316)
tzaffi May 2, 2022
dd4bf95
merge conflicts
May 2, 2022
b500499
merge again
May 2, 2022
57a9e36
Merge branch 'master' into feature/abi
tzaffi May 2, 2022
11ff5c3
wip
May 2, 2022
36657c9
pass all tests after resolving conflicts
May 2, 2022
7c3b59d
workable merge on subroutine
ahangsu May 3, 2022
47402e1
Merge branch 'feature/abi' into abi-subroutine-feature-merge
ahangsu May 3, 2022
be2a2f0
update docstring and minor refactoring
ahangsu May 3, 2022
4520f6c
oops
ahangsu May 3, 2022
b425857
minor reconstruct
ahangsu May 3, 2022
99eb726
Add Args (input_types) in `_validate` docstring from Zeph
ahangsu May 3, 2022
3e0c0fc
more test cases (#321)
tzaffi May 3, 2022
0f478e3
Update subroutine impl from Zeph comments
ahangsu May 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ignore =
per-file-ignores =
pyteal/compiler/optimizer/__init__.py: F401
examples/application/asset.py: F403, F405
examples/application/opup.py: F403, F405
examples/application/security_token.py: F403, F405
examples/application/vote.py: F403, F405
examples/signature/atomic_swap.py: F403, F405
Expand All @@ -23,9 +24,7 @@ per-file-ignores =
examples/signature/recurring_swap_deploy.py: F403, F405
pyteal/__init__.py: F401, F403
pyteal/ir/ops.py: E221
tests/module_test.py: F401, F403
tests/*.py: I252
tests/unit/module_test.py: F401, F403

# from flake8-tidy-imports
ban-relative-imports = true

53 changes: 51 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
container: python:${{ matrix.python }}
strategy:
matrix:
python: ['3.10']
python: ["3.10"]
steps:
- run: python3 --version
- name: Check out code
Expand All @@ -25,19 +25,68 @@ jobs:
- name: Build and Test
run: make build-and-test

run-integration-tests:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [ "3.10" ]
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: "${{ matrix.python }}"
- name: Test Python version
run: |
installed="$(python --version)"
expected="${{ matrix.python }}"
echo $installed
[[ $installed =~ "Python ${expected}" ]] && echo "Configured Python" || (echo "Failed to configure Python" && exit 1)
- name: Local ACT Only - Install required os level applications
if: ${{ env.ACT }}
run: |
sudo apt update -y
sudo apt install -y curl
sudo apt -y install ca-certificates curl gnupg lsb-release
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
sudo echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt -y install docker-ce docker-ce-cli containerd.io
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
- name: Create sandbox
run: make sandbox-dev-up
- name: Install python dependencies
run: make setup-development
- name: Build, Unit Tests and Integration Tests
run: make all-tests
- name: Stop running images
run: make sandbox-dev-stop

build-docset:
runs-on: ubuntu-20.04
container: python:3.10 # Needs `make`, can't be slim
strategy:
matrix:
python: [ "3.10" ]
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: "${{ matrix.python }}"
- name: Install python dependencies
run: make setup-docs
- name: Make docs
run: make bundle-docs
- name: Archive docset
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v2
with:
name: pyteal.docset
Expand Down
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ coverage.xml
.hypothesis/
.pytest_cache/

# Tests generating TEAL output to compared against an expected example.
tests/**/*.teal
!tests/**/*_expected.teal
# Generated by unit tests - usually for diffs against expected:
**/generated

# Translations
*.mo
Expand Down Expand Up @@ -133,5 +132,9 @@ dmypy.json
.idea
.vscode

# comma seperated vals report files
*.csv
!tests/**/*_example.csv

# mac OS
.DS_Store
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 0.12.0

## Added
* Introduce a utility for increasing opcode budget referred to as OpUp ([#274](https://github.com/algorand/pyteal/pull/274)).
* Introduce dryrun testing facilities referred to as blackbox testing ([#249](https://github.com/algorand/pyteal/pull/249)).

## Changed
* Make various user guide updates/corrections ([#291](https://github.com/algorand/pyteal/pull/291), [#295](https://github.com/algorand/pyteal/pull/295), [#301](https://github.com/algorand/pyteal/pull/301)).
* Install flake8 linter ([#273](https://github.com/algorand/pyteal/pull/273), [#283](https://github.com/algorand/pyteal/pull/283)).

# 0.11.1

## Fixed
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ A sibling module is defined as a different child module of the parent module. Fo

#### In Runtime Code

A file in this codebase that requires another module/file in this codebase, should import the absolute path of the module/file, not the relative one, using the `from X import Y` method.
When a runtime file in this codebase needs to import another module/file in this codebase, you should import the absolute path of the module/file, not the relative one, using the `from X import Y` method.

With regard to modules, there are two ways to import an object from this codebase:

Expand Down
49 changes: 44 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ---- Setup ---- #

setup-development:
pip install -e.[development]
pip install -e .[development]

setup-docs: setup-development
pip install -r docs/requirements.txt
Expand All @@ -8,6 +10,11 @@ setup-docs: setup-development
setup-wheel:
pip install wheel

generate-init:
python -m scripts.generate_init

# ---- Docs and Distribution ---- #

bdist-wheel:
python setup.py sdist bdist_wheel

Expand All @@ -20,8 +27,7 @@ bundle-docs: bundle-docs-clean
doc2dash --name pyteal --index-page index.html --online-redirect-url https://pyteal.readthedocs.io/en/ _build/html && \
tar -czvf pyteal.docset.tar.gz pyteal.docset

generate-init:
python -m scripts.generate_init
# ---- Code Quality ---- #

check-generate-init:
python -m scripts.generate_init --check
Expand All @@ -33,17 +39,50 @@ black:
flake8:
flake8 $(ALLPY)

# TODO: add `tests` to $MYPY when graviton respects mypy (version 🐗)
MYPY = pyteal scripts
mypy:
mypy $(MYPY)

lint: black flake8 mypy

# ---- Unit Tests (no algod) ---- #

# TODO: add blackbox_test.py to multithreaded tests when following issue has been fixed https://github.com/algorand/pyteal/issues/199
NUM_PROCS = auto
test-unit:
pytest
pytest -n $(NUM_PROCS) --durations=10 -sv pyteal tests/unit --ignore tests/unit/blackbox_test.py --ignore tests/unit/user_guide_test.py
pytest -n 1 -sv tests/unit/blackbox_test.py tests/unit/user_guide_test.py

build-and-test: check-generate-init lint test-unit

# Extras:
# ---- Integration Test (algod required) ---- #

sandbox-dev-up:
docker-compose up -d algod

sandbox-dev-stop:
docker-compose stop algod

integration-run:
pytest -n $(NUM_PROCS) --durations=10 -sv tests/integration

test-integration: integration-run

all-tests: build-and-test test-integration

# ---- Local Github Actions Simulation via `act` ---- #
# assumes act is installed, e.g. via `brew install act`

ACT_JOB = run-integration-tests
local-gh-job:
act -j $(ACT_JOB)

local-gh-simulate:
act


# ---- Extras ---- #

coverage:
pytest --cov-report html --cov=pyteal
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,30 @@ Pip install PyTeal in editable state with dependencies:
* `pip install -e.[development]`
* Note, that if you're using `zsh` you'll need to escape the brackets: `pip install -e.\[development\]`

Format code:

* `black .`

Lint using flake8:

* `flake8 docs examples pyteal scripts tests *.py`

Type checking using mypy:

* `mypy pyteal`
* `mypy pyteal scripts`

Run tests:
Run unit tests:

* `pytest`
* `pytest pyteal tests/unit`

Format code:
Run integration tests (assumes a developer-mode `algod` is available on port 4001):

* `black .`
* `pytest tests/integration`

Lint using flake8:
Stand up developer-mode algod on ports 4001, 4002 and `tealdbg` on port 9392 (assumes [Docker](https://www.docker.com/) is available on your system):

* `flake8 docs examples pyteal scripts tests *.py`
* `docker-compose up -d`

Tear down and clean up resources for the developer-mode algod stood up above:

* `docker-compose down`
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3'

services:
algod:
image: makerxau/algorand-sandbox-dev:latest
ports:
- "4001:4001"
- "4002:4002"
- "9392:9392"
6 changes: 3 additions & 3 deletions docs/accessing_transaction_field.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Operator
:any:`Txn.global_num_byte_slices() <TxnObject.global_num_byte_slices>` :code:`TealType.uint64` 3 Maximum global byte strings in app schema
:any:`Txn.local_num_uints() <TxnObject.local_num_uints>` :code:`TealType.uint64` 3 Maximum local integers in app schema
:any:`Txn.local_num_byte_slices() <TxnObject.local_num_byte_slices>` :code:`TealType.uint64` 3 Maximum local byte strings in app schema
:any:`Txn.accounts <TxnObject.accounts>` :code:`TealType.bytes[]` 2 Array of application accounts
:any:`Txn.assets <TxnObject.assets>` :code:`TealType.uint64[]` 3 Array of application assets
:any:`Txn.accounts <TxnObject.accounts>` :code:`TealType.bytes[]` 2 Array of accounts available to the application
:any:`Txn.assets <TxnObject.assets>` :code:`TealType.uint64[]` 3 Array of assets available to the application
:any:`Txn.applications <TxnObject.applications>` :code:`TealType.uint64[]` 3 Array of applications
:any:`Txn.clear_state_program() <TxnObject.clear_state_program>` :code:`TealType.bytes` 2
:any:`Txn.extra_program_pages() <TxnObject.extra_program_pages>` :code:`TealType.uint64` 4 Number of extra program pages for app
Expand Down Expand Up @@ -223,7 +223,7 @@ Information about the current state of the blockchain can be obtained using the
Operator Type Min TEAL Version Notes
=========================================== ======================= ================ =============================================================
:any:`Global.min_txn_fee()` :code:`TealType.uint64` 2 in microAlgos
:any:`Global.min_balance()` :code:`TealType.uint64` 2 in mircoAlgos
:any:`Global.min_balance()` :code:`TealType.uint64` 2 in microAlgos
:any:`Global.max_txn_life()` :code:`TealType.uint64` 2 number of rounds
:any:`Global.zero_address()` :code:`TealType.bytes` 2 32 byte address of all zero bytes
:any:`Global.group_size()` :code:`TealType.uint64` 2 number of txns in this atomic transaction group, at least 1
Expand Down
1 change: 1 addition & 0 deletions docs/assets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Expression Type Description
:any:`AssetParam.name()` :code:`TealType.bytes` The name of the asset.
:any:`AssetParam.url()` :code:`TealType.bytes` A URL associated with the asset.
:any:`AssetParam.metadataHash()` :code:`TealType.bytes` A 32-byte hash associated with the asset.
:any:`AssetParam.creator()` :code:`TealType.bytes` The address of the asset's creator account.
:any:`AssetParam.manager()` :code:`TealType.bytes` The address of the asset's manager account.
:any:`AssetParam.reserve()` :code:`TealType.bytes` The address of the asset's reserve account.
:any:`AssetParam.freeze()` :code:`TealType.bytes` The address of the asset's freeze account.
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ PyTeal **hasn't been security audited**. Use it at your own risk.
assets
versions
compiler_optimization
opup

.. toctree::
:maxdepth: 3
Expand Down
Loading