Skip to content

Releases: algorandfoundation/puya

v3.1.0

13 Sep 02:37
Compare
Choose a tag to compare

v3.1.0 (2024-09-13)

Feature

  • algopy.arc4.abi_call, algopy.arc4.arc4_create and algopy.arc4.arc4_update now all support txn arguments (8133e1d)

  • add CLI option to serialize AWST to JSON (66bf127)

  • optimize int 0; return -> err (3605cf4)

  • allow user to implement approval_program in ARC4Contract subclasses (004450b)

Fix

  • handle zero values for TemplateVar (6087dc2)

    boolean values are now also allowed as True or False

    also incorrect values will no longer result in a critical error, but a CLI usage error instead

  • when accessing a member of self, use the source location of the access (2f827ab)

  • when there is exactly 15 arguments to an ABI function, the final argument should not be expected to be automatically tuple-packed (04e15df)

  • calling algopy.arc4.arc4_create or algopy.arc4.arc4_update with a ARC4Contract type now works for abimethods that have a return type (99d6a24)

  • fix super() usage in multiple inheritance scenarios (21929cc)

  • allow super().__init__() calls that resolve to object.__init__() as no-ops, this is valid and can be useful in multiple inheritance scenarios (267f423)

  • abstract methods can still have implementations, which can be called via super (9615467)

  • evaluate class bodies at module evaluation time, so that any referenced constants in e.g. decorators receive the correct value if it's later updated (9aea78c)

  • resolve all base scratch slot reservations, not just direct bases (f9521b5)

v3.0.3

28 Aug 12:05
Compare
Choose a tag to compare

v3.0.3 (2024-08-28)

Fix

  • do not remove swap ops before itxn_field if it's immediates point to the same field (0e88cdb)

v3.0.2

23 Aug 05:46
Compare
Choose a tag to compare

v3.0.2 (2024-08-23)

Fix

  • handle utf-8 alias's when checking for encoding, addresses #300 (90bf86f)

  • remove slice from __getitem__ in algopy.arc4.DynamicArray and algopy.arc4.StaticArray (c0049f1)

Documentation

  • improve ARC4 array documentation (251759f)

v3.0.1

20 Aug 07:09
Compare
Choose a tag to compare

v3.0.1 (2024-08-20)

Fix

  • handle in/not in tests correctly for differing types that can still be considered equal (234c376)

  • do not error when using algopy.arc4.abi_call with a method selector string containing no arguments (74577c4)

v3.0.0

16 Aug 02:08
Compare
Choose a tag to compare

v3.0.0 (2024-08-16)

Breaking

  • use correct return type for algopy.op.gaid (a5c57ef)

    BREAKING CHANGE: algop.op.gaid return type has changed from algopy.Application to algopy.UInt64 as the return value could be the id of either an application or an asset. Any existing usages of algopy.op.gaid will need to pass the result to either algopy.Application or algopy.Asset as appropriate

Feature

  • include num_log, log, create_app and created_asset properties for group transactions (5359c4d)

  • as part of optimization, remove no-op subroutines (5663a55)

v2.3.0

12 Aug 04:49
Compare
Choose a tag to compare

v2.3.0 (2024-08-12)

Feature

  • improved optimization when uint64 comparisons involve a boolean value (a68ca06)

  • more aggressive optimization of select op involving constants or references to constants (8d59e2d)

  • optimise away select op when both values are the same (f8eb257)

  • optimise code size by converting conditional (ie ternary) expressions into select op when both values are simple variables / constants (b748976)

  • more aggressive optimization of the boolean condition argument to setbit (e9828b3)

  • support nested tuples (fe270dc)

Fix

  • correctly type the result of BigUInt bin ops at IR layer (d8d92bd)

  • ensure non-zero UInt64 values that are explicitly converted to bool are handled correctly (issue #194) (13929de)

Documentation

v2.2.0

30 Jul 09:32
Compare
Choose a tag to compare

v2.2.0 (2024-07-30)

Feature

  • remove requirement that the target variable of a for-loop with enumeration be a tuple unpacking (5b994e3)

  • support for-else and while-else (0959e2d)

  • include ARC-22 readonly flag in ARC-32 output (6d325b9)

  • add support for compiling programs to AVM bytecode, and referencing those programs within other contracts. (7d7a4fd)

Fix

  • ensure conversion of UInt64 enum types to arc4 UIntN is handled correctly. (70b49dc)

  • change total_num_byte_slice return type to UInt64 (96b5165)

  • fix bug with iteration of single item tuples (983f171)

  • fix a regression where algopy.op functions that accepted multiple literal types would fail to compile with all except one type (2cbf5df)

  • use UInt64 enum types as return types where appropriate in low-level ops stubs (008c96a)

  • prevent internal errors when for-loop bodies always exit (#269) (1b24cd7)

v2.1.2

10 Jul 07:52
Compare
Choose a tag to compare

v2.1.2 (2024-07-10)

Fix

  • corrected parsing of ARC4 ufixed types when provided via string literals in algopy.arc4.abi_call and algopy.arc4.emit (43ffe8e)

  • in the case of overlapping values in a Switch (ie Python match-case), mark subsequent cases as unreachable to prevent a critical error from occurring ("Attempted to add a (non-entry) block with no predecessors") (f21efc1)

Documentation

  • clarify default behaviour of key_prefix in BoxMap (786e9b5)

    also fix existing invalid doc syntax for arguments

  • fix documentation of arc4.Tuple native property (172934b)

v2.1.1

01 Jul 09:48
Compare
Choose a tag to compare

v2.1.1 (2024-07-01)

Fix

  • prevent assertion error when using dynamic key with storage proxy and assinging to self member (351b51e)

  • add dynamic key types to stubs for LocalState and GlobalState (0aade7a)

    also add this use cases to tests

v2.1.0

25 Jun 10:18
Compare
Choose a tag to compare

v2.1.0 (2024-06-25)

This Release introduces first-class support for box storage to Algorand Python.

We wanted to make this support as flexible as possible. Given that box storage requirements are not necessarily known at contract creation time, this meant supporting Box objects outside of __init__, and even the ability to not assign them to self at all, but to treat them as local variables, and even pass them between subroutines.

This paradigm fell outside the existing usage of storage proxies such as LocalState and GlobalState, requiring a significant overhaul to the (internal) type system of the Algorand Python front-end. We also took this opportunity to significantly reduce the Python-specific constructs outside of the puya.awst_build module, to improve the ability of the compiler to handle new front end languages.

As part of this refactor, many other user facing improvements have eventuated.

In the same way the Box (and BoxRef and BoxMap) objects can be used without assigning to self, so too can LocalState and GlobalState - and in such cases, the key can even be dynamic, allow use of these more ergonomic APIs over having to fallback to algopy.op.AppLocal and algopy.op.AppGlobal when interacting with dynamic state.

Another significant change is the reduced need for explicit giving literals and Algorand Python type, examples that are now possible:

  • x = UInt64(12 if condition else 34)
  • x += 45 if condition else 67
  • op.addw(2**64-1 if condition else 0, x)
  • String(" ").join(("Hello ", name, " !"))

Feature

  • support comparisons between arc4.Bool and bool (1787f06)

  • support a wider range of types for inner transaction application args (28b5197)

  • support string literals in String.join argument (0818d7d)

  • support constructing tuples via tuple(<expr>) where expr is a fixed size sequence (529f12a)

  • support tuple equality comparisons with literal elements, support tuple repetition & concatenation, and support indexing/slicing literals that support it (0c8a745)

  • allow conditional expressions involving literals when either interacting with an algopy type or being passed to an algopy function, where possible (a047d92)

    examples that are now possible: - x = UInt64(12 if condition else 34) - x += 45 if condition else 67 - op.addw(2**64-1 if condition else 0, x)

  • Box storage api (c41ce5e)

  • handle cover/uncover rotation simplification edge case (9ed7a60)

Fix

  • bool evaluations that evaluate to constants are now treated as errors as they were either hiding a semantic compatability issue or were a sign of a mistake in the code. (247d62d)

  • handle single item tuples correctly (2026815)

  • add missing * to stubs, that EB was expecting (4842719)

  • ensure tuple expressions are evaluated when converting to a bool (9d556e6)

  • do not require ARC4 types to .copy() when being as arguments to an inner transaction (601a385)

  • fix argument packing condition when using abi_call (070d224)

  • fix UInt64 handling of construction from bool (07cd6d9)

  • fix semantic issues with tuple comparisons of different length / types (840118a)

  • fix semantic compatibility issue with comparisons involving tuple literals (180d363)

  • support negative indexes on indexable types (9213996)

  • fix bug in "untyped" itxn creation not being declared as allowing BytesBacked (f5aeada)

  • fix encoding of bytes constants and allow String as sep value (6e82f80)

  • handle eq for ufixed (83b346b)

  • handle bool values (as subtype of int) when comparing against arc4 uintn (74e065d)

    fix: allow arc4.String comparison with String without going through constructor

    refactoring convert_arc4_literal (wip)

  • fix bug with inner-transaction-containing tuple detection (6ca2c45)

  • resolve issue when using native types with arguments and return values in abi_call (604dddc)

  • allow usage of module constants in ARC4 method decorators (d09f381)

  • fix bug with resolving super/direct base method invocation (a0618cb)

  • improve error messages when typing.Any type is encountered (c2cfaf5)

  • prevent critical error message when missing self param in declaration (7ff2e17)

  • correct return type of String.join (3df0b8b)

  • fix resolution of base class references across modules (cf7c67f)

  • resolve potential semantic incompatibility with super() usage and differing kinds of attributes (methods vs data) (f1f2bdd)

    add bad super() usage test

  • ARC4 Bool decode now resolves to IRType.bool (9b4e82d)