diff --git a/scripts/generate_stubs.py b/scripts/generate_stubs.py index 0821234334..2e503ee95e 100755 --- a/scripts/generate_stubs.py +++ b/scripts/generate_stubs.py @@ -844,9 +844,7 @@ def pytype_repr(typ: pytypes.PyType) -> str: except KeyError: pass match typ: - case pytypes.TupleType(generic=pytypes.GenericTupleType, items=tuple_items) if len( - tuple_items - ) > 1: + case pytypes.TupleType(items=tuple_items) if len(tuple_items) > 1: item_strs = [pytype_repr(item) for item in tuple_items] return ( f"pytypes.GenericTupleType.parameterise(" diff --git a/src/puya/awst/nodes.py b/src/puya/awst/nodes.py index e8934d9c17..d1f226ded4 100644 --- a/src/puya/awst/nodes.py +++ b/src/puya/awst/nodes.py @@ -727,16 +727,12 @@ class FieldExpression(Expression): @wtype.default def _wtype_factory(self) -> wtypes.WType: - struct_wtype = self.base.wtype - if isinstance(struct_wtype, wtypes.WTuple) and struct_wtype.names: - index = struct_wtype.name_to_index(self.name, self.source_location) - return struct_wtype.types[index] - if not isinstance(struct_wtype, wtypes.WStructType | wtypes.ARC4Struct): - raise InternalError("invalid struct wtype") + dataclass_type = self.base.wtype + assert isinstance(dataclass_type, wtypes.WStructType | wtypes.ARC4Struct | wtypes.WTuple) try: - return struct_wtype.fields[self.name] + return dataclass_type.fields[self.name] except KeyError: - raise CodeError(f"invalid field for {struct_wtype}", self.source_location) from None + raise CodeError(f"invalid field for {dataclass_type}", self.source_location) from None def accept(self, visitor: ExpressionVisitor[T]) -> T: return visitor.visit_field_expression(self) diff --git a/src/puya/awst/wtypes.py b/src/puya/awst/wtypes.py index e3e3eb5e15..f18a400c42 100644 --- a/src/puya/awst/wtypes.py +++ b/src/puya/awst/wtypes.py @@ -1,5 +1,5 @@ import typing -from collections.abc import Iterable, Mapping, Sequence +from collections.abc import Iterable, Mapping from functools import cached_property import attrs @@ -10,6 +10,7 @@ from puya.errors import CodeError, InternalError from puya.models import TransactionType from puya.parse import SourceLocation +from puya.utils import unique logger = log.get_logger(__name__) @@ -160,12 +161,12 @@ def from_type(cls, transaction_type: TransactionType | None) -> "WInnerTransacti @typing.final @attrs.frozen class WStructType(WType): - fields: Mapping[str, WType] = attrs.field(converter=immutabledict) + fields: immutabledict[str, WType] = attrs.field(converter=immutabledict) scalar_type: None = attrs.field(default=None, init=False) source_location: SourceLocation | None = attrs.field(eq=False) @fields.validator - def _fields_validator(self, _: object, fields: Mapping[str, WType]) -> None: + def _fields_validator(self, _: object, fields: immutabledict[str, WType]) -> None: if not fields: raise CodeError("struct needs fields", self.source_location) if void_wtype in fields.values(): @@ -191,26 +192,18 @@ def _name(self) -> str: return f"array<{self.element_type.name}>" -def _names_converter(val: Iterable[str] | None) -> tuple[str, ...] | None: - return None if val is None else tuple[str, ...](val) - - @typing.final @attrs.frozen class WTuple(WType): - names: Sequence[str] | None = attrs.field( - default=None, - kw_only=True, - converter=_names_converter, - ) - types: Sequence[WType] = attrs.field(converter=tuple[WType, ...]) + types: tuple[WType, ...] = attrs.field(converter=tuple[WType, ...]) + source_location: SourceLocation | None = attrs.field(default=None, eq=False) scalar_type: None = attrs.field(default=None, init=False) immutable: bool = attrs.field(default=True, init=False) name: str = attrs.field(eq=False, kw_only=True) - source_location: SourceLocation | None = attrs.field(default=None, eq=False) + names: tuple[str, ...] | None = attrs.field(default=None) @types.validator - def _types_validator(self, _attribute: object, types: Sequence[WType]) -> None: + def _types_validator(self, _attribute: object, types: tuple[WType, ...]) -> None: if not types: raise CodeError("empty tuples are not supported", self.source_location) if void_wtype in types: @@ -220,10 +213,26 @@ def _types_validator(self, _attribute: object, types: Sequence[WType]) -> None: def _name(self) -> str: return f"tuple<{','.join([t.name for t in self.types])}>" + @names.validator + def _names_validator(self, _attribute: object, names: tuple[str, ...] | None) -> None: + if names is None: + return + if len(names) != len(self.types): + raise InternalError("mismatch between tuple item names length and types") + if len(names) != len(unique(names)): + raise CodeError("tuple item names are not unique", self.source_location) + + @cached_property + def fields(self) -> Mapping[str, WType]: + """Mapping of item names to types if `names` is defined, otherwise empty.""" + if self.names is None: + return {} + return dict(zip(self.names, self.types, strict=True)) + def name_to_index(self, name: str, source_location: SourceLocation) -> int: if self.names is None: raise CodeError( - "Cannot access tuple item by name of an unnamed tuple", source_location + "cannot access tuple item by name of an unnamed tuple", source_location ) try: return self.names.index(name) @@ -326,7 +335,7 @@ def _m_validator(self, _attribute: object, m: int) -> None: raise CodeError("Precision must be between 1 and 160 inclusive", self.source_location) -def _required_arc4_wtypes(wtypes: Iterable[WType]) -> Sequence[ARC4Type]: +def _required_arc4_wtypes(wtypes: Iterable[WType]) -> tuple[ARC4Type, ...]: result = [] for wtype in wtypes: if not isinstance(wtype, ARC4Type): @@ -339,7 +348,7 @@ def _required_arc4_wtypes(wtypes: Iterable[WType]) -> Sequence[ARC4Type]: @attrs.frozen(kw_only=True) class ARC4Tuple(ARC4Type): source_location: SourceLocation | None = attrs.field(default=None, eq=False) - types: Sequence[ARC4Type] = attrs.field(converter=_required_arc4_wtypes) + types: tuple[ARC4Type, ...] = attrs.field(converter=_required_arc4_wtypes) name: str = attrs.field(init=False) arc4_name: str = attrs.field(init=False, eq=False) immutable: bool = attrs.field(init=False) @@ -362,14 +371,20 @@ def _decode_type(self) -> WTuple: return WTuple(self.types, self.source_location) def can_encode_type(self, wtype: WType) -> bool: - if wtype == self.decode_type: - return True - elif not isinstance(wtype, WTuple) or len(wtype.types) != len(self.types): - return False - return all( + return super().can_encode_type(wtype) or _is_arc4_encodeable_tuple(wtype, self.types) + + +def _is_arc4_encodeable_tuple( + wtype: WType, target_types: tuple[ARC4Type, ...] +) -> typing.TypeGuard[WTuple]: + return ( + isinstance(wtype, WTuple) + and len(wtype.types) == len(target_types) + and all( arc4_wtype == encode_wtype or arc4_wtype.can_encode_type(encode_wtype) - for arc4_wtype, encode_wtype in zip(self.types, wtype.types, strict=True) + for arc4_wtype, encode_wtype in zip(target_types, wtype.types, strict=True) ) + ) def _expect_arc4_type(wtype: WType) -> ARC4Type: @@ -428,7 +443,7 @@ def _require_arc4_fields(fields: Mapping[str, WType]) -> immutabledict[str, ARC4 ] if non_arc4_fields: raise CodeError( - "Invalid ARC4 Struct declaration," + "invalid ARC4 Struct declaration," f" the following fields are not ARC4 encoded types: {', '.join(non_arc4_fields)}", ) return immutabledict(fields) @@ -437,7 +452,7 @@ def _require_arc4_fields(fields: Mapping[str, WType]) -> immutabledict[str, ARC4 @typing.final @attrs.frozen(kw_only=True) class ARC4Struct(ARC4Type): - fields: Mapping[str, ARC4Type] = attrs.field(converter=_require_arc4_fields) + fields: immutabledict[str, ARC4Type] = attrs.field(converter=_require_arc4_fields) immutable: bool = attrs.field() source_location: SourceLocation | None = attrs.field(default=None, eq=False) arc4_name: str = attrs.field(init=False, eq=False) @@ -452,29 +467,17 @@ def _arc4_name(self) -> str: return f"({','.join(item.arc4_name for item in self.types)})" @cached_property - def names(self) -> Sequence[str]: - return list(self.fields.keys()) + def names(self) -> tuple[str, ...]: + return tuple(self.fields.keys()) @cached_property - def types(self) -> Sequence[ARC4Type]: - return list(self.fields.values()) + def types(self) -> tuple[ARC4Type, ...]: + return tuple(self.fields.values()) def can_encode_type(self, wtype: WType) -> bool: - if wtype == self.decode_type: - return True - elif not isinstance(wtype, WTuple) or len(wtype.types) != len(self.types): - return False - elif wtype.names is not None: - # Named tuple must have same fields and types - return len(wtype.names) == len(self.fields) and all( - n == f and (t == ft or ft.can_encode_type(t)) - for n, t, (f, ft) in zip( - wtype.names, wtype.types, self.fields.items(), strict=True - ) - ) - return all( - arc4_wtype == encode_wtype or arc4_wtype.can_encode_type(encode_wtype) - for arc4_wtype, encode_wtype in zip(self.types, wtype.types, strict=True) + return super().can_encode_type(wtype) or ( + _is_arc4_encodeable_tuple(wtype, self.types) + and (wtype.names is None or wtype.names == self.names) ) diff --git a/src/puya/ir/_puya_lib.awst.json b/src/puya/ir/_puya_lib.awst.json index cc2e5d5251..c8dfc103f8 100644 --- a/src/puya/ir/_puya_lib.awst.json +++ b/src/puya/ir/_puya_lib.awst.json @@ -1306,6 +1306,8 @@ } ], "source_location": null, + "name": "tuple", + "names": null, "_type": "WTuple" }, "body": { @@ -2270,6 +2272,8 @@ "column": 11, "end_column": 25 }, + "name": "tuple", + "names": null, "_type": "WTuple" }, "_type": "TupleExpression" @@ -2356,6 +2360,8 @@ } ], "source_location": null, + "name": "tuple", + "names": null, "_type": "WTuple" }, "body": { @@ -3091,6 +3097,8 @@ "column": 11, "end_column": 25 }, + "name": "tuple", + "names": null, "_type": "WTuple" }, "_type": "TupleExpression" @@ -3159,6 +3167,8 @@ } ], "source_location": null, + "name": "tuple", + "names": null, "_type": "WTuple" }, "body": { @@ -4244,6 +4254,8 @@ "column": 11, "end_column": 26 }, + "name": "tuple", + "names": null, "_type": "WTuple" }, "_type": "TupleExpression" @@ -4312,6 +4324,8 @@ } ], "source_location": null, + "name": "tuple", + "names": null, "_type": "WTuple" }, "body": { @@ -5652,6 +5666,8 @@ "column": 11, "end_column": 26 }, + "name": "tuple", + "names": null, "_type": "WTuple" }, "_type": "TupleExpression" diff --git a/src/puya/ir/builder/arc4.py b/src/puya/ir/builder/arc4.py index 3b5c65b9c4..41ad797f3d 100644 --- a/src/puya/ir/builder/arc4.py +++ b/src/puya/ir/builder/arc4.py @@ -397,16 +397,9 @@ def handle_arc4_assign( source_location=source_location, is_mutation=True, ) - case awst_nodes.TupleItemExpression( - base=awst_nodes.Expression(wtype=wtypes.ARC4Tuple() as base_type), - index=str(), - ): - raise InternalError( - f"{base_type} does not support indexing by name", target.source_location - ) case awst_nodes.TupleItemExpression( base=awst_nodes.Expression(wtype=wtypes.ARC4Tuple() as tuple_wtype) as base_expr, - index=int(index_value), + index=index_value, ): return handle_arc4_assign( context, @@ -448,11 +441,12 @@ def handle_arc4_assign( def _get_tuple_var_name(expr: awst_nodes.TupleItemExpression) -> str: - if isinstance(expr.base, awst_nodes.TupleItemExpression): - return format_tuple_index(expr.base.wtype, _get_tuple_var_name(expr.base), expr.index) - if isinstance(expr.base, awst_nodes.VarExpression): - return format_tuple_index(expr.base.wtype, expr.base.name, expr.index) - raise CodeError("Invalid assignment target", expr.base.source_location) + if isinstance(expr.base.wtype, wtypes.WTuple): + if isinstance(expr.base, awst_nodes.TupleItemExpression): + return format_tuple_index(expr.base.wtype, _get_tuple_var_name(expr.base), expr.index) + if isinstance(expr.base, awst_nodes.VarExpression): + return format_tuple_index(expr.base.wtype, expr.base.name, expr.index) + raise CodeError("invalid assignment target", expr.base.source_location) def concat_values( diff --git a/src/puya/ir/builder/itxn.py b/src/puya/ir/builder/itxn.py index 4fd8a49ab4..2a5266bcf1 100644 --- a/src/puya/ir/builder/itxn.py +++ b/src/puya/ir/builder/itxn.py @@ -551,7 +551,8 @@ def _resolve_inner_txn_params_var_name(self, params: awst_nodes.Expression) -> s case awst_nodes.VarExpression(name=var_name): pass case awst_nodes.TupleItemExpression( - base=awst_nodes.VarExpression(name=name, wtype=base_wtype), index=index + base=awst_nodes.VarExpression(name=name, wtype=wtypes.WTuple() as base_wtype), + index=index, ): return format_tuple_index(base_wtype, name, index) case awst_nodes.Copy(value=value): @@ -570,7 +571,7 @@ def _get_assignment_target_local_names( match target: case awst_nodes.VarExpression(name=var_name) if expected_number == 1: return [(var_name, target.source_location)] - case awst_nodes.VarExpression(name=var_name, wtype=var_wtype): + case awst_nodes.VarExpression(name=var_name, wtype=wtypes.WTuple() as var_wtype): return [ (format_tuple_index(var_wtype, var_name, idx), target.source_location) for idx in range(expected_number) @@ -581,8 +582,7 @@ def _get_assignment_target_local_names( items = typing.cast(Sequence[awst_nodes.VarExpression], items) return [(expr.name, expr.source_location) for expr in items] case awst_nodes.TupleItemExpression( - base=awst_nodes.TupleExpression(wtype=tuple_wtype) as base, - index=index, + base=awst_nodes.TupleExpression(wtype=tuple_wtype) as base, index=index ): tuple_names = _get_assignment_target_local_names(base, len(tuple_wtype.types)) return [tuple_names[index]] @@ -646,18 +646,12 @@ def visit_inner_transaction_field(self, itxn_field: awst_nodes.InnerTransactionF pass def visit_tuple_item_expression(self, expr: awst_nodes.TupleItemExpression) -> None: - if isinstance(expr.index, str): - assert isinstance(expr.base.wtype, wtypes.WTuple), "Tuple item must index tuple" - idx_num = expr.base.wtype.name_to_index(expr.index, expr.source_location) - else: - idx_num = expr.index - start_len = len(self._actions) super().visit_tuple_item_expression(expr) added = self._actions[start_len:] # only keep the relevant action if isinstance(expr.wtype, wtypes.WInnerTransaction): - self._actions[start_len:] = [added[idx_num]] + self._actions[start_len:] = [added[expr.index]] def visit_slice_expression(self, expr: awst_nodes.SliceExpression) -> None: start_len = len(self._actions) @@ -700,13 +694,13 @@ def _is_last_itxn(expr: awst_nodes.Expression) -> bool: if not isinstance(base.wtype, wtypes.WTuple): return False - idx_num = ( + index = ( expr.index if isinstance(expr, awst_nodes.TupleItemExpression) else base.wtype.name_to_index(expr.name, expr.source_location) ) tuple_size = len(base.wtype.types) - if idx_num == -1 or (idx_num + 1) == tuple_size: + if index == -1 or (index + 1) == tuple_size: return _is_submit_expr_of_size(base, tuple_size) else: return False diff --git a/src/puya/ir/builder/main.py b/src/puya/ir/builder/main.py index e884cd62a9..f8741f4917 100644 --- a/src/puya/ir/builder/main.py +++ b/src/puya/ir/builder/main.py @@ -605,10 +605,6 @@ def visit_tuple_item_expression(self, expr: awst_nodes.TupleItemExpression) -> T ) elif isinstance(expr.base.wtype, wtypes.ARC4Tuple): base = self.visit_and_materialise_single(expr.base) - if isinstance(expr.index, str): - raise InternalError( - f"Cannot index {expr.base.wtype} by name", expr.source_location - ) return arc4.arc4_tuple_index( self.context, base=base, @@ -626,7 +622,7 @@ def visit_tuple_item_expression(self, expr: awst_nodes.TupleItemExpression) -> T def visit_field_expression(self, expr: awst_nodes.FieldExpression) -> TExpression: if isinstance(expr.base.wtype, wtypes.WStructType): raise NotImplementedError - if isinstance(expr.base.wtype, wtypes.WTuple) and expr.base.wtype.names: + if isinstance(expr.base.wtype, wtypes.WTuple): index = expr.base.wtype.name_to_index(expr.name, expr.source_location) tup = self.visit_and_materialise(expr.base) return get_tuple_item_values( diff --git a/src/puya/ir/utils.py b/src/puya/ir/utils.py index 757afb0e2d..b1272d8f6e 100644 --- a/src/puya/ir/utils.py +++ b/src/puya/ir/utils.py @@ -1,9 +1,10 @@ import base64 from collections.abc import Sequence -from puya.awst import nodes as awst_nodes -from puya.awst.wtypes import WTuple, WType -from puya.errors import InternalError +from puya.awst import ( + nodes as awst_nodes, + wtypes, +) from puya.ir.types_ import AVMBytesEncoding @@ -54,14 +55,11 @@ def format_bytes(b: bytes, encoding: AVMBytesEncoding) -> str: return f"0x{b.hex()}" -def format_tuple_index(var_type: WType, var_name: str, index: int | str) -> str: - if isinstance(var_type, WTuple) and var_type.names is not None: - # If a named tuple is indexed numerical, convert this to the item name - name = index if isinstance(index, str) else var_type.names[index] - return f"{var_name}.{name}" - if isinstance(index, str): - raise InternalError(f"Cannot index {var_type} by name") - return f"{var_name}.{index}" +def format_tuple_index(var_type: wtypes.WTuple, base_name: str, index_or_name: int | str) -> str: + # If a named tuple is indexed numerical, convert this to the item name + if isinstance(index_or_name, int) and var_type.names is not None: + index_or_name = var_type.names[index_or_name] + return f"{base_name}.{index_or_name}" def lvalue_items(tup: awst_nodes.TupleExpression) -> Sequence[awst_nodes.Lvalue]: diff --git a/src/puyapy/awst_build/arc4_utils.py b/src/puyapy/awst_build/arc4_utils.py index b6c0feaf73..df73eeffe1 100644 --- a/src/puyapy/awst_build/arc4_utils.py +++ b/src/puyapy/awst_build/arc4_utils.py @@ -24,7 +24,6 @@ from puyapy.awst_build import pytypes from puyapy.awst_build.context import ASTConversionModuleContext -from puyapy.awst_build.pytypes import ARC4StructBaseType from puyapy.awst_build.utils import extract_bytes_literal_from_mypy, get_unaliased_fullname __all__ = [ @@ -256,12 +255,13 @@ def get_arc4_abimethod_data( case invalid_default_args_option: context.error(f"invalid default_args option: {invalid_default_args_option}", dec_loc) - mapped_return_types = ( - (n, pytype_to_arc4_pytype(t, on_error=lambda t: t)) for n, t in func_types.items() - ) - structs = immutabledict[str, ARC32StructDef]( - {n: _pytype_to_struct_def(pt) for n, pt in mapped_return_types if _is_arc4_struct(pt)} - ) + # extract "structs" from signature + structs = dict[str, ARC32StructDef]() + for n, pt in func_types.items(): + mapped_type = pytype_to_arc4_pytype(pt, on_error=lambda t: t) + if _is_arc4_struct(mapped_type): + structs[n] = _pytype_to_struct_def(mapped_type) + config = ARC4ABIMethodConfig( source_location=dec_loc, allowed_completion_types=allowed_completion_types, @@ -269,7 +269,7 @@ def get_arc4_abimethod_data( name=name, readonly=readonly, default_args=immutabledict(default_args), - structs=structs, + structs=immutabledict(structs), ) return ARC4ABIMethodData(config=config, signature=func_types) @@ -423,33 +423,21 @@ def pytype_to_arc4_pytype( return pytypes.ARC4DynamicBytesType case pytypes.StringType: return pytypes.ARC4StringType - case pytypes.TupleType( - name=tuple_name, - generic=None, - items=tuple_item_types, - names=tuple_item_names, - source_location=tuple_location, - ) if tuple_item_names: - # Named tuples can be encoded as ARC4 Struct + case pytypes.NamedTupleType(): return pytypes.StructType( - base=ARC4StructBaseType, - name=tuple_name, + base=pytypes.ARC4StructBaseType, + name=pytype.name, fields={ - name: pytype_to_arc4_pytype(t, on_error) - for name, t in zip(tuple_item_names, tuple_item_types, strict=True) + name: pytype_to_arc4_pytype(t, on_error) for name, t in pytype.fields.items() }, frozen=True, - source_location=tuple_location, + source_location=pytype.source_location, ) - case pytypes.TupleType( - generic=pytypes.GenericTupleType, - items=tuple_item_types, - source_location=tuple_location, - ): + case pytypes.TupleType(): return pytypes.GenericARC4TupleType.parameterise( - [pytype_to_arc4_pytype(item_typ, on_error) for item_typ in tuple_item_types], - tuple_location, + [pytype_to_arc4_pytype(t, on_error) for t in pytype.items], pytype.source_location ) + case ( pytypes.NoneType | pytypes.ApplicationType diff --git a/src/puyapy/awst_build/context.py b/src/puyapy/awst_build/context.py index 719c872103..8c7fa3165e 100644 --- a/src/puyapy/awst_build/context.py +++ b/src/puyapy/awst_build/context.py @@ -242,12 +242,12 @@ def type_to_pytype( msg = f"Unknown type: {fullname}" raise CodeError(msg, loc) return _maybe_parameterise_pytype(registry, result, args, loc) - case mypy.types.TupleType(items=items, partial_fallback=true_type): - generic = registry.get(true_type.type.fullname) + case mypy.types.TupleType(items=items, partial_fallback=fallback): + if not fallback.args: + return recurse(fallback) + generic = registry.get(fallback.type.fullname) if generic is None: - raise CodeError(f"Unknown tuple base type: {true_type.type.fullname}", loc) - if isinstance(generic, pytypes.TupleType): - return generic # Named tuples extend generic tuples but are not themselves generic + raise CodeError(f"unknown tuple base type: {fallback.type.fullname}", loc) return _maybe_parameterise_pytype(registry, generic, items, loc) case mypy.types.LiteralType(fallback=fallback, value=literal_value) as mypy_literal_type: if not in_type_args: diff --git a/src/puyapy/awst_build/eb/_base.py b/src/puyapy/awst_build/eb/_base.py index f5ee6122d4..b8fed50ba6 100644 --- a/src/puyapy/awst_build/eb/_base.py +++ b/src/puyapy/awst_build/eb/_base.py @@ -227,7 +227,7 @@ def _validate_lvalue(typ: pytypes.PyType, resolved: Expression) -> Lvalue: resolved.source_location, ) elif isinstance(resolved, TupleExpression): - assert isinstance(typ, pytypes.TupleType) + assert isinstance(typ, pytypes.TupleLikeType) for item_typ, item in zip(typ.items, resolved.items, strict=True): _validate_lvalue(item_typ, item) return resolved diff --git a/src/puyapy/awst_build/eb/_type_registry.py b/src/puyapy/awst_build/eb/_type_registry.py index 9c6f925dd1..46681adaae 100644 --- a/src/puyapy/awst_build/eb/_type_registry.py +++ b/src/puyapy/awst_build/eb/_type_registry.py @@ -62,7 +62,7 @@ PYTYPE_TO_TYPE_BUILDER: dict[pytypes.PyType, CallableBuilderFromSourceFactory] = { pytypes.NoneType: none.NoneTypeBuilder, pytypes.BoolType: bool_.BoolTypeBuilder, - pytypes.GenericTupleType: tuple_.GenericTupleTypeExpressionBuilder, + pytypes.GenericTupleType: tuple_.GenericTupleTypeBuilder, pytypes.reversedGenericType: unsigned_builtins.ReversedFunctionExpressionBuilder, pytypes.urangeType: unsigned_builtins.UnsignedRangeBuilder, pytypes.uenumerateGenericType: unsigned_builtins.UnsignedEnumerateBuilder, @@ -143,7 +143,7 @@ pytypes.GenericBoxType: storage.BoxTypeBuilder, pytypes.GenericBoxMapType: storage.BoxMapTypeBuilder, pytypes.GenericARC4TupleType: arc4.ARC4TupleTypeBuilder, - pytypes.GenericTupleType: tuple_.TupleTypeExpressionBuilder, + pytypes.GenericTupleType: tuple_.TupleTypeBuilder, pytypes.GenericArrayType: array.ArrayTypeBuilder, pytypes.GenericARC4UFixedNxMType: arc4.UFixedNxMTypeBuilder, pytypes.GenericARC4BigUFixedNxMType: arc4.UFixedNxMTypeBuilder, @@ -156,6 +156,7 @@ PYTYPE_BASE_TO_TYPE_BUILDER: dict[pytypes.PyType, CallableBuilderFromPyTypeAndSourceFactory] = { pytypes.ARC4StructBaseType: arc4.ARC4StructTypeBuilder, pytypes.StructBaseType: struct.StructSubclassExpressionBuilder, + pytypes.NamedTupleBaseType: tuple_.NamedTupleTypeBuilder, } PYTYPE_TO_BUILDER: dict[pytypes.PyType, Callable[[Expression], InstanceBuilder]] = { @@ -236,6 +237,7 @@ PYTYPE_BASE_TO_BUILDER: dict[pytypes.PyType, InstanceBuilderFromExpressionAndPyTypeFactory] = { pytypes.ARC4StructBaseType: arc4.ARC4StructExpressionBuilder, pytypes.StructBaseType: struct.StructExpressionBuilder, + pytypes.NamedTupleBaseType: tuple_.TupleExpressionBuilder, } @@ -247,9 +249,6 @@ def builder_for_instance(pytyp: pytypes.PyType, expr: Expression) -> InstanceBui for base in pytyp.mro: if eb_base := PYTYPE_BASE_TO_BUILDER.get(base): return eb_base(expr, pytyp) - if isinstance(pytyp, pytypes.TupleType) and pytyp.names is not None: - return tuple_.TupleExpressionBuilder(expr, pytyp) - if isinstance(pytyp, pytypes.UnionType): raise CodeError("type unions are unsupported at this location", expr.source_location) raise InternalError(f"no builder for instance: {pytyp}", expr.source_location) @@ -263,9 +262,6 @@ def builder_for_type(pytyp: pytypes.PyType, expr_loc: SourceLocation) -> Callabl for base in pytyp.mro: if tb_base := PYTYPE_BASE_TO_TYPE_BUILDER.get(base): return tb_base(pytyp, expr_loc) - - if isinstance(pytyp, pytypes.TupleType) and pytyp.names is not None: - return tuple_.TupleTypeExpressionBuilder(pytyp, expr_loc) if isinstance(pytyp, pytypes.UnionType): raise CodeError("type unions are unsupported at this location", expr_loc) raise InternalError(f"no builder for type: {pytyp}", expr_loc) diff --git a/src/puyapy/awst_build/eb/arc4/_utils.py b/src/puyapy/awst_build/eb/arc4/_utils.py index 0a5f5a7f41..3bd2c516f7 100644 --- a/src/puyapy/awst_build/eb/arc4/_utils.py +++ b/src/puyapy/awst_build/eb/arc4/_utils.py @@ -11,10 +11,14 @@ from puyapy.awst_build import arc4_utils, pytypes from puyapy.awst_build.arc4_utils import pytype_to_arc4_pytype from puyapy.awst_build.eb import _expect as expect -from puyapy.awst_build.eb._literals import LiteralBuilderImpl from puyapy.awst_build.eb._utils import dummy_value from puyapy.awst_build.eb.factories import builder_for_type -from puyapy.awst_build.eb.interface import InstanceBuilder, LiteralBuilder, NodeBuilder +from puyapy.awst_build.eb.interface import ( + InstanceBuilder, + LiteralBuilder, + NodeBuilder, + StaticSizedCollectionBuilder, +) from puyapy.awst_build.utils import maybe_resolve_literal logger = log.get_logger(__name__) @@ -187,30 +191,27 @@ def _implicit_arc4_conversion( f"cannot encode {instance.pytype} to {target_type}", location=instance.source_location ) return dummy_value(target_type, instance.source_location) - target_type_builder = builder_for_type(target_type, instance.source_location) - if isinstance(target_type, pytypes.StructType) and isinstance( - instance.pytype, pytypes.TupleType + if ( + isinstance(target_type, pytypes.StructType) + and isinstance(instance.pytype, pytypes.TupleType) + and len(target_type.types) == len(instance.pytype.items) ): # Special handling to map tuples (named and unnamed) to arc4 structs - num_fields = len(target_type.types) - return target_type_builder.call( - args=[ - _implicit_arc4_conversion( - instance.index( - LiteralBuilderImpl(idx, instance.source_location), instance.source_location - ), - typ, - ) - for idx, typ in enumerate(target_type.types) - ], - arg_names=[None] * num_fields, - arg_kinds=[mypy.nodes.ARG_POS] * num_fields, - location=instance.source_location, - ) + # instance builder for TupleType should be a StaticSizedCollectionBuilder + assert isinstance(instance, StaticSizedCollectionBuilder) + conversion_args = [ + _implicit_arc4_conversion(item, item_target_typ) + for item, item_target_typ in zip( + instance.iterate_static(), target_type.types, strict=True + ) + ] + else: + conversion_args = [instance] + target_type_builder = builder_for_type(target_type, instance.source_location) return target_type_builder.call( - args=[instance], - arg_names=[None], - arg_kinds=[mypy.nodes.ARG_POS], + args=conversion_args, + arg_names=[None] * len(conversion_args), + arg_kinds=[mypy.nodes.ARG_POS] * len(conversion_args), location=instance.source_location, ) @@ -221,11 +222,7 @@ def _maybe_resolve_arc4_literal( """Handles special case of resolving a literal tuple into an arc4 tuple""" from puyapy.awst_build.eb.tuple import TupleLiteralBuilder - if ( - isinstance(operand, TupleLiteralBuilder) - and target_type.generic is pytypes.GenericARC4TupleType - ): - assert isinstance(target_type, pytypes.TupleType), "expected TupleType" + if isinstance(operand, TupleLiteralBuilder) and isinstance(target_type, pytypes.ARC4TupleType): resolved_items = [ _maybe_resolve_arc4_literal(item, item_type) for item, item_type in zip(operand.iterate_static(), target_type.items, strict=True) diff --git a/src/puyapy/awst_build/eb/arc4/dynamic_array.py b/src/puyapy/awst_build/eb/arc4/dynamic_array.py index b2af434461..5275b01fd7 100644 --- a/src/puyapy/awst_build/eb/arc4/dynamic_array.py +++ b/src/puyapy/awst_build/eb/arc4/dynamic_array.py @@ -242,7 +242,7 @@ def _check_array_concat_arg(arg: InstanceBuilder, arr_type: pytypes.ArrayType) - match arg: case InstanceBuilder(pytype=pytypes.ArrayType(items=arr_type.items)): return True - case InstanceBuilder(pytype=pytypes.TupleType(items=tup_items)) if all( + case InstanceBuilder(pytype=pytypes.TupleLikeType(items=tup_items)) if all( ti == arr_type.items for ti in tup_items ): return True diff --git a/src/puyapy/awst_build/eb/arc4/struct.py b/src/puyapy/awst_build/eb/arc4/struct.py index d26c4fd6d4..f5615cfdab 100644 --- a/src/puyapy/awst_build/eb/arc4/struct.py +++ b/src/puyapy/awst_build/eb/arc4/struct.py @@ -55,7 +55,7 @@ def call( for field_name, field_type in pytype.fields.items() } assert isinstance(pytype.wtype, wtypes.ARC4Struct) - expr: Expression = NewStruct(wtype=pytype.wtype, values=values, source_location=location) + expr = NewStruct(wtype=pytype.wtype, values=values, source_location=location) return ARC4StructExpressionBuilder(expr, pytype) diff --git a/src/puyapy/awst_build/eb/arc4/tuple.py b/src/puyapy/awst_build/eb/arc4/tuple.py index 77c0b906e7..8cc61f0b67 100644 --- a/src/puyapy/awst_build/eb/arc4/tuple.py +++ b/src/puyapy/awst_build/eb/arc4/tuple.py @@ -38,24 +38,19 @@ def call( ) -> InstanceBuilder: arg = expect.exactly_one_arg(args, location, default=expect.default_raise) match arg: - case InstanceBuilder( - pytype=pytypes.TupleType(items=items, generic=pytypes.GenericTupleType) - ): + case InstanceBuilder(pytype=pytypes.TupleType(items=items)): typ = pytypes.GenericARC4TupleType.parameterise(items, location) - wtype = typ.wtype - assert isinstance(wtype, wtypes.ARC4Tuple) return ARC4TupleExpressionBuilder( - ARC4Encode(value=arg.resolve(), wtype=wtype, source_location=location), typ + ARC4Encode(value=arg.resolve(), wtype=typ.wtype, source_location=location), typ ) case _: # don't know expected type, so raise expect.not_this_type(arg, default=expect.default_raise) -class ARC4TupleTypeBuilder(ARC4TypeBuilder[pytypes.TupleType]): +class ARC4TupleTypeBuilder(ARC4TypeBuilder[pytypes.ARC4TupleType]): def __init__(self, typ: pytypes.PyType, location: SourceLocation): - assert isinstance(typ, pytypes.TupleType) - assert typ.generic == pytypes.GenericARC4TupleType + assert isinstance(typ, pytypes.ARC4TupleType) super().__init__(typ, location) @typing.override @@ -81,11 +76,10 @@ def call( class ARC4TupleExpressionBuilder( - BytesBackedInstanceExpressionBuilder[pytypes.TupleType], StaticSizedCollectionBuilder + BytesBackedInstanceExpressionBuilder[pytypes.ARC4TupleType], StaticSizedCollectionBuilder ): def __init__(self, expr: Expression, typ: pytypes.PyType): - assert isinstance(typ, pytypes.TupleType) - assert typ.generic == pytypes.GenericARC4TupleType + assert isinstance(typ, pytypes.ARC4TupleType) super().__init__(typ, expr) @typing.override diff --git a/src/puyapy/awst_build/eb/compiled.py b/src/puyapy/awst_build/eb/compiled.py index bb5d6ac04d..5e3437484f 100644 --- a/src/puyapy/awst_build/eb/compiled.py +++ b/src/puyapy/awst_build/eb/compiled.py @@ -1,27 +1,18 @@ -import itertools import typing from collections.abc import Mapping, Sequence import mypy.nodes -from puya.awst.nodes import ( - CompiledContract, - CompiledLogicSig, - Expression, - TupleExpression, - TupleItemExpression, -) +from puya.awst.nodes import CompiledContract, CompiledLogicSig, Expression from puya.awst.txn_fields import TxnField -from puya.errors import CodeError from puya.log import get_logger from puya.models import LogicSigReference from puya.parse import SourceLocation from puyapy.awst_build import pytypes from puyapy.awst_build.eb import _expect as expect -from puyapy.awst_build.eb._base import FunctionBuilder, NotIterableInstanceExpressionBuilder -from puyapy.awst_build.eb._utils import constant_bool_and_error, dummy_value +from puyapy.awst_build.eb._base import FunctionBuilder +from puyapy.awst_build.eb._utils import dummy_value from puyapy.awst_build.eb.dict_ import DictLiteralBuilder -from puyapy.awst_build.eb.factories import builder_for_instance from puyapy.awst_build.eb.interface import InstanceBuilder, NodeBuilder from puyapy.awst_build.eb.logicsig import LogicSigExpressionBuilder from puyapy.awst_build.eb.tuple import TupleExpressionBuilder @@ -43,82 +34,12 @@ } -class _LinearizedNamedTuple(NotIterableInstanceExpressionBuilder): - def __init__(self, expr: Expression, pytype: pytypes.TupleType): - names = pytype.names - assert names is not None - self._item_map = {name: (idx, pytype.items[idx]) for idx, name in enumerate(names)} - super().__init__(pytype, expr) - - @typing.override - @typing.final - def bool_eval(self, location: SourceLocation, *, negate: bool = False) -> InstanceBuilder: - return constant_bool_and_error(value=True, location=location, negate=negate) - - @typing.override - @typing.final - def to_bytes(self, location: SourceLocation) -> Expression: - raise CodeError(f"cannot serialize {self.pytype}", location) - - @typing.override - def member_access(self, name: str, location: SourceLocation) -> NodeBuilder: - try: - item_index, item_type = self._item_map[name] - except KeyError: - return super().member_access(name, location) - if isinstance(item_type, pytypes.TupleType): - return self._read_tuple_slice(item_index, item_type, location) - else: - return self._read_tuple_index(item_index, item_type, location) - - def _read_tuple_slice( - self, item_index: int, item_type: pytypes.TupleType, location: SourceLocation - ) -> InstanceBuilder: - start_index = self._get_linear_index(item_index) - end_index = start_index + _get_linear_tuple_size(item_type) - expr = self.resolve() - return TupleExpressionBuilder( - TupleExpression.from_items( - [ - TupleItemExpression(base=expr, index=index, source_location=location) - for index in range(start_index, end_index) - ], - location, - ), - item_type, - ) - - def _read_tuple_index( - self, item_index: int, item_type: pytypes.PyType, location: SourceLocation - ) -> InstanceBuilder: - return builder_for_instance( - item_type, - TupleItemExpression( - base=self.resolve(), - index=self._get_linear_index(item_index), - source_location=location, - ), - ) - - def _get_linear_index(self, index: int) -> int: - length = 0 - for _, item_type in itertools.islice(self._item_map.values(), index): - length += _get_linear_tuple_size(item_type) - return length - - -def _get_linear_tuple_size(pytyp: pytypes.PyType) -> int: - if isinstance(pytyp, pytypes.TupleType): - return sum(map(_get_linear_tuple_size, pytyp.items)) - return 1 - - -class CompiledContractExpressionBuilder(_LinearizedNamedTuple): +class CompiledContractExpressionBuilder(TupleExpressionBuilder): def __init__(self, expr: Expression) -> None: super().__init__(expr, pytypes.CompiledContractType) -class CompiledLogicSigExpressionBuilder(_LinearizedNamedTuple): +class CompiledLogicSigExpressionBuilder(TupleExpressionBuilder): def __init__(self, expr: Expression) -> None: super().__init__(expr, pytypes.CompiledLogicSigType) diff --git a/src/puyapy/awst_build/eb/tuple.py b/src/puyapy/awst_build/eb/tuple.py index 304608b1d8..1b6498d655 100644 --- a/src/puyapy/awst_build/eb/tuple.py +++ b/src/puyapy/awst_build/eb/tuple.py @@ -19,7 +19,6 @@ TupleItemExpression, UInt64Constant, ) -from puya.awst.wtypes import WTuple from puya.errors import CodeError from puya.parse import SourceLocation from puya.utils import clamp, positive_index @@ -41,13 +40,12 @@ StaticSizedCollectionBuilder, TypeBuilder, ) -from puyapy.awst_build.pytypes import PyType, TupleType from puyapy.awst_build.utils import determine_base_type, get_arg_mapping logger = log.get_logger(__name__) -class GenericTupleTypeExpressionBuilder(GenericTypeBuilder): +class GenericTupleTypeBuilder(GenericTypeBuilder): @typing.override def call( self, @@ -59,9 +57,10 @@ def call( return _init(args, location) -class TupleTypeExpressionBuilder(TypeBuilder[pytypes.TupleType]): +class TupleTypeBuilder(TypeBuilder[pytypes.TupleType]): def __init__(self, typ: pytypes.PyType, location: SourceLocation): assert isinstance(typ, pytypes.TupleType) + assert typ.generic == pytypes.GenericTupleType super().__init__(typ, location) @typing.override @@ -72,49 +71,12 @@ def call( arg_names: list[str | None], location: SourceLocation, ) -> InstanceBuilder: - pytype = self.produces() - if isinstance(pytype, pytypes.TupleType) and pytype.names is not None: - result = _init_named(args, arg_names, pytype, location) - else: - result = _init(args, location) + result = _init(args, location) if result.pytype != self.produces(): raise CodeError("type mismatch between tuple parameters and argument types", location) return result -def _init_named( - args: Sequence[NodeBuilder], - arg_names: list[str | None], - pytype: TupleType, - location: SourceLocation, -) -> InstanceBuilder: - assert pytype.names is not None, "_init_named should only be called on named tuples" - field_mapping, any_missing = get_arg_mapping( - required_positional_names=list(pytype.names), - args=args, - arg_names=arg_names, - call_location=location, - raise_on_missing=False, - ) - if any_missing: - return dummy_value(pytype, location) - wtype = pytype.wtype - assert isinstance(wtype, WTuple), "wtype for named tuple must be WTuple" - - def _get_item(name: str, typ: PyType) -> Expression: - val = field_mapping.get(name) - if val is None: - return dummy_value(typ, location).resolve() - return expect.argument_of_type_else_dummy(val, typ).resolve() - - tuple_expr = TupleExpression( - items=[_get_item(n, t) for n, t in zip(pytype.names, pytype.items, strict=True)], - wtype=wtype, - source_location=location, - ) - return TupleExpressionBuilder(tuple_expr, pytype) - - def _init(args: Sequence[NodeBuilder], location: SourceLocation) -> InstanceBuilder: arg = expect.at_most_one_arg(args, location) if arg is None: @@ -137,6 +99,42 @@ def _init(args: Sequence[NodeBuilder], location: SourceLocation) -> InstanceBuil raise CodeError("unhandled argument type", arg.source_location) +class NamedTupleTypeBuilder(TypeBuilder[pytypes.NamedTupleType]): + def __init__(self, typ: pytypes.PyType, location: SourceLocation): + assert isinstance(typ, pytypes.NamedTupleType) + super().__init__(typ, location) + + @typing.override + def call( + self, + args: Sequence[NodeBuilder], + arg_kinds: list[mypy.nodes.ArgKind], + arg_names: list[str | None], + location: SourceLocation, + ) -> InstanceBuilder: + pytype = self.produces() + field_mapping, any_missing = get_arg_mapping( + required_positional_names=list(pytype.fields), + args=args, + arg_names=arg_names, + call_location=location, + raise_on_missing=False, + ) + if any_missing: + return dummy_value(pytype, location) + + values = [ + expect.argument_of_type_else_dummy(field_mapping[field_name], field_type).resolve() + for field_name, field_type in pytype.fields.items() + ] + expr = TupleExpression( + items=values, + wtype=pytype.wtype, + source_location=location, + ) + return TupleExpressionBuilder(expr, pytype) + + class TupleLiteralBuilder(InstanceBuilder[pytypes.TupleType], StaticSizedCollectionBuilder): def __init__(self, items: Sequence[InstanceBuilder], location: SourceLocation): super().__init__(location) @@ -290,18 +288,18 @@ def to_bytes(self, location: SourceLocation) -> Expression: @typing.override def member_access(self, name: str, location: SourceLocation) -> InstanceBuilder: + if isinstance(self.pytype, pytypes.NamedTupleType): + item_typ = self.pytype.fields.get(name) + if item_typ is not None: + item_expr = FieldExpression( + base=self.resolve(), + name=name, + source_location=location, + ) + return builder_for_instance(item_typ, item_expr) if name in dir(tuple()): # noqa: C408 raise CodeError("method is not currently supported", location) - if self.pytype.names is None or name not in self.pytype.names: - raise CodeError("unrecognised member access", location) - item_index = self.pytype.name_to_index(name, location) - item_typ = self.pytype.items[item_index] - item_expr = FieldExpression( - base=self.resolve(), - name=name, - source_location=location, - ) - return builder_for_instance(item_typ, item_expr) + raise CodeError("unrecognised member access", location) @typing.override def binary_op( diff --git a/src/puyapy/awst_build/module.py b/src/puyapy/awst_build/module.py index 4107c2fca0..a021d7599e 100644 --- a/src/puyapy/awst_build/module.py +++ b/src/puyapy/awst_build/module.py @@ -19,7 +19,6 @@ from puyapy.awst_build.contract import ContractASTConverter from puyapy.awst_build.contract_data import ContractClassOptions from puyapy.awst_build.exceptions import UnsupportedASTError -from puyapy.awst_build.pytypes import make_wtuple from puyapy.awst_build.subroutine import FunctionASTConverter from puyapy.awst_build.utils import ( extract_bytes_literal_from_mypy, @@ -639,12 +638,13 @@ def _process_contract_class_options( ) -def _process_struct_like_fields( - context: ASTConversionModuleContext, cdef: mypy.nodes.ClassDef, type_name: str -) -> tuple[bool, dict[str, pytypes.PyType]]: +def _process_dataclass_like_fields( + context: ASTConversionModuleContext, cdef: mypy.nodes.ClassDef, base_type: pytypes.PyType +) -> dict[str, pytypes.PyType] | None: fields = dict[str, pytypes.PyType]() has_error = False for stmt in cdef.defs.body: + stmt_loc = context.node_location(stmt) match stmt: case mypy.nodes.ExpressionStmt(expr=mypy.nodes.StrExpr()): # ignore class docstring, already extracted @@ -655,7 +655,7 @@ def _process_struct_like_fields( rvalue=mypy.nodes.TempNode(), type=mypy.types.Type() as mypy_type, ): - stmt_loc = context.node_location(stmt) + pytype = context.type_to_pytype(mypy_type, source_location=stmt_loc) fields[field_name] = pytype case mypy.nodes.SymbolNode(name=symbol_name) if ( @@ -665,50 +665,46 @@ def _process_struct_like_fields( case mypy.nodes.PassStmt(): pass case _: - context.error(f"Unsupported syntax for {type_name} member declaration", stmt) + logger.error( + f"unsupported syntax for {base_type} member declaration", location=stmt_loc + ) has_error = True - return (has_error, fields) + return fields if not has_error else None -def _process_named_tuple( - context: ASTConversionModuleContext, cdef: mypy.nodes.ClassDef +def _process_struct( + context: ASTConversionModuleContext, base: pytypes.PyType, cdef: mypy.nodes.ClassDef ) -> StatementResult: - has_error, fields = _process_struct_like_fields(context, cdef, "NamedTuple") - if has_error: + fields = _process_dataclass_like_fields(context, cdef, base) + if fields is None: return [] - - if not fields: - context.error("NamedTuple must have at least one member", cdef) cls_loc = context.node_location(cdef) - - named_tuple_type = pytypes.TupleType( + frozen = cdef.info.metadata["dataclass"]["frozen"] + assert isinstance(frozen, bool) + struct_typ = pytypes.StructType( + base=base, name=cdef.fullname, - names=tuple(fields.keys()), - items=tuple(fields.values()), + fields=fields, + frozen=frozen, source_location=cls_loc, - wtype_factory=make_wtuple, ) - context.register_pytype(named_tuple_type) + context.register_pytype(struct_typ) return [] -def _process_struct( - context: ASTConversionModuleContext, base: pytypes.PyType, cdef: mypy.nodes.ClassDef +def _process_named_tuple( + context: ASTConversionModuleContext, cdef: mypy.nodes.ClassDef ) -> StatementResult: - has_error, fields = _process_struct_like_fields(context, cdef, str(base)) - if has_error: + fields = _process_dataclass_like_fields(context, cdef, pytypes.NamedTupleBaseType) + if fields is None: return [] cls_loc = context.node_location(cdef) - frozen = cdef.info.metadata["dataclass"]["frozen"] - assert isinstance(frozen, bool) - struct_typ = pytypes.StructType( - base=base, + named_tuple_type = pytypes.NamedTupleType( name=cdef.fullname, fields=fields, - frozen=frozen, source_location=cls_loc, ) - context.register_pytype(struct_typ) + context.register_pytype(named_tuple_type) return [] diff --git a/src/puyapy/awst_build/pytypes.py b/src/puyapy/awst_build/pytypes.py index b263d50ba9..4f17fae377 100644 --- a/src/puyapy/awst_build/pytypes.py +++ b/src/puyapy/awst_build/pytypes.py @@ -2,7 +2,7 @@ import abc import typing -from collections.abc import Callable, Iterable, Mapping, Sequence +from collections.abc import Callable, Mapping, Sequence from functools import cached_property import attrs @@ -34,18 +34,18 @@ class PyType(abc.ABC): """The canonical fully qualified type name""" generic: PyType | None = None """The generic type that this type was parameterised from, if any.""" - bases: Sequence[PyType] = attrs.field(default=(), converter=tuple["PyType", ...]) + bases: tuple[PyType, ...] = attrs.field(default=(), converter=tuple["PyType", ...]) """Direct base classes. probably excluding the implicit builtins.object?""" - mro: Sequence[PyType] = attrs.field(default=(), converter=tuple["PyType", ...]) + mro: tuple[PyType, ...] = attrs.field(default=(), converter=tuple["PyType", ...]) """All base cases, in Method Resolution Order""" @bases.validator - def _bases_validate(self, _attribute: object, bases: Sequence[PyType]) -> None: + def _bases_validate(self, _attribute: object, bases: tuple[PyType, ...]) -> None: if len(set(bases)) != len(bases): raise InternalError(f"Duplicate bases in {self}: [{', '.join(map(str, bases))}]") @mro.validator - def _mro_validate(self, _attribute: object, mro: Sequence[PyType]) -> None: + def _mro_validate(self, _attribute: object, mro: tuple[PyType, ...]) -> None: bases_missing_from_mro = set(self.bases).difference(mro) if bases_missing_from_mro: raise InternalError( @@ -194,8 +194,8 @@ class TypingLiteralType(PyType): source_location: SourceLocation | None name: str = attrs.field(init=False) generic: None = attrs.field(default=None, init=False) - bases: Sequence[PyType] = attrs.field(default=(), init=False) - mro: Sequence[PyType] = attrs.field(default=(), init=False) + bases: tuple[PyType, ...] = attrs.field(default=(), init=False) + mro: tuple[PyType, ...] = attrs.field(default=(), init=False) @name.default def _name_default(self) -> str: @@ -207,26 +207,26 @@ def wtype(self) -> typing.Never: raise CodeError(f"{self} is not usable as a value", self.source_location) -def _flatten_nested_unions(types: Sequence[PyType]) -> Sequence[PyType]: +def _flatten_nested_unions(types: Sequence[PyType]) -> tuple[PyType, ...]: result = list[PyType]() for t in types: if isinstance(t, UnionType): result.extend(t.types) else: result.append(t) - return unique(result) + return tuple(unique(result)) @typing.final @attrs.frozen class UnionType(PyType): - types: Sequence[PyType] = attrs.field( + types: tuple[PyType, ...] = attrs.field( converter=_flatten_nested_unions, validator=attrs.validators.min_len(2) ) name: str = attrs.field(init=False) generic: None = attrs.field(default=None, init=False) - bases: Sequence[PyType] = attrs.field(default=(), init=False) - mro: Sequence[PyType] = attrs.field(default=(), init=False) + bases: tuple[PyType, ...] = attrs.field(default=(), init=False) + mro: tuple[PyType, ...] = attrs.field(default=(), init=False) source_location: SourceLocation @name.default @@ -239,48 +239,75 @@ def wtype(self) -> typing.Never: raise CodeError("type unions are unsupported at this location", self.source_location) -class _TupleWTypeFactory(typing.Protocol): +@attrs.frozen +class _BaseType(PyType): + """Type that is only usable as a base type""" - def __call__( - self, - *, - types: Iterable[wtypes.WType], - names: Iterable[str] | None, - name: str, - source_location: SourceLocation | None, - ) -> wtypes.WTuple | wtypes.ARC4Tuple: ... + @typing.override + @property + def wtype(self) -> typing.Never: + raise CodeError(f"{self} is only usable as a base type") + + def __attrs_post_init__(self) -> None: + _register_builtin(self) -@typing.final -@attrs.frozen(kw_only=True) -class TupleType(PyType): - names: tuple[str, ...] | None = attrs.field() +@attrs.frozen +class TupleLikeType(PyType, abc.ABC): items: tuple[PyType, ...] - _wtype_factory: _TupleWTypeFactory source_location: SourceLocation | None - @names.validator - def _validate_names(self, _attribute: object, names: tuple[str, ...]) -> None: - if names is not None and len(names) != len(self.items): - raise InternalError("names length must match items length", self.source_location) - def name_to_index(self, name: str, source_location: SourceLocation) -> int: - if self.names is None: - raise CodeError( - "Cannot access tuple item by name of an unnamed tuple", source_location - ) - try: - return self.names.index(name) - except ValueError: - raise CodeError(f"{name} is not a member of {self.name}") from None +def _parameterise_tuple( + self: _GenericType[TupleType], args: _TypeArgs, source_location: SourceLocation | None +) -> TupleType: + name = f"{self.name}[{', '.join(pyt.name for pyt in args)}]" + return TupleType(name=name, items=tuple(args), source_location=source_location) + + +GenericTupleType: typing.Final = _GenericType( + name="builtins.tuple", + parameterise=_parameterise_tuple, +) + + +@attrs.frozen(kw_only=True) +class TupleType(TupleLikeType): + generic: PyType | None = attrs.field(default=GenericTupleType, init=False) + bases: tuple[PyType, ...] = attrs.field(default=(), init=False) + mro: tuple[PyType, ...] = attrs.field(default=(), init=False) @property - def wtype(self) -> wtypes.WTuple | wtypes.ARC4Tuple: - return self._wtype_factory( + def wtype(self) -> wtypes.WTuple: + return wtypes.WTuple( types=(i.wtype for i in self.items), source_location=self.source_location, - names=self.names, + ) + + +NamedTupleBaseType: typing.Final[PyType] = _BaseType(name="typing.NamedTuple") + + +@attrs.frozen +class NamedTupleType(TupleType): + fields: immutabledict[str, PyType] = attrs.field(converter=immutabledict) + items: tuple[PyType, ...] = attrs.field(init=False) + generic: None = attrs.field(default=None, init=False) + bases: tuple[PyType, ...] = attrs.field(default=(NamedTupleBaseType,), init=False) + mro: tuple[PyType, ...] = attrs.field(default=(NamedTupleBaseType,), init=False) + + @items.default + def _items(self) -> tuple[PyType, ...]: + return tuple(self.fields.values()) + + @typing.override + @property + def wtype(self) -> wtypes.WTuple: + return wtypes.WTuple( name=self.name, + types=(i.wtype for i in self.items), + names=tuple(self.fields), + source_location=self.source_location, ) @@ -321,8 +348,8 @@ class FuncArg: class FuncType(PyType): generic: None = None ret_type: PyType - args: Sequence[FuncArg] = attrs.field(converter=tuple[FuncArg, ...]) - bound_arg_types: Sequence[PyType] = attrs.field(converter=tuple[PyType, ...]) + args: tuple[FuncArg, ...] = attrs.field(converter=tuple[FuncArg, ...]) + bound_arg_types: tuple[PyType, ...] = attrs.field(converter=tuple[PyType, ...]) @typing.override @property @@ -364,7 +391,7 @@ def wtype(self) -> typing.Never: @typing.final @attrs.frozen(init=False) class StructType(PyType): - fields: Mapping[str, PyType] = attrs.field( + fields: immutabledict[str, PyType] = attrs.field( converter=immutabledict, validator=[attrs.validators.min_len(1)] ) frozen: bool @@ -373,11 +400,11 @@ class StructType(PyType): generic: None = None @cached_property - def names(self) -> Sequence[str]: + def names(self) -> tuple[str, ...]: return tuple(self.fields.keys()) @cached_property - def types(self) -> Sequence[PyType]: + def types(self) -> tuple[PyType, ...]: return tuple(self.fields.values()) def __init__( @@ -646,116 +673,61 @@ def parameterise( ) -def _make_tuple_parameterise( - wtype_factory: _TupleWTypeFactory, -) -> _Parameterise[TupleType]: - def parameterise( - self: _GenericType[TupleType], args: _TypeArgs, source_location: SourceLocation | None - ) -> TupleType: - name = f"{self.name}[{', '.join(pyt.name for pyt in args)}]" - return TupleType( - generic=self, - name=name, - names=None, - items=tuple(args), - wtype_factory=wtype_factory, - source_location=source_location, - ) +@typing.final +@attrs.frozen(kw_only=True) +class ARC4TupleType(TupleLikeType): + generic: PyType + bases: tuple[PyType, ...] = attrs.field(default=(), init=False) + mro: tuple[PyType, ...] = attrs.field(default=(), init=False) - return parameterise + @property + def wtype(self) -> wtypes.ARC4Tuple: + return wtypes.ARC4Tuple( + types=(i.wtype for i in self.items), + source_location=self.source_location, + ) -def make_wtuple( - *, - types: Iterable[wtypes.WType], - names: Iterable[str] | None, - name: str, - source_location: SourceLocation | None, -) -> wtypes.WTuple | wtypes.ARC4Tuple: - return wtypes.WTuple( - types=types, - names=names, - name=attrs.NOTHING if names is None else name, # type: ignore[arg-type] +def _parameterise_arc4_tuple( + self: _GenericType[ARC4TupleType], args: _TypeArgs, source_location: SourceLocation | None +) -> ARC4TupleType: + name = f"{self.name}[{', '.join(pyt.name for pyt in args)}]" + return ARC4TupleType( + generic=self, + name=name, + items=tuple(args), source_location=source_location, ) -GenericTupleType: typing.Final = _GenericType( - name="builtins.tuple", - parameterise=_make_tuple_parameterise(make_wtuple), -) - - -def _make_arc4_tuple( - *, - types: Iterable[wtypes.WType], - names: Iterable[str] | None, - name: str, # noqa: ARG001 - source_location: SourceLocation | None, -) -> wtypes.WTuple | wtypes.ARC4Tuple: - assert names is None, "arc4 tuple cannot have names" - return wtypes.ARC4Tuple(types=types, source_location=source_location) - - GenericARC4TupleType: typing.Final = _GenericType( name="algopy.arc4.Tuple", - parameterise=_make_tuple_parameterise(_make_arc4_tuple), + parameterise=_parameterise_arc4_tuple, ) - -def _flattened_named_tuple(name: str, items: Mapping[str, PyType]) -> TupleType: - """ - Produces a TupleType with an underlying WType that is a linear WTuple of provided items - """ - - def _flatten(items: Iterable[wtypes.WType]) -> Iterable[wtypes.WType]: - for item in items: - if isinstance(item, wtypes.WTuple): - yield from _flatten(item.types) - else: - yield item - - def _wtuple_factory( - *, - types: Iterable[wtypes.WType], - names: Iterable[str] | None, # noqa: ARG001 - name: str, # noqa: ARG001 - source_location: SourceLocation | None, - ) -> wtypes.WTuple: - return wtypes.WTuple(types=_flatten(types), source_location=source_location) - - pytype = TupleType( - name=name, - generic=None, - names=tuple(items.keys()), - items=tuple(items.values()), - wtype_factory=_wtuple_factory, +CompiledContractType: typing.Final = _register_builtin( + NamedTupleType( + name="algopy._compiled.CompiledContract", + fields={ + "approval_program": GenericTupleType.parameterise([BytesType, BytesType], None), + "clear_state_program": GenericTupleType.parameterise([BytesType, BytesType], None), + "extra_program_pages": UInt64Type, + "global_uints": UInt64Type, + "global_bytes": UInt64Type, + "local_uints": UInt64Type, + "local_bytes": UInt64Type, + }, source_location=None, ) - _register_builtin(pytype) - return pytype - - -# TODO: The CompiledContract and CompiledLogicSig types are currently just protocols in the stubs, -# however the should become named tuples once nested tuples are supported. -# For now it is convenient to represent them as named tuples at the pytypes level -CompiledContractType: typing.Final[TupleType] = _flattened_named_tuple( - name="algopy._compiled.CompiledContract", - items={ - "approval_program": GenericTupleType.parameterise([BytesType, BytesType], None), - "clear_state_program": GenericTupleType.parameterise([BytesType, BytesType], None), - "extra_program_pages": UInt64Type, - "global_uints": UInt64Type, - "global_bytes": UInt64Type, - "local_uints": UInt64Type, - "local_bytes": UInt64Type, - }, ) -CompiledLogicSigType: typing.Final[TupleType] = _flattened_named_tuple( - name="algopy._compiled.CompiledLogicSig", - items={ - "account": AccountType, - }, +CompiledLogicSigType: typing.Final = _register_builtin( + NamedTupleType( + name="algopy._compiled.CompiledLogicSig", + fields={ + "account": AccountType, + }, + source_location=None, + ) ) @@ -764,8 +736,8 @@ def _wtuple_factory( class VariadicTupleType(PyType): items: PyType generic: _GenericType = attrs.field(default=GenericTupleType, init=False) - bases: Sequence[PyType] = attrs.field(default=(), init=False) - mro: Sequence[PyType] = attrs.field(default=(), init=False) + bases: tuple[PyType, ...] = attrs.field(default=(), init=False) + mro: tuple[PyType, ...] = attrs.field(default=(), init=False) name: str = attrs.field(init=False) @name.default @@ -1055,12 +1027,12 @@ def __attrs_post_init__(self) -> None: @attrs.frozen(kw_only=True) class IntrinsicEnumType(PyType): generic: None = attrs.field(default=None, init=False) - bases: Sequence[PyType] = attrs.field( + bases: tuple[PyType, ...] = attrs.field( default=(StrLiteralType,), # strictly true, but not sure if we want this? init=False, ) - mro: Sequence[PyType] = attrs.field(default=(StrLiteralType,), init=False) - members: Mapping[str, str] = attrs.field(converter=immutabledict) + mro: tuple[PyType, ...] = attrs.field(default=(StrLiteralType,), init=False) + members: immutabledict[str, str] = attrs.field(converter=immutabledict) @property def wtype(self) -> wtypes.WType: @@ -1084,9 +1056,9 @@ def _make_intrinsic_enum_types() -> Sequence[IntrinsicEnumType]: @attrs.frozen(kw_only=True) class IntrinsicNamespaceType(PyType): generic: None = attrs.field(default=None, init=False) - bases: Sequence[PyType] = attrs.field(default=(), init=False) - mro: Sequence[PyType] = attrs.field(default=(), init=False) - members: Mapping[str, PropertyOpMapping | OpMappingWithOverloads] = attrs.field( + bases: tuple[PyType, ...] = attrs.field(default=(), init=False) + mro: tuple[PyType, ...] = attrs.field(default=(), init=False) + members: immutabledict[str, PropertyOpMapping | OpMappingWithOverloads] = attrs.field( converter=immutabledict ) @@ -1147,19 +1119,6 @@ def _parameterise_any_compile_time( ) -@attrs.frozen -class _BaseType(PyType): - """Type that is only usable as a base type""" - - @typing.override - @property - def wtype(self) -> typing.Never: - raise CodeError(f"{self} is only usable as a base type") - - def __attrs_post_init__(self) -> None: - _register_builtin(self) - - ContractBaseType: typing.Final[PyType] = _BaseType(name=constants.CONTRACT_BASE) ARC4ContractBaseType: typing.Final[PyType] = _BaseType( name=constants.ARC4_CONTRACT_BASE, @@ -1176,8 +1135,8 @@ def __attrs_post_init__(self) -> None: class PseudoGenericFunctionType(PyType): return_type: PyType generic: _GenericType[PseudoGenericFunctionType] - bases: Sequence[PyType] = attrs.field(default=(), init=False) - mro: Sequence[PyType] = attrs.field(default=(), init=False) + bases: tuple[PyType, ...] = attrs.field(default=(), init=False) + mro: tuple[PyType, ...] = attrs.field(default=(), init=False) @property def wtype(self) -> typing.Never: diff --git a/src/puyapy/awst_build/subroutine.py b/src/puyapy/awst_build/subroutine.py index 96f04081f8..900ed3482e 100644 --- a/src/puyapy/awst_build/subroutine.py +++ b/src/puyapy/awst_build/subroutine.py @@ -379,7 +379,7 @@ def _assign_type( items=homogenous_type ): tuple_item_types = (homogenous_type,) * len(lval_items) - case pytypes.TupleType(items=tuple_item_types): + case pytypes.TupleLikeType(items=tuple_item_types): if len(tuple_item_types) != len(lval_items): raise CodeError( f"length mismatch source size of {len(tuple_item_types)}" diff --git a/test_cases/compile/out/HelloFactory.ssa.ir b/test_cases/compile/out/HelloFactory.ssa.ir index c3d2776e1d..c3341dc580 100644 --- a/test_cases/compile/out/HelloFactory.ssa.ir +++ b/test_cases/compile/out/HelloFactory.ssa.ir @@ -149,7 +149,7 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_compile_contract() -> void: block@0: // L30 - let (compiled.0#0: bytes, compiled.1#0: bytes, compiled.2#0: bytes, compiled.3#0: bytes, compiled.4#0: uint64, compiled.5#0: uint64, compiled.6#0: uint64, compiled.7#0: uint64, compiled.8#0: uint64) = (compiled_contract('test_cases.compile.apps.Hello', field=ApprovalProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.Hello', field=ApprovalProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.Hello', field=ClearStateProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.Hello', field=ClearStateProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.Hello', field=ExtraProgramPages, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=GlobalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=GlobalNumByteSlice, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=LocalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=LocalNumByteSlice, program_page=None)) + let (compiled.approval_program.0#0: bytes, compiled.approval_program.1#0: bytes, compiled.clear_state_program.0#0: bytes, compiled.clear_state_program.1#0: bytes, compiled.extra_program_pages#0: uint64, compiled.global_uints#0: uint64, compiled.global_bytes#0: uint64, compiled.local_uints#0: uint64, compiled.local_bytes#0: uint64) = (compiled_contract('test_cases.compile.apps.Hello', field=ApprovalProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.Hello', field=ApprovalProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.Hello', field=ClearStateProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.Hello', field=ClearStateProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.Hello', field=ExtraProgramPages, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=GlobalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=GlobalNumByteSlice, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=LocalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=LocalNumByteSlice, program_page=None)) itxn_begin let inner_txn_params%0#0: itxn_field_set = itxn_field_set(0) let inner_txn_params%0%%param_Fee_idx_0#0: uint64 = 0u @@ -163,11 +163,11 @@ contract test_cases.compile.factory.HelloFactory: let inner_txn_params%0%%param_ApplicationArgs_idx_0#0: bytes = method "create(string)void" let inner_txn_params%0%%param_ApplicationArgs_idx_1#0: bytes = encoded_value%0#0 let inner_txn_params%0%%ApplicationArgs_length#0: uint64 = 2u - let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.0#0 - let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.1#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.approval_program.0#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.approval_program.1#0 let inner_txn_params%0%%ApprovalProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.2#0 - let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.3#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.clear_state_program.0#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.clear_state_program.1#0 let inner_txn_params%0%%ClearStateProgramPages_length#0: uint64 = 2u let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = 1u let inner_txn_params%0%%GlobalNumByteSlice_length#0: uint64 = 1u @@ -444,7 +444,7 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_compile_contract_tmpl() -> void: block@0: // L61 let greeting#0: bytes = "hey" - let (compiled.0#0: bytes, compiled.1#0: bytes, compiled.2#0: bytes, compiled.3#0: bytes, compiled.4#0: uint64, compiled.5#0: uint64, compiled.6#0: uint64, compiled.7#0: uint64, compiled.8#0: uint64) = (compiled_contract('test_cases.compile.apps.HelloTmpl', field=ApprovalProgramPages, program_page=0, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ApprovalProgramPages, program_page=1, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ClearStateProgramPages, program_page=0, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ClearStateProgramPages, program_page=1, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ExtraProgramPages, program_page=None, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=GlobalNumUint, program_page=None, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=GlobalNumByteSlice, program_page=None, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=LocalNumUint, program_page=None, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=LocalNumByteSlice, program_page=None, GREETING=greeting#0)) + let (compiled.approval_program.0#0: bytes, compiled.approval_program.1#0: bytes, compiled.clear_state_program.0#0: bytes, compiled.clear_state_program.1#0: bytes, compiled.extra_program_pages#0: uint64, compiled.global_uints#0: uint64, compiled.global_bytes#0: uint64, compiled.local_uints#0: uint64, compiled.local_bytes#0: uint64) = (compiled_contract('test_cases.compile.apps.HelloTmpl', field=ApprovalProgramPages, program_page=0, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ApprovalProgramPages, program_page=1, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ClearStateProgramPages, program_page=0, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ClearStateProgramPages, program_page=1, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ExtraProgramPages, program_page=None, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=GlobalNumUint, program_page=None, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=GlobalNumByteSlice, program_page=None, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=LocalNumUint, program_page=None, GREETING=greeting#0), compiled_contract('test_cases.compile.apps.HelloTmpl', field=LocalNumByteSlice, program_page=None, GREETING=greeting#0)) itxn_begin let inner_txn_params%0#0: itxn_field_set = itxn_field_set(0) let inner_txn_params%0%%param_Fee_idx_0#0: uint64 = 0u @@ -453,19 +453,19 @@ contract test_cases.compile.factory.HelloFactory: let inner_txn_params%0%%TypeEnum_length#0: uint64 = 1u let inner_txn_params%0%%param_ApplicationArgs_idx_0#0: bytes = method "create()void" let inner_txn_params%0%%ApplicationArgs_length#0: uint64 = 1u - let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.0#0 - let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.1#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.approval_program.0#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.approval_program.1#0 let inner_txn_params%0%%ApprovalProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.2#0 - let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.3#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.clear_state_program.0#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.clear_state_program.1#0 let inner_txn_params%0%%ClearStateProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_GlobalNumUint_idx_0#0: uint64 = compiled.5#0 + let inner_txn_params%0%%param_GlobalNumUint_idx_0#0: uint64 = compiled.global_uints#0 let inner_txn_params%0%%GlobalNumUint_length#0: uint64 = 1u - let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.6#0 + let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.global_bytes#0 let inner_txn_params%0%%GlobalNumByteSlice_length#0: uint64 = 1u - let inner_txn_params%0%%param_LocalNumUint_idx_0#0: uint64 = compiled.7#0 + let inner_txn_params%0%%param_LocalNumUint_idx_0#0: uint64 = compiled.local_uints#0 let inner_txn_params%0%%LocalNumUint_length#0: uint64 = 1u - let inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0: uint64 = compiled.8#0 + let inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0: uint64 = compiled.local_bytes#0 let inner_txn_params%0%%LocalNumByteSlice_length#0: uint64 = 1u let inner_txn_params%0%%Sender_length#0: uint64 = 0u let inner_txn_params%0%%Note_length#0: uint64 = 0u @@ -738,7 +738,7 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_compile_contract_prfx() -> void: block@0: // L96 - let (compiled.0#0: bytes, compiled.1#0: bytes, compiled.2#0: bytes, compiled.3#0: bytes, compiled.4#0: uint64, compiled.5#0: uint64, compiled.6#0: uint64, compiled.7#0: uint64, compiled.8#0: uint64) = (compiled_contract('test_cases.compile.apps.HelloPrfx', field=ApprovalProgramPages, program_page=0, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ApprovalProgramPages, program_page=1, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ClearStateProgramPages, program_page=0, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ClearStateProgramPages, program_page=1, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ExtraProgramPages, program_page=None, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=GlobalNumUint, program_page=None, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=GlobalNumByteSlice, program_page=None, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=LocalNumUint, program_page=None, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=LocalNumByteSlice, program_page=None, PRFX_GREETING="hi")) + let (compiled.approval_program.0#0: bytes, compiled.approval_program.1#0: bytes, compiled.clear_state_program.0#0: bytes, compiled.clear_state_program.1#0: bytes, compiled.extra_program_pages#0: uint64, compiled.global_uints#0: uint64, compiled.global_bytes#0: uint64, compiled.local_uints#0: uint64, compiled.local_bytes#0: uint64) = (compiled_contract('test_cases.compile.apps.HelloPrfx', field=ApprovalProgramPages, program_page=0, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ApprovalProgramPages, program_page=1, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ClearStateProgramPages, program_page=0, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ClearStateProgramPages, program_page=1, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ExtraProgramPages, program_page=None, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=GlobalNumUint, program_page=None, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=GlobalNumByteSlice, program_page=None, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=LocalNumUint, program_page=None, PRFX_GREETING="hi"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=LocalNumByteSlice, program_page=None, PRFX_GREETING="hi")) itxn_begin let inner_txn_params%0#0: itxn_field_set = itxn_field_set(0) let inner_txn_params%0%%param_Fee_idx_0#0: uint64 = 0u @@ -747,13 +747,13 @@ contract test_cases.compile.factory.HelloFactory: let inner_txn_params%0%%TypeEnum_length#0: uint64 = 1u let inner_txn_params%0%%param_ApplicationArgs_idx_0#0: bytes = method "create()void" let inner_txn_params%0%%ApplicationArgs_length#0: uint64 = 1u - let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.0#0 - let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.1#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.approval_program.0#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.approval_program.1#0 let inner_txn_params%0%%ApprovalProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.2#0 - let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.3#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.clear_state_program.0#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.clear_state_program.1#0 let inner_txn_params%0%%ClearStateProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.6#0 + let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.global_bytes#0 let inner_txn_params%0%%GlobalNumByteSlice_length#0: uint64 = 1u let inner_txn_params%0%%Sender_length#0: uint64 = 0u let inner_txn_params%0%%Note_length#0: uint64 = 0u @@ -1026,22 +1026,22 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_compile_contract_large() -> void: block@0: // L129 - let (compiled.0#0: bytes, compiled.1#0: bytes, compiled.2#0: bytes, compiled.3#0: bytes, compiled.4#0: uint64, compiled.5#0: uint64, compiled.6#0: uint64, compiled.7#0: uint64, compiled.8#0: uint64) = (compiled_contract('test_cases.compile.apps.LargeProgram', field=ApprovalProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.LargeProgram', field=ApprovalProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.LargeProgram', field=ClearStateProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.LargeProgram', field=ClearStateProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.LargeProgram', field=ExtraProgramPages, program_page=None), compiled_contract('test_cases.compile.apps.LargeProgram', field=GlobalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.LargeProgram', field=GlobalNumByteSlice, program_page=None), compiled_contract('test_cases.compile.apps.LargeProgram', field=LocalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.LargeProgram', field=LocalNumByteSlice, program_page=None)) + let (compiled.approval_program.0#0: bytes, compiled.approval_program.1#0: bytes, compiled.clear_state_program.0#0: bytes, compiled.clear_state_program.1#0: bytes, compiled.extra_program_pages#0: uint64, compiled.global_uints#0: uint64, compiled.global_bytes#0: uint64, compiled.local_uints#0: uint64, compiled.local_bytes#0: uint64) = (compiled_contract('test_cases.compile.apps.LargeProgram', field=ApprovalProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.LargeProgram', field=ApprovalProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.LargeProgram', field=ClearStateProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.LargeProgram', field=ClearStateProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.LargeProgram', field=ExtraProgramPages, program_page=None), compiled_contract('test_cases.compile.apps.LargeProgram', field=GlobalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.LargeProgram', field=GlobalNumByteSlice, program_page=None), compiled_contract('test_cases.compile.apps.LargeProgram', field=LocalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.LargeProgram', field=LocalNumByteSlice, program_page=None)) itxn_begin let inner_txn_params%0#0: itxn_field_set = itxn_field_set(0) let inner_txn_params%0%%param_Fee_idx_0#0: uint64 = 0u let inner_txn_params%0%%Fee_length#0: uint64 = 1u let inner_txn_params%0%%param_TypeEnum_idx_0#0: uint64 = appl let inner_txn_params%0%%TypeEnum_length#0: uint64 = 1u - let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.0#0 - let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.1#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.approval_program.0#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.approval_program.1#0 let inner_txn_params%0%%ApprovalProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.2#0 - let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.3#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.clear_state_program.0#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.clear_state_program.1#0 let inner_txn_params%0%%ClearStateProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ExtraProgramPages_idx_0#0: uint64 = compiled.4#0 + let inner_txn_params%0%%param_ExtraProgramPages_idx_0#0: uint64 = compiled.extra_program_pages#0 let inner_txn_params%0%%ExtraProgramPages_length#0: uint64 = 1u - let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.6#0 + let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.global_bytes#0 let inner_txn_params%0%%GlobalNumByteSlice_length#0: uint64 = 1u let inner_txn_params%0%%Sender_length#0: uint64 = 0u let inner_txn_params%0%%Note_length#0: uint64 = 0u @@ -1605,7 +1605,7 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_arc4_create_tmpl() -> void: block@0: // L177 - let (compiled.0#0: bytes, compiled.1#0: bytes, compiled.2#0: bytes, compiled.3#0: bytes, compiled.4#0: uint64, compiled.5#0: uint64, compiled.6#0: uint64, compiled.7#0: uint64, compiled.8#0: uint64) = (compiled_contract('test_cases.compile.apps.HelloTmpl', field=ApprovalProgramPages, program_page=0, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ApprovalProgramPages, program_page=1, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ClearStateProgramPages, program_page=0, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ClearStateProgramPages, program_page=1, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ExtraProgramPages, program_page=None, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=GlobalNumUint, program_page=None, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=GlobalNumByteSlice, program_page=None, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=LocalNumUint, program_page=None, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=LocalNumByteSlice, program_page=None, GREETING="tmpl2")) + let (compiled.approval_program.0#0: bytes, compiled.approval_program.1#0: bytes, compiled.clear_state_program.0#0: bytes, compiled.clear_state_program.1#0: bytes, compiled.extra_program_pages#0: uint64, compiled.global_uints#0: uint64, compiled.global_bytes#0: uint64, compiled.local_uints#0: uint64, compiled.local_bytes#0: uint64) = (compiled_contract('test_cases.compile.apps.HelloTmpl', field=ApprovalProgramPages, program_page=0, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ApprovalProgramPages, program_page=1, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ClearStateProgramPages, program_page=0, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ClearStateProgramPages, program_page=1, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=ExtraProgramPages, program_page=None, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=GlobalNumUint, program_page=None, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=GlobalNumByteSlice, program_page=None, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=LocalNumUint, program_page=None, GREETING="tmpl2"), compiled_contract('test_cases.compile.apps.HelloTmpl', field=LocalNumByteSlice, program_page=None, GREETING="tmpl2")) itxn_begin let inner_txn_params%0#0: itxn_field_set = itxn_field_set(0) let inner_txn_params%0%%param_Fee_idx_0#0: uint64 = 0u @@ -1614,21 +1614,21 @@ contract test_cases.compile.factory.HelloFactory: let inner_txn_params%0%%TypeEnum_length#0: uint64 = 1u let inner_txn_params%0%%param_ApplicationArgs_idx_0#0: bytes = method "create()void" let inner_txn_params%0%%ApplicationArgs_length#0: uint64 = 1u - let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.0#0 - let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.1#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.approval_program.0#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.approval_program.1#0 let inner_txn_params%0%%ApprovalProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.2#0 - let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.3#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.clear_state_program.0#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.clear_state_program.1#0 let inner_txn_params%0%%ClearStateProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ExtraProgramPages_idx_0#0: uint64 = compiled.4#0 + let inner_txn_params%0%%param_ExtraProgramPages_idx_0#0: uint64 = compiled.extra_program_pages#0 let inner_txn_params%0%%ExtraProgramPages_length#0: uint64 = 1u - let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.6#0 + let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.global_bytes#0 let inner_txn_params%0%%GlobalNumByteSlice_length#0: uint64 = 1u - let inner_txn_params%0%%param_GlobalNumUint_idx_0#0: uint64 = compiled.5#0 + let inner_txn_params%0%%param_GlobalNumUint_idx_0#0: uint64 = compiled.global_uints#0 let inner_txn_params%0%%GlobalNumUint_length#0: uint64 = 1u - let inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0: uint64 = compiled.8#0 + let inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0: uint64 = compiled.local_bytes#0 let inner_txn_params%0%%LocalNumByteSlice_length#0: uint64 = 1u - let inner_txn_params%0%%param_LocalNumUint_idx_0#0: uint64 = compiled.7#0 + let inner_txn_params%0%%param_LocalNumUint_idx_0#0: uint64 = compiled.local_uints#0 let inner_txn_params%0%%LocalNumUint_length#0: uint64 = 1u let inner_txn_params%0%%Sender_length#0: uint64 = 0u let inner_txn_params%0%%Note_length#0: uint64 = 0u @@ -1899,7 +1899,7 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_arc4_create_prfx() -> void: block@0: // L198 - let (compiled.0#0: bytes, compiled.1#0: bytes, compiled.2#0: bytes, compiled.3#0: bytes, compiled.4#0: uint64, compiled.5#0: uint64, compiled.6#0: uint64, compiled.7#0: uint64, compiled.8#0: uint64) = (compiled_contract('test_cases.compile.apps.HelloPrfx', field=ApprovalProgramPages, program_page=0, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ApprovalProgramPages, program_page=1, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ClearStateProgramPages, program_page=0, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ClearStateProgramPages, program_page=1, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ExtraProgramPages, program_page=None, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=GlobalNumUint, program_page=None, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=GlobalNumByteSlice, program_page=None, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=LocalNumUint, program_page=None, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=LocalNumByteSlice, program_page=None, PRFX_GREETING="prfx2")) + let (compiled.approval_program.0#0: bytes, compiled.approval_program.1#0: bytes, compiled.clear_state_program.0#0: bytes, compiled.clear_state_program.1#0: bytes, compiled.extra_program_pages#0: uint64, compiled.global_uints#0: uint64, compiled.global_bytes#0: uint64, compiled.local_uints#0: uint64, compiled.local_bytes#0: uint64) = (compiled_contract('test_cases.compile.apps.HelloPrfx', field=ApprovalProgramPages, program_page=0, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ApprovalProgramPages, program_page=1, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ClearStateProgramPages, program_page=0, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ClearStateProgramPages, program_page=1, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=ExtraProgramPages, program_page=None, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=GlobalNumUint, program_page=None, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=GlobalNumByteSlice, program_page=None, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=LocalNumUint, program_page=None, PRFX_GREETING="prfx2"), compiled_contract('test_cases.compile.apps.HelloPrfx', field=LocalNumByteSlice, program_page=None, PRFX_GREETING="prfx2")) itxn_begin let inner_txn_params%0#0: itxn_field_set = itxn_field_set(0) let inner_txn_params%0%%param_Fee_idx_0#0: uint64 = 0u @@ -1908,21 +1908,21 @@ contract test_cases.compile.factory.HelloFactory: let inner_txn_params%0%%TypeEnum_length#0: uint64 = 1u let inner_txn_params%0%%param_ApplicationArgs_idx_0#0: bytes = method "create()void" let inner_txn_params%0%%ApplicationArgs_length#0: uint64 = 1u - let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.0#0 - let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.1#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.approval_program.0#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.approval_program.1#0 let inner_txn_params%0%%ApprovalProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.2#0 - let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.3#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.clear_state_program.0#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.clear_state_program.1#0 let inner_txn_params%0%%ClearStateProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ExtraProgramPages_idx_0#0: uint64 = compiled.4#0 + let inner_txn_params%0%%param_ExtraProgramPages_idx_0#0: uint64 = compiled.extra_program_pages#0 let inner_txn_params%0%%ExtraProgramPages_length#0: uint64 = 1u - let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.6#0 + let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.global_bytes#0 let inner_txn_params%0%%GlobalNumByteSlice_length#0: uint64 = 1u - let inner_txn_params%0%%param_GlobalNumUint_idx_0#0: uint64 = compiled.5#0 + let inner_txn_params%0%%param_GlobalNumUint_idx_0#0: uint64 = compiled.global_uints#0 let inner_txn_params%0%%GlobalNumUint_length#0: uint64 = 1u - let inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0: uint64 = compiled.8#0 + let inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0: uint64 = compiled.local_bytes#0 let inner_txn_params%0%%LocalNumByteSlice_length#0: uint64 = 1u - let inner_txn_params%0%%param_LocalNumUint_idx_0#0: uint64 = compiled.7#0 + let inner_txn_params%0%%param_LocalNumUint_idx_0#0: uint64 = compiled.local_uints#0 let inner_txn_params%0%%LocalNumUint_length#0: uint64 = 1u let inner_txn_params%0%%Sender_length#0: uint64 = 0u let inner_txn_params%0%%Note_length#0: uint64 = 0u @@ -3281,7 +3281,7 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_abi_call_create_params() -> void: block@0: // L296 - let (compiled.0#0: bytes, compiled.1#0: bytes, compiled.2#0: bytes, compiled.3#0: bytes, compiled.4#0: uint64, compiled.5#0: uint64, compiled.6#0: uint64, compiled.7#0: uint64, compiled.8#0: uint64) = (compiled_contract('test_cases.compile.apps.Hello', field=ApprovalProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.Hello', field=ApprovalProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.Hello', field=ClearStateProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.Hello', field=ClearStateProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.Hello', field=ExtraProgramPages, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=GlobalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=GlobalNumByteSlice, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=LocalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=LocalNumByteSlice, program_page=None)) + let (compiled.approval_program.0#0: bytes, compiled.approval_program.1#0: bytes, compiled.clear_state_program.0#0: bytes, compiled.clear_state_program.1#0: bytes, compiled.extra_program_pages#0: uint64, compiled.global_uints#0: uint64, compiled.global_bytes#0: uint64, compiled.local_uints#0: uint64, compiled.local_bytes#0: uint64) = (compiled_contract('test_cases.compile.apps.Hello', field=ApprovalProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.Hello', field=ApprovalProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.Hello', field=ClearStateProgramPages, program_page=0), compiled_contract('test_cases.compile.apps.Hello', field=ClearStateProgramPages, program_page=1), compiled_contract('test_cases.compile.apps.Hello', field=ExtraProgramPages, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=GlobalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=GlobalNumByteSlice, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=LocalNumUint, program_page=None), compiled_contract('test_cases.compile.apps.Hello', field=LocalNumByteSlice, program_page=None)) itxn_begin let inner_txn_params%0#0: itxn_field_set = itxn_field_set(0) let inner_txn_params%0%%param_Fee_idx_0#0: uint64 = 0u @@ -3295,21 +3295,21 @@ contract test_cases.compile.factory.HelloFactory: let inner_txn_params%0%%param_ApplicationArgs_idx_0#0: bytes = method "create(string)void" let inner_txn_params%0%%param_ApplicationArgs_idx_1#0: bytes = encoded_value%0#0 let inner_txn_params%0%%ApplicationArgs_length#0: uint64 = 2u - let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.0#0 - let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.1#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0: bytes = compiled.approval_program.0#0 + let inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0: bytes = compiled.approval_program.1#0 let inner_txn_params%0%%ApprovalProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.2#0 - let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.3#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0: bytes = compiled.clear_state_program.0#0 + let inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0: bytes = compiled.clear_state_program.1#0 let inner_txn_params%0%%ClearStateProgramPages_length#0: uint64 = 2u - let inner_txn_params%0%%param_GlobalNumUint_idx_0#0: uint64 = compiled.5#0 + let inner_txn_params%0%%param_GlobalNumUint_idx_0#0: uint64 = compiled.global_uints#0 let inner_txn_params%0%%GlobalNumUint_length#0: uint64 = 1u - let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.6#0 + let inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0: uint64 = compiled.global_bytes#0 let inner_txn_params%0%%GlobalNumByteSlice_length#0: uint64 = 1u - let inner_txn_params%0%%param_LocalNumUint_idx_0#0: uint64 = compiled.7#0 + let inner_txn_params%0%%param_LocalNumUint_idx_0#0: uint64 = compiled.local_uints#0 let inner_txn_params%0%%LocalNumUint_length#0: uint64 = 1u - let inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0: uint64 = compiled.8#0 + let inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0: uint64 = compiled.local_bytes#0 let inner_txn_params%0%%LocalNumByteSlice_length#0: uint64 = 1u - let inner_txn_params%0%%param_ExtraProgramPages_idx_0#0: uint64 = compiled.4#0 + let inner_txn_params%0%%param_ExtraProgramPages_idx_0#0: uint64 = compiled.extra_program_pages#0 let inner_txn_params%0%%ExtraProgramPages_length#0: uint64 = 1u let inner_txn_params%0%%Sender_length#0: uint64 = 0u let inner_txn_params%0%%Note_length#0: uint64 = 0u diff --git a/test_cases/compile/out/HelloFactory.ssa.opt_pass_1.ir b/test_cases/compile/out/HelloFactory.ssa.opt_pass_1.ir index ea72a250cd..c1a56530e2 100644 --- a/test_cases/compile/out/HelloFactory.ssa.opt_pass_1.ir +++ b/test_cases/compile/out/HelloFactory.ssa.opt_pass_1.ir @@ -127,20 +127,20 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_compile_contract() -> void: block@0: // L30 - let compiled.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACRiAABQ4oAATEbQQBfggMEIN86VAQkN408BNCiggA2GgCOAwACABUAICOJMRkURDEYFEQ2GgFXAgCIAD8iiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAKkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQAoi/9niYoBASMoZUSAASBQi/9QiYoAACiAAGeJ - let compiled.1#0: bytes = - let compiled.2#0: bytes = CoEBQw== - let compiled.3#0: bytes = + let compiled.approval_program.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACRiAABQ4oAATEbQQBfggMEIN86VAQkN408BNCiggA2GgCOAwACABUAICOJMRkURDEYFEQ2GgFXAgCIAD8iiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAKkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQAoi/9niYoBASMoZUSAASBQi/9QiYoAACiAAGeJ + let compiled.approval_program.1#0: bytes = + let compiled.clear_state_program.0#0: bytes = CoEBQw== + let compiled.clear_state_program.1#0: bytes = itxn_begin let length%0#0: uint64 = 5u let as_bytes%0#0: bytes = (itob length%0#0) let length_uint16%0#0: bytes = ((extract 6 2) as_bytes%0#0) let encoded_value%0#0: bytes = (concat length_uint16%0#0 "hello") ((itxn_field GlobalNumByteSlice) 1u) - ((itxn_field ClearStateProgramPages) compiled.2#0) - ((itxn_field ClearStateProgramPages) compiled.3#0) - ((itxn_field ApprovalProgramPages) compiled.0#0) - ((itxn_field ApprovalProgramPages) compiled.1#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.0#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.1#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.0#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.1#0) ((itxn_field ApplicationArgs) method "create(string)void") ((itxn_field ApplicationArgs) encoded_value%0#0) ((itxn_field TypeEnum) appl) @@ -180,23 +180,23 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_compile_contract_tmpl() -> void: block@0: // L61 - let compiled.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACAiAABQ4oAATEbQQBWggMETFxhugQkN408BNCiggA2GgCOAwACAAwAFyOJMRkURDEYFEQiiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAIkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQEjKGVEgAEgUIv/UImKAAAogAR0bXBsZ4k= - let compiled.1#0: bytes = - let compiled.2#0: bytes = CoEBQw== - let compiled.3#0: bytes = - let compiled.5#0: uint64 = 0u - let compiled.6#0: uint64 = 1u - let compiled.7#0: uint64 = 0u - let compiled.8#0: uint64 = 0u - itxn_begin - ((itxn_field LocalNumByteSlice) compiled.8#0) - ((itxn_field LocalNumUint) compiled.7#0) - ((itxn_field GlobalNumByteSlice) compiled.6#0) - ((itxn_field GlobalNumUint) compiled.5#0) - ((itxn_field ClearStateProgramPages) compiled.2#0) - ((itxn_field ClearStateProgramPages) compiled.3#0) - ((itxn_field ApprovalProgramPages) compiled.0#0) - ((itxn_field ApprovalProgramPages) compiled.1#0) + let compiled.approval_program.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACAiAABQ4oAATEbQQBWggMETFxhugQkN408BNCiggA2GgCOAwACAAwAFyOJMRkURDEYFEQiiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAIkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQEjKGVEgAEgUIv/UImKAAAogAR0bXBsZ4k= + let compiled.approval_program.1#0: bytes = + let compiled.clear_state_program.0#0: bytes = CoEBQw== + let compiled.clear_state_program.1#0: bytes = + let compiled.global_uints#0: uint64 = 0u + let compiled.global_bytes#0: uint64 = 1u + let compiled.local_uints#0: uint64 = 0u + let compiled.local_bytes#0: uint64 = 0u + itxn_begin + ((itxn_field LocalNumByteSlice) compiled.local_bytes#0) + ((itxn_field LocalNumUint) compiled.local_uints#0) + ((itxn_field GlobalNumByteSlice) compiled.global_bytes#0) + ((itxn_field GlobalNumUint) compiled.global_uints#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.0#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.1#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.0#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.1#0) ((itxn_field ApplicationArgs) method "create()void") ((itxn_field TypeEnum) appl) ((itxn_field Fee) 0u) @@ -235,17 +235,17 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_compile_contract_prfx() -> void: block@0: // L96 - let compiled.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACAiAABQ4oAATEbQQBWggMETFxhugQkN408BNCiggA2GgCOAwACAAwAFyOJMRkURDEYFEQiiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAIkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQEjKGVEgAEgUIv/UImKAAAogAJoaWeJ - let compiled.1#0: bytes = - let compiled.2#0: bytes = CoEBQw== - let compiled.3#0: bytes = - let compiled.6#0: uint64 = 1u - itxn_begin - ((itxn_field GlobalNumByteSlice) compiled.6#0) - ((itxn_field ClearStateProgramPages) compiled.2#0) - ((itxn_field ClearStateProgramPages) compiled.3#0) - ((itxn_field ApprovalProgramPages) compiled.0#0) - ((itxn_field ApprovalProgramPages) compiled.1#0) + let compiled.approval_program.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACAiAABQ4oAATEbQQBWggMETFxhugQkN408BNCiggA2GgCOAwACAAwAFyOJMRkURDEYFEQiiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAIkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQEjKGVEgAEgUIv/UImKAAAogAJoaWeJ + let compiled.approval_program.1#0: bytes = + let compiled.clear_state_program.0#0: bytes = CoEBQw== + let compiled.clear_state_program.1#0: bytes = + let compiled.global_bytes#0: uint64 = 1u + itxn_begin + ((itxn_field GlobalNumByteSlice) compiled.global_bytes#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.0#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.1#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.0#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.1#0) ((itxn_field ApplicationArgs) method "create()void") ((itxn_field TypeEnum) appl) ((itxn_field Fee) 0u) @@ -284,19 +284,19 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_compile_contract_large() -> void: block@0: // L129 - let compiled.0#0: bytes = CiACAQCIAAFDigABMRtBADiCAgT15P1NBCQ3jTw2GgCOAgACABgjiTEZFEQxGESIACQWgAQVH3x1TFCwIokxGYEFEkQxGEQiiTEZQAAGMRgURCKJI4mKAAGIAAIViYoAAYCAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - let compiled.1#0: bytes = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIk= - let compiled.2#0: bytes = CoEBQw== - let compiled.3#0: bytes = - let compiled.4#0: uint64 = 2u - let compiled.6#0: uint64 = 0u + let compiled.approval_program.0#0: bytes = CiACAQCIAAFDigABMRtBADiCAgT15P1NBCQ3jTw2GgCOAgACABgjiTEZFEQxGESIACQWgAQVH3x1TFCwIokxGYEFEkQxGEQiiTEZQAAGMRgURCKJI4mKAAGIAAIViYoAAYCAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + let compiled.approval_program.1#0: bytes = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIk= + let compiled.clear_state_program.0#0: bytes = CoEBQw== + let compiled.clear_state_program.1#0: bytes = + let compiled.extra_program_pages#0: uint64 = 2u + let compiled.global_bytes#0: uint64 = 0u itxn_begin - ((itxn_field GlobalNumByteSlice) compiled.6#0) - ((itxn_field ExtraProgramPages) compiled.4#0) - ((itxn_field ClearStateProgramPages) compiled.2#0) - ((itxn_field ClearStateProgramPages) compiled.3#0) - ((itxn_field ApprovalProgramPages) compiled.0#0) - ((itxn_field ApprovalProgramPages) compiled.1#0) + ((itxn_field GlobalNumByteSlice) compiled.global_bytes#0) + ((itxn_field ExtraProgramPages) compiled.extra_program_pages#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.0#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.1#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.0#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.1#0) ((itxn_field TypeEnum) appl) ((itxn_field Fee) 0u) itxn_submit @@ -384,25 +384,25 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_arc4_create_tmpl() -> void: block@0: // L177 - let compiled.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACAiAABQ4oAATEbQQBWggMETFxhugQkN408BNCiggA2GgCOAwACAAwAFyOJMRkURDEYFEQiiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAIkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQEjKGVEgAEgUIv/UImKAAAogAR0bXBsZ4k= - let compiled.1#0: bytes = - let compiled.2#0: bytes = CoEBQw== - let compiled.3#0: bytes = - let compiled.4#0: uint64 = 0u - let compiled.5#0: uint64 = 0u - let compiled.6#0: uint64 = 1u - let compiled.7#0: uint64 = 0u - let compiled.8#0: uint64 = 0u - itxn_begin - ((itxn_field LocalNumUint) compiled.7#0) - ((itxn_field LocalNumByteSlice) compiled.8#0) - ((itxn_field GlobalNumUint) compiled.5#0) - ((itxn_field GlobalNumByteSlice) compiled.6#0) - ((itxn_field ExtraProgramPages) compiled.4#0) - ((itxn_field ClearStateProgramPages) compiled.2#0) - ((itxn_field ClearStateProgramPages) compiled.3#0) - ((itxn_field ApprovalProgramPages) compiled.0#0) - ((itxn_field ApprovalProgramPages) compiled.1#0) + let compiled.approval_program.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACAiAABQ4oAATEbQQBWggMETFxhugQkN408BNCiggA2GgCOAwACAAwAFyOJMRkURDEYFEQiiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAIkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQEjKGVEgAEgUIv/UImKAAAogAR0bXBsZ4k= + let compiled.approval_program.1#0: bytes = + let compiled.clear_state_program.0#0: bytes = CoEBQw== + let compiled.clear_state_program.1#0: bytes = + let compiled.extra_program_pages#0: uint64 = 0u + let compiled.global_uints#0: uint64 = 0u + let compiled.global_bytes#0: uint64 = 1u + let compiled.local_uints#0: uint64 = 0u + let compiled.local_bytes#0: uint64 = 0u + itxn_begin + ((itxn_field LocalNumUint) compiled.local_uints#0) + ((itxn_field LocalNumByteSlice) compiled.local_bytes#0) + ((itxn_field GlobalNumUint) compiled.global_uints#0) + ((itxn_field GlobalNumByteSlice) compiled.global_bytes#0) + ((itxn_field ExtraProgramPages) compiled.extra_program_pages#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.0#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.1#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.0#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.1#0) ((itxn_field ApplicationArgs) method "create()void") ((itxn_field TypeEnum) appl) ((itxn_field Fee) 0u) @@ -438,25 +438,25 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_arc4_create_prfx() -> void: block@0: // L198 - let compiled.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACAiAABQ4oAATEbQQBWggMETFxhugQkN408BNCiggA2GgCOAwACAAwAFyOJMRkURDEYFEQiiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAIkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQEjKGVEgAEgUIv/UImKAAAogAVwcmZ4MmeJ - let compiled.1#0: bytes = - let compiled.2#0: bytes = CoEBQw== - let compiled.3#0: bytes = - let compiled.4#0: uint64 = 0u - let compiled.5#0: uint64 = 0u - let compiled.6#0: uint64 = 1u - let compiled.7#0: uint64 = 0u - let compiled.8#0: uint64 = 0u - itxn_begin - ((itxn_field LocalNumUint) compiled.7#0) - ((itxn_field LocalNumByteSlice) compiled.8#0) - ((itxn_field GlobalNumUint) compiled.5#0) - ((itxn_field GlobalNumByteSlice) compiled.6#0) - ((itxn_field ExtraProgramPages) compiled.4#0) - ((itxn_field ClearStateProgramPages) compiled.2#0) - ((itxn_field ClearStateProgramPages) compiled.3#0) - ((itxn_field ApprovalProgramPages) compiled.0#0) - ((itxn_field ApprovalProgramPages) compiled.1#0) + let compiled.approval_program.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACAiAABQ4oAATEbQQBWggMETFxhugQkN408BNCiggA2GgCOAwACAAwAFyOJMRkURDEYFEQiiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAIkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQEjKGVEgAEgUIv/UImKAAAogAVwcmZ4MmeJ + let compiled.approval_program.1#0: bytes = + let compiled.clear_state_program.0#0: bytes = CoEBQw== + let compiled.clear_state_program.1#0: bytes = + let compiled.extra_program_pages#0: uint64 = 0u + let compiled.global_uints#0: uint64 = 0u + let compiled.global_bytes#0: uint64 = 1u + let compiled.local_uints#0: uint64 = 0u + let compiled.local_bytes#0: uint64 = 0u + itxn_begin + ((itxn_field LocalNumUint) compiled.local_uints#0) + ((itxn_field LocalNumByteSlice) compiled.local_bytes#0) + ((itxn_field GlobalNumUint) compiled.global_uints#0) + ((itxn_field GlobalNumByteSlice) compiled.global_bytes#0) + ((itxn_field ExtraProgramPages) compiled.extra_program_pages#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.0#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.1#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.0#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.1#0) ((itxn_field ApplicationArgs) method "create()void") ((itxn_field TypeEnum) appl) ((itxn_field Fee) 0u) @@ -678,29 +678,29 @@ contract test_cases.compile.factory.HelloFactory: subroutine test_cases.compile.factory.HelloFactory.test_abi_call_create_params() -> void: block@0: // L296 - let compiled.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACRiAABQ4oAATEbQQBfggMEIN86VAQkN408BNCiggA2GgCOAwACABUAICOJMRkURDEYFEQ2GgFXAgCIAD8iiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAKkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQAoi/9niYoBASMoZUSAASBQi/9QiYoAACiAAGeJ - let compiled.1#0: bytes = - let compiled.2#0: bytes = CoEBQw== - let compiled.3#0: bytes = - let compiled.4#0: uint64 = 0u - let compiled.5#0: uint64 = 0u - let compiled.6#0: uint64 = 1u - let compiled.7#0: uint64 = 0u - let compiled.8#0: uint64 = 0u + let compiled.approval_program.0#0: bytes = CiACAQAmAQhncmVldGluZzEYQAADiACRiAABQ4oAATEbQQBfggMEIN86VAQkN408BNCiggA2GgCOAwACABUAICOJMRkURDEYFEQ2GgFXAgCIAD8iiTEZgQUSRDEYRCKJMRkURDEYRDYaAVcCAIgAKkkVFlcGAkxQgAQVH3x1TFCwIomBBDEZjgEAAiOJMRhEIomKAQAoi/9niYoBASMoZUSAASBQi/9QiYoAACiAAGeJ + let compiled.approval_program.1#0: bytes = + let compiled.clear_state_program.0#0: bytes = CoEBQw== + let compiled.clear_state_program.1#0: bytes = + let compiled.extra_program_pages#0: uint64 = 0u + let compiled.global_uints#0: uint64 = 0u + let compiled.global_bytes#0: uint64 = 1u + let compiled.local_uints#0: uint64 = 0u + let compiled.local_bytes#0: uint64 = 0u itxn_begin let length%0#0: uint64 = 3u let as_bytes%0#0: bytes = (itob length%0#0) let length_uint16%0#0: bytes = ((extract 6 2) as_bytes%0#0) let encoded_value%0#0: bytes = (concat length_uint16%0#0 "hey") - ((itxn_field ExtraProgramPages) compiled.4#0) - ((itxn_field LocalNumByteSlice) compiled.8#0) - ((itxn_field LocalNumUint) compiled.7#0) - ((itxn_field GlobalNumByteSlice) compiled.6#0) - ((itxn_field GlobalNumUint) compiled.5#0) - ((itxn_field ClearStateProgramPages) compiled.2#0) - ((itxn_field ClearStateProgramPages) compiled.3#0) - ((itxn_field ApprovalProgramPages) compiled.0#0) - ((itxn_field ApprovalProgramPages) compiled.1#0) + ((itxn_field ExtraProgramPages) compiled.extra_program_pages#0) + ((itxn_field LocalNumByteSlice) compiled.local_bytes#0) + ((itxn_field LocalNumUint) compiled.local_uints#0) + ((itxn_field GlobalNumByteSlice) compiled.global_bytes#0) + ((itxn_field GlobalNumUint) compiled.global_uints#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.0#0) + ((itxn_field ClearStateProgramPages) compiled.clear_state_program.1#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.0#0) + ((itxn_field ApprovalProgramPages) compiled.approval_program.1#0) ((itxn_field ApplicationArgs) method "create(string)void") ((itxn_field ApplicationArgs) encoded_value%0#0) ((itxn_field TypeEnum) appl) diff --git a/test_cases/compile/out/module.awst b/test_cases/compile/out/module.awst index b018fe7a10..83b33903a3 100644 --- a/test_cases/compile/out/module.awst +++ b/test_cases/compile/out/module.awst @@ -126,13 +126,13 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_logicsig(): arc4.static_array { - return reinterpret_cast>(compiled_logicsig('test_cases.compile.apps.always_approve_sig', prefix=None, variables={})[0]) + return reinterpret_cast>(compiled_logicsig('test_cases.compile.apps.always_approve_sig', prefix=None, variables={}).account) } abimethod test_compile_contract(): void { - compiled: tuple = compiled_contract(test_cases.compile.apps.Hello,,, prefix=None, variables={}) - hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create(string)void"), reinterpret_cast(arc4_encode('hello', arc4.dynamic_array))), ApprovalProgramPages=(SINGLE_EVAL(id=0, source=(compiled[0], compiled[1]))[0], SINGLE_EVAL(id=0)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=1, source=(compiled[2], compiled[3]))[0], SINGLE_EVAL(id=1)[1]), GlobalNumByteSlice=1u)).CreatedApplicationID + compiled: algopy._compiled.CompiledContract = compiled_contract(test_cases.compile.apps.Hello,,, prefix=None, variables={}) + hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create(string)void"), reinterpret_cast(arc4_encode('hello', arc4.dynamic_array))), ApprovalProgramPages=(SINGLE_EVAL(id=0, source=compiled.approval_program)[0], SINGLE_EVAL(id=0)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=1, source=compiled.clear_state_program)[0], SINGLE_EVAL(id=1)[1]), GlobalNumByteSlice=1u)).CreatedApplicationID txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), reinterpret_cast(arc4_encode('world', arc4.dynamic_array))), ApplicationID=hello_app)) result: arc4.dynamic_array = checked_maybe((extract<4, 0>(SINGLE_EVAL(id=2, source=txn.LastLog)), extract<0, 4>(SINGLE_EVAL(id=2)) == hex<"151F7C75">)) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationID=hello_app, ApplicationArgs=(Method("delete()void")), OnCompletion=DeleteApplication)) @@ -142,8 +142,8 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_compile_contract_tmpl(): void { greeting: string = 'hey' - compiled: tuple = compiled_contract(test_cases.compile.apps.HelloTmpl,,, prefix=None, variables={'GREETING': greeting}) - hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=3, source=(compiled[0], compiled[1]))[0], SINGLE_EVAL(id=3)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=4, source=(compiled[2], compiled[3]))[0], SINGLE_EVAL(id=4)[1]), GlobalNumUint=compiled[5], GlobalNumByteSlice=compiled[6], LocalNumUint=compiled[7], LocalNumByteSlice=compiled[8])).CreatedApplicationID + compiled: algopy._compiled.CompiledContract = compiled_contract(test_cases.compile.apps.HelloTmpl,,, prefix=None, variables={'GREETING': greeting}) + hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=3, source=compiled.approval_program)[0], SINGLE_EVAL(id=3)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=4, source=compiled.clear_state_program)[0], SINGLE_EVAL(id=4)[1]), GlobalNumUint=compiled.global_uints, GlobalNumByteSlice=compiled.global_bytes, LocalNumUint=compiled.local_uints, LocalNumByteSlice=compiled.local_bytes)).CreatedApplicationID txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), reinterpret_cast(arc4_encode('world', arc4.dynamic_array))), ApplicationID=hello_app)) result: arc4.dynamic_array = checked_maybe((extract<4, 0>(SINGLE_EVAL(id=5, source=txn.LastLog)), extract<0, 4>(SINGLE_EVAL(id=5)) == hex<"151F7C75">)) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationID=hello_app, ApplicationArgs=(Method("delete()void")), OnCompletion=DeleteApplication)) @@ -152,8 +152,8 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_compile_contract_prfx(): void { - compiled: tuple = compiled_contract(test_cases.compile.apps.HelloPrfx,,, prefix='PRFX_', variables={'GREETING': 'hi'}) - hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=6, source=(compiled[0], compiled[1]))[0], SINGLE_EVAL(id=6)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=7, source=(compiled[2], compiled[3]))[0], SINGLE_EVAL(id=7)[1]), GlobalNumByteSlice=compiled[6])).CreatedApplicationID + compiled: algopy._compiled.CompiledContract = compiled_contract(test_cases.compile.apps.HelloPrfx,,, prefix='PRFX_', variables={'GREETING': 'hi'}) + hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=6, source=compiled.approval_program)[0], SINGLE_EVAL(id=6)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=7, source=compiled.clear_state_program)[0], SINGLE_EVAL(id=7)[1]), GlobalNumByteSlice=compiled.global_bytes)).CreatedApplicationID txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), reinterpret_cast(arc4_encode('world', arc4.dynamic_array))), ApplicationID=hello_app)) result: arc4.dynamic_array = checked_maybe((extract<4, 0>(SINGLE_EVAL(id=8, source=txn.LastLog)), extract<0, 4>(SINGLE_EVAL(id=8)) == hex<"151F7C75">)) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationID=hello_app, ApplicationArgs=(Method("delete()void")), OnCompletion=DeleteApplication)) @@ -162,8 +162,8 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_compile_contract_large(): void { - compiled: tuple = compiled_contract(test_cases.compile.apps.LargeProgram,,, prefix=None, variables={}) - hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApprovalProgramPages=(SINGLE_EVAL(id=9, source=(compiled[0], compiled[1]))[0], SINGLE_EVAL(id=9)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=10, source=(compiled[2], compiled[3]))[0], SINGLE_EVAL(id=10)[1]), ExtraProgramPages=compiled[4], GlobalNumByteSlice=compiled[6])).CreatedApplicationID + compiled: algopy._compiled.CompiledContract = compiled_contract(test_cases.compile.apps.LargeProgram,,, prefix=None, variables={}) + hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApprovalProgramPages=(SINGLE_EVAL(id=9, source=compiled.approval_program)[0], SINGLE_EVAL(id=9)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=10, source=compiled.clear_state_program)[0], SINGLE_EVAL(id=10)[1]), ExtraProgramPages=compiled.extra_program_pages, GlobalNumByteSlice=compiled.global_bytes)).CreatedApplicationID txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("get_big_bytes_length()uint64")), ApplicationID=hello_app)) result: arc4.uint64 = checked_maybe((extract<4, 0>(SINGLE_EVAL(id=11, source=txn.LastLog)), extract<0, 4>(SINGLE_EVAL(id=11)) == hex<"151F7C75">)) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationID=hello_app, ApplicationArgs=(Method("delete()void")), OnCompletion=DeleteApplication)) @@ -172,7 +172,7 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_arc4_create(): void { - hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create(string)void"), arc4_encode('hello', arc4.dynamic_array)), ApprovalProgramPages=(SINGLE_EVAL(id=13, source=(SINGLE_EVAL(id=12, source=compiled_contract(test_cases.compile.apps.Hello,,, prefix=None, variables={}))[0], SINGLE_EVAL(id=12)[1]))[0], SINGLE_EVAL(id=13)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=14, source=(SINGLE_EVAL(id=12)[2], SINGLE_EVAL(id=12)[3]))[0], SINGLE_EVAL(id=14)[1]), ExtraProgramPages=SINGLE_EVAL(id=12)[4], GlobalNumByteSlice=SINGLE_EVAL(id=12)[6], GlobalNumUint=SINGLE_EVAL(id=12)[5], LocalNumByteSlice=SINGLE_EVAL(id=12)[8], LocalNumUint=SINGLE_EVAL(id=12)[7])).CreatedApplicationID + hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create(string)void"), arc4_encode('hello', arc4.dynamic_array)), ApprovalProgramPages=(SINGLE_EVAL(id=13, source=SINGLE_EVAL(id=12, source=compiled_contract(test_cases.compile.apps.Hello,,, prefix=None, variables={})).approval_program)[0], SINGLE_EVAL(id=13)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=14, source=SINGLE_EVAL(id=12).clear_state_program)[0], SINGLE_EVAL(id=14)[1]), ExtraProgramPages=SINGLE_EVAL(id=12).extra_program_pages, GlobalNumByteSlice=SINGLE_EVAL(id=12).global_bytes, GlobalNumUint=SINGLE_EVAL(id=12).global_uints, LocalNumByteSlice=SINGLE_EVAL(id=12).local_bytes, LocalNumUint=SINGLE_EVAL(id=12).local_uints)).CreatedApplicationID (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=16, source=SINGLE_EVAL(id=15, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), arc4_encode('world', arc4.dynamic_array)), ApplicationID=hello_app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=16)) == hex<"151F7C75">)), string), SINGLE_EVAL(id=15)) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("delete()void")), ApplicationID=hello_app, OnCompletion=DeleteApplication)) assert(result == 'hello world') @@ -180,8 +180,8 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_arc4_create_tmpl(): void { - compiled: tuple = compiled_contract(test_cases.compile.apps.HelloTmpl,,, prefix=None, variables={'GREETING': 'tmpl2'}) - hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=17, source=(compiled[0], compiled[1]))[0], SINGLE_EVAL(id=17)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=18, source=(compiled[2], compiled[3]))[0], SINGLE_EVAL(id=18)[1]), ExtraProgramPages=compiled[4], GlobalNumByteSlice=compiled[6], GlobalNumUint=compiled[5], LocalNumByteSlice=compiled[8], LocalNumUint=compiled[7])).CreatedApplicationID + compiled: algopy._compiled.CompiledContract = compiled_contract(test_cases.compile.apps.HelloTmpl,,, prefix=None, variables={'GREETING': 'tmpl2'}) + hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=17, source=compiled.approval_program)[0], SINGLE_EVAL(id=17)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=18, source=compiled.clear_state_program)[0], SINGLE_EVAL(id=18)[1]), ExtraProgramPages=compiled.extra_program_pages, GlobalNumByteSlice=compiled.global_bytes, GlobalNumUint=compiled.global_uints, LocalNumByteSlice=compiled.local_bytes, LocalNumUint=compiled.local_uints)).CreatedApplicationID (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=20, source=SINGLE_EVAL(id=19, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), arc4_encode('world', arc4.dynamic_array)), ApplicationID=hello_app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=20)) == hex<"151F7C75">)), string), SINGLE_EVAL(id=19)) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("delete()void")), ApplicationID=hello_app, OnCompletion=DeleteApplication)) assert(result == 'tmpl2 world') @@ -189,8 +189,8 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_arc4_create_prfx(): void { - compiled: tuple = compiled_contract(test_cases.compile.apps.HelloPrfx,,, prefix='PRFX_', variables={'GREETING': 'prfx2'}) - hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=21, source=(compiled[0], compiled[1]))[0], SINGLE_EVAL(id=21)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=22, source=(compiled[2], compiled[3]))[0], SINGLE_EVAL(id=22)[1]), ExtraProgramPages=compiled[4], GlobalNumByteSlice=compiled[6], GlobalNumUint=compiled[5], LocalNumByteSlice=compiled[8], LocalNumUint=compiled[7])).CreatedApplicationID + compiled: algopy._compiled.CompiledContract = compiled_contract(test_cases.compile.apps.HelloPrfx,,, prefix='PRFX_', variables={'GREETING': 'prfx2'}) + hello_app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=21, source=compiled.approval_program)[0], SINGLE_EVAL(id=21)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=22, source=compiled.clear_state_program)[0], SINGLE_EVAL(id=22)[1]), ExtraProgramPages=compiled.extra_program_pages, GlobalNumByteSlice=compiled.global_bytes, GlobalNumUint=compiled.global_uints, LocalNumByteSlice=compiled.local_bytes, LocalNumUint=compiled.local_uints)).CreatedApplicationID (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=24, source=SINGLE_EVAL(id=23, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), arc4_encode('world', arc4.dynamic_array)), ApplicationID=hello_app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=24)) == hex<"151F7C75">)), string), SINGLE_EVAL(id=23)) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("delete()void")), ApplicationID=hello_app, OnCompletion=DeleteApplication)) assert(result == 'prfx2 world') @@ -198,7 +198,7 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_arc4_create_large(): void { - app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApprovalProgramPages=(SINGLE_EVAL(id=26, source=(SINGLE_EVAL(id=25, source=compiled_contract(test_cases.compile.apps.LargeProgram,,, prefix=None, variables={}))[0], SINGLE_EVAL(id=25)[1]))[0], SINGLE_EVAL(id=26)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=27, source=(SINGLE_EVAL(id=25)[2], SINGLE_EVAL(id=25)[3]))[0], SINGLE_EVAL(id=27)[1]), ExtraProgramPages=SINGLE_EVAL(id=25)[4], GlobalNumByteSlice=SINGLE_EVAL(id=25)[6], GlobalNumUint=SINGLE_EVAL(id=25)[5], LocalNumByteSlice=SINGLE_EVAL(id=25)[8], LocalNumUint=SINGLE_EVAL(id=25)[7])).CreatedApplicationID + app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApprovalProgramPages=(SINGLE_EVAL(id=26, source=SINGLE_EVAL(id=25, source=compiled_contract(test_cases.compile.apps.LargeProgram,,, prefix=None, variables={})).approval_program)[0], SINGLE_EVAL(id=26)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=27, source=SINGLE_EVAL(id=25).clear_state_program)[0], SINGLE_EVAL(id=27)[1]), ExtraProgramPages=SINGLE_EVAL(id=25).extra_program_pages, GlobalNumByteSlice=SINGLE_EVAL(id=25).global_bytes, GlobalNumUint=SINGLE_EVAL(id=25).global_uints, LocalNumByteSlice=SINGLE_EVAL(id=25).local_bytes, LocalNumUint=SINGLE_EVAL(id=25).local_uints)).CreatedApplicationID (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=29, source=SINGLE_EVAL(id=28, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("get_big_bytes_length()uint64")), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=29)) == hex<"151F7C75">)), uint64), SINGLE_EVAL(id=28)) assert(result == 4096u) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("delete()void")), ApplicationID=app, OnCompletion=DeleteApplication)) @@ -206,10 +206,10 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_arc4_update(): void { - app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=31, source=(SINGLE_EVAL(id=30, source=compiled_contract(test_cases.compile.apps.HelloTmpl,ExtraProgramPages=1u, GlobalNumByteSlice=2u, GlobalNumUint=2u, LocalNumByteSlice=2u, LocalNumUint=2u,, prefix=None, variables={'GREETING': 'hi'}))[0], SINGLE_EVAL(id=30)[1]))[0], SINGLE_EVAL(id=31)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=32, source=(SINGLE_EVAL(id=30)[2], SINGLE_EVAL(id=30)[3]))[0], SINGLE_EVAL(id=32)[1]), ExtraProgramPages=SINGLE_EVAL(id=30)[4], GlobalNumByteSlice=SINGLE_EVAL(id=30)[6], GlobalNumUint=SINGLE_EVAL(id=30)[5], LocalNumByteSlice=SINGLE_EVAL(id=30)[8], LocalNumUint=SINGLE_EVAL(id=30)[7])).CreatedApplicationID + app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()void")), ApprovalProgramPages=(SINGLE_EVAL(id=31, source=SINGLE_EVAL(id=30, source=compiled_contract(test_cases.compile.apps.HelloTmpl,ExtraProgramPages=1u, GlobalNumByteSlice=2u, GlobalNumUint=2u, LocalNumByteSlice=2u, LocalNumUint=2u,, prefix=None, variables={'GREETING': 'hi'})).approval_program)[0], SINGLE_EVAL(id=31)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=32, source=SINGLE_EVAL(id=30).clear_state_program)[0], SINGLE_EVAL(id=32)[1]), ExtraProgramPages=SINGLE_EVAL(id=30).extra_program_pages, GlobalNumByteSlice=SINGLE_EVAL(id=30).global_bytes, GlobalNumUint=SINGLE_EVAL(id=30).global_uints, LocalNumByteSlice=SINGLE_EVAL(id=30).local_bytes, LocalNumUint=SINGLE_EVAL(id=30).local_uints)).CreatedApplicationID (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=34, source=SINGLE_EVAL(id=33, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), arc4_encode('there', arc4.dynamic_array)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=34)) == hex<"151F7C75">)), string), SINGLE_EVAL(id=33)) assert(result == 'hi there') - submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationID=app, OnCompletion=UpdateApplication, ApprovalProgramPages=(SINGLE_EVAL(id=36, source=(SINGLE_EVAL(id=35, source=compiled_contract(test_cases.compile.apps.Hello,,, prefix=None, variables={}))[0], SINGLE_EVAL(id=35)[1]))[0], SINGLE_EVAL(id=36)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=37, source=(SINGLE_EVAL(id=35)[2], SINGLE_EVAL(id=35)[3]))[0], SINGLE_EVAL(id=37)[1]))) + submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationID=app, OnCompletion=UpdateApplication, ApprovalProgramPages=(SINGLE_EVAL(id=36, source=SINGLE_EVAL(id=35, source=compiled_contract(test_cases.compile.apps.Hello,,, prefix=None, variables={})).approval_program)[0], SINGLE_EVAL(id=36)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=37, source=SINGLE_EVAL(id=35).clear_state_program)[0], SINGLE_EVAL(id=37)[1]))) (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=39, source=SINGLE_EVAL(id=38, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), arc4_encode('there', arc4.dynamic_array)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=39)) == hex<"151F7C75">)), string), SINGLE_EVAL(id=38)) assert(result == 'hi there') submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("delete()void")), ApplicationID=app, OnCompletion=DeleteApplication)) @@ -217,7 +217,7 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_other_constants(): void { - app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()uint64")), ApprovalProgramPages=(SINGLE_EVAL(id=41, source=(SINGLE_EVAL(id=40, source=compiled_contract(test_cases.compile.apps.HelloOtherConstants,,, prefix=None, variables={'NUM': 5n, 'GREETING': 'hello', 'ACCOUNT': Address("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ"), 'METHOD': Method("something()void")}))[0], SINGLE_EVAL(id=40)[1]))[0], SINGLE_EVAL(id=41)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=42, source=(SINGLE_EVAL(id=40)[2], SINGLE_EVAL(id=40)[3]))[0], SINGLE_EVAL(id=42)[1]), ExtraProgramPages=SINGLE_EVAL(id=40)[4], GlobalNumByteSlice=SINGLE_EVAL(id=40)[6], GlobalNumUint=SINGLE_EVAL(id=40)[5], LocalNumByteSlice=SINGLE_EVAL(id=40)[8], LocalNumUint=SINGLE_EVAL(id=40)[7])).CreatedApplicationID + app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create()uint64")), ApprovalProgramPages=(SINGLE_EVAL(id=41, source=SINGLE_EVAL(id=40, source=compiled_contract(test_cases.compile.apps.HelloOtherConstants,,, prefix=None, variables={'NUM': 5n, 'GREETING': 'hello', 'ACCOUNT': Address("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ"), 'METHOD': Method("something()void")})).approval_program)[0], SINGLE_EVAL(id=41)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=42, source=SINGLE_EVAL(id=40).clear_state_program)[0], SINGLE_EVAL(id=42)[1]), ExtraProgramPages=SINGLE_EVAL(id=40).extra_program_pages, GlobalNumByteSlice=SINGLE_EVAL(id=40).global_bytes, GlobalNumUint=SINGLE_EVAL(id=40).global_uints, LocalNumByteSlice=SINGLE_EVAL(id=40).local_bytes, LocalNumUint=SINGLE_EVAL(id=40).local_uints)).CreatedApplicationID (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=44, source=SINGLE_EVAL(id=43, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)byte[]"), arc4_encode('Johnny', arc4.dynamic_array)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=44)) == hex<"151F7C75">)), bytes), SINGLE_EVAL(id=43)) assert(result == hex<"68656C6C6F204A6F686E6E7935"> + reinterpret_cast(global()) + Method("something()void")) submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("delete()void")), ApplicationID=app, OnCompletion=DeleteApplication)) @@ -225,8 +225,8 @@ contract HelloFactory extends (algopy.arc4.ARC4Contract) abimethod test_abi_call_create_params(): void { - compiled: tuple = compiled_contract(test_cases.compile.apps.Hello,,, prefix=None, variables={}) - app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create(string)void"), arc4_encode('hey', arc4.dynamic_array)), ApprovalProgramPages=(SINGLE_EVAL(id=45, source=(compiled[0], compiled[1]))[0], SINGLE_EVAL(id=45)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=46, source=(compiled[2], compiled[3]))[0], SINGLE_EVAL(id=46)[1]), GlobalNumUint=compiled[5], GlobalNumByteSlice=compiled[6], LocalNumUint=compiled[7], LocalNumByteSlice=compiled[8], ExtraProgramPages=compiled[4])).CreatedApplicationID + compiled: algopy._compiled.CompiledContract = compiled_contract(test_cases.compile.apps.Hello,,, prefix=None, variables={}) + app: application = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("create(string)void"), arc4_encode('hey', arc4.dynamic_array)), ApprovalProgramPages=(SINGLE_EVAL(id=45, source=compiled.approval_program)[0], SINGLE_EVAL(id=45)[1]), ClearStateProgramPages=(SINGLE_EVAL(id=46, source=compiled.clear_state_program)[0], SINGLE_EVAL(id=46)[1]), GlobalNumUint=compiled.global_uints, GlobalNumByteSlice=compiled.global_bytes, LocalNumUint=compiled.local_uints, LocalNumByteSlice=compiled.local_bytes, ExtraProgramPages=compiled.extra_program_pages)).CreatedApplicationID (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=48, source=SINGLE_EVAL(id=47, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("greet(string)string"), arc4_encode('there', arc4.dynamic_array)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=48)) == hex<"151F7C75">)), string), SINGLE_EVAL(id=47)) assert(result == 'hey there') submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("delete()void")), ApplicationID=app, OnCompletion=DeleteApplication)) diff --git a/test_cases/compile/puya.log b/test_cases/compile/puya.log index e7131b3b20..77d28ed82f 100644 --- a/test_cases/compile/puya.log +++ b/test_cases/compile/puya.log @@ -2618,14 +2618,14 @@ debug: Optimizer: Constant Replacer debug: Optimizer: Copy Propagation debug: Found equivalence set: encoded_value%0#0, inner_txn_params%0%%param_ApplicationArgs_idx_1#0 debug: Replacing {inner_txn_params%0%%param_ApplicationArgs_idx_1#0} with encoded_value%0#0 made 1 modifications -debug: Found equivalence set: compiled.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.0#0 made 1 modifications -debug: Found equivalence set: compiled.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.1#0 made 1 modifications -debug: Found equivalence set: compiled.2#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.2#0 made 1 modifications -debug: Found equivalence set: compiled.3#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.3#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.approval_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.approval_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.0#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.clear_state_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.1#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.clear_state_program.1#0 made 1 modifications debug: Found equivalence set: encoded_value%1#0, inner_txn_params%1%%param_ApplicationArgs_idx_1#0 debug: Replacing {inner_txn_params%1%%param_ApplicationArgs_idx_1#0} with encoded_value%1#0 made 1 modifications debug: Found equivalence set: hello_app#0, inner_txn_params%1%%param_ApplicationID_idx_0#0, inner_txn_params%2%%param_ApplicationID_idx_0#0 @@ -2637,11 +2637,11 @@ debug: Simplified (len "hello") to 5u debug: Simplified (len "world") to 5u debug: Simplified (len "hello world") to 11u debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.4#0 -debug: Removing unused variable compiled.5#0 -debug: Removing unused variable compiled.6#0 -debug: Removing unused variable compiled.7#0 -debug: Removing unused variable compiled.8#0 +debug: Removing unused variable compiled.extra_program_pages#0 +debug: Removing unused variable compiled.global_uints#0 +debug: Removing unused variable compiled.global_bytes#0 +debug: Removing unused variable compiled.local_uints#0 +debug: Removing unused variable compiled.local_bytes#0 debug: Removing unused variable inner_txn_params%0#0 debug: Removing unused variable inner_txn_params%0%%param_Fee_idx_0#0 debug: Removing unused variable inner_txn_params%0%%Fee_length#0 @@ -2888,22 +2888,22 @@ debug: Optimizing subroutine test_cases.compile.factory.HelloFactory.test_compil debug: Splitting parallel copies prior to optimization debug: Optimizer: Constant Replacer debug: Optimizer: Copy Propagation -debug: Found equivalence set: compiled.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.0#0 made 1 modifications -debug: Found equivalence set: compiled.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.1#0 made 1 modifications -debug: Found equivalence set: compiled.2#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.2#0 made 1 modifications -debug: Found equivalence set: compiled.3#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.3#0 made 1 modifications -debug: Found equivalence set: compiled.5#0, inner_txn_params%0%%param_GlobalNumUint_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumUint_idx_0#0} with compiled.5#0 made 1 modifications -debug: Found equivalence set: compiled.6#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.6#0 made 1 modifications -debug: Found equivalence set: compiled.7#0, inner_txn_params%0%%param_LocalNumUint_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_LocalNumUint_idx_0#0} with compiled.7#0 made 1 modifications -debug: Found equivalence set: compiled.8#0, inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0} with compiled.8#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.approval_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.approval_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.0#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.clear_state_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.1#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.clear_state_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.global_uints#0, inner_txn_params%0%%param_GlobalNumUint_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumUint_idx_0#0} with compiled.global_uints#0 made 1 modifications +debug: Found equivalence set: compiled.global_bytes#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.global_bytes#0 made 1 modifications +debug: Found equivalence set: compiled.local_uints#0, inner_txn_params%0%%param_LocalNumUint_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_LocalNumUint_idx_0#0} with compiled.local_uints#0 made 1 modifications +debug: Found equivalence set: compiled.local_bytes#0, inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0} with compiled.local_bytes#0 made 1 modifications debug: Found equivalence set: encoded_value%0#0, inner_txn_params%1%%param_ApplicationArgs_idx_1#0 debug: Replacing {inner_txn_params%1%%param_ApplicationArgs_idx_1#0} with encoded_value%0#0 made 1 modifications debug: Found equivalence set: hello_app#0, inner_txn_params%1%%param_ApplicationID_idx_0#0, inner_txn_params%2%%param_ApplicationID_idx_0#0 @@ -2915,7 +2915,7 @@ debug: Simplified (len "world") to 5u debug: Simplified (len "hey world") to 9u debug: Optimizer: Remove Unused Variables debug: Removing unused variable greeting#0 -debug: Removing unused variable compiled.4#0 +debug: Removing unused variable compiled.extra_program_pages#0 debug: Removing unused variable inner_txn_params%0#0 debug: Removing unused variable inner_txn_params%0%%param_Fee_idx_0#0 debug: Removing unused variable inner_txn_params%0%%Fee_length#0 @@ -3161,16 +3161,16 @@ debug: Optimizing subroutine test_cases.compile.factory.HelloFactory.test_compil debug: Splitting parallel copies prior to optimization debug: Optimizer: Constant Replacer debug: Optimizer: Copy Propagation -debug: Found equivalence set: compiled.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.0#0 made 1 modifications -debug: Found equivalence set: compiled.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.1#0 made 1 modifications -debug: Found equivalence set: compiled.2#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.2#0 made 1 modifications -debug: Found equivalence set: compiled.3#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.3#0 made 1 modifications -debug: Found equivalence set: compiled.6#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.6#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.approval_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.approval_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.0#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.clear_state_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.1#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.clear_state_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.global_bytes#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.global_bytes#0 made 1 modifications debug: Found equivalence set: encoded_value%0#0, inner_txn_params%1%%param_ApplicationArgs_idx_1#0 debug: Replacing {inner_txn_params%1%%param_ApplicationArgs_idx_1#0} with encoded_value%0#0 made 1 modifications debug: Found equivalence set: hello_app#0, inner_txn_params%1%%param_ApplicationID_idx_0#0, inner_txn_params%2%%param_ApplicationID_idx_0#0 @@ -3181,10 +3181,10 @@ debug: Optimizer: Intrinsic Simplifier debug: Simplified (len "world") to 5u debug: Simplified (len "hi world") to 8u debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.4#0 -debug: Removing unused variable compiled.5#0 -debug: Removing unused variable compiled.7#0 -debug: Removing unused variable compiled.8#0 +debug: Removing unused variable compiled.extra_program_pages#0 +debug: Removing unused variable compiled.global_uints#0 +debug: Removing unused variable compiled.local_uints#0 +debug: Removing unused variable compiled.local_bytes#0 debug: Removing unused variable inner_txn_params%0#0 debug: Removing unused variable inner_txn_params%0%%param_Fee_idx_0#0 debug: Removing unused variable inner_txn_params%0%%Fee_length#0 @@ -3430,27 +3430,27 @@ debug: Optimizing subroutine test_cases.compile.factory.HelloFactory.test_compil debug: Splitting parallel copies prior to optimization debug: Optimizer: Constant Replacer debug: Optimizer: Copy Propagation -debug: Found equivalence set: compiled.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.0#0 made 1 modifications -debug: Found equivalence set: compiled.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.1#0 made 1 modifications -debug: Found equivalence set: compiled.2#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.2#0 made 1 modifications -debug: Found equivalence set: compiled.3#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.3#0 made 1 modifications -debug: Found equivalence set: compiled.4#0, inner_txn_params%0%%param_ExtraProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ExtraProgramPages_idx_0#0} with compiled.4#0 made 1 modifications -debug: Found equivalence set: compiled.6#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.6#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.approval_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.approval_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.0#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.clear_state_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.1#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.clear_state_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.extra_program_pages#0, inner_txn_params%0%%param_ExtraProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ExtraProgramPages_idx_0#0} with compiled.extra_program_pages#0 made 1 modifications +debug: Found equivalence set: compiled.global_bytes#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.global_bytes#0 made 1 modifications debug: Found equivalence set: hello_app#0, inner_txn_params%1%%param_ApplicationID_idx_0#0, inner_txn_params%2%%param_ApplicationID_idx_0#0 debug: Replacing {inner_txn_params%1%%param_ApplicationID_idx_0#0, inner_txn_params%2%%param_ApplicationID_idx_0#0} with hello_app#0 made 2 modifications debug: Found equivalence set: tmp%0#0, result#0, reinterpret_biguint%0#0 debug: Replacing {tmp%0#0, reinterpret_biguint%0#0} with result#0 made 2 modifications debug: Optimizer: Intrinsic Simplifier debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.5#0 -debug: Removing unused variable compiled.7#0 -debug: Removing unused variable compiled.8#0 +debug: Removing unused variable compiled.global_uints#0 +debug: Removing unused variable compiled.local_uints#0 +debug: Removing unused variable compiled.local_bytes#0 debug: Removing unused variable inner_txn_params%0#0 debug: Removing unused variable inner_txn_params%0%%param_Fee_idx_0#0 debug: Removing unused variable inner_txn_params%0%%Fee_length#0 @@ -3954,24 +3954,24 @@ debug: Optimizing subroutine test_cases.compile.factory.HelloFactory.test_arc4_c debug: Splitting parallel copies prior to optimization debug: Optimizer: Constant Replacer debug: Optimizer: Copy Propagation -debug: Found equivalence set: compiled.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.0#0 made 1 modifications -debug: Found equivalence set: compiled.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.1#0 made 1 modifications -debug: Found equivalence set: compiled.2#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.2#0 made 1 modifications -debug: Found equivalence set: compiled.3#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.3#0 made 1 modifications -debug: Found equivalence set: compiled.4#0, inner_txn_params%0%%param_ExtraProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ExtraProgramPages_idx_0#0} with compiled.4#0 made 1 modifications -debug: Found equivalence set: compiled.6#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.6#0 made 1 modifications -debug: Found equivalence set: compiled.5#0, inner_txn_params%0%%param_GlobalNumUint_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumUint_idx_0#0} with compiled.5#0 made 1 modifications -debug: Found equivalence set: compiled.8#0, inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0} with compiled.8#0 made 1 modifications -debug: Found equivalence set: compiled.7#0, inner_txn_params%0%%param_LocalNumUint_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_LocalNumUint_idx_0#0} with compiled.7#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.approval_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.approval_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.0#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.clear_state_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.1#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.clear_state_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.extra_program_pages#0, inner_txn_params%0%%param_ExtraProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ExtraProgramPages_idx_0#0} with compiled.extra_program_pages#0 made 1 modifications +debug: Found equivalence set: compiled.global_bytes#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.global_bytes#0 made 1 modifications +debug: Found equivalence set: compiled.global_uints#0, inner_txn_params%0%%param_GlobalNumUint_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumUint_idx_0#0} with compiled.global_uints#0 made 1 modifications +debug: Found equivalence set: compiled.local_bytes#0, inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0} with compiled.local_bytes#0 made 1 modifications +debug: Found equivalence set: compiled.local_uints#0, inner_txn_params%0%%param_LocalNumUint_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_LocalNumUint_idx_0#0} with compiled.local_uints#0 made 1 modifications debug: Found equivalence set: encoded_value%0#0, inner_txn_params%1%%param_ApplicationArgs_idx_1#0 debug: Replacing {inner_txn_params%1%%param_ApplicationArgs_idx_1#0} with encoded_value%0#0 made 1 modifications debug: Found equivalence set: hello_app#0, inner_txn_params%1%%param_ApplicationID_idx_0#0, inner_txn_params%2%%param_ApplicationID_idx_0#0 @@ -4227,24 +4227,24 @@ debug: Optimizing subroutine test_cases.compile.factory.HelloFactory.test_arc4_c debug: Splitting parallel copies prior to optimization debug: Optimizer: Constant Replacer debug: Optimizer: Copy Propagation -debug: Found equivalence set: compiled.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.0#0 made 1 modifications -debug: Found equivalence set: compiled.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.1#0 made 1 modifications -debug: Found equivalence set: compiled.2#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.2#0 made 1 modifications -debug: Found equivalence set: compiled.3#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.3#0 made 1 modifications -debug: Found equivalence set: compiled.4#0, inner_txn_params%0%%param_ExtraProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ExtraProgramPages_idx_0#0} with compiled.4#0 made 1 modifications -debug: Found equivalence set: compiled.6#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.6#0 made 1 modifications -debug: Found equivalence set: compiled.5#0, inner_txn_params%0%%param_GlobalNumUint_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumUint_idx_0#0} with compiled.5#0 made 1 modifications -debug: Found equivalence set: compiled.8#0, inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0} with compiled.8#0 made 1 modifications -debug: Found equivalence set: compiled.7#0, inner_txn_params%0%%param_LocalNumUint_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_LocalNumUint_idx_0#0} with compiled.7#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.approval_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.approval_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.0#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.clear_state_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.1#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.clear_state_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.extra_program_pages#0, inner_txn_params%0%%param_ExtraProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ExtraProgramPages_idx_0#0} with compiled.extra_program_pages#0 made 1 modifications +debug: Found equivalence set: compiled.global_bytes#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.global_bytes#0 made 1 modifications +debug: Found equivalence set: compiled.global_uints#0, inner_txn_params%0%%param_GlobalNumUint_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumUint_idx_0#0} with compiled.global_uints#0 made 1 modifications +debug: Found equivalence set: compiled.local_bytes#0, inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0} with compiled.local_bytes#0 made 1 modifications +debug: Found equivalence set: compiled.local_uints#0, inner_txn_params%0%%param_LocalNumUint_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_LocalNumUint_idx_0#0} with compiled.local_uints#0 made 1 modifications debug: Found equivalence set: encoded_value%0#0, inner_txn_params%1%%param_ApplicationArgs_idx_1#0 debug: Replacing {inner_txn_params%1%%param_ApplicationArgs_idx_1#0} with encoded_value%0#0 made 1 modifications debug: Found equivalence set: hello_app#0, inner_txn_params%1%%param_ApplicationID_idx_0#0, inner_txn_params%2%%param_ApplicationID_idx_0#0 @@ -5452,24 +5452,24 @@ debug: Optimizer: Constant Replacer debug: Optimizer: Copy Propagation debug: Found equivalence set: encoded_value%0#0, inner_txn_params%0%%param_ApplicationArgs_idx_1#0 debug: Replacing {inner_txn_params%0%%param_ApplicationArgs_idx_1#0} with encoded_value%0#0 made 1 modifications -debug: Found equivalence set: compiled.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.0#0 made 1 modifications -debug: Found equivalence set: compiled.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.1#0 made 1 modifications -debug: Found equivalence set: compiled.2#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.2#0 made 1 modifications -debug: Found equivalence set: compiled.3#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 -debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.3#0 made 1 modifications -debug: Found equivalence set: compiled.5#0, inner_txn_params%0%%param_GlobalNumUint_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumUint_idx_0#0} with compiled.5#0 made 1 modifications -debug: Found equivalence set: compiled.6#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.6#0 made 1 modifications -debug: Found equivalence set: compiled.7#0, inner_txn_params%0%%param_LocalNumUint_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_LocalNumUint_idx_0#0} with compiled.7#0 made 1 modifications -debug: Found equivalence set: compiled.8#0, inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0} with compiled.8#0 made 1 modifications -debug: Found equivalence set: compiled.4#0, inner_txn_params%0%%param_ExtraProgramPages_idx_0#0 -debug: Replacing {inner_txn_params%0%%param_ExtraProgramPages_idx_0#0} with compiled.4#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.0#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_0#0} with compiled.approval_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.approval_program.1#0, inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ApprovalProgramPages_idx_1#0} with compiled.approval_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.0#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_0#0} with compiled.clear_state_program.0#0 made 1 modifications +debug: Found equivalence set: compiled.clear_state_program.1#0, inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0 +debug: Replacing {inner_txn_params%0%%param_ClearStateProgramPages_idx_1#0} with compiled.clear_state_program.1#0 made 1 modifications +debug: Found equivalence set: compiled.global_uints#0, inner_txn_params%0%%param_GlobalNumUint_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumUint_idx_0#0} with compiled.global_uints#0 made 1 modifications +debug: Found equivalence set: compiled.global_bytes#0, inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_GlobalNumByteSlice_idx_0#0} with compiled.global_bytes#0 made 1 modifications +debug: Found equivalence set: compiled.local_uints#0, inner_txn_params%0%%param_LocalNumUint_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_LocalNumUint_idx_0#0} with compiled.local_uints#0 made 1 modifications +debug: Found equivalence set: compiled.local_bytes#0, inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_LocalNumByteSlice_idx_0#0} with compiled.local_bytes#0 made 1 modifications +debug: Found equivalence set: compiled.extra_program_pages#0, inner_txn_params%0%%param_ExtraProgramPages_idx_0#0 +debug: Replacing {inner_txn_params%0%%param_ExtraProgramPages_idx_0#0} with compiled.extra_program_pages#0 made 1 modifications debug: Found equivalence set: encoded_value%1#0, inner_txn_params%1%%param_ApplicationArgs_idx_1#0 debug: Replacing {inner_txn_params%1%%param_ApplicationArgs_idx_1#0} with encoded_value%1#0 made 1 modifications debug: Found equivalence set: app#0, inner_txn_params%1%%param_ApplicationID_idx_0#0, inner_txn_params%2%%param_ApplicationID_idx_0#0 @@ -5799,10 +5799,10 @@ debug: Simplified ((extract 6 2) as_bytes%0#0) to 0x0005 debug: Simplified ((extract 6 2) as_bytes%1#0) to 0x0005 debug: Simplified ((extract 6 2) as_bytes%2#0) to 0x000b debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.0#0 -debug: Removing unused variable compiled.1#0 -debug: Removing unused variable compiled.2#0 -debug: Removing unused variable compiled.3#0 +debug: Removing unused variable compiled.approval_program.0#0 +debug: Removing unused variable compiled.approval_program.1#0 +debug: Removing unused variable compiled.clear_state_program.0#0 +debug: Removing unused variable compiled.clear_state_program.1#0 debug: Removing unused variable length%0#0 debug: Removing unused variable as_bytes%0#0 debug: Removing unused variable length%1#0 @@ -5824,14 +5824,14 @@ debug: Optimizer: Intrinsic Simplifier debug: Simplified ((extract 6 2) as_bytes%0#0) to 0x0005 debug: Simplified ((extract 6 2) as_bytes%1#0) to 0x0009 debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.0#0 -debug: Removing unused variable compiled.1#0 -debug: Removing unused variable compiled.2#0 -debug: Removing unused variable compiled.3#0 -debug: Removing unused variable compiled.5#0 -debug: Removing unused variable compiled.6#0 -debug: Removing unused variable compiled.7#0 -debug: Removing unused variable compiled.8#0 +debug: Removing unused variable compiled.approval_program.0#0 +debug: Removing unused variable compiled.approval_program.1#0 +debug: Removing unused variable compiled.clear_state_program.0#0 +debug: Removing unused variable compiled.clear_state_program.1#0 +debug: Removing unused variable compiled.global_uints#0 +debug: Removing unused variable compiled.global_bytes#0 +debug: Removing unused variable compiled.local_uints#0 +debug: Removing unused variable compiled.local_bytes#0 debug: Removing unused variable length%0#0 debug: Removing unused variable as_bytes%0#0 debug: Removing unused variable length%1#0 @@ -5851,11 +5851,11 @@ debug: Optimizer: Intrinsic Simplifier debug: Simplified ((extract 6 2) as_bytes%0#0) to 0x0005 debug: Simplified ((extract 6 2) as_bytes%1#0) to 0x0008 debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.0#0 -debug: Removing unused variable compiled.1#0 -debug: Removing unused variable compiled.2#0 -debug: Removing unused variable compiled.3#0 -debug: Removing unused variable compiled.6#0 +debug: Removing unused variable compiled.approval_program.0#0 +debug: Removing unused variable compiled.approval_program.1#0 +debug: Removing unused variable compiled.clear_state_program.0#0 +debug: Removing unused variable compiled.clear_state_program.1#0 +debug: Removing unused variable compiled.global_bytes#0 debug: Removing unused variable length%0#0 debug: Removing unused variable as_bytes%0#0 debug: Removing unused variable length%1#0 @@ -5873,12 +5873,12 @@ debug: Optimizer: Constant Replacer debug: Optimizer: Copy Propagation debug: Optimizer: Intrinsic Simplifier debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.0#0 -debug: Removing unused variable compiled.1#0 -debug: Removing unused variable compiled.2#0 -debug: Removing unused variable compiled.3#0 -debug: Removing unused variable compiled.4#0 -debug: Removing unused variable compiled.6#0 +debug: Removing unused variable compiled.approval_program.0#0 +debug: Removing unused variable compiled.approval_program.1#0 +debug: Removing unused variable compiled.clear_state_program.0#0 +debug: Removing unused variable compiled.clear_state_program.1#0 +debug: Removing unused variable compiled.extra_program_pages#0 +debug: Removing unused variable compiled.global_bytes#0 debug: Optimizer: Inner Txn Field Replacer debug: Optimizer: Replace Compiled References debug: Optimizer: Simplify Control Ops @@ -5921,15 +5921,15 @@ debug: Optimizer: Copy Propagation debug: Optimizer: Intrinsic Simplifier debug: Simplified ((extract 6 2) as_bytes%0#0) to 0x0005 debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.0#0 -debug: Removing unused variable compiled.1#0 -debug: Removing unused variable compiled.2#0 -debug: Removing unused variable compiled.3#0 -debug: Removing unused variable compiled.4#0 -debug: Removing unused variable compiled.5#0 -debug: Removing unused variable compiled.6#0 -debug: Removing unused variable compiled.7#0 -debug: Removing unused variable compiled.8#0 +debug: Removing unused variable compiled.approval_program.0#0 +debug: Removing unused variable compiled.approval_program.1#0 +debug: Removing unused variable compiled.clear_state_program.0#0 +debug: Removing unused variable compiled.clear_state_program.1#0 +debug: Removing unused variable compiled.extra_program_pages#0 +debug: Removing unused variable compiled.global_uints#0 +debug: Removing unused variable compiled.global_bytes#0 +debug: Removing unused variable compiled.local_uints#0 +debug: Removing unused variable compiled.local_bytes#0 debug: Removing unused variable length%0#0 debug: Removing unused variable as_bytes%0#0 debug: Optimizer: Inner Txn Field Replacer @@ -5946,15 +5946,15 @@ debug: Optimizer: Copy Propagation debug: Optimizer: Intrinsic Simplifier debug: Simplified ((extract 6 2) as_bytes%0#0) to 0x0005 debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.0#0 -debug: Removing unused variable compiled.1#0 -debug: Removing unused variable compiled.2#0 -debug: Removing unused variable compiled.3#0 -debug: Removing unused variable compiled.4#0 -debug: Removing unused variable compiled.5#0 -debug: Removing unused variable compiled.6#0 -debug: Removing unused variable compiled.7#0 -debug: Removing unused variable compiled.8#0 +debug: Removing unused variable compiled.approval_program.0#0 +debug: Removing unused variable compiled.approval_program.1#0 +debug: Removing unused variable compiled.clear_state_program.0#0 +debug: Removing unused variable compiled.clear_state_program.1#0 +debug: Removing unused variable compiled.extra_program_pages#0 +debug: Removing unused variable compiled.global_uints#0 +debug: Removing unused variable compiled.global_bytes#0 +debug: Removing unused variable compiled.local_uints#0 +debug: Removing unused variable compiled.local_bytes#0 debug: Removing unused variable length%0#0 debug: Removing unused variable as_bytes%0#0 debug: Optimizer: Inner Txn Field Replacer @@ -6047,15 +6047,15 @@ debug: Optimizer: Intrinsic Simplifier debug: Simplified ((extract 6 2) as_bytes%0#0) to 0x0003 debug: Simplified ((extract 6 2) as_bytes%1#0) to 0x0005 debug: Optimizer: Remove Unused Variables -debug: Removing unused variable compiled.0#0 -debug: Removing unused variable compiled.1#0 -debug: Removing unused variable compiled.2#0 -debug: Removing unused variable compiled.3#0 -debug: Removing unused variable compiled.4#0 -debug: Removing unused variable compiled.5#0 -debug: Removing unused variable compiled.6#0 -debug: Removing unused variable compiled.7#0 -debug: Removing unused variable compiled.8#0 +debug: Removing unused variable compiled.approval_program.0#0 +debug: Removing unused variable compiled.approval_program.1#0 +debug: Removing unused variable compiled.clear_state_program.0#0 +debug: Removing unused variable compiled.clear_state_program.1#0 +debug: Removing unused variable compiled.extra_program_pages#0 +debug: Removing unused variable compiled.global_uints#0 +debug: Removing unused variable compiled.global_bytes#0 +debug: Removing unused variable compiled.local_uints#0 +debug: Removing unused variable compiled.local_bytes#0 debug: Removing unused variable length%0#0 debug: Removing unused variable as_bytes%0#0 debug: Removing unused variable length%1#0 diff --git a/test_cases/typed_abi_call/out/module.awst b/test_cases/typed_abi_call/out/module.awst index 3d5a3087cb..3db542d28d 100644 --- a/test_cases/typed_abi_call/out/module.awst +++ b/test_cases/typed_abi_call/out/module.awst @@ -282,9 +282,9 @@ contract Greeter extends (algopy.arc4.ARC4Contract) abimethod test_named_tuples(app: application): void { - (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=74, source=SINGLE_EVAL(id=73, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("logs_are_equal((uint64,string),(uint64,string))bool"), new test_cases.typed_abi_call.logger.LogMessage(level=arc4_encode((1u, 'log 1')[0], arc4.uint64), message=arc4_encode((1u, 'log 1')[1], arc4.dynamic_array)), new test_cases.typed_abi_call.logger.LogMessage(level=arc4_encode((1u, 'log 1')[0], arc4.uint64), message=arc4_encode((1u, 'log 1')[1], arc4.dynamic_array))), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=74)) == hex<"151F7C75">)), bool), SINGLE_EVAL(id=73)) + (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=75, source=SINGLE_EVAL(id=74, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("logs_are_equal((uint64,string),(uint64,string))bool"), new test_cases.typed_abi_call.logger.LogMessage(level=arc4_encode(1u, arc4.uint64), message=arc4_encode('log 1', arc4.dynamic_array)), new test_cases.typed_abi_call.logger.LogMessage(level=arc4_encode(SINGLE_EVAL(id=73, source=(1u, 'log 1'))[0], arc4.uint64), message=arc4_encode(SINGLE_EVAL(id=73)[1], arc4.dynamic_array))), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=75)) == hex<"151F7C75">)), bool), SINGLE_EVAL(id=74)) assert(result) - (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=76, source=SINGLE_EVAL(id=75, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("logs_are_equal((uint64,string),(uint64,string))bool"), new test_cases.typed_abi_call.logger.LogMessage(level=arc4_encode((2u, 'log 2')[0], arc4.uint64), message=arc4_encode((2u, 'log 2')[1], arc4.dynamic_array)), new test_cases.typed_abi_call.logger.LogMessage(level=arc4_encode((1u, 'log 1')[0], arc4.uint64), message=arc4_encode((1u, 'log 1')[1], arc4.dynamic_array))), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=76)) == hex<"151F7C75">)), bool), SINGLE_EVAL(id=75)) + (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=78, source=SINGLE_EVAL(id=77, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("logs_are_equal((uint64,string),(uint64,string))bool"), new test_cases.typed_abi_call.logger.LogMessage(level=arc4_encode(2u, arc4.uint64), message=arc4_encode('log 2', arc4.dynamic_array)), new test_cases.typed_abi_call.logger.LogMessage(level=arc4_encode(SINGLE_EVAL(id=76, source=(1u, 'log 1'))[0], arc4.uint64), message=arc4_encode(SINGLE_EVAL(id=76)[1], arc4.dynamic_array))), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=78)) == hex<"151F7C75">)), bool), SINGLE_EVAL(id=77)) assert(!(result)) } } \ No newline at end of file diff --git a/test_cases/typed_abi_call/puya.log b/test_cases/typed_abi_call/puya.log index 289bdc014a..1916158674 100644 --- a/test_cases/typed_abi_call/puya.log +++ b/test_cases/typed_abi_call/puya.log @@ -9635,8 +9635,8 @@ debug: Merged linear block@2: // next_txn_L348 into block@0: // L339 debug: Optimizer: Remove Empty Blocks debug: Optimizer: Remove Unreachable Blocks debug: Optimizer: Repeated Expression Elimination -debug: Replacing redundant declaration let val_as_bytes%1#0: bytes = (itob 1u) with copy of existing registers (Register(source_location=typed_abi_call/typed_c2c.py:343:12-40, ir_type=bytes, name='val_as_bytes%0', version=0),) -debug: Replacing redundant declaration let val_as_bytes%3#0: bytes = (itob 1u) with copy of existing registers (Register(source_location=typed_abi_call/typed_c2c.py:343:12-40, ir_type=bytes, name='val_as_bytes%0', version=0),) +debug: Replacing redundant declaration let val_as_bytes%1#0: bytes = (itob 1u) with copy of existing registers (Register(source_location=typed_abi_call/typed_c2c.py:343:13-22, ir_type=bytes, name='val_as_bytes%0', version=0),) +debug: Replacing redundant declaration let val_as_bytes%3#0: bytes = (itob 1u) with copy of existing registers (Register(source_location=typed_abi_call/typed_c2c.py:343:13-22, ir_type=bytes, name='val_as_bytes%0', version=0),) debug: Found equivalence set: val_as_bytes%0#0, encoded_tuple_buffer%1#0, val_as_bytes%1#0, encoded_tuple_buffer%5#0, val_as_bytes%3#0, encoded_tuple_buffer%13#0 debug: Replacing {encoded_tuple_buffer%1#0, val_as_bytes%1#0, encoded_tuple_buffer%5#0, val_as_bytes%3#0, encoded_tuple_buffer%13#0} with val_as_bytes%0#0 made 3 modifications debug: Found equivalence set: val_as_bytes%2#0, encoded_tuple_buffer%9#0 diff --git a/tests/test_expected_output/arc4.test b/tests/test_expected_output/arc4.test index 4e82e2b7c1..3ef33845b1 100644 --- a/tests/test_expected_output/arc4.test +++ b/tests/test_expected_output/arc4.test @@ -5,7 +5,7 @@ import gtxn ## case: test_invalid_arc4_struct_member_type from algopy import * -class BadStruct(arc4.Struct): ## E: Invalid ARC4 Struct declaration, the following fields are not ARC4 encoded types: a, c +class BadStruct(arc4.Struct): ## E: invalid ARC4 Struct declaration, the following fields are not ARC4 encoded types: a, c a: UInt64 b: arc4.UInt64 c: bool @@ -20,7 +20,7 @@ class BadStruct2(arc4.Struct): ## E: arc4.Struct needs at least one element from algopy import * class BadStruct3(arc4.Struct): - x: arc4.UInt64 = arc4.UInt64(1) ## E: Unsupported syntax for algopy.arc4.Struct member declaration + x: arc4.UInt64 = arc4.UInt64(1) ## E: unsupported syntax for algopy.arc4.Struct member declaration ## case: test_emit_errors from algopy import * diff --git a/tests/test_expected_output/module.test b/tests/test_expected_output/module.test index 7a0d33d8eb..8831ac8697 100644 --- a/tests/test_expected_output/module.test +++ b/tests/test_expected_output/module.test @@ -36,6 +36,27 @@ import typing class NotAllowed(typing.TypedDict): ## E: Unsupported construct ClassDef: TypedDict classes are not supported an_int: UInt64 +## case: no_collections_namedtuple +import collections + +from algopy import UInt64 + +NotAllowed = collections.namedtuple("NotAllowed", ["x", "y"]) ## E: Unsupported construct CallExpr: not supported at module level \ + ## E: Module has no attribute "namedtuple" [attr-defined] \ + ## E: Expression has type "Any" [misc] + + +## case: empty_namedtuple +import typing +from algopy import * + +class MyTuple(typing.NamedTuple): ## E: empty tuples are not supported + pass + +@subroutine +def my_sub(t: MyTuple) -> None: + pass + ## case: unsupported_class from algopy import Contract, UInt64 diff --git a/tests/test_transaction_fields.py b/tests/test_transaction_fields.py index 8b6e2c48ec..bfbf60f037 100644 --- a/tests/test_transaction_fields.py +++ b/tests/test_transaction_fields.py @@ -152,14 +152,14 @@ def test_txn_fields(builtins_registry: Mapping[str, pytypes.PyType]) -> None: if isinstance(arg.type, pytypes.UnionType): arg_types = arg.type.types else: - arg_types = [arg.type] + arg_types = (arg.type,) assert set(txn_field_param.literal_overrides.keys()).issubset(arg_types) if txn_field.is_array: - arg_types = [ + arg_types = tuple( vt.items for vt in arg_types if isinstance(vt, pytypes.VariadicTupleType) - ] + ) if txn_field_param.auto_serialize_bytes: - assert list(arg_types) == [pytypes.ObjectType] + assert arg_types == (pytypes.ObjectType,) else: non_literal_arg_types = { at for at in arg_types if not isinstance(at, pytypes.LiteralOnlyType)