From a36c7ffcb147183942f9d5c539860e4f6a07451a Mon Sep 17 00:00:00 2001 From: Jason Paulos Date: Fri, 2 Jun 2023 12:11:13 -0700 Subject: [PATCH] Support AVM v9 (#707) Co-authored-by: Ben Guidarelli --- CHANGELOG.md | 2 ++ docs/versions.rst | 1 + pyteal/compiler/compiler.py | 2 +- pyteal/compiler/compiler_test.py | 4 +++- tests/unit/sourcemap_constructs311_test.py | 6 +++--- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90ca79e62..e42d35dcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Added +* Support for compiling AVM v9 programs. ([#707](https://github.com/algorand/pyteal/pull/707)) + ## Fixed ## Changed diff --git a/docs/versions.rst b/docs/versions.rst index 135e3676e..7487ab5fe 100644 --- a/docs/versions.rst +++ b/docs/versions.rst @@ -18,6 +18,7 @@ AVM Version PyTeal Version 6 >= 0.10.0 7 >= 0.15.0 8 >= 0.20.0 +9 >= 0.25.0 ============ ============== .. _version pragmas: diff --git a/pyteal/compiler/compiler.py b/pyteal/compiler/compiler.py index c68250c83..0b66682c9 100644 --- a/pyteal/compiler/compiler.py +++ b/pyteal/compiler/compiler.py @@ -35,7 +35,7 @@ from pyteal.util import algod_with_assertion -MAX_PROGRAM_VERSION = 8 +MAX_PROGRAM_VERSION = 9 FRAME_POINTERS_VERSION = 8 DEFAULT_SCRATCH_SLOT_OPTIMIZE_VERSION = 9 MIN_PROGRAM_VERSION = 2 diff --git a/pyteal/compiler/compiler_test.py b/pyteal/compiler/compiler_test.py index 75ace9f0e..2f1f41881 100644 --- a/pyteal/compiler/compiler_test.py +++ b/pyteal/compiler/compiler_test.py @@ -143,7 +143,9 @@ def test_compile_version_invalid(): pt.compileTeal(expr, pt.Mode.Signature, version=1) # too small with pytest.raises(pt.TealInputError): - pt.compileTeal(expr, pt.Mode.Signature, version=9) # too large + pt.compileTeal( + expr, pt.Mode.Signature, version=pt.MAX_PROGRAM_VERSION + 1 + ) # too large with pytest.raises(pt.TealInputError): pt.compileTeal(expr, pt.Mode.Signature, version=2.0) # decimal diff --git a/tests/unit/sourcemap_constructs311_test.py b/tests/unit/sourcemap_constructs311_test.py index 5a5a1c96f..7b26a9e5d 100644 --- a/tests/unit/sourcemap_constructs311_test.py +++ b/tests/unit/sourcemap_constructs311_test.py @@ -153,7 +153,7 @@ def big_opups_example(pt): ) -CONSTRUCTS_LATEST_VERSION = 8 +CONSTRUCTS_LATEST_VERSION = 9 def test_constructs_handles_latest_pyteal(): @@ -2235,9 +2235,9 @@ def constructs_test(i, test_case, mode, version): fixed_mode = test_case[3] if mode != fixed_mode: return - optimize = None + optimize = pt.OptimizeOptions(scratch_slots=False) if len(test_case) > 4: - optimize = pt.OptimizeOptions(**test_case[4]) + optimize = pt.OptimizeOptions(scratch_slots=False, **test_case[4]) mode = getattr(pt.Mode, mode) if isinstance(expr, pt.Router):