Skip to content

Latest commit

 

History

History
924 lines (478 loc) · 61.9 KB

CHANGELOG.md

File metadata and controls

924 lines (478 loc) · 61.9 KB

CHANGELOG

v4.0.0 (2024-11-14)

Breaking

  • raise an error when attempting to iterate a tuple of mutable values (43a364e)

    BREAKING CHANGE: iterating a tuple of mutable types will now raise an error as they cannot be copied

  • passing a mutable value more than once to a subroutine will now raise an error as allowing it would break semantic compatability (dac51be)

    BREAKING CHANGE: passing a mutable value more than once to a subroutine causes an error

  • raise an error when attempting to modify immutable arrays such as algopy.arc4.Address (9450c7a)

    BREAKING CHANGE: modifying an algopy.arc4.Address will now raise an error

Feature

  • use extract3 instead of substring3 for bytes indexing (4954155)

  • remove ops with no side effects when result is not used (ea34059)

  • ARC-56 application specifications can now be output using the --output-arc56 option (2d3eb49)

  • add .copy() to arc4.Tuple (fe7a0ea)

  • add support for AVM version 11 (0c31697)

  • allow variable rebinding of mutable parameter values (253168a)

Fix

  • ensure expressions are only evaluated once (359956c)

  • prevent errors trying to optimize dig 0 (bf52c36)

  • improve error message when a self parameter is missing from a method declaration (8153cfb)

  • use read location for variable source locations, rather than where the variable was last defined (27e2659)

  • correctly determine if an algopy.arc4.Struct sub-class is immutable or not based on frozen class parameter and immutability of fields (0491d0b)

v3.6.0 (2024-11-04)

Fix

  • ensure paths are normalised in Puya source maps (29224ef)

v3.5.0 (2024-10-30)

Feature

  • add _replace implementation for named tuples, make algopy.CompiledContract and algopy.CompiledLogicSig named tuples (93a47f2)

  • reduce stack manipulations ops when subroutine/op results are directly assigned (fbe6ebb)

  • add CLI option --output_source_map to produce debug information that can be used with the next release of AVM debugger (3009822)

  • add optimization to include constant blocks in TEAL output (671677b)

Fix

  • check target type for ARC4Decode (9704011)

  • deprecate --match-algod-bytecode option as there is now no difference between algod and puya bytecode output (de0fd58)

v3.4.1 (2024-10-24)

Fix

  • allow named tuples to be unpacked (320efd2)

  • itxn arguments are now inferred correctly when using only a method name in algopy.arc4.abi_call (04fe6d7)

v3.4.0 (2024-10-23)

Feature

  • Named tuple support in contract to contract calls (c742281)

  • Named tuples (e0abe5c)

Fix

  • Round trip serialization of names property on WTuple (dd7b679)

v3.3.0 (2024-10-16)

v3.2.3 (2024-10-15)

Fix

  • native tuples now supported as arguments and return value when using algopy.arc4.abi_call, algopy.arc4.arc4_create or algopy.arc4.arc4_update (#324) (6dfd68b)

v3.2.2 (2024-10-08)

Fix

  • assigning transaction result from algopy.arc4.abi_call containing other transactions no longer causes an error (125e85e)

  • fixed incorrect typing of algopy.arc4.abi_call parameters global_num_uint, global_num_bytes, local_num_uint, local_num_bytes and extra_program_pages (e464ca2)

v3.2.1 (2024-10-04)

Fix

  • fixed error when assigning result of an abi_call with inner transactions that return an ABI value (e3ef7dd)

v3.2.0 (2024-09-24)

Feature

  • expand handling of literal expressions to allow combining them with binary boolean operators, and improve error messaging when handling of type unions in nested bool contexts (b4e0c30)

Fix

  • prevent error that occurs when removing a series of redundant Load and Store ops (17778b8)

  • fix compilation error when a nested tuple is passed as a named argument (d849496)

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 (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 (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 (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 (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 (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 (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 (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 (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 (2024-06-25)

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)

v2.0.2 (2024-06-10)

Fix

  • resolve issues with reading and writing ARC4 types (23f9bd2)

    Reading and writing dynamic ARC4 types in an array Modifying ARC4 tuple items (#152) Require ARC4 struct initialisation to have unaliased values to maintain reference semantics

  • fix inner transaction validation to handle some cases that were accidentally missed (#233) (cd42f02)

Documentation

  • Add example of struct in a box (#243) (b0530c1)

v2.0.1 (2024-05-21)

Fix

  • fix incorrectly mapped transaction arguments global_num_uint and local_num_uint in algopy.arc4.abi_call #232 (0c35caa)

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

  • correct default value for fee in abi_call (ac46f49)

  • fix IR return types of b+ and b* ops (0de49c1)

  • correct return type of String.join expression (873460d)

  • corrected itxn field type definitions for VotePK, SelectionPK and FreezeAssetFrozen (5f59f15)

  • correctly handle BigUInt in ARC4 methods (354a4a2)

  • handle resolve reinterpret cast at the IR level with a temporary assignment if required (#219) (4b1bff3)

  • do not match dup2 op when performing constant stack shuffling (815e253)

  • remove type bound on TemplateVar allowing it to be used with all types. (4226e0f)

Documentation

  • improve some stub type signatures & copy in transaction field notes from Algorand docs (#215) (4f01df5)

v2.0.0 (2024-04-26)

🚨 BREAKING CHANGES 🚨

Support inner transactions being assigned to unpacked tuples

Accessing an array field of an inner transaction result after it may no longer be available (i.e. after another inner transaction submission) is now a compile error, to resolve this move the array field access before the statement that causes this.

Commit: 0915c5c

Prevent usage of state proxies (GlobalState, LocalState) outside __init__ method

Using state proxies (GlobalState, LocalState) outside of an __init__ method may not give the behaviour expected, so prevent their usage in those scenarios.

Commit: d354d4e

Default transaction fees to 0 (#202)

The default fee for inner transactions is now 0 unless explicitly specified.

Commit: 519957f

Feature

  • Allow wider range of algorand-python versions as long as no incompatible definitions are used. Instead of an error, a prominent warning is displayed if there is a potential mismatch. (bf84501)
  • Allow raw select op usage, since it's a very efficient way to do a ternary operator if greedy argument evaluation is acceptable (e91a157)
  • Constant optimisation for algopy.op.sqrt and algopy.op.bsqrt (bb8f03b)
  • Allow int literals with algopy.op functions that take a BigUInt (currently just bsqrt) (a8e14c3)
  • Add missing constant folding optimization for b% (9536d59)
  • Add support for bool types in state proxies (e.g. GlobalState) and remove generic type constraint. (c9a7224)
  • Allow module constants to be used as assert statement messages (328ee55)

Fix

  • Add missing asset_sender field to inner transactions (fd6bba3)
  • Treat unassigned & unsubmitted inner-transaction field-sets as a code error, not an internal error (b86bfa6)
  • Use return type of method signature as return type for an abi_call without an indexed type param (1318459)
  • Fix issue #195 where certain state comparisons could fail to compile. (b8efcc3)
  • Add missing ARC4-copy-checks of .get() and .maybe() methods in state proxies (49da224)
  • Allow negative arc4.Tuple indexing (67ff876)
  • Add missing stub indicators for unary + operator to BigUInt and UInt64 (caa98dc)
  • Improve error message with invalid String() comparisons (f340c86)
  • Improve source location for Asset(&lt;int&gt;) (7c89ad7)
  • Correct input value types for algopy.op.setbit (c8fda82)
  • Handle arc4.Address.native (6dcb55d)
  • References to unknown symbols are now correctly treated as code errors rather than fatal errors (eb802d3)
  • Fix unnecessary .copy() requirement when providing an ARC4 encoded initial value to GlobalState (5a56041)
  • Ensure ARC router generation works with minimal contracts that don't have any explicit abimethods (936f378)
  • Fix bug with failing to discard unassigned results from algopy.op.* functions (33d961a)
  • Prevent multiline assert messages from breaking TEAL output (4ea5ae6)
  • Fix incorrect error message on unsupported class declaration (8eb5a78)
  • Add colorama as a dependency on Windows, this is required when using PowerShell (0acb4b2)

Documentation

  • Add note about method behaviour for accounts which have not opted in (12282b9)
  • Use best practices in ARC-4 examples of dealing with native types and letting the router do encode/decode, which generally saves at least one op. (7504ed5)
  • Simplify "Quick start" steps (01a9f95)
  • Adding missing install step to install algorand-python (c08f753)
  • Corrections & improvements to BigUInt type docs (7e20261)

v1.0.1 (2024-03-27)

Fix

  • include algorand-python 1.0.1 stubs (ba2fe25)

Documentation

  • added v1 documentation (#147) (faf9995)

v1.0.0 (2024-03-27)

Breaking

  • enable major on zero (64145c2)

    BREAKING CHANGE: 1.0 release

Feature

  • set --output-client=False by default (438d815)

Fix

  • search for python3 when attempting to locate python executable (abf5c09)

  • use shutil.which to find python exe (56e46c9)

  • set supported algopy version range correctly (6c1a387)

  • better support for executing puyapy within a venv and outside a venv (212201e)

Documentation

v0.7.1 (2024-03-26)

Fix

  • prevent mypy error when stubs and puyapy are in the same venv (91f6765)

v0.7.0 (2024-03-26)

Breaking

  • change abimethod/baremethod "create" parameter to &#34;allow&#34; | &#34;require&#34; | &#34;disallow&#34; instead of &#34;allow&#34; | True | False (2ca4c67)

    BREAKING CHANGE: Replace create=True with create="require" in abimethod/baremethod decorators, and replace create=False with create="disallow" in abimethod/baremethod decorators.

  • prevent reassignment of mutable parameters that are passed by reference (a9c7600)

    BREAKING CHANGE: Re-assigment to a parameter that is mutable is now disallowed.

  • Prevent iteration of arc4 containers with mutable items (f857181)

    BREAKING CHANGE: Direct iteration of arc4 containers with mutable items is no longer possible due to issues with the reference vs value semantics, instead use for &lt;index&gt; in urange(&lt;array&gt;.length) and access/update elements by index.

  • rename stubs from puyapy to algopy (31052e3)

    BREAKING CHANGE: Any imports from puyapy should be replaced with algopy.

  • to prevent file output collisions, the ARC32 JSON output is now always named according the class name (or name= override). Tests for output collision is also performed before final output. For consistency, the TEAL files are use this same prefix, rather than the module name. (78d5a31)

    Compilation stages and error checking have been refactored to maintain a higher degree of logical separation.

    BREAKING CHANGE: Output files names have changed as per the above ARC32 output fix note.

Feature

  • separate stubs into their own wheel (#154) (9c58ae5)

  • Allow mutable tuple items to be updated (8ea6ed5)

  • warn if a Contract class is implicitly abstract (4d6317f)

    fixes #120

  • compare arc4.Address against Account (3888220)

  • empty constructor for arc4 numeric types, defaults to zero (c514753)

  • allow bytes literal with BytesBacked.from_bytes (d47be8c)

    test: add test for Struct.from_bytes

  • empty constructor for BigUInt() defaults to zero (c02079b)

    chore: address minor TODO regarding source locations

  • empty constructor for UInt64() defaults to zero (6f79b8a)

    chore: address minor TODO regarding source locations

  • simplify more conditions when we're in a select context (7403e7b)

  • simplify more conditions when we're in a ConditionalBranch context (80f0167)

  • simplify more conditions when we're in an assert context (7f89b6c)

  • allow bytes optimizations to handle addr constants, and also global ZeroAddress ops (a508274)

  • Allow empty constructors to default to "zero" values for Account, Asset, Application, and arc4.Address (3ad9c18)

    Also, generally establish feature parity between Account and arc4.Address constructors

  • Add a validation step to confirm ops used in an app or lsig are available for those respecitve modes (8600d4e)

    Also moved avm version check into a validator with the same pattern

  • add empty arc4.Bool constructor to mimic bool() (6175b59)

  • remove encode() from ARC4 types, an ensure constructors take appropriate values. Ensure all ARC4 types have from_log classmethod. Remove decode() method and instead have a native property that returns decoded values where appropriate (146748e)

  • Allow arc4 types to be used in native tuples in ABI methods (0948d83)

  • add class options for declaring storage values used in ARC32 specifications (#123) (5721f4a)

  • allow primitive String type to be used in arc4 methods (23fa701)

  • add startswith, endswith, and join to String (262c679)

  • add primitive UTF-8 String type (14d35c6)

  • add support for emitting ARC-28 events (aa4a651)

  • allow TEAL optimizer to handle dup/dupn ops when removing stack shuffling of constants, and collapse any repeated elements with a dup/dupn (b48db43)

  • added puyapy.arc4.call_abi for typed contract to contract calls (#112) (3d42df3)

  • add optimization to propagate constants found in Phi nodes resolving to the same constant value (1b2e504)

  • add is_opted_in method to Account type (#126) (e21dc55)

  • allow gtxn.Transaction as an ABI argument (#127) (e31eda8)

  • add asset and application reference types to op module (#124) (47741ab)

    BREAKING CHANGE: op module now uses Asset and Application types in ops involving those types Asset.asset_id is now Aseet.id Application.application_id is now Application.id

  • Template variables (9d93fee)

    refactoring template-var feature

  • pop/popn collapse optimisation (0b90505)

    refactor: make checking for ABI router only calls (in the context of implicit return elisions) more robust

    refactor: other non-functional refactorings of the implicit return feature

    test: ensure there's a multi-valued explicit return combined with implicit returns being tested

  • Allow slicing Bytes with UInt64. Code generation has also been improved for slicing, and a potential double-evaluation has been fixed. (0f9dd79)

  • implement ordering comparisons for arc4.UIntN and arc4.BigUIntN types (f83a397)

  • implement missing optimisations for self comparisons (24ead20)

  • improved constant folding, particularly with ARC4 operations (17216c4)

  • optimisation of extract_uint16/32/64 with constants (bf00f0d)

  • allow optimisation to concat bytes with different encodings (e3c6253)

  • allow itob of a constant to flow through further optimisations (ea2ce28)

  • implement boolean evaluation of ARC4 types (aaa32ad)

  • Local/GlobalState custom keys & descriptions (e9d5084)

    also:

    • solve issue of requiring forward declaration of constants & types
    • improve code generation for state access in some cases
    • scratch_slots reservation fixes/improvements
    • address usage of non-utf8 file encodings
    • various bug fixes, refactoring, and minor optimisation improvements
  • add version option to CLI (44b5e7f)

Fix

  • Improve coverage of arc4_copy validator (b482ebe)

  • arc4.String() gets incorrectly inferred as native String wtype (4b12156)

  • ensure all index_multiple methods have the same signature (0c93a47)

  • treat ARC4 Tuples with mutable elements as mutable overall (7f7a4b6)

  • fix source location for function signatures (14b9eb3)

  • use repr for literal validation errors (2d0feee)

  • add some missing positional-only indicators to stubs, and relax typing.LiteralString to str, it's not really applicable for our use case (f5031a5)

  • don't implicitly map [32]byte to Account in stubs (668c2e0)

  • consistent usage of positional-only arguments in stubs (547d62c)

  • produce error with incorrect arc4 numeric class usage based on bit-sizes (4cb6bbc)

  • check for state exceeding known consensus parameters and warn (not an error in case the consensus parameters update before a new compiler release) (d65b350)

  • allow references to module constants in StateTotals args (550fbd3)

    also replace magic "auto" string with just StateTotals() since the behaviour is the same.

    docs for this feature improved, and code simplified

  • Fix optimizer bug where differing behaviour of extract with & without immediates when length is zero was not accounted for (6a8db34)

  • handle tuple return types in method signatures (6d31a69)

  • don't inline control ops of Switch or GotoNth nodes if it would result in additional copies in destructured SSA (#130) (189847d)

  • check for errors between each stage of compiler pipeline (b860e5a)

  • no longer eliminate expressions outside of dominators in RCE optimization (#119) (b6bfc0a)

  • Address unexpected Python behaviour in slicing, where end > start would panic instead of returning an empty byte slice (52c1666)

Documentation

  • update ARCHITECTURE.md (d52d4a6)

  • add default= keyword to GlobalState.get() usage to make example clearer (61e9bef)

  • improve tictactoe example (0eb2d00)

  • Add a tictactoe game to the example contracts (e866809)

  • Add example merkletree contract (#122) (fccb36e)

v0.6.0 (2024-02-20)

Breaking

  • rename some op code types to more closely reflect the underlying op code (#102) (d6c1441)

    BREAKING CHANGE: The following op code classes were renamed:

    AppGlobals -> AppGlobal AppLocals -> AppLocal Transaction -> Txn TransactionGroup -> GTxn InnerTransaction -> ITxn InnerTransactionGroup -> GITxn CreateInnerTransaction -> ITxnCreate

  • Optimizer improvements & significantly reworked TEAL output (c2f778a)

    The annotated output of a TEAL file has been greatly improved. The format now shows the source lines and source code above the section of associated TEAL. Extraneous information that was intended for internal development purposes has been removed (available as a separate output now with --output-memory-ir). Multi-line statements are faithfully reproduced now, so for example if an assert spans multiple lines it will appear as such in the TEAL file. Additionally, any comments on the line or on preceding lines (up to a blank line or the previous statement) will also be preserved.

    Optimizer improvements: Implemented repeated expression elimination. Optimize branching on a ! condition, by swapping the branches Eliminated unused pure intrinsic ops. Inline conditional branch to an err block into an assert true/false. Blocks ending in a TEAL switch or match op can now have ops other than b as a fallback, in particular with err this, together with the above change, eliminates almost all standalone err blocks. Added a TEAL optimization pass that runs between MIR and TEAL generation, this simplifies the optimizer and also allows for crossing more virtual stack op boundaries easily. Added almost all cases found by the O2 brute force TEAL replacement search as special cases at O1. Added multiple other new optimizations to the new final TEAL optimizer. Minor tweaking of ARC4 embedded subroutine dynamic_array_pop_fixed_size. Add locals coalescing strategy as an option that it's independent of the optimization level, given that there's not necessarily one best approach. Significantly improved the code generated when routing >15 ABI args by removing a temporary assignment, which allows the new Repeated Expression Elimination optimizer pass to do its thing.

    BREAKING CHANGE: --output-cssa-ir and --output-parallel-copies-ir CLI options have been removed, and --output-final-ir is now --output-destructured-ir to better reflect its position in the compiler chain. The default debug level is now 1, and only one TEAL file will be emitted for each program. To get back the previous default behaviour of only outputting an unannotated teal file, pass -g0.

Feature

  • improve coalescing by performing before sequentialisation, thus reducing chances of interference (a29fba9)

  • reduce number of iterations required by optimiser by enabling fixed point iteration within ControlOp simplifier optimisation step (b7b27d3)

  • add simple pass to collapse constants repeated >= 2 times by using a dupn (47d90d6)

  • add duplicate block elimination as a post-SSA optimisation, at -O2 or above since it can mess with debugging info quite a bit (c13d8fe)

  • add API for creating and submitting inner transactions (#98) (6b76183)

  • move ops into their own module (7678a7e)

    Global and Transaction op values that are constant for a transaction are now class attributes added puyapy.log that can log any primitive type

    BREAKING CHANGE: many functions and classes under puyapy can now be found in puyapy.op. Values that are constant for a transaction in the puyapy.op.Global and puyapy.op.Transaction classes are now typed as final class vars

  • fix generated class names that are acronyms (#91) (bd3f222)

    Allow OnCompleteAction use in ARC4 abimethod, baremethod decorators

    BREAKING CHANGE: enum class names have changed

Fix

  • reduce number of iterations required in TEAL optimiser (597b939)

  • reduce number of iterations required in RCE optimizer, and ensure dominator set is stable by sorting it (2af7135)

  • if simplifying a control op by inlining a block then ensure successor phi arguments are also updated (bdbdb11)

Documentation

  • Added link to the version of voting contract the puya example is converted from so you can compare before vs after (21fd5be)

v0.5.1 (2024-02-09)

Performance

  • prevent too many permutations during O2 stack optimizations (#85) (4dcdd6a)

Documentation

  • add documentation for more stubs (#88) (2668623)

  • add autogenerated API documentation (#87) (6ca27aa)

v0.5.0 (2024-02-06)

Feature

  • Check min_avm_version of intrinsic ops against target avm version for compiler (2b3dea0)

  • update langspec to v10 (be62082)

  • Optimise constant mod expressions and pre-check for div 0 errors (24c5020)

Fix

  • Use Bytes as the return type where the langspec lists [32]byte instead of Account (41bead7)

  • improve error output when parsing fails (c3d8f25)

  • Don't unnecessarilly pre-check uranges for forward iteration (066088c)

  • Don't raise on div 0 in optimizer as the operation might be pre-checked for != 0 in previous operations (6d549ed)

Documentation

  • make hello_world ARC example consistent with Puya template example (f294371)

v0.4.0 (2024-01-31)

Feature

  • Add scratch space API (#56) (ad09eb8)

Fix

  • fix argument matching order for gtxn, gtxna, gtxnsa, gtxnas. (6d10fef)

    test: add test that exercises compilation + execution of the trickier overloads with literal vs non-literal args

  • correct intrinsic mapping for RenamedOpCode types, so that the correct overload gets chosen. This is particularly important for extract, where a 0 immediate for length (along with an immediate for start) behaves very differently to the stack based variant. There is still potential for confusion if the start parameter is a literal vs a constant UInt64, but this at least fixes the inability to get the correct result with the right set of args. (7bf88e3)

    fix: prevent substitution of extract3 with extract if the length is zero, due to behaviour difference.

    fix: improve performance of the string/dynamic array of fixed size concatenation subroutine

    enhancement: add intrinsic simplifier for replace3 -> replace2 and args -> arg

  • fix potential bug when removing an empty entry block that had a goto which was not the next block (11c6a3e)

    also do empty block removal immediately, to prevent confusion and potentially reduce the number of optimization passes

  • Add slot range validation to range expressions which specify a step (3ccd47f)

Documentation

  • add initial structure for documentation (719c015)

v0.3.0 (2024-01-22)

Breaking

  • Replace references to local and global storage with "app account state" and "app state" (ad2b326)

  • Rename Local to LocalState and introduce GlobalState type to provide a similar abstraction over app global storage (6c6ac97)

Performance

Fix

  • validate_awst was not called as part of testing (71e9fbc)

    fix: application.json was not being updated by tests

  • UnusedRegisterCollector no longer visits a Phi's register, so it can be considered as a potential unused register (8b0e91a)

  • IntrinsicSimplifier now visits source values on Assignment ops (2da337e)

  • Enforce copying of arc4 mutable types when passing them around so that developers are not fooled by the illusion of reference imutability as arc4 encoded data is still a value type underneath (c20e621)

  • don't use structlog private fields (831bd68)

  • MyPy incorrectly inferring generic types from first init overload when using classmethod (14aecde)

  • Explicitly disallow nested native tuples in abi methods (8663945)

v0.2.0 (2023-12-19)

Feature

  • move subroutine elimination to IR stage (#44) (d65c9b6)

Fix

  • reduce unnecessary usages of VLA (9b2cc85)

  • relax docstring-parser version constraint for now (d15046d)

  • stack ops optimisation looping, including not running at all if -O0 (b6eaaa6)

    feat: reduce stack shuffling when there is a swap preceded by two load ops

  • remove support for non bool literals in match cases (c4520fb)

    mypy does not consider runtime equality when evaluating if a case can be reached, resulting in blocks not being fully analyzed when matching literals against equivalent puya primitives

  • allow using puyapy primitive types with match statements (e669c04)

  • use PYTHONUTF8 in compile_all_examples.py to force windows to use utf8 when running puya (b4ab579)

v0.1.3 (2023-12-11)

Fix

  • resolves some bugs with match statements (#25) (2c7de55)

  • add back arc4_signature (c21dd34)

v0.1.2 (2023-12-11)

v0.1.1 (2023-12-11)

v0.1.0 (2023-12-11)

Feature

  • change default optimization level to 1 (72b205a)

  • rename executable to puya (24659c8)

Fix

  • log level display in CLI arguments (9bfc4e1)

  • work around windows issue with outputting Phi symbol (#6) (6baa9c3)

    temporary work around for Windows issue with outputting ϕ symbol

  • use utf-8 encoding when running puya from compile_all_examples.py (f760e5c)

  • Making compiler name more succinct (34bfd04)

  • Resolving line endings issues on windows (b382d5a)

Documentation

  • Adding quick getting started instructions to README.md (321fb5f)