Releases: algorandfoundation/puya
v3.1.0
v3.1.0 (2024-09-13)
Feature
-
algopy.arc4.abi_call
,algopy.arc4.arc4_create
andalgopy.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
orFalse
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
oralgopy.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 toobject.__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
v3.0.2
v3.0.1
v3.0.0
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 fromalgopy.Application
toalgopy.UInt64
as the return value could be the id of either an application or an asset. Any existing usages ofalgopy.op.gaid
will need to pass the result to eitheralgopy.Application
oralgopy.Asset
as appropriate
Feature
v2.3.0
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
- fix link (
c53d1f7
)
v2.2.0
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
v2.1.2 (2024-07-10)
Fix
-
corrected parsing of ARC4 ufixed types when provided via string literals in
algopy.arc4.abi_call
andalgopy.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
v2.1.1
v2.1.0
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
andbool
(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
)