diff --git a/examples/box_storage/out/module.awst b/examples/box_storage/out/module.awst index 5a84f53551..77e9448a82 100644 --- a/examples/box_storage/out/module.awst +++ b/examples/box_storage/out/module.awst @@ -95,11 +95,11 @@ contract BoxContract abimethod examples.box_storage.contract.BoxContract.arc4_box(): void { box_d: box_key = hex<"64"> - Box[box_d]: arc4.static_array = new arc4.static_array(0arc4u8, 1arc4u8, 2arc4u8, 3arc4u8) - assert(reinterpret_cast(Box[box_d][0u]) == reinterpret_cast(0arc4u8)) - assert(reinterpret_cast(Box[box_d][1u]) == reinterpret_cast(1arc4u8)) - assert(reinterpret_cast(Box[box_d][2u]) == reinterpret_cast(2arc4u8)) - assert(reinterpret_cast(Box[box_d][3u]) == reinterpret_cast(3arc4u8)) + Box[box_d]: arc4.static_array = new arc4.static_array(0_arc4u8, 1_arc4u8, 2_arc4u8, 3_arc4u8) + assert(reinterpret_cast(Box[box_d][0u]) == reinterpret_cast(0_arc4u8)) + assert(reinterpret_cast(Box[box_d][1u]) == reinterpret_cast(1_arc4u8)) + assert(reinterpret_cast(Box[box_d][2u]) == reinterpret_cast(2_arc4u8)) + assert(reinterpret_cast(Box[box_d][3u]) == reinterpret_cast(3_arc4u8)) } abimethod examples.box_storage.contract.BoxContract.test_box_ref(): void diff --git a/examples/sizes.txt b/examples/sizes.txt index 32bf5cbd71..2fcbd621de 100644 --- a/examples/sizes.txt +++ b/examples/sizes.txt @@ -14,7 +14,7 @@ arc4_types/Arc4DynamicStringArray 283 124 - | 172 53 - arc4_types/Arc4MutableParams 471 286 - | 292 141 - arc4_types/Arc4Mutation 2958 1426 - | 1977 593 - - arc4_types/Arc4NumericTypes 740 186 - | 239 26 - + arc4_types/Arc4NumericTypes 749 186 - | 243 26 - arc4_types/Arc4RefTypes 85 46 - | 32 27 - arc4_types/Arc4StringTypes 455 35 - | 245 13 - arc4_types/Arc4StructsFromAnotherModule 67 12 - | 49 6 - @@ -130,4 +130,4 @@ unssa/UnSSA 432 368 - | 241 204 - voting/VotingRoundApp 1593 1483 - | 734 649 - with_reentrancy/WithReentrancy 255 242 - | 132 122 - - Total 69191 53576 53517 | 32839 21764 21720 \ No newline at end of file + Total 69200 53576 53517 | 32843 21764 21720 \ No newline at end of file diff --git a/examples/tictactoe/out/module.awst b/examples/tictactoe/out/module.awst index 17791c1b04..c9f2b09543 100644 --- a/examples/tictactoe/out/module.awst +++ b/examples/tictactoe/out/module.awst @@ -41,7 +41,7 @@ contract TicTacToeContract GlobalState['game']: arc4.static_array, 3> = reinterpret_cast, 3>>(bzero(9u)) (column, row): tuple = move assert(column < 3u and row < 3u, comment="Move must be in range") - GlobalState['game'][row][column]: arc4.uint8 = 1arc4u8 + GlobalState['game'][row][column]: arc4.uint8 = 1_arc4u8 GlobalState['turns']: uint64 = 0u } @@ -49,12 +49,12 @@ contract TicTacToeContract { assert(!(STATE_EXISTS(GlobalState['challenger'])), comment="Host already has a challenger") GlobalState['challenger']: account = txn() - this::make_move(2arc4u8, move) + this::make_move(2_arc4u8, move) } abimethod examples.tictactoe.tictactoe.TicTacToeContract.whose_turn(): arc4.uint8 { - return (GlobalState['turns'] % 2u != 0u) ? (1arc4u8) : (2arc4u8) + return (GlobalState['turns'] % 2u != 0u) ? (1_arc4u8) : (2_arc4u8) } abimethod examples.tictactoe.tictactoe.TicTacToeContract.play(move: tuple): void @@ -62,10 +62,10 @@ contract TicTacToeContract assert(!(STATE_EXISTS(GlobalState['winner'])), comment="Game is already finished") if (GlobalState['turns'] % 2u != 0u) { assert(txn() == GlobalState['host'], comment="It is the host's turn") - player: arc4.uint8 = 1arc4u8 + player: arc4.uint8 = 1_arc4u8 } else { assert(txn() == STATE_GET(GlobalState['challenger'], default=global()), comment="It is the challenger's turn") - player: arc4.uint8 = 2arc4u8 + player: arc4.uint8 = 2_arc4u8 } this::make_move(player, move) } @@ -74,14 +74,14 @@ contract TicTacToeContract { (column, row): tuple = move assert(column < 3u and row < 3u, comment="Move must be in range") - assert(reinterpret_cast(GlobalState['game'][row][column]) == reinterpret_cast(0arc4u8), comment="Square is already taken") + assert(reinterpret_cast(GlobalState['game'][row][column]) == reinterpret_cast(0_arc4u8), comment="Square is already taken") GlobalState['game'][row][column]: arc4.uint8 = player GlobalState['turns'] += 1u if (this::did_win(player, column=column, row=row)) { GlobalState['winner']: arc4.uint8 = player } else { if (GlobalState['turns'] == 9u) { - GlobalState['winner']: arc4.uint8 = 3arc4u8 + GlobalState['winner']: arc4.uint8 = 3_arc4u8 } } } diff --git a/examples/voting/out/module.awst b/examples/voting/out/module.awst index 9842f6b513..91e75bd1c6 100644 --- a/examples/voting/out/module.awst +++ b/examples/voting/out/module.awst @@ -79,7 +79,7 @@ contract VotingRoundApp if (question_index > 0u) { note += ',' } - if (reinterpret_cast(question_options) > reinterpret_cast(0arc4u8)) { + if (reinterpret_cast(question_options) > reinterpret_cast(0_arc4u8)) { note += '[' for option_index in range(0u, arc4_decode(question_options, uint64), 1u) { if (option_index > 0u) { diff --git a/src/puya/awst/nodes.py b/src/puya/awst/nodes.py index 2be939e34d..32d421907f 100644 --- a/src/puya/awst/nodes.py +++ b/src/puya/awst/nodes.py @@ -484,15 +484,18 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T: @attrs.frozen class ARC4Decode(Expression): - value: Expression = attrs.field() + value: Expression = attrs.field( + validator=expression_has_wtype( + wtypes.arc4_bool_wtype, + wtypes.ARC4UIntN, + wtypes.ARC4Tuple, + wtypes.ARC4DynamicArray, # only if element type is bytes for now + ) + ) @value.validator def _value_wtype_validator(self, _attribute: object, value: Expression) -> None: - if not isinstance(value.wtype, wtypes.ARC4Type): - raise InternalError( - f"ARC4Decode should only be used with expressions of ARC4Type, got {value.wtype}", - self.source_location, - ) + assert isinstance(value.wtype, wtypes.ARC4Type) # validated by `value` if not value.wtype.can_encode_type(self.wtype): raise InternalError( f"ARC4Decode from {value.wtype} should have non ARC4 target type {self.wtype}", diff --git a/src/puya/awst/to_code_visitor.py b/src/puya/awst/to_code_visitor.py index 1e75db11f0..74b9f035c9 100644 --- a/src/puya/awst/to_code_visitor.py +++ b/src/puya/awst/to_code_visitor.py @@ -320,12 +320,8 @@ def visit_integer_constant(self, expr: nodes.IntegerConstant) -> str: suffix = "u" case wtypes.biguint_wtype: suffix = "n" - case wtypes.ARC4UIntN(n=n, decode_type=decode_type): - if decode_type == wtypes.uint64_wtype: - suffix = f"arc4u{n}" - else: - assert decode_type == wtypes.biguint_wtype - suffix = f"arc4n{n}" + case wtypes.ARC4UIntN(n=n): + suffix = f"_arc4u{n}" case _: raise InternalError( f"Numeric type not implemented: {expr.wtype}", expr.source_location diff --git a/src/puya/awst/wtypes.py b/src/puya/awst/wtypes.py index 899f721052..55934edf93 100644 --- a/src/puya/awst/wtypes.py +++ b/src/puya/awst/wtypes.py @@ -257,17 +257,17 @@ def name_to_index(self, name: str, source_location: SourceLocation) -> int: class ARC4Type(WType): scalar_type: typing.Literal[AVMType.bytes] = attrs.field(default=AVMType.bytes, init=False) arc4_name: str = attrs.field(eq=False) # exclude from equality in case of aliasing - decode_type: WType | None + native_type: WType | None def can_encode_type(self, wtype: WType) -> bool: - return wtype == self.decode_type + return wtype == self.native_type arc4_bool_wtype: typing.Final = ARC4Type( name="arc4.bool", arc4_name="bool", immutable=True, - decode_type=bool_wtype, + native_type=bool_wtype, ) @@ -275,7 +275,7 @@ def can_encode_type(self, wtype: WType) -> bool: @attrs.frozen(kw_only=True) class ARC4UIntN(ARC4Type): immutable: bool = attrs.field(default=True, init=False) - decode_type: WType = attrs.field() + native_type: WType = attrs.field(default=biguint_wtype, init=False) n: int = attrs.field() arc4_name: str = attrs.field(eq=False) name: str = attrs.field(init=False) @@ -288,22 +288,6 @@ def _n_validator(self, _attribute: object, n: int) -> None: if not (8 <= n <= 512): raise CodeError("Bit size must be between 8 and 512 inclusive", self.source_location) - @decode_type.validator - def _decode_type_validator(self, _attribute: object, decode_type: WType) -> None: - if decode_type == uint64_wtype: - if self.n > 64: - raise InternalError( - f"ARC-4 UIntN type received decode type {decode_type}," - f" which is smaller than size {self.n}", - self.source_location, - ) - elif decode_type == biguint_wtype: - pass - else: - raise InternalError( - f"Unhandled decode_type for ARC-4 UIntN: {decode_type}", self.source_location - ) - @arc4_name.default def _arc4_name(self) -> str: return f"uint{self.n}" @@ -325,7 +309,7 @@ class ARC4UFixedNxM(ARC4Type): arc4_name: str = attrs.field(init=False, eq=False) name: str = attrs.field(init=False) source_location: SourceLocation | None = attrs.field(default=None, eq=False) - decode_type = attrs.field(default=None, init=False) + native_type: None = attrs.field(default=None, init=False) @arc4_name.default def _arc4_name(self) -> str: @@ -365,7 +349,7 @@ class ARC4Tuple(ARC4Type): name: str = attrs.field(init=False) arc4_name: str = attrs.field(init=False, eq=False) immutable: bool = attrs.field(init=False) - decode_type: WTuple = attrs.field(init=False) + native_type: WTuple = attrs.field(init=False) @name.default def _name(self) -> str: @@ -379,8 +363,8 @@ def _arc4_name(self) -> str: def _immutable(self) -> bool: return all(typ.immutable for typ in self.types) - @decode_type.default - def _decode_type(self) -> WTuple: + @native_type.default + def _native_type(self) -> WTuple: return WTuple(self.types, self.source_location) def can_encode_type(self, wtype: WType) -> bool: @@ -409,7 +393,7 @@ def _expect_arc4_type(wtype: WType) -> ARC4Type: @attrs.frozen(kw_only=True) class ARC4Array(ARC4Type): element_type: ARC4Type = attrs.field(converter=_expect_arc4_type) - decode_type: WType | None = None + native_type: WType | None = None immutable: bool = False @@ -469,7 +453,7 @@ class ARC4Struct(ARC4Type): immutable: bool = attrs.field() source_location: SourceLocation | None = attrs.field(default=None, eq=False) arc4_name: str = attrs.field(init=False, eq=False) - decode_type: WType | None = None + native_type: None = attrs.field(default=None, init=False) @immutable.default def _immutable(self) -> bool: @@ -497,14 +481,13 @@ def can_encode_type(self, wtype: WType) -> bool: arc4_byte_alias: typing.Final = ARC4UIntN( n=8, arc4_name="byte", - decode_type=uint64_wtype, source_location=None, ) arc4_string_alias: typing.Final = ARC4DynamicArray( arc4_name="string", element_type=arc4_byte_alias, - decode_type=string_wtype, + native_type=string_wtype, immutable=True, source_location=None, ) @@ -512,7 +495,7 @@ def can_encode_type(self, wtype: WType) -> bool: arc4_address_alias: typing.Final = ARC4StaticArray( arc4_name="address", element_type=arc4_byte_alias, - decode_type=account_wtype, + native_type=account_wtype, array_size=32, immutable=True, source_location=None, diff --git a/src/puya/ir/arc4_router.py b/src/puya/ir/arc4_router.py index 7fc4b6ab92..9b235a57d4 100644 --- a/src/puya/ir/arc4_router.py +++ b/src/puya/ir/arc4_router.py @@ -716,12 +716,12 @@ def _maybe_avm_to_arc4_equivalent_type(wtype: wtypes.WType) -> wtypes.ARC4Type | case wtypes.bool_wtype: return wtypes.arc4_bool_wtype case wtypes.uint64_wtype: - return wtypes.ARC4UIntN(n=64, decode_type=wtype, source_location=None) + return wtypes.ARC4UIntN(n=64, source_location=None) case wtypes.biguint_wtype: - return wtypes.ARC4UIntN(n=512, decode_type=wtype, source_location=None) + return wtypes.ARC4UIntN(n=512, source_location=None) case wtypes.bytes_wtype: return wtypes.ARC4DynamicArray( - element_type=wtypes.arc4_byte_alias, decode_type=wtype, source_location=None + element_type=wtypes.arc4_byte_alias, native_type=wtype, source_location=None ) case wtypes.string_wtype: return wtypes.arc4_string_alias diff --git a/src/puya/ir/builder/arc4.py b/src/puya/ir/builder/arc4.py index 41ad797f3d..500a7dbb82 100644 --- a/src/puya/ir/builder/arc4.py +++ b/src/puya/ir/builder/arc4.py @@ -72,39 +72,40 @@ def _decode_arc4_value( target_wtype: wtypes.WType, loc: SourceLocation, ) -> ValueProvider: - match arc4_wtype: - case wtypes.ARC4UIntN(n=scale) | wtypes.ARC4UFixedNxM(n=scale): - if scale > 64: - return value - else: - return Intrinsic( - op=AVMOp.btoi, - args=[value], - source_location=loc, - ) - case wtypes.arc4_bool_wtype: + match arc4_wtype, target_wtype: + case wtypes.ARC4UIntN(), wtypes.biguint_wtype: + return value + case wtypes.ARC4UIntN(), (wtypes.uint64_wtype | wtypes.bool_wtype): + return Intrinsic( + op=AVMOp.btoi, + args=[value], + source_location=loc, + ) + case wtypes.arc4_bool_wtype, wtypes.bool_wtype: return Intrinsic( op=AVMOp.getbit, args=[value, UInt64Constant(value=0, source_location=None)], source_location=loc, types=(IRType.bool,), ) - case wtypes.ARC4DynamicArray(element_type=wtypes.ARC4UIntN(n=8)): + case wtypes.ARC4DynamicArray(element_type=wtypes.ARC4UIntN(n=8)), ( + wtypes.bytes_wtype | wtypes.string_wtype + ): return Intrinsic( op=AVMOp.extract, immediates=[2, 0], args=[value], source_location=loc, ) - case wtypes.ARC4Tuple() as arc4_tuple: + case wtypes.ARC4Tuple() as arc4_tuple, wtypes.WTuple() as native_tuple if ( + len(arc4_tuple.types) == len(native_tuple.types) + ): return _visit_arc4_tuple_decode( - context, arc4_tuple, value, target_wtype=target_wtype, source_location=loc - ) - case _: - raise InternalError( - f"Unsupported wtype for ARC4Decode: {arc4_wtype}", - location=loc, + context, arc4_tuple, value, target_wtype=native_tuple, source_location=loc ) + raise InternalError( + f"unsupported ARC4Decode operation from {arc4_wtype} to {target_wtype}", loc + ) def encode_arc4_struct( @@ -608,13 +609,10 @@ def _visit_arc4_tuple_decode( context: IRFunctionBuildContext, wtype: wtypes.ARC4Tuple, value: Value, - target_wtype: wtypes.WType, + target_wtype: wtypes.WTuple, source_location: SourceLocation, ) -> ValueProvider: items = list[Value]() - if not isinstance(target_wtype, wtypes.WTuple): - raise InternalError("expected ARC4Decode of a tuple to target a WTuple", source_location) - for index, (target_item_wtype, item_wtype) in enumerate( zip(target_wtype.types, wtype.types, strict=True) ): diff --git a/src/puyapy/awst_build/pytypes.py b/src/puyapy/awst_build/pytypes.py index 56f0000fee..08f54901fc 100644 --- a/src/puyapy/awst_build/pytypes.py +++ b/src/puyapy/awst_build/pytypes.py @@ -586,9 +586,7 @@ def parameterise( name=name, bits=bits, native_type=native_type, - wtype=wtypes.ARC4UIntN( - n=bits, decode_type=native_type.wtype, source_location=source_location - ), + wtype=wtypes.ARC4UIntN(n=bits, source_location=source_location), ) return parameterise @@ -790,7 +788,7 @@ def parameterise( name="algopy.arc4.DynamicBytes", wtype=wtypes.ARC4DynamicArray( element_type=ARC4ByteType.wtype, - decode_type=wtypes.bytes_wtype, + native_type=wtypes.bytes_wtype, source_location=None, ), size=None, diff --git a/test_cases/abi_routing/out/module.awst b/test_cases/abi_routing/out/module.awst index 28ba12cb63..875aee57a3 100644 --- a/test_cases/abi_routing/out/module.awst +++ b/test_cases/abi_routing/out/module.awst @@ -124,7 +124,7 @@ contract Reference { GlobalState['asa']: asset = reinterpret_cast(123u) GlobalState['an_int']: uint64 = 2u - GlobalState['some_bytes']: arc4.static_array = new arc4.static_array(7arc4u8, 8arc4u8, 9arc4u8) + GlobalState['some_bytes']: arc4.static_array = new arc4.static_array(7_arc4u8, 8_arc4u8, 9_arc4u8) GlobalState['creator']: account = txn() GlobalState['app']: application = reinterpret_cast(123u) assert(len(Method("get(uint64,byte[])byte[]")) != 0u, comment="has method selector") @@ -186,17 +186,17 @@ contract Reference abimethod test_cases.abi_routing.contract.Reference.get_asset(): arc4.uint64 { - return 456arc4u64 + return 456_arc4u64 } abimethod[name_override=get_application] test_cases.abi_routing.contract.Reference.get_app(): arc4.uint64 { - return 456arc4u64 + return 456_arc4u64 } abimethod[name_override=get_an_int] test_cases.abi_routing.contract.Reference.get_a_int(): arc4.uint64 { - return 3arc4u64 + return 3_arc4u64 } abimethod test_cases.abi_routing.contract.Reference.method_with_default_args(asset_from_storage: asset, asset_from_function: asset, account_from_storage: account, account_from_function: account, application_from_storage: application, application_from_function: application, bytes_from_storage: arc4.static_array, int_from_storage: arc4.uint64, int_from_function: arc4.uint64): void @@ -207,9 +207,9 @@ contract Reference assert(account_from_function == global(), comment="wrong account from function") assert(application_from_storage == reinterpret_cast(123u), comment="wrong application from storage") assert(application_from_function == reinterpret_cast(456u), comment="wrong application from function") - assert(reinterpret_cast(bytes_from_storage[0u]) == reinterpret_cast(7arc4u8), comment="wrong 0th byte from storage") - assert(reinterpret_cast(bytes_from_storage[1u]) == reinterpret_cast(8arc4u8), comment="wrong 1st byte from storage") - assert(reinterpret_cast(bytes_from_storage[2u]) == reinterpret_cast(9arc4u8), comment="wrong 2nd byte from storage") + assert(reinterpret_cast(bytes_from_storage[0u]) == reinterpret_cast(7_arc4u8), comment="wrong 0th byte from storage") + assert(reinterpret_cast(bytes_from_storage[1u]) == reinterpret_cast(8_arc4u8), comment="wrong 1st byte from storage") + assert(reinterpret_cast(bytes_from_storage[2u]) == reinterpret_cast(9_arc4u8), comment="wrong 2nd byte from storage") assert(arc4_decode(int_from_storage, uint64) == 2u, comment="wrong int from storage") assert(arc4_decode(int_from_function, uint64) == 3u, comment="wrong int from function") } diff --git a/test_cases/arc4_dynamic_arrays/out/module.awst b/test_cases/arc4_dynamic_arrays/out/module.awst index 9ca92788ba..c718be0072 100644 --- a/test_cases/arc4_dynamic_arrays/out/module.awst +++ b/test_cases/arc4_dynamic_arrays/out/module.awst @@ -95,7 +95,7 @@ contract DynamicArrayContract two: test_cases.arc4_dynamic_arrays.contract.DynamicStruct = new test_cases.arc4_dynamic_arrays.contract.DynamicStruct(a=test_cases.arc4_dynamic_arrays.contract.get_string1(), b=test_cases.arc4_dynamic_arrays.contract.get_string2()) three: test_cases.arc4_dynamic_arrays.contract.StaticStruct = new test_cases.arc4_dynamic_arrays.contract.StaticStruct(a=test_cases.arc4_dynamic_arrays.contract.get_uint2(), b=new arc4.static_array(test_cases.arc4_dynamic_arrays.contract.get_byte2(), test_cases.arc4_dynamic_arrays.contract.get_byte1())) four1: test_cases.arc4_dynamic_arrays.contract.MixedMultipleStruct = new test_cases.arc4_dynamic_arrays.contract.MixedMultipleStruct(a=test_cases.arc4_dynamic_arrays.contract.get_uint1(), b=test_cases.arc4_dynamic_arrays.contract.get_string1(), c=test_cases.arc4_dynamic_arrays.contract.get_uint2(), d=test_cases.arc4_dynamic_arrays.contract.get_u16_arr1(), e=test_cases.arc4_dynamic_arrays.contract.get_uint1()) - four2: test_cases.arc4_dynamic_arrays.contract.MixedMultipleStruct = new test_cases.arc4_dynamic_arrays.contract.MixedMultipleStruct(a=test_cases.arc4_dynamic_arrays.contract.get_uint1(), b=test_cases.arc4_dynamic_arrays.contract.get_string1(), c=test_cases.arc4_dynamic_arrays.contract.get_uint2(), d=test_cases.arc4_dynamic_arrays.contract.get_u16_arr1() + (123arc4u16), e=test_cases.arc4_dynamic_arrays.contract.get_uint1()) + four2: test_cases.arc4_dynamic_arrays.contract.MixedMultipleStruct = new test_cases.arc4_dynamic_arrays.contract.MixedMultipleStruct(a=test_cases.arc4_dynamic_arrays.contract.get_uint1(), b=test_cases.arc4_dynamic_arrays.contract.get_string1(), c=test_cases.arc4_dynamic_arrays.contract.get_uint2(), d=test_cases.arc4_dynamic_arrays.contract.get_u16_arr1() + (123_arc4u16), e=test_cases.arc4_dynamic_arrays.contract.get_uint1()) five: test_cases.arc4_dynamic_arrays.contract.DynamicStruct = new test_cases.arc4_dynamic_arrays.contract.DynamicStruct(a=test_cases.arc4_dynamic_arrays.contract.get_string1(), b=test_cases.arc4_dynamic_arrays.contract.get_string2()) tup1: arc4.tuple = arc4_encode((one.copy(), two.copy(), three.copy(), four1.copy(), five.copy()), arc4.tuple) tup2: arc4.tuple = arc4_encode((one.copy(), two.copy(), three.copy(), four2.copy(), five.copy()), arc4.tuple) @@ -125,40 +125,40 @@ subroutine get_string3(): arc4.dynamic_array subroutine get_uint1(): arc4.uint64 { - return 3arc4u64 + return 3_arc4u64 } subroutine get_uint2(): arc4.uint64 { - return 4398046511104arc4u64 + return 4398046511104_arc4u64 } subroutine get_byte1(): arc4.uint8 { - return 4arc4u8 + return 4_arc4u8 } subroutine get_byte2(): arc4.uint8 { - return 5arc4u8 + return 5_arc4u8 } subroutine get_byte3(): arc4.uint8 { - return 42arc4u8 + return 42_arc4u8 } subroutine get_byte4(): arc4.uint8 { - return 255arc4u8 + return 255_arc4u8 } subroutine get_u16_arr1(): arc4.dynamic_array { - return new arc4.dynamic_array(65535arc4u16, 0arc4u16, 42arc4u16) + return new arc4.dynamic_array(65535_arc4u16, 0_arc4u16, 42_arc4u16) } subroutine get_u16_arr2(): arc4.dynamic_array { - return new arc4.dynamic_array(1arc4u16, 2arc4u16, 3arc4u16, 4arc4u16) + return new arc4.dynamic_array(1_arc4u16, 2_arc4u16, 3_arc4u16, 4_arc4u16) } \ No newline at end of file diff --git a/test_cases/arc4_numeric_comparisons/out/module.awst b/test_cases/arc4_numeric_comparisons/out/module.awst index c9ce52da3a..66eb94cfe0 100644 --- a/test_cases/arc4_numeric_comparisons/out/module.awst +++ b/test_cases/arc4_numeric_comparisons/out/module.awst @@ -5,9 +5,9 @@ contract UIntNOrdering subroutine test_cases.arc4_numeric_comparisons.uint_n.UIntNOrdering.approval_program(): bool { - test_cases.arc4_numeric_comparisons.uint_n.check_both_uint_n(1arc4u8, 2arc4u64) - test_cases.arc4_numeric_comparisons.uint_n.check_mixed(1arc4u8, 2arc4n264) - test_cases.arc4_numeric_comparisons.uint_n.check_both_big_uint_n(1arc4n256, 2arc4n264) + test_cases.arc4_numeric_comparisons.uint_n.check_both_uint_n(1_arc4u8, 2_arc4u64) + test_cases.arc4_numeric_comparisons.uint_n.check_mixed(1_arc4u8, 2_arc4u264) + test_cases.arc4_numeric_comparisons.uint_n.check_both_big_uint_n(1_arc4u256, 2_arc4u264) return true } @@ -23,57 +23,57 @@ subroutine check_both_uint_n(one: arc4.uint8, two: arc4.uint64): void one_biguint: biguint = 1n two_uint64: uint64 = 2u two_biguint: biguint = 2n - assert(reinterpret_cast(one) == reinterpret_cast(1arc4u8)) - assert(reinterpret_cast(one) == reinterpret_cast(1arc4u8)) + assert(reinterpret_cast(one) == reinterpret_cast(1_arc4u8)) + assert(reinterpret_cast(one) == reinterpret_cast(1_arc4u8)) assert(reinterpret_cast(one) == reinterpret_cast(one)) assert(reinterpret_cast(one) == itob(one_uint64)) assert(reinterpret_cast(one) == one_biguint) - assert(!(reinterpret_cast(one) == reinterpret_cast(2arc4u8))) + assert(!(reinterpret_cast(one) == reinterpret_cast(2_arc4u8))) assert(!(reinterpret_cast(one) == reinterpret_cast(two))) assert(!(reinterpret_cast(one) == itob(two_uint64))) assert(!(reinterpret_cast(one) == two_biguint)) - assert(!(reinterpret_cast(one) != reinterpret_cast(1arc4u8))) - assert(!(reinterpret_cast(one) != reinterpret_cast(1arc4u8))) + assert(!(reinterpret_cast(one) != reinterpret_cast(1_arc4u8))) + assert(!(reinterpret_cast(one) != reinterpret_cast(1_arc4u8))) assert(!(reinterpret_cast(one) != reinterpret_cast(one))) assert(!(reinterpret_cast(one) != itob(one_uint64))) assert(!(reinterpret_cast(one) != one_biguint)) - assert(reinterpret_cast(one) != reinterpret_cast(2arc4u8)) + assert(reinterpret_cast(one) != reinterpret_cast(2_arc4u8)) assert(reinterpret_cast(one) != reinterpret_cast(two)) assert(reinterpret_cast(one) != itob(two_uint64)) assert(reinterpret_cast(one) != two_biguint) - assert(reinterpret_cast(one) <= reinterpret_cast(1arc4u8)) - assert(reinterpret_cast(one) >= reinterpret_cast(1arc4u8)) + assert(reinterpret_cast(one) <= reinterpret_cast(1_arc4u8)) + assert(reinterpret_cast(one) >= reinterpret_cast(1_arc4u8)) assert(reinterpret_cast(one) <= reinterpret_cast(one)) assert(reinterpret_cast(one) <= itob(one_uint64)) assert(reinterpret_cast(one) <= one_biguint) - assert(reinterpret_cast(one) <= reinterpret_cast(2arc4u8)) + assert(reinterpret_cast(one) <= reinterpret_cast(2_arc4u8)) assert(reinterpret_cast(one) <= reinterpret_cast(two)) assert(reinterpret_cast(one) <= itob(two_uint64)) assert(reinterpret_cast(one) <= two_biguint) - assert(!(reinterpret_cast(one) < reinterpret_cast(1arc4u8))) - assert(!(reinterpret_cast(one) > reinterpret_cast(1arc4u8))) + assert(!(reinterpret_cast(one) < reinterpret_cast(1_arc4u8))) + assert(!(reinterpret_cast(one) > reinterpret_cast(1_arc4u8))) assert(!(reinterpret_cast(one) < reinterpret_cast(one))) assert(!(reinterpret_cast(one) < itob(one_uint64))) assert(!(reinterpret_cast(one) < one_biguint)) - assert(reinterpret_cast(one) < reinterpret_cast(2arc4u8)) + assert(reinterpret_cast(one) < reinterpret_cast(2_arc4u8)) assert(reinterpret_cast(one) < reinterpret_cast(two)) assert(reinterpret_cast(one) < itob(two_uint64)) assert(reinterpret_cast(one) < two_biguint) - assert(reinterpret_cast(one) >= reinterpret_cast(1arc4u8)) - assert(reinterpret_cast(one) <= reinterpret_cast(1arc4u8)) + assert(reinterpret_cast(one) >= reinterpret_cast(1_arc4u8)) + assert(reinterpret_cast(one) <= reinterpret_cast(1_arc4u8)) assert(reinterpret_cast(one) >= reinterpret_cast(one)) assert(reinterpret_cast(one) >= itob(one_uint64)) assert(reinterpret_cast(one) >= one_biguint) - assert(!(reinterpret_cast(one) >= reinterpret_cast(2arc4u8))) + assert(!(reinterpret_cast(one) >= reinterpret_cast(2_arc4u8))) assert(!(reinterpret_cast(one) >= reinterpret_cast(two))) assert(!(reinterpret_cast(one) >= itob(two_uint64))) assert(!(reinterpret_cast(one) >= two_biguint)) - assert(!(reinterpret_cast(one) > reinterpret_cast(1arc4u8))) - assert(!(reinterpret_cast(one) < reinterpret_cast(1arc4u8))) + assert(!(reinterpret_cast(one) > reinterpret_cast(1_arc4u8))) + assert(!(reinterpret_cast(one) < reinterpret_cast(1_arc4u8))) assert(!(reinterpret_cast(one) > reinterpret_cast(one))) assert(!(reinterpret_cast(one) > itob(one_uint64))) assert(!(reinterpret_cast(one) > one_biguint)) - assert(!(reinterpret_cast(one) > reinterpret_cast(2arc4u8))) + assert(!(reinterpret_cast(one) > reinterpret_cast(2_arc4u8))) assert(!(reinterpret_cast(one) > reinterpret_cast(two))) assert(!(reinterpret_cast(one) > itob(two_uint64))) assert(!(reinterpret_cast(one) > two_biguint)) @@ -85,57 +85,57 @@ subroutine check_mixed(one: arc4.uint8, two: arc4.uint264): void one_biguint: biguint = 1n two_uint64: uint64 = 2u two_biguint: biguint = 2n - assert(reinterpret_cast(one) == reinterpret_cast(1arc4u8)) - assert(reinterpret_cast(one) == reinterpret_cast(1arc4u8)) + assert(reinterpret_cast(one) == reinterpret_cast(1_arc4u8)) + assert(reinterpret_cast(one) == reinterpret_cast(1_arc4u8)) assert(reinterpret_cast(one) == reinterpret_cast(one)) assert(reinterpret_cast(one) == itob(one_uint64)) assert(reinterpret_cast(one) == one_biguint) - assert(!(reinterpret_cast(one) == reinterpret_cast(2arc4u8))) + assert(!(reinterpret_cast(one) == reinterpret_cast(2_arc4u8))) assert(!(reinterpret_cast(one) == reinterpret_cast(two))) assert(!(reinterpret_cast(one) == itob(two_uint64))) assert(!(reinterpret_cast(one) == two_biguint)) - assert(!(reinterpret_cast(one) != reinterpret_cast(1arc4u8))) - assert(!(reinterpret_cast(one) != reinterpret_cast(1arc4u8))) + assert(!(reinterpret_cast(one) != reinterpret_cast(1_arc4u8))) + assert(!(reinterpret_cast(one) != reinterpret_cast(1_arc4u8))) assert(!(reinterpret_cast(one) != reinterpret_cast(one))) assert(!(reinterpret_cast(one) != itob(one_uint64))) assert(!(reinterpret_cast(one) != one_biguint)) - assert(reinterpret_cast(one) != reinterpret_cast(2arc4u8)) + assert(reinterpret_cast(one) != reinterpret_cast(2_arc4u8)) assert(reinterpret_cast(one) != reinterpret_cast(two)) assert(reinterpret_cast(one) != itob(two_uint64)) assert(reinterpret_cast(one) != two_biguint) - assert(reinterpret_cast(one) <= reinterpret_cast(1arc4u8)) - assert(reinterpret_cast(one) >= reinterpret_cast(1arc4u8)) + assert(reinterpret_cast(one) <= reinterpret_cast(1_arc4u8)) + assert(reinterpret_cast(one) >= reinterpret_cast(1_arc4u8)) assert(reinterpret_cast(one) <= reinterpret_cast(one)) assert(reinterpret_cast(one) <= itob(one_uint64)) assert(reinterpret_cast(one) <= one_biguint) - assert(reinterpret_cast(one) <= reinterpret_cast(2arc4u8)) + assert(reinterpret_cast(one) <= reinterpret_cast(2_arc4u8)) assert(reinterpret_cast(one) <= reinterpret_cast(two)) assert(reinterpret_cast(one) <= itob(two_uint64)) assert(reinterpret_cast(one) <= two_biguint) - assert(!(reinterpret_cast(one) < reinterpret_cast(1arc4u8))) - assert(!(reinterpret_cast(one) > reinterpret_cast(1arc4u8))) + assert(!(reinterpret_cast(one) < reinterpret_cast(1_arc4u8))) + assert(!(reinterpret_cast(one) > reinterpret_cast(1_arc4u8))) assert(!(reinterpret_cast(one) < reinterpret_cast(one))) assert(!(reinterpret_cast(one) < itob(one_uint64))) assert(!(reinterpret_cast(one) < one_biguint)) - assert(reinterpret_cast(one) < reinterpret_cast(2arc4u8)) + assert(reinterpret_cast(one) < reinterpret_cast(2_arc4u8)) assert(reinterpret_cast(one) < reinterpret_cast(two)) assert(reinterpret_cast(one) < itob(two_uint64)) assert(reinterpret_cast(one) < two_biguint) - assert(reinterpret_cast(one) >= reinterpret_cast(1arc4u8)) - assert(reinterpret_cast(one) <= reinterpret_cast(1arc4u8)) + assert(reinterpret_cast(one) >= reinterpret_cast(1_arc4u8)) + assert(reinterpret_cast(one) <= reinterpret_cast(1_arc4u8)) assert(reinterpret_cast(one) >= reinterpret_cast(one)) assert(reinterpret_cast(one) >= itob(one_uint64)) assert(reinterpret_cast(one) >= one_biguint) - assert(!(reinterpret_cast(one) >= reinterpret_cast(2arc4u8))) + assert(!(reinterpret_cast(one) >= reinterpret_cast(2_arc4u8))) assert(!(reinterpret_cast(one) >= reinterpret_cast(two))) assert(!(reinterpret_cast(one) >= itob(two_uint64))) assert(!(reinterpret_cast(one) >= two_biguint)) - assert(!(reinterpret_cast(one) > reinterpret_cast(1arc4u8))) - assert(!(reinterpret_cast(one) < reinterpret_cast(1arc4u8))) + assert(!(reinterpret_cast(one) > reinterpret_cast(1_arc4u8))) + assert(!(reinterpret_cast(one) < reinterpret_cast(1_arc4u8))) assert(!(reinterpret_cast(one) > reinterpret_cast(one))) assert(!(reinterpret_cast(one) > itob(one_uint64))) assert(!(reinterpret_cast(one) > one_biguint)) - assert(!(reinterpret_cast(one) > reinterpret_cast(2arc4u8))) + assert(!(reinterpret_cast(one) > reinterpret_cast(2_arc4u8))) assert(!(reinterpret_cast(one) > reinterpret_cast(two))) assert(!(reinterpret_cast(one) > itob(two_uint64))) assert(!(reinterpret_cast(one) > two_biguint)) @@ -147,57 +147,57 @@ subroutine check_both_big_uint_n(one: arc4.uint256, two: arc4.uint264): void one_biguint: biguint = 1n two_uint64: uint64 = 2u two_biguint: biguint = 2n - assert(reinterpret_cast(one) == reinterpret_cast(1arc4n256)) - assert(reinterpret_cast(one) == reinterpret_cast(1arc4n256)) + assert(reinterpret_cast(one) == reinterpret_cast(1_arc4u256)) + assert(reinterpret_cast(one) == reinterpret_cast(1_arc4u256)) assert(reinterpret_cast(one) == reinterpret_cast(one)) assert(reinterpret_cast(one) == itob(one_uint64)) assert(reinterpret_cast(one) == one_biguint) - assert(!(reinterpret_cast(one) == reinterpret_cast(2arc4n256))) + assert(!(reinterpret_cast(one) == reinterpret_cast(2_arc4u256))) assert(!(reinterpret_cast(one) == reinterpret_cast(two))) assert(!(reinterpret_cast(one) == itob(two_uint64))) assert(!(reinterpret_cast(one) == two_biguint)) - assert(!(reinterpret_cast(one) != reinterpret_cast(1arc4n256))) - assert(!(reinterpret_cast(one) != reinterpret_cast(1arc4n256))) + assert(!(reinterpret_cast(one) != reinterpret_cast(1_arc4u256))) + assert(!(reinterpret_cast(one) != reinterpret_cast(1_arc4u256))) assert(!(reinterpret_cast(one) != reinterpret_cast(one))) assert(!(reinterpret_cast(one) != itob(one_uint64))) assert(!(reinterpret_cast(one) != one_biguint)) - assert(reinterpret_cast(one) != reinterpret_cast(2arc4n256)) + assert(reinterpret_cast(one) != reinterpret_cast(2_arc4u256)) assert(reinterpret_cast(one) != reinterpret_cast(two)) assert(reinterpret_cast(one) != itob(two_uint64)) assert(reinterpret_cast(one) != two_biguint) - assert(reinterpret_cast(one) <= reinterpret_cast(1arc4n256)) - assert(reinterpret_cast(one) >= reinterpret_cast(1arc4n256)) + assert(reinterpret_cast(one) <= reinterpret_cast(1_arc4u256)) + assert(reinterpret_cast(one) >= reinterpret_cast(1_arc4u256)) assert(reinterpret_cast(one) <= reinterpret_cast(one)) assert(reinterpret_cast(one) <= itob(one_uint64)) assert(reinterpret_cast(one) <= one_biguint) - assert(reinterpret_cast(one) <= reinterpret_cast(2arc4n256)) + assert(reinterpret_cast(one) <= reinterpret_cast(2_arc4u256)) assert(reinterpret_cast(one) <= reinterpret_cast(two)) assert(reinterpret_cast(one) <= itob(two_uint64)) assert(reinterpret_cast(one) <= two_biguint) - assert(!(reinterpret_cast(one) < reinterpret_cast(1arc4n256))) - assert(!(reinterpret_cast(one) > reinterpret_cast(1arc4n256))) + assert(!(reinterpret_cast(one) < reinterpret_cast(1_arc4u256))) + assert(!(reinterpret_cast(one) > reinterpret_cast(1_arc4u256))) assert(!(reinterpret_cast(one) < reinterpret_cast(one))) assert(!(reinterpret_cast(one) < itob(one_uint64))) assert(!(reinterpret_cast(one) < one_biguint)) - assert(reinterpret_cast(one) < reinterpret_cast(2arc4n256)) + assert(reinterpret_cast(one) < reinterpret_cast(2_arc4u256)) assert(reinterpret_cast(one) < reinterpret_cast(two)) assert(reinterpret_cast(one) < itob(two_uint64)) assert(reinterpret_cast(one) < two_biguint) - assert(reinterpret_cast(one) >= reinterpret_cast(1arc4n256)) - assert(reinterpret_cast(one) <= reinterpret_cast(1arc4n256)) + assert(reinterpret_cast(one) >= reinterpret_cast(1_arc4u256)) + assert(reinterpret_cast(one) <= reinterpret_cast(1_arc4u256)) assert(reinterpret_cast(one) >= reinterpret_cast(one)) assert(reinterpret_cast(one) >= itob(one_uint64)) assert(reinterpret_cast(one) >= one_biguint) - assert(!(reinterpret_cast(one) >= reinterpret_cast(2arc4n256))) + assert(!(reinterpret_cast(one) >= reinterpret_cast(2_arc4u256))) assert(!(reinterpret_cast(one) >= reinterpret_cast(two))) assert(!(reinterpret_cast(one) >= itob(two_uint64))) assert(!(reinterpret_cast(one) >= two_biguint)) - assert(!(reinterpret_cast(one) > reinterpret_cast(1arc4n256))) - assert(!(reinterpret_cast(one) < reinterpret_cast(1arc4n256))) + assert(!(reinterpret_cast(one) > reinterpret_cast(1_arc4u256))) + assert(!(reinterpret_cast(one) < reinterpret_cast(1_arc4u256))) assert(!(reinterpret_cast(one) > reinterpret_cast(one))) assert(!(reinterpret_cast(one) > itob(one_uint64))) assert(!(reinterpret_cast(one) > one_biguint)) - assert(!(reinterpret_cast(one) > reinterpret_cast(2arc4n256))) + assert(!(reinterpret_cast(one) > reinterpret_cast(2_arc4u256))) assert(!(reinterpret_cast(one) > reinterpret_cast(two))) assert(!(reinterpret_cast(one) > itob(two_uint64))) assert(!(reinterpret_cast(one) > two_biguint)) diff --git a/test_cases/arc4_types/numeric.py b/test_cases/arc4_types/numeric.py index 7cd8aaad1a..f9e10a2ee4 100644 --- a/test_cases/arc4_types/numeric.py +++ b/test_cases/arc4_types/numeric.py @@ -20,6 +20,8 @@ ARC4BigUInt: t.TypeAlias = BigUIntN[t.Literal[128]] +ARC4BiggieSmalls: t.TypeAlias = BigUIntN[t.Literal[32]] + sixty_four_byte_num = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF # noqa: E501 @@ -104,6 +106,8 @@ def approval_program(self) -> bool: tup = Tuple((ARC4UInt64(OnCompleteAction.ClearState),)) assert tup[0].native == OnCompleteAction.ClearState + assert ARC4BiggieSmalls(1).native == BigUInt(1) + return True def clear_state_program(self) -> bool: diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.approval.mir b/test_cases/arc4_types/out/Arc4NumericTypesContract.approval.mir index 32358b3573..c5bed3f959 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.approval.mir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.approval.mir @@ -1,7 +1,7 @@ // Op Stack (out) // test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> uint64: main_block@0: - // arc4_types/numeric.py:43 + // arc4_types/numeric.py:45 // assert UInt8(1 if Txn.num_app_args else 2) == 2 txn NumAppArgs tmp%16#0 byte 0x02 tmp%16#0,0x02 @@ -11,7 +11,7 @@ main_block@0: byte 0x02 reinterpret_biguint%0#0,0x02 b== tmp%18#0 assert - // arc4_types/numeric.py:44 + // arc4_types/numeric.py:46 // assert UInt512(1 if Txn.num_app_args else 2) == 2 txn NumAppArgs tmp%19#0 byte 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 tmp%19#0,0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 @@ -21,7 +21,7 @@ main_block@0: byte 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 reinterpret_biguint%2#0,0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 b== tmp%21#0 assert - // arc4_types/numeric.py:91 + // arc4_types/numeric.py:93 // assert Decimal("1844674407.3709551615" if Txn.num_app_args else "0.0") == Decimal() txn NumAppArgs tmp%43#0 byte 0x0000000000000000 tmp%43#0,0x0000000000000000 @@ -31,7 +31,7 @@ main_block@0: byte 0x0000000000000000 tmp%45#0,0x0000000000000000 == tmp%46#0 assert - // arc4_types/numeric.py:107 + // arc4_types/numeric.py:111 // return True int 1 1 return diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.approval.teal b/test_cases/arc4_types/out/Arc4NumericTypesContract.approval.teal index da7e20bd0f..49b3b870e1 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.approval.teal +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.approval.teal @@ -2,7 +2,7 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: bytecblock 0x02 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 0x0000000000000000 - // arc4_types/numeric.py:43 + // arc4_types/numeric.py:45 // assert UInt8(1 if Txn.num_app_args else 2) == 2 bytec_0 // 0x02 pushbytes 0x01 @@ -11,7 +11,7 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: bytec_0 // 0x02 b== assert - // arc4_types/numeric.py:44 + // arc4_types/numeric.py:46 // assert UInt512(1 if Txn.num_app_args else 2) == 2 bytec_1 // 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 pushbytes 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 @@ -20,7 +20,7 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: bytec_1 // 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 b== assert - // arc4_types/numeric.py:91 + // arc4_types/numeric.py:93 // assert Decimal("1844674407.3709551615" if Txn.num_app_args else "0.0") == Decimal() bytec_2 // 0x0000000000000000 pushbytes 0xffffffffffffffff @@ -29,7 +29,7 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: bytec_2 // 0x0000000000000000 == assert - // arc4_types/numeric.py:107 + // arc4_types/numeric.py:111 // return True pushint 1 // 1 return diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.clear.mir b/test_cases/arc4_types/out/Arc4NumericTypesContract.clear.mir index d5b717972d..78ef6265e5 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.clear.mir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.clear.mir @@ -1,7 +1,7 @@ // Op Stack (out) // test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> uint64: main_block@0: - // arc4_types/numeric.py:116 + // arc4_types/numeric.py:120 // return True int 1 1 return diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.clear.teal b/test_cases/arc4_types/out/Arc4NumericTypesContract.clear.teal index 9ff5d5e278..166f951067 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.clear.teal +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.clear.teal @@ -1,7 +1,7 @@ #pragma version 10 test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program: - // arc4_types/numeric.py:116 + // arc4_types/numeric.py:120 // return True pushint 1 // 1 return diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.destructured.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.destructured.ir index e322353d24..c9ebe051cb 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.destructured.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.destructured.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let tmp%16#0: uint64 = (txn NumAppArgs) let reinterpret_biguint%0#0: biguint = (select 0x02 0x01 tmp%16#0) let tmp%18#0: bool = (b== reinterpret_biguint%0#0 0x02) @@ -18,5 +18,5 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 return 1u \ No newline at end of file diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.ir index 0206553487..04940f63e4 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let uint8#0: uint64 = 255u let val_as_bytes%0#0: bytes = (itob uint8#0) let int8_encoded#0: bytes = ((extract 7 1) val_as_bytes%0#0) @@ -132,11 +132,13 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: let tmp%53#0: uint64 = (btoi tmp%52#0) let tmp%54#0: bool = (== tmp%53#0 ClearState) (assert tmp%54#0) + let tmp%55#0: bool = (b== 0x00000001 1b) + (assert tmp%55#0) return 1u program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 let reinterpret_biguint%0#0: biguint = 0x0000000000000000 let tmp%0#0: bool = (b== reinterpret_biguint%0#0 0b) (assert tmp%0#0) diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_1.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_1.ir index 1c668ba0ee..09064d010d 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_1.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_1.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let int8_encoded#0: bytes = 0xff let int8_decoded#0: uint64 = (btoi int8_encoded#0) let tmp%0#0: bool = (== 255u int8_decoded#0) @@ -96,11 +96,13 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: let tmp%53#0: uint64 = (btoi tmp%52#0) let tmp%54#0: bool = (== tmp%53#0 ClearState) (assert tmp%54#0) + let tmp%55#0: bool = 1u + (assert tmp%55#0) return 1u program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 let tmp%0#0: bool = 1u (assert tmp%0#0) let tmp%1#0: bool = 1u diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_2.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_2.ir index 38abbd5957..1e56159882 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_2.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_2.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let int8_decoded#0: uint64 = 255u let tmp%0#0: bool = (== 255u int8_decoded#0) (assert tmp%0#0) @@ -66,5 +66,5 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 return 1u \ No newline at end of file diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_3.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_3.ir index 01d2bcfe6e..5d685d7c7f 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_3.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_3.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let tmp%0#0: bool = 1u (assert tmp%0#0) let bounded_index%0#0: uint64 = 1u @@ -53,5 +53,5 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 return 1u \ No newline at end of file diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_4.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_4.ir index 9cb172731b..32066511f9 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_4.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_4.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let tmp%1#0: bytes = 0x7f let tmp%2#0: uint64 = (btoi tmp%1#0) let tmp%3#0: bool = (== tmp%2#0 127u) @@ -42,5 +42,5 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 return 1u \ No newline at end of file diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_5.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_5.ir index 5e7cb960c1..262cf146d0 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_5.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_5.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let tmp%2#0: uint64 = 127u let tmp%3#0: bool = (== tmp%2#0 127u) (assert tmp%3#0) @@ -33,5 +33,5 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 return 1u \ No newline at end of file diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_6.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_6.ir index c4436c2b27..610ffa1553 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_6.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_6.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let tmp%3#0: bool = 1u (assert tmp%3#0) let tmp%6#0: bool = 1u @@ -28,5 +28,5 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 return 1u \ No newline at end of file diff --git a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_7.ir b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_7.ir index e322353d24..c9ebe051cb 100644 --- a/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_7.ir +++ b/test_cases/arc4_types/out/Arc4NumericTypesContract.ssa.opt_pass_7.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let tmp%16#0: uint64 = (txn NumAppArgs) let reinterpret_biguint%0#0: biguint = (select 0x02 0x01 tmp%16#0) let tmp%18#0: bool = (b== reinterpret_biguint%0#0 0x02) @@ -18,5 +18,5 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 return 1u \ No newline at end of file diff --git a/test_cases/arc4_types/out/module.awst b/test_cases/arc4_types/out/module.awst index 3682c8ba51..d55add56f1 100644 --- a/test_cases/arc4_types/out/module.awst +++ b/test_cases/arc4_types/out/module.awst @@ -5,9 +5,9 @@ contract Arc4TuplesTypeContract subroutine test_cases.arc4_types.tuples.Arc4TuplesTypeContract.approval_program(): bool { - my_tuple: arc4.tuple,arc4.dynamic_array,arc4.uint8> = arc4_encode((1arc4u8, 2arc4u8, arc4_encode('hello', arc4.dynamic_array), arc4_encode('world', arc4.dynamic_array), 255arc4u8), arc4.tuple,arc4.dynamic_array,arc4.uint8>) + my_tuple: arc4.tuple,arc4.dynamic_array,arc4.uint8> = arc4_encode((1_arc4u8, 2_arc4u8, arc4_encode('hello', arc4.dynamic_array), arc4_encode('world', arc4.dynamic_array), 255_arc4u8), arc4.tuple,arc4.dynamic_array,arc4.uint8>) assert(my_tuple == reinterpret_cast,arc4.dynamic_array,arc4.uint8>>(hex<"01020007000EFF000568656C6C6F0005776F726C64">)) - boolean_packing: arc4.tuple = arc4_encode((4arc4u8, arc4_encode(true, arc4.bool), arc4_encode(false, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(false, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(true, arc4.bool), 16arc4u8), arc4.tuple) + boolean_packing: arc4.tuple = arc4_encode((4_arc4u8, arc4_encode(true, arc4.bool), arc4_encode(false, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(false, arc4.bool), arc4_encode(true, arc4.bool), arc4_encode(true, arc4.bool), 16_arc4u8), arc4.tuple) assert(reinterpret_cast(boolean_packing) == hex<"04BD8010">) (a, b, c, d, e, f, g, h, i, j, k): tuple = arc4_decode(boolean_packing, tuple) assert(reinterpret_cast(boolean_packing[10]) == reinterpret_cast(k)) @@ -165,8 +165,8 @@ contract Arc4NumericTypesContract assert(arc4_decode(reinterpret_cast(test_bytes[:2]), uint64) == 32767u) assert(arc4_decode(reinterpret_cast(test_bytes[:4]), uint64) == 2147483647u) assert(arc4_decode(reinterpret_cast(test_bytes[:8]), uint64) == 9223372036854775807u) - assert(reinterpret_cast((txn() != 0u) ? (1arc4u8) : (2arc4u8)) == reinterpret_cast(2arc4u8)) - assert(reinterpret_cast((txn() != 0u) ? (1arc4n512) : (2arc4n512)) == reinterpret_cast(2arc4n512)) + assert(reinterpret_cast((txn() != 0u) ? (1_arc4u8) : (2_arc4u8)) == reinterpret_cast(2_arc4u8)) + assert(reinterpret_cast((txn() != 0u) ? (1_arc4u512) : (2_arc4u512)) == reinterpret_cast(2_arc4u512)) decimals: arc4.ufixed64x10 = 145.6853943940arc4u64x10 assert(reinterpret_cast(decimals) == itob(1456853943940u)) decimals_from_truncated_str: arc4.ufixed64x10 = 145.0000000000arc4u64x10 @@ -186,18 +186,19 @@ contract Arc4NumericTypesContract assert(reinterpret_cast(smallest_decimal) == itob(1u)) sixty_four_decimal: arc4.ufixed64x10 = 1844674407.3709551615arc4u64x10 assert(reinterpret_cast(sixty_four_decimal) == itob(18446744073709551615u)) - really_big_int: arc4.uint512 = 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095arc4n512 + really_big_int: arc4.uint512 = 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095_arc4u512 assert(reinterpret_cast(really_big_int) == reinterpret_cast(reinterpret_cast(reinterpret_cast(really_big_int)))) really_big_decimal: arc4.ufixed512x2 = reinterpret_cast(reinterpret_cast(13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095n)) assert((txn() != 0u) ? (1844674407.3709551615arc4u64x10) : (0E-10arc4u64x10) == 0E-10arc4u64x10) biguint: biguint = 1n - arc4_biguint_const: arc4.uint128 = 1arc4n128 + arc4_biguint_const: arc4.uint128 = 1_arc4u128 arc4_biguint_dynamic: arc4.uint128 = arc4_encode(biguint b+ 1n, arc4.uint128) assert(biguint == arc4_decode(arc4_biguint_const, biguint)) assert(len(reinterpret_cast(arc4_biguint_dynamic)) == 16u) assert(len(reinterpret_cast(really_big_decimal)) == 64u) tup: arc4.tuple = arc4_encode((arc4_encode(ClearState, arc4.uint64)), arc4.tuple) assert(arc4_decode(tup[0], uint64) == ClearState) + assert(arc4_decode(1_arc4u32, biguint) == 1n) return true } @@ -205,9 +206,9 @@ contract Arc4NumericTypesContract { assert(reinterpret_cast(reinterpret_cast(0E-10arc4u64x10)) == 0n) assert(reinterpret_cast(reinterpret_cast(0.00000arc4n512x5)) == 0n) - assert(reinterpret_cast(0arc4u8) == reinterpret_cast(0arc4u8)) - assert(reinterpret_cast(0arc4u64) == reinterpret_cast(0arc4u64)) - assert(reinterpret_cast(0arc4n512) == reinterpret_cast(0arc4n512)) + assert(reinterpret_cast(0_arc4u8) == reinterpret_cast(0_arc4u8)) + assert(reinterpret_cast(0_arc4u64) == reinterpret_cast(0_arc4u64)) + assert(reinterpret_cast(0_arc4u512) == reinterpret_cast(0_arc4u512)) return true } } @@ -245,11 +246,11 @@ contract Arc4MutationContract subroutine test_cases.arc4_types.mutation.Arc4MutationContract.array_concat(): void { - uint8_array: arc4.dynamic_array = new arc4.dynamic_array(1arc4u8, 2arc4u8) - array_concat_tuple: arc4.dynamic_array = uint8_array + (3arc4u8, 4arc4u8) - assert(array_concat_tuple == new arc4.dynamic_array(1arc4u8, 2arc4u8, 3arc4u8, 4arc4u8)) - array_concat_tuple.extend((5arc4u8)) - assert(array_concat_tuple == new arc4.dynamic_array(1arc4u8, 2arc4u8, 3arc4u8, 4arc4u8, 5arc4u8)) + uint8_array: arc4.dynamic_array = new arc4.dynamic_array(1_arc4u8, 2_arc4u8) + array_concat_tuple: arc4.dynamic_array = uint8_array + (3_arc4u8, 4_arc4u8) + assert(array_concat_tuple == new arc4.dynamic_array(1_arc4u8, 2_arc4u8, 3_arc4u8, 4_arc4u8)) + array_concat_tuple.extend((5_arc4u8)) + assert(array_concat_tuple == new arc4.dynamic_array(1_arc4u8, 2_arc4u8, 3_arc4u8, 4_arc4u8, 5_arc4u8)) hello_world: arc4.dynamic_array> = new arc4.dynamic_array>(arc4_encode('Hello', arc4.dynamic_array), arc4_encode('World', arc4.dynamic_array)) hello_world_concat: arc4.dynamic_array> = new arc4.dynamic_array>(arc4_encode('Hello', arc4.dynamic_array)) + new arc4.dynamic_array>(arc4_encode('World', arc4.dynamic_array)) assert(hello_world == hello_world_concat) @@ -259,33 +260,33 @@ contract Arc4MutationContract { array_of_array: arc4.dynamic_array> = new arc4.dynamic_array>() assert(reinterpret_cast(array_of_array) == hex<"0000">) - array_of_array.extend((new arc4.dynamic_array(10arc4u8))) + array_of_array.extend((new arc4.dynamic_array(10_arc4u8))) assert(reinterpret_cast(array_of_array) == hex<"0001000200010A">) - array_of_array.extend((new arc4.dynamic_array(16arc4u8))) + array_of_array.extend((new arc4.dynamic_array(16_arc4u8))) assert(reinterpret_cast(array_of_array) == hex<"00020004000700010A000110">) - array_of_array[0u].extend((255arc4u8)) + array_of_array[0u].extend((255_arc4u8)) assert(reinterpret_cast(array_of_array) == hex<"00020004000800020AFF000110">) - array_of_array[0u][1u]: arc4.uint8 = 0arc4u8 + array_of_array[0u][1u]: arc4.uint8 = 0_arc4u8 assert(reinterpret_cast(array_of_array) == hex<"00020004000800020A00000110">) } subroutine test_cases.arc4_types.mutation.Arc4MutationContract.array_of_array_static(): void { - array_of_array: arc4.static_array, 2> = new arc4.static_array, 2>(new arc4.static_array(10arc4u8, 9arc4u8), new arc4.static_array(64arc4u8, 128arc4u8)) + array_of_array: arc4.static_array, 2> = new arc4.static_array, 2>(new arc4.static_array(10_arc4u8, 9_arc4u8), new arc4.static_array(64_arc4u8, 128_arc4u8)) assert(reinterpret_cast(array_of_array) == hex<"0A094080">) - array_of_array[0u]: arc4.static_array = new arc4.static_array(255arc4u8, 254arc4u8) + array_of_array[0u]: arc4.static_array = new arc4.static_array(255_arc4u8, 254_arc4u8) assert(reinterpret_cast(array_of_array) == hex<"FFFE4080">) - array_of_array[1u][0u]: arc4.uint8 = 1arc4u8 + array_of_array[1u][0u]: arc4.uint8 = 1_arc4u8 assert(reinterpret_cast(array_of_array) == hex<"FFFE0180">) } subroutine test_cases.arc4_types.mutation.Arc4MutationContract.index_assign(): void { - dynamic_uint8_array: arc4.dynamic_array = new arc4.dynamic_array(1arc4u8, 2arc4u8) - dynamic_uint8_array[0u]: arc4.uint8 = 255arc4u8 + dynamic_uint8_array: arc4.dynamic_array = new arc4.dynamic_array(1_arc4u8, 2_arc4u8) + dynamic_uint8_array[0u]: arc4.uint8 = 255_arc4u8 assert(reinterpret_cast(dynamic_uint8_array) == hex<"0002FF02">) - static_uint8_array: arc4.static_array = new arc4.static_array(1arc4u8, 2arc4u8) - static_uint8_array[1u]: arc4.uint8 = 255arc4u8 + static_uint8_array: arc4.static_array = new arc4.static_array(1_arc4u8, 2_arc4u8) + static_uint8_array[1u]: arc4.uint8 = 255_arc4u8 assert(reinterpret_cast(static_uint8_array) == hex<"01FF">) dynamic_bool_array: arc4.dynamic_array = new arc4.dynamic_array(arc4_encode(true, arc4.bool), arc4_encode(false, arc4.bool)) dynamic_bool_array[0u]: arc4.bool = arc4_encode(false, arc4.bool) @@ -297,27 +298,27 @@ contract Arc4MutationContract subroutine test_cases.arc4_types.mutation.Arc4MutationContract.struct_assign(): void { - test_struct: test_cases.arc4_types.mutation.TestStruct = new test_cases.arc4_types.mutation.TestStruct(b_val=arc4_encode(true, arc4.bool), u_val=50arc4u8, s_val_1=arc4_encode('Happy', arc4.dynamic_array), s_val_2=arc4_encode('Days', arc4.dynamic_array)) + test_struct: test_cases.arc4_types.mutation.TestStruct = new test_cases.arc4_types.mutation.TestStruct(b_val=arc4_encode(true, arc4.bool), u_val=50_arc4u8, s_val_1=arc4_encode('Happy', arc4.dynamic_array), s_val_2=arc4_encode('Days', arc4.dynamic_array)) test_struct.b_val: arc4.bool = arc4_encode(false, arc4.bool) - test_struct.u_val: arc4.uint8 = 12arc4u8 - assert(test_struct == new test_cases.arc4_types.mutation.TestStruct(b_val=arc4_encode(false, arc4.bool), u_val=12arc4u8, s_val_1=arc4_encode('Happy', arc4.dynamic_array), s_val_2=arc4_encode('Days', arc4.dynamic_array))) + test_struct.u_val: arc4.uint8 = 12_arc4u8 + assert(test_struct == new test_cases.arc4_types.mutation.TestStruct(b_val=arc4_encode(false, arc4.bool), u_val=12_arc4u8, s_val_1=arc4_encode('Happy', arc4.dynamic_array), s_val_2=arc4_encode('Days', arc4.dynamic_array))) test_struct.s_val_1: arc4.dynamic_array = arc4_encode('Hmmmm', arc4.dynamic_array) test_struct.s_val_2: arc4.dynamic_array = arc4_encode('Oh well', arc4.dynamic_array) - assert(test_struct == new test_cases.arc4_types.mutation.TestStruct(b_val=arc4_encode(false, arc4.bool), u_val=12arc4u8, s_val_1=arc4_encode('Hmmmm', arc4.dynamic_array), s_val_2=arc4_encode('Oh well', arc4.dynamic_array))) + assert(test_struct == new test_cases.arc4_types.mutation.TestStruct(b_val=arc4_encode(false, arc4.bool), u_val=12_arc4u8, s_val_1=arc4_encode('Hmmmm', arc4.dynamic_array), s_val_2=arc4_encode('Oh well', arc4.dynamic_array))) } subroutine test_cases.arc4_types.mutation.Arc4MutationContract.dynamic_array_fixed_size(): void { - dynamic_uint8_array: arc4.dynamic_array = new arc4.dynamic_array(1arc4u8, 2arc4u8) - dynamic_uint8_array.extend((50arc4u8)) - assert(dynamic_uint8_array == new arc4.dynamic_array(1arc4u8, 2arc4u8, 50arc4u8)) + dynamic_uint8_array: arc4.dynamic_array = new arc4.dynamic_array(1_arc4u8, 2_arc4u8) + dynamic_uint8_array.extend((50_arc4u8)) + assert(dynamic_uint8_array == new arc4.dynamic_array(1_arc4u8, 2_arc4u8, 50_arc4u8)) dynamic_uint8_array.extend(dynamic_uint8_array) - assert(dynamic_uint8_array == new arc4.dynamic_array(1arc4u8, 2arc4u8, 50arc4u8, 1arc4u8, 2arc4u8, 50arc4u8)) - dynamic_uint8_array.extend((4arc4u8, 90arc4u8)) - assert(dynamic_uint8_array == new arc4.dynamic_array(1arc4u8, 2arc4u8, 50arc4u8, 1arc4u8, 2arc4u8, 50arc4u8, 4arc4u8, 90arc4u8)) + assert(dynamic_uint8_array == new arc4.dynamic_array(1_arc4u8, 2_arc4u8, 50_arc4u8, 1_arc4u8, 2_arc4u8, 50_arc4u8)) + dynamic_uint8_array.extend((4_arc4u8, 90_arc4u8)) + assert(dynamic_uint8_array == new arc4.dynamic_array(1_arc4u8, 2_arc4u8, 50_arc4u8, 1_arc4u8, 2_arc4u8, 50_arc4u8, 4_arc4u8, 90_arc4u8)) popped: arc4.uint8 = dynamic_uint8_array.pop() - assert(reinterpret_cast(popped) == reinterpret_cast(90arc4u8)) - assert(dynamic_uint8_array == new arc4.dynamic_array(1arc4u8, 2arc4u8, 50arc4u8, 1arc4u8, 2arc4u8, 50arc4u8, 4arc4u8)) + assert(reinterpret_cast(popped) == reinterpret_cast(90_arc4u8)) + assert(dynamic_uint8_array == new arc4.dynamic_array(1_arc4u8, 2_arc4u8, 50_arc4u8, 1_arc4u8, 2_arc4u8, 50_arc4u8, 4_arc4u8)) } subroutine test_cases.arc4_types.mutation.Arc4MutationContract.dynamic_array_bool(): void @@ -376,26 +377,26 @@ contract Arc4MutableParamsContract subroutine test_cases.arc4_types.mutable_params.Arc4MutableParamsContract.mutating_copies(): void { - my_array: arc4.static_array = new arc4.static_array(1arc4u8, 2arc4u8, 3arc4u8, 4arc4u8) - my_struct: test_cases.arc4_types.mutable_params.TestStruct = new test_cases.arc4_types.mutable_params.TestStruct(b_val=arc4_encode(true, arc4.bool), u_val=50arc4u8, s_val_1=arc4_encode('Happy', arc4.dynamic_array), s_val_2=arc4_encode('Days', arc4.dynamic_array)) + my_array: arc4.static_array = new arc4.static_array(1_arc4u8, 2_arc4u8, 3_arc4u8, 4_arc4u8) + my_struct: test_cases.arc4_types.mutable_params.TestStruct = new test_cases.arc4_types.mutable_params.TestStruct(b_val=arc4_encode(true, arc4.bool), u_val=50_arc4u8, s_val_1=arc4_encode('Happy', arc4.dynamic_array), s_val_2=arc4_encode('Days', arc4.dynamic_array)) my_array_copy: arc4.static_array = my_array.copy() my_struct_copy: test_cases.arc4_types.mutable_params.TestStruct = my_struct.copy() - my_array[2u]: arc4.uint8 = 5arc4u8 - assert(reinterpret_cast(my_array_copy[2u]) == reinterpret_cast(3arc4u8), comment="my_array_copy should be unchanged") - assert(reinterpret_cast(my_array[2u]) == reinterpret_cast(5arc4u8), comment="my_array should be mutated") + my_array[2u]: arc4.uint8 = 5_arc4u8 + assert(reinterpret_cast(my_array_copy[2u]) == reinterpret_cast(3_arc4u8), comment="my_array_copy should be unchanged") + assert(reinterpret_cast(my_array[2u]) == reinterpret_cast(5_arc4u8), comment="my_array should be mutated") (t, f): tuple = this::other_routine(my_array, my_struct) assert(t) assert(!(f)) - assert(reinterpret_cast(my_array[1u]) == reinterpret_cast(5arc4u8), comment="my_array has been mutated by the subroutine") + assert(reinterpret_cast(my_array[1u]) == reinterpret_cast(5_arc4u8), comment="my_array has been mutated by the subroutine") assert(my_struct.s_val_1 == arc4_encode('AARRGH!', arc4.dynamic_array), comment="my_struct has been mutated by the subroutine") this::other_routine(my_array_copy.copy(), my_struct_copy.copy()) - assert(reinterpret_cast(my_array_copy[1u]) == reinterpret_cast(2arc4u8), comment="my_array_copy should not be mutated by the subroutine") + assert(reinterpret_cast(my_array_copy[1u]) == reinterpret_cast(2_arc4u8), comment="my_array_copy should not be mutated by the subroutine") assert(my_struct_copy.s_val_1 == arc4_encode('Happy', arc4.dynamic_array), comment="my_struct_copy should not be mutated by the subroutine") my_array_copy_2: arc4.static_array = my_array_copy.copy() my_array_copy_2: arc4.static_array = this::other_routine_2(my_array_copy_2) - assert(reinterpret_cast(my_array_copy_2[0u]) == reinterpret_cast(1arc4u8), comment="my_array_copy_2 should have original value") + assert(reinterpret_cast(my_array_copy_2[0u]) == reinterpret_cast(1_arc4u8), comment="my_array_copy_2 should have original value") this::other_routine_2(my_array_copy_2) - assert(reinterpret_cast(my_array_copy_2[0u]) == reinterpret_cast(10arc4u8), comment="my_array_copy_2 should have mutated value") + assert(reinterpret_cast(my_array_copy_2[0u]) == reinterpret_cast(10_arc4u8), comment="my_array_copy_2 should have mutated value") this::other_routine_3((my_array.copy(), my_array_copy_2.copy(), my_array_copy_2.copy())) nested: test_cases.arc4_types.mutable_params.StructWithArray = new test_cases.arc4_types.mutable_params.StructWithArray(test_array=my_array.copy()) this::other_routine_2(nested.test_array.copy()) @@ -403,7 +404,7 @@ contract Arc4MutableParamsContract subroutine test_cases.arc4_types.mutable_params.Arc4MutableParamsContract.other_routine(array: arc4.static_array, struct: test_cases.arc4_types.mutable_params.TestStruct): tuple { - array[1u]: arc4.uint8 = 5arc4u8 + array[1u]: arc4.uint8 = 5_arc4u8 struct.s_val_1: arc4.dynamic_array = arc4_encode('AARRGH!', arc4.dynamic_array) return (true, false) } @@ -411,18 +412,18 @@ contract Arc4MutableParamsContract subroutine test_cases.arc4_types.mutable_params.Arc4MutableParamsContract.other_routine_2(array: arc4.static_array): arc4.static_array { copy: arc4.static_array = array.copy() - array[0u]: arc4.uint8 = 10arc4u8 + array[0u]: arc4.uint8 = 10_arc4u8 return copy } subroutine test_cases.arc4_types.mutable_params.Arc4MutableParamsContract.other_routine_3(arrays: tuple,arc4.static_array,arc4.static_array>): void { for array in arrays { - array[0u]: arc4.uint8 = 99arc4u8 + array[0u]: arc4.uint8 = 99_arc4u8 } - arrays[0][0u]: arc4.uint8 = 99arc4u8 - arrays[1][0u]: arc4.uint8 = 99arc4u8 - arrays[2][0u]: arc4.uint8 = 99arc4u8 + arrays[0][0u]: arc4.uint8 = 99_arc4u8 + arrays[1][0u]: arc4.uint8 = 99_arc4u8 + arrays[2][0u]: arc4.uint8 = 99_arc4u8 } } @@ -449,7 +450,7 @@ contract Arc4DynamicStringArrayContract abimethod test_cases.arc4_types.dynamic_string_array.Arc4DynamicStringArrayContract.xyz_raw(): arc4.dynamic_array> { - raw: arc4.dynamic_array> = new arc4.dynamic_array>(new arc4.dynamic_array(88arc4u8), new arc4.dynamic_array(89arc4u8), new arc4.dynamic_array(90arc4u8)) + raw: arc4.dynamic_array> = new arc4.dynamic_array>(new arc4.dynamic_array(88_arc4u8), new arc4.dynamic_array(89_arc4u8), new arc4.dynamic_array(90_arc4u8)) return reinterpret_cast>>(reinterpret_cast(raw)) } @@ -466,7 +467,7 @@ contract Arc4DynamicBytesContract subroutine test_cases.arc4_types.dynamic_bytes.Arc4DynamicBytesContract.approval_program(): bool { total: uint64 = 0u - dynamic_bytes: arc4.dynamic_array = new arc4.dynamic_array(2arc4u8, 3arc4u8, 1arc4u8) + dynamic_bytes: arc4.dynamic_array = new arc4.dynamic_array(2_arc4u8, 3_arc4u8, 1_arc4u8) assert(arc4_decode(dynamic_bytes, bytes) == hex<"020301">) assert(reinterpret_cast(dynamic_bytes) == hex<"0003020301">) for uint8_item in dynamic_bytes { @@ -489,7 +490,7 @@ contract Arc4DynamicBytesContract dynamic_bytes3.extend(arc4_encode(hex<"616263">, arc4.dynamic_array)) assert(reinterpret_cast(dynamic_bytes3) == hex<"00050304616263">) assert(arc4_decode(dynamic_bytes3, bytes) == hex<"0304616263">) - dynamic_bytes: arc4.dynamic_array = new arc4.dynamic_array((txn() != 0u) ? (2arc4u8) : (3arc4u8), 3arc4u8, 1arc4u8) + dynamic_bytes: arc4.dynamic_array = new arc4.dynamic_array((txn() != 0u) ? (2_arc4u8) : (3_arc4u8), 3_arc4u8, 1_arc4u8) assert(arc4_decode(dynamic_bytes, bytes) == hex<"030301">) dynamic_bytes: arc4.dynamic_array = (txn() != 0u) ? (arc4_encode(hex<"32">, arc4.dynamic_array)) : (arc4_encode(hex<"33">, arc4.dynamic_array)) assert(arc4_decode(dynamic_bytes, bytes) == hex<"33">) @@ -515,31 +516,31 @@ contract Arc4BoolEvalContract assert(arc4_encode('.', arc4.dynamic_array) != hex<"0000">) assert(global() == global()) assert(reinterpret_cast>(txn()) != global()) - assert(0arc4u8 == hex<"00">) - assert(1arc4u8 != hex<"00">) - assert(0arc4u16 == hex<"0000">) - assert(1arc4u16 != hex<"0000">) - assert(0arc4u32 == hex<"00000000">) - assert(1arc4u32 != hex<"00000000">) - assert(0arc4u64 == hex<"0000000000000000">) - assert(1arc4u64 != hex<"0000000000000000">) - assert(0arc4n128 == hex<"00000000000000000000000000000000">) - assert(1arc4n128 != hex<"00000000000000000000000000000000">) - assert(0arc4n256 == hex<"0000000000000000000000000000000000000000000000000000000000000000">) - assert(1arc4n256 != hex<"0000000000000000000000000000000000000000000000000000000000000000">) - assert(0arc4n512 == hex<"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) - assert(1arc4n512 != hex<"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) - assert(0arc4u24 == hex<"000000">) - assert(1arc4u24 != hex<"000000">) - assert(0arc4n504 == hex<"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) - assert(1arc4n504 != hex<"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) + assert(0_arc4u8 == hex<"00">) + assert(1_arc4u8 != hex<"00">) + assert(0_arc4u16 == hex<"0000">) + assert(1_arc4u16 != hex<"0000">) + assert(0_arc4u32 == hex<"00000000">) + assert(1_arc4u32 != hex<"00000000">) + assert(0_arc4u64 == hex<"0000000000000000">) + assert(1_arc4u64 != hex<"0000000000000000">) + assert(0_arc4u128 == hex<"00000000000000000000000000000000">) + assert(1_arc4u128 != hex<"00000000000000000000000000000000">) + assert(0_arc4u256 == hex<"0000000000000000000000000000000000000000000000000000000000000000">) + assert(1_arc4u256 != hex<"0000000000000000000000000000000000000000000000000000000000000000">) + assert(0_arc4u512 == hex<"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) + assert(1_arc4u512 != hex<"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) + assert(0_arc4u24 == hex<"000000">) + assert(1_arc4u24 != hex<"000000">) + assert(0_arc4u504 == hex<"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) + assert(1_arc4u504 != hex<"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) assert(0E-10arc4u48x10 == hex<"000000000000">) assert(1.0000000000arc4u48x10 != hex<"000000000000">) assert(0E-10arc4n496x10 == hex<"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) assert(0.0100000000arc4n496x10 != hex<"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">) dynamic_arr: arc4.dynamic_array = new arc4.dynamic_array() assert(dynamic_arr == hex<"0000">) - dynamic_arr.extend((0arc4u64)) + dynamic_arr.extend((0_arc4u64)) assert(dynamic_arr != hex<"0000">) assert(arc4_encode(false, arc4.bool) == arc4_encode(false, arc4.bool)) return true @@ -595,13 +596,13 @@ contract Arc4ArraysContract subroutine test_cases.arc4_types.array.Arc4ArraysContract.approval_program(): bool { - dynamic_uint8_array: arc4.dynamic_array = new arc4.dynamic_array(1arc4u8, 2arc4u8) + dynamic_uint8_array: arc4.dynamic_array = new arc4.dynamic_array(1_arc4u8, 2_arc4u8) total: uint64 = 0u for uint8_item in dynamic_uint8_array { total += arc4_decode(uint8_item, uint64) } assert(total == 3u, comment="Total should be sum of dynamic_uint8_array items") - aliased_dynamic: arc4.dynamic_array = new arc4.dynamic_array(1arc4u16) + aliased_dynamic: arc4.dynamic_array = new arc4.dynamic_array(1_arc4u16) for uint16_item in aliased_dynamic { total += arc4_decode(uint16_item, uint64) } @@ -618,12 +619,12 @@ contract Arc4ArraysContract } } assert(result == 'Hello World') - static_uint32_array: arc4.static_array = new arc4.static_array(1arc4u32, 10arc4u32, 255arc4u32, 128arc4u32) + static_uint32_array: arc4.static_array = new arc4.static_array(1_arc4u32, 10_arc4u32, 255_arc4u32, 128_arc4u32) for uint32_item in static_uint32_array { total += arc4_decode(uint32_item, uint64) } assert(total == 398u) - aliased_static: arc4.static_array = new arc4.static_array(101arc4u8) + aliased_static: arc4.static_array = new arc4.static_array(101_arc4u8) index: uint64 = 0u assert(arc4_decode(aliased_static[0u], uint64) + arc4_decode(aliased_static[index], uint64) == 202u) static_string_array: arc4.static_array, 2> = new arc4.static_array, 2>(arc4_encode('Ping', arc4.dynamic_array), arc4_encode('Pong', arc4.dynamic_array)) @@ -666,7 +667,7 @@ contract Arc4AddressContract assert(reinterpret_cast(zero_address) == reinterpret_cast(global())) some_address: arc4.static_array = Address("VCMJKWOY5P5P7SKMZFFOCEROPJCZOTIJMNIYNUCKH7LRO45JMJP6UYBIJA") assert(some_address == Address("VCMJKWOY5P5P7SKMZFFOCEROPJCZOTIJMNIYNUCKH7LRO45JMJP6UYBIJA")) - some_address[0u]: arc4.uint8 = 123arc4u8 + some_address[0u]: arc4.uint8 = 123_arc4u8 assert(some_address != Address("VCMJKWOY5P5P7SKMZFFOCEROPJCZOTIJMNIYNUCKH7LRO45JMJP6UYBIJA")) return true } diff --git a/test_cases/arc4_types/out/numeric.O0.log b/test_cases/arc4_types/out/numeric.O0.log index b0d67093f5..a8ecd592e4 100644 --- a/test_cases/arc4_types/out/numeric.O0.log +++ b/test_cases/arc4_types/out/numeric.O0.log @@ -213,5 +213,9 @@ PC Teal 632 intc_2 3, 3 633 == 1 634 assert -635 intc_1 1 -636 return 1 \ No newline at end of file +635 pushbytes 0x00000001 0x00000001 +641 bytec_1 0x00000001, 0x01 +642 b== 1 +643 assert +644 intc_1 1 +645 return 1 \ No newline at end of file diff --git a/test_cases/arc4_types/out_O2/Arc4NumericTypesContract.destructured.ir b/test_cases/arc4_types/out_O2/Arc4NumericTypesContract.destructured.ir index e322353d24..c9ebe051cb 100644 --- a/test_cases/arc4_types/out_O2/Arc4NumericTypesContract.destructured.ir +++ b/test_cases/arc4_types/out_O2/Arc4NumericTypesContract.destructured.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let tmp%16#0: uint64 = (txn NumAppArgs) let reinterpret_biguint%0#0: biguint = (select 0x02 0x01 tmp%16#0) let tmp%18#0: bool = (b== reinterpret_biguint%0#0 0x02) @@ -18,5 +18,5 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 return 1u \ No newline at end of file diff --git a/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.approval.teal b/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.approval.teal index fe792b605f..6be11ae6a2 100644 --- a/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.approval.teal +++ b/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.approval.teal @@ -3,27 +3,27 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: intcblock 0 1 3 8 bytecblock 0x7fffffffffffffff00 0x01 0x0000000000000000 0x02 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 0x000009184e72a000 0xffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - // arc4_types/numeric.py:29 + // arc4_types/numeric.py:31 // uint8 = UInt64(255) pushint 255 // 255 - // arc4_types/numeric.py:31 + // arc4_types/numeric.py:33 // int8_encoded = UInt8(uint8) itob extract 7 1 - // arc4_types/numeric.py:33 + // arc4_types/numeric.py:35 // int8_decoded = int8_encoded.native btoi - // arc4_types/numeric.py:29 + // arc4_types/numeric.py:31 // uint8 = UInt64(255) pushint 255 // 255 - // arc4_types/numeric.py:35 + // arc4_types/numeric.py:37 // assert uint8 == int8_decoded == assert - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:38 + // arc4_types/numeric.py:40 // assert UInt8.from_bytes(test_bytes[:1]).native == 2**8 - 1 - 2**7 len intc_1 // 1 @@ -33,10 +33,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: uncover 2 uncover 2 select - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:38 + // arc4_types/numeric.py:40 // assert UInt8.from_bytes(test_bytes[:1]).native == 2**8 - 1 - 2**7 intc_0 // 0 uncover 2 @@ -45,10 +45,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: pushint 127 // 127 == assert - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:39 + // arc4_types/numeric.py:41 // assert UIntN[typing.Literal[24]].from_bytes(test_bytes[:3]).native == 2**24 - 1 - 2**23 len intc_2 // 3 @@ -58,10 +58,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: uncover 2 uncover 2 select - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:39 + // arc4_types/numeric.py:41 // assert UIntN[typing.Literal[24]].from_bytes(test_bytes[:3]).native == 2**24 - 1 - 2**23 intc_0 // 0 uncover 2 @@ -70,10 +70,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: pushint 8388607 // 8388607 == assert - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:40 + // arc4_types/numeric.py:42 // assert UInt16.from_bytes(test_bytes[:2]).native == 2**16 - 1 - 2**15 len pushint 2 // 2 @@ -83,10 +83,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: uncover 2 uncover 2 select - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:40 + // arc4_types/numeric.py:42 // assert UInt16.from_bytes(test_bytes[:2]).native == 2**16 - 1 - 2**15 intc_0 // 0 uncover 2 @@ -95,10 +95,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: pushint 32767 // 32767 == assert - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:41 + // arc4_types/numeric.py:43 // assert UInt32.from_bytes(test_bytes[:4]).native == 2**32 - 1 - 2**31 len pushint 4 // 4 @@ -108,10 +108,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: uncover 2 uncover 2 select - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:41 + // arc4_types/numeric.py:43 // assert UInt32.from_bytes(test_bytes[:4]).native == 2**32 - 1 - 2**31 intc_0 // 0 uncover 2 @@ -120,10 +120,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: pushint 2147483647 // 2147483647 == assert - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:42 + // arc4_types/numeric.py:44 // assert ARC4UInt64.from_bytes(test_bytes[:8]).native == 2**64 - 1 - 2**63 len intc_3 // 8 @@ -133,10 +133,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: uncover 2 uncover 2 select - // arc4_types/numeric.py:37 + // arc4_types/numeric.py:39 // test_bytes = Bytes.from_hex("7FFFFFFFFFFFFFFF00") bytec_0 // 0x7fffffffffffffff00 - // arc4_types/numeric.py:42 + // arc4_types/numeric.py:44 // assert ARC4UInt64.from_bytes(test_bytes[:8]).native == 2**64 - 1 - 2**63 intc_0 // 0 uncover 2 @@ -145,7 +145,7 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: pushint 9223372036854775807 // 9223372036854775807 == assert - // arc4_types/numeric.py:43 + // arc4_types/numeric.py:45 // assert UInt8(1 if Txn.num_app_args else 2) == 2 txn NumAppArgs intc_0 // 0 @@ -157,7 +157,7 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: bytec_3 // 0x02 b== assert - // arc4_types/numeric.py:44 + // arc4_types/numeric.py:46 // assert UInt512(1 if Txn.num_app_args else 2) == 2 txn NumAppArgs intc_0 // 0 @@ -169,123 +169,123 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: bytec 4 // 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 b== assert - // arc4_types/numeric.py:48 + // arc4_types/numeric.py:50 // assert decimals.bytes == op.itob(145_6853943940) pushint 1456853943940 // 1456853943940 itob - // arc4_types/numeric.py:46 + // arc4_types/numeric.py:48 // decimals = Decimal("145.6853943940") pushbytes 0x0000015333430684 - // arc4_types/numeric.py:48 + // arc4_types/numeric.py:50 // assert decimals.bytes == op.itob(145_6853943940) == assert - // arc4_types/numeric.py:52 + // arc4_types/numeric.py:54 // assert decimals_from_truncated_str.bytes == op.itob(145_0000000000) pushint 1450000000000 // 1450000000000 itob - // arc4_types/numeric.py:50 + // arc4_types/numeric.py:52 // decimals_from_truncated_str = Decimal("145.0") pushbytes 0x000001519abc2400 - // arc4_types/numeric.py:52 + // arc4_types/numeric.py:54 // assert decimals_from_truncated_str.bytes == op.itob(145_0000000000) == assert - // arc4_types/numeric.py:54 + // arc4_types/numeric.py:56 // thousand = Decimal("1e3") bytec 5 // 0x000009184e72a000 - // arc4_types/numeric.py:56 + // arc4_types/numeric.py:58 // assert thousand.bytes.length == 8 len intc_3 // 8 == assert - // arc4_types/numeric.py:57 + // arc4_types/numeric.py:59 // assert thousand.bytes == op.itob(1000_0000000000) pushint 10000000000000 // 10000000000000 itob - // arc4_types/numeric.py:54 + // arc4_types/numeric.py:56 // thousand = Decimal("1e3") bytec 5 // 0x000009184e72a000 - // arc4_types/numeric.py:57 + // arc4_types/numeric.py:59 // assert thousand.bytes == op.itob(1000_0000000000) == assert - // arc4_types/numeric.py:61 + // arc4_types/numeric.py:63 // assert one_decimal.bytes == op.itob(1_0000000000) pushint 10000000000 // 10000000000 itob - // arc4_types/numeric.py:59 + // arc4_types/numeric.py:61 // one_decimal = Decimal("1.0") pushbytes 0x00000002540be400 - // arc4_types/numeric.py:61 + // arc4_types/numeric.py:63 // assert one_decimal.bytes == op.itob(1_0000000000) == assert - // arc4_types/numeric.py:65 + // arc4_types/numeric.py:67 // assert zero_decimal.bytes == op.itob(0) intc_0 // 0 itob - // arc4_types/numeric.py:63 + // arc4_types/numeric.py:65 // zero_decimal = Decimal("0.0") bytec_2 // 0x0000000000000000 - // arc4_types/numeric.py:65 + // arc4_types/numeric.py:67 // assert zero_decimal.bytes == op.itob(0) == assert - // arc4_types/numeric.py:69 + // arc4_types/numeric.py:71 // assert small_decimal.bytes == op.itob(100) pushint 100 // 100 itob - // arc4_types/numeric.py:67 + // arc4_types/numeric.py:69 // small_decimal = Decimal("0.00000001") pushbytes 0x0000000000000064 - // arc4_types/numeric.py:69 + // arc4_types/numeric.py:71 // assert small_decimal.bytes == op.itob(100) == assert - // arc4_types/numeric.py:73 + // arc4_types/numeric.py:75 // assert smaller_decimal.bytes == op.itob(10) pushint 10 // 10 itob - // arc4_types/numeric.py:71 + // arc4_types/numeric.py:73 // smaller_decimal = Decimal("1E-9") pushbytes 0x000000000000000a - // arc4_types/numeric.py:73 + // arc4_types/numeric.py:75 // assert smaller_decimal.bytes == op.itob(10) == assert - // arc4_types/numeric.py:77 + // arc4_types/numeric.py:79 // assert smallest_decimal.bytes == op.itob(1) intc_1 // 1 itob - // arc4_types/numeric.py:75 + // arc4_types/numeric.py:77 // smallest_decimal = Decimal("0.0000000001") pushbytes 0x0000000000000001 - // arc4_types/numeric.py:77 + // arc4_types/numeric.py:79 // assert smallest_decimal.bytes == op.itob(1) == assert - // arc4_types/numeric.py:81 + // arc4_types/numeric.py:83 // assert sixty_four_decimal.bytes == op.itob(1844674407_3709551615) pushint 18446744073709551615 // 18446744073709551615 itob - // arc4_types/numeric.py:79 + // arc4_types/numeric.py:81 // sixty_four_decimal = Decimal("1844674407.3709551615") bytec 6 // 0xffffffffffffffff - // arc4_types/numeric.py:81 + // arc4_types/numeric.py:83 // assert sixty_four_decimal.bytes == op.itob(1844674407_3709551615) == assert - // arc4_types/numeric.py:83 + // arc4_types/numeric.py:85 // really_big_int = BigUIntN[t.Literal[512]](sixty_four_byte_num) bytec 7 // 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff dup - // arc4_types/numeric.py:85 + // arc4_types/numeric.py:87 // assert really_big_int == BigUIntN[t.Literal[512]].from_bytes(really_big_int.bytes) b== assert - // arc4_types/numeric.py:91 + // arc4_types/numeric.py:93 // assert Decimal("1844674407.3709551615" if Txn.num_app_args else "0.0") == Decimal() txn NumAppArgs intc_0 // 0 @@ -297,10 +297,10 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: bytec_2 // 0x0000000000000000 == assert - // arc4_types/numeric.py:93 + // arc4_types/numeric.py:95 // biguint = BigUInt(1) bytec_1 // 0x01 - // arc4_types/numeric.py:95 + // arc4_types/numeric.py:97 // arc4_biguint_dynamic = ARC4BigUInt(biguint + 1) dup b+ @@ -312,32 +312,32 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: pushint 16 // 16 bzero b| - // arc4_types/numeric.py:93 + // arc4_types/numeric.py:95 // biguint = BigUInt(1) bytec_1 // 0x01 - // arc4_types/numeric.py:94 + // arc4_types/numeric.py:96 // arc4_biguint_const = ARC4BigUInt(1) pushbytes 0x00000000000000000000000000000001 - // arc4_types/numeric.py:97 + // arc4_types/numeric.py:99 // assert biguint == arc4_biguint_const.native b== assert - // arc4_types/numeric.py:99 + // arc4_types/numeric.py:101 // assert arc4_biguint_dynamic.bytes.length == (128 // 8) len pushint 16 // 16 == assert - // arc4_types/numeric.py:88 + // arc4_types/numeric.py:90 // BigUInt(sixty_four_byte_num).bytes bytec 7 // 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - // arc4_types/numeric.py:101 + // arc4_types/numeric.py:103 // assert really_big_decimal.bytes.length == 64 len pushint 64 // 64 == assert - // arc4_types/numeric.py:103-104 + // arc4_types/numeric.py:105-106 // # check UInt64 sub-types are converted properly // tup = Tuple((ARC4UInt64(OnCompleteAction.ClearState),)) intc_2 // ClearState @@ -345,7 +345,7 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: pushbytes 0x swap concat - // arc4_types/numeric.py:105 + // arc4_types/numeric.py:107 // assert tup[0].native == OnCompleteAction.ClearState intc_0 // 0 intc_3 // 8 @@ -354,7 +354,13 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program: intc_2 // ClearState == assert - // arc4_types/numeric.py:107 + // arc4_types/numeric.py:109 + // assert ARC4BiggieSmalls(1).native == BigUInt(1) + pushbytes 0x00000001 + bytec_1 // 0x01 + b== + assert + // arc4_types/numeric.py:111 // return True intc_1 // 1 return diff --git a/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.clear.teal b/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.clear.teal index ef35466b50..7ef8c80904 100644 --- a/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.clear.teal +++ b/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.clear.teal @@ -2,37 +2,37 @@ test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program: bytecblock 0x0000000000000000 0x 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - // arc4_types/numeric.py:110 + // arc4_types/numeric.py:114 // assert BigUInt.from_bytes(Decimal().bytes) == 0 bytec_0 // 0x0000000000000000 bytec_1 // 0x b== assert - // arc4_types/numeric.py:111 + // arc4_types/numeric.py:115 // assert BigUInt.from_bytes(BigUFixedNxM[t.Literal[512], t.Literal[5]]().bytes) == 0 bytec_2 // 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 bytec_1 // 0x b== assert - // arc4_types/numeric.py:112 + // arc4_types/numeric.py:116 // assert Byte() == 0 pushbytes 0x00 dup b== assert - // arc4_types/numeric.py:113 + // arc4_types/numeric.py:117 // assert ARC4UInt64() == 0 bytec_0 // 0x0000000000000000 dup b== assert - // arc4_types/numeric.py:114 + // arc4_types/numeric.py:118 // assert UInt512() == 0 bytec_2 // 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dup b== assert - // arc4_types/numeric.py:116 + // arc4_types/numeric.py:120 // return True pushint 1 // 1 return diff --git a/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.destructured.ir b/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.destructured.ir index 5b530f4c37..b1cbc7cb58 100644 --- a/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.destructured.ir +++ b/test_cases/arc4_types/out_unoptimized/Arc4NumericTypesContract.destructured.ir @@ -1,7 +1,7 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: program approval: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.approval_program() -> bool: - block@0: // L28 + block@0: // L30 let val_as_bytes%0#0: bytes = (itob 255u) let int8_encoded#0: bytes = ((extract 7 1) val_as_bytes%0#0) let int8_decoded#0: uint64 = (btoi int8_encoded#0) @@ -110,11 +110,13 @@ contract test_cases.arc4_types.numeric.Arc4NumericTypesContract: let tmp%53#0: uint64 = (btoi tmp%52#0) let tmp%54#0: bool = (== tmp%53#0 ClearState) (assert tmp%54#0) + let tmp%55#0: bool = (b== 0x00000001 1b) + (assert tmp%55#0) return 1u program clear-state: subroutine test_cases.arc4_types.numeric.Arc4NumericTypesContract.clear_state_program() -> bool: - block@0: // L109 + block@0: // L113 let tmp%0#0: bool = (b== 0x0000000000000000 0b) (assert tmp%0#0) let tmp%1#0: bool = (b== 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0b) diff --git a/test_cases/arc4_types/puya.log b/test_cases/arc4_types/puya.log index 1492be0f04..3f8265139b 100644 --- a/test_cases/arc4_types/puya.log +++ b/test_cases/arc4_types/puya.log @@ -608,18 +608,18 @@ debug: Added and_result%0#1 to Phi node: let and_result%0#2: bool = φ(and_resul debug: Terminated block@4: // bool_merge_L16 debug: Sealing block@0: // L21 debug: Terminated block@0: // L21 -debug: Sealing block@0: // L27 -debug: Terminated block@0: // L27 -debug: Sealing block@1: // abi_routing_L27 -debug: Terminated block@1: // abi_routing_L27 -debug: Sealing block@2: // bare_routing_L27 -debug: Terminated block@2: // bare_routing_L27 -debug: Sealing block@3: // after_if_else_L27 -debug: Terminated block@3: // after_if_else_L27 -debug: Sealing block@0: // L28 -debug: Terminated block@0: // L28 -debug: Sealing block@0: // L109 -debug: Terminated block@0: // L109 +debug: Sealing block@0: // L29 +debug: Terminated block@0: // L29 +debug: Sealing block@1: // abi_routing_L29 +debug: Terminated block@1: // abi_routing_L29 +debug: Sealing block@2: // bare_routing_L29 +debug: Terminated block@2: // bare_routing_L29 +debug: Sealing block@3: // after_if_else_L29 +debug: Terminated block@3: // after_if_else_L29 +debug: Sealing block@0: // L30 +debug: Terminated block@0: // L30 +debug: Sealing block@0: // L113 +debug: Terminated block@0: // L113 debug: Sealing block@0: // L33 debug: Terminated block@0: // L33 debug: Sealing block@1: // abi_routing_L33 @@ -4769,6 +4769,7 @@ debug: Simplified (b== 1b 0x00000000000000000000000000000001) to 1u debug: Simplified (len 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095b) to 64u debug: Simplified (concat 0x val_as_bytes%1#0) to val_as_bytes%1#0 debug: Simplified (extract3 tup#0 0u 8u) // on error: Index access is out of bounds to ((extract 0 8) tup#0) // on error: Index access is out of bounds +debug: Simplified (b== 0x00000001 1b) to 1u debug: Optimizer: Remove Unused Variables debug: Removing unused variable uint8#0 debug: Removing unused variable val_as_bytes%0#0 @@ -4882,6 +4883,7 @@ debug: Removing unused variable b_zeros%0#0 debug: Removing unused variable tmp%47#0 debug: Removing unused variable tmp%50#0 debug: Removing unused variable tup#0 +debug: Removing unused variable tmp%55#0 debug: Optimizer: Inner Txn Field Replacer debug: Optimizer: Replace Compiled References debug: Optimizer: Simplify Control Ops diff --git a/test_cases/compile/out/module.awst b/test_cases/compile/out/module.awst index 39714926d6..4eacd06a68 100644 --- a/test_cases/compile/out/module.awst +++ b/test_cases/compile/out/module.awst @@ -365,7 +365,7 @@ contract HelloFactory 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)) - assert(reinterpret_cast(result) == reinterpret_cast(4096arc4u64)) + assert(reinterpret_cast(result) == reinterpret_cast(4096_arc4u64)) } abimethod test_cases.compile.factory.HelloFactory.test_arc4_create(): void diff --git a/test_cases/contains/out/module.awst b/test_cases/contains/out/module.awst index c725939f87..f3525b6319 100644 --- a/test_cases/contains/out/module.awst +++ b/test_cases/contains/out/module.awst @@ -89,7 +89,7 @@ contract MyContract assert(!(reinterpret_cast(SINGLE_EVAL(id=69, source=test_cases.contains.contract.two_u8())) == itob(SINGLE_EVAL(id=70, source=(test_cases.contains.contract.bar_arc4(), 3u))[1])), comment="2 not in (bar, 3)") assert(!(reinterpret_cast(SINGLE_EVAL(id=71, source=test_cases.contains.contract.two_u8())) == itob(SINGLE_EVAL(id=72, source=(test_cases.contains.contract.foo_string(), 3u))[1])), comment="2 not in (foo, 3)") assert(!(reinterpret_cast(SINGLE_EVAL(id=73, source=test_cases.contains.contract.three_u512())) == itob(SINGLE_EVAL(id=74, source=(5u, test_cases.contains.contract.foo_string()))[0])), comment="3 not in (5, foo)") - assert(!(reinterpret_cast(65arc4u8) == itob(SINGLE_EVAL(id=75, source=(hex<"41">, 64u, 66u))[1]) or reinterpret_cast(65arc4u8) == itob(SINGLE_EVAL(id=75)[2])), comment="65 not in (b'A', 64, 66)") + assert(!(reinterpret_cast(65_arc4u8) == itob(SINGLE_EVAL(id=75, source=(hex<"41">, 64u, 66u))[1]) or reinterpret_cast(65_arc4u8) == itob(SINGLE_EVAL(id=75)[2])), comment="65 not in (b'A', 64, 66)") } } @@ -100,7 +100,7 @@ subroutine one_u64(): uint64 subroutine one_arc4u64(): arc4.uint64 { - return 1arc4u64 + return 1_arc4u64 } subroutine two_u64(): uint64 @@ -110,12 +110,12 @@ subroutine two_u64(): uint64 subroutine two_u8(): arc4.uint8 { - return 2arc4u8 + return 2_arc4u8 } subroutine three_u512(): arc4.uint512 { - return 3arc4n512 + return 3_arc4u512 } subroutine four_biguint(): biguint diff --git a/test_cases/literals/out/module.awst b/test_cases/literals/out/module.awst index b2a6aac293..80efbbd6b4 100644 --- a/test_cases/literals/out/module.awst +++ b/test_cases/literals/out/module.awst @@ -78,7 +78,7 @@ subroutine tuples(): void { assert(&&(&&(true, 98u == 98u), true)) assert(&&(&&(true, true), true)) - assert(&&(&&(reinterpret_cast(SINGLE_EVAL(id=0, source=new arc4.static_array(97arc4u64, 98arc4u64, 99arc4u64))[0u]) == reinterpret_cast(97arc4u64), reinterpret_cast(SINGLE_EVAL(id=0)[1u]) == itob(98u)), reinterpret_cast(SINGLE_EVAL(id=0)[2u]) == reinterpret_cast(99arc4u64))) + assert(&&(&&(reinterpret_cast(SINGLE_EVAL(id=0, source=new arc4.static_array(97_arc4u64, 98_arc4u64, 99_arc4u64))[0u]) == reinterpret_cast(97_arc4u64), reinterpret_cast(SINGLE_EVAL(id=0)[1u]) == itob(98u)), reinterpret_cast(SINGLE_EVAL(id=0)[2u]) == reinterpret_cast(99_arc4u64))) assert(&&(true, true)) } diff --git a/test_cases/state_mutations/out/module.awst b/test_cases/state_mutations/out/module.awst index bfe8993dd7..cdb782c720 100644 --- a/test_cases/state_mutations/out/module.awst +++ b/test_cases/state_mutations/out/module.awst @@ -80,5 +80,5 @@ contract Contract subroutine get_struct(): test_cases.state_mutations.contract.MyStruct { - return new test_cases.state_mutations.contract.MyStruct(bar=1arc4u64, baz=arc4_encode('baz', arc4.dynamic_array)) + return new test_cases.state_mutations.contract.MyStruct(bar=1_arc4u64, baz=arc4_encode('baz', arc4.dynamic_array)) } \ No newline at end of file diff --git a/test_cases/tuple_support/out/module.awst b/test_cases/tuple_support/out/module.awst index 6871c2a171..4d0cfae760 100644 --- a/test_cases/tuple_support/out/module.awst +++ b/test_cases/tuple_support/out/module.awst @@ -419,8 +419,8 @@ subroutine test_nested_singles(one: uint64, reassign: bool): void subroutine test_nested_mutation(): void { - x: tuple>> = ((new arc4.dynamic_array(0arc4u64))) - x[0][0].extend((1arc4u64)) + x: tuple>> = ((new arc4.dynamic_array(0_arc4u64))) + x[0][0].extend((1_arc4u64)) assert(extract_uint16(x[0][0], 0u) == 2u) } diff --git a/test_cases/typed_abi_call/out/module.awst b/test_cases/typed_abi_call/out/module.awst index db79d0c736..4e92d0424d 100644 --- a/test_cases/typed_abi_call/out/module.awst +++ b/test_cases/typed_abi_call/out/module.awst @@ -160,9 +160,9 @@ contract Greeter { txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("log(string)void"), arc4_encode('converted1', arc4.dynamic_array)), ApplicationID=app)) assert(txn.LastLog == hex<"636F6E76657274656431">) - txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("log(uint64)void"), 2arc4u64), ApplicationID=app)) + txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("log(uint64)void"), 2_arc4u64), ApplicationID=app)) assert(txn.LastLog == itob(2u)) - txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("log(uint512)void"), 3arc4n512), ApplicationID=app)) + txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("log(uint512)void"), 3_arc4u512), ApplicationID=app)) assert(txn.LastLog == bzero(56u) + itob(3u)) txn: inner_transaction_appl = submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("log(byte[])void"), arc4_encode(hex<"34">, arc4.dynamic_array)), ApplicationID=app)) assert(txn.LastLog == hex<"34">) @@ -172,7 +172,7 @@ contract Greeter abimethod test_cases.typed_abi_call.typed_c2c.Greeter.test_15plus_args(app: application): void { - (result, txn): tuple,inner_transaction_appl> = (checked_maybe((extract<4, 0>(SINGLE_EVAL(id=19, source=SINGLE_EVAL(id=18, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("return_args_after_14th(uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint8,uint8,uint8,uint8,(uint8,uint8,uint8,uint8),uint8)byte[]"), 1arc4u64, 2arc4u64, 3arc4u64, 4arc4u64, 5arc4u64, 6arc4u64, 7arc4u64, 8arc4u64, 9arc4u64, 10arc4u64, 11arc4u64, 12arc4u64, 13arc4u64, 14arc4u64, arc4_encode((15arc4u8, 16arc4u8, 17arc4u8, 18arc4u8, arc4_encode((222arc4u8, 173arc4u8, 190arc4u8, 239arc4u8), arc4.tuple), 20arc4u8), arc4.tuple,arc4.uint8>)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=19)) == hex<"151F7C75">)), SINGLE_EVAL(id=18)) + (result, txn): tuple,inner_transaction_appl> = (checked_maybe((extract<4, 0>(SINGLE_EVAL(id=19, source=SINGLE_EVAL(id=18, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("return_args_after_14th(uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint8,uint8,uint8,uint8,(uint8,uint8,uint8,uint8),uint8)byte[]"), 1_arc4u64, 2_arc4u64, 3_arc4u64, 4_arc4u64, 5_arc4u64, 6_arc4u64, 7_arc4u64, 8_arc4u64, 9_arc4u64, 10_arc4u64, 11_arc4u64, 12_arc4u64, 13_arc4u64, 14_arc4u64, arc4_encode((15_arc4u8, 16_arc4u8, 17_arc4u8, 18_arc4u8, arc4_encode((222_arc4u8, 173_arc4u8, 190_arc4u8, 239_arc4u8), arc4.tuple), 20_arc4u8), arc4.tuple,arc4.uint8>)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=19)) == hex<"151F7C75">)), SINGLE_EVAL(id=18)) assert(arc4_decode(result, bytes) == hex<"0F101112DEADBEEF14">) } @@ -216,27 +216,27 @@ contract Greeter abimethod test_cases.typed_abi_call.typed_c2c.Greeter.test_native_uint64(app: application): void { - (result1, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=33, source=SINGLE_EVAL(id=32, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_uint64(uint64)uint64"), 1arc4u64), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=33)) == hex<"151F7C75">)), uint64), SINGLE_EVAL(id=32)) + (result1, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=33, source=SINGLE_EVAL(id=32, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_uint64(uint64)uint64"), 1_arc4u64), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=33)) == hex<"151F7C75">)), uint64), SINGLE_EVAL(id=32)) assert(result1 == 2u) (result2, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=35, source=SINGLE_EVAL(id=34, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_uint64(uint64)uint64"), arc4_encode(1u, arc4.uint64)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=35)) == hex<"151F7C75">)), uint64), SINGLE_EVAL(id=34)) assert(result2 == result1) - (result3, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=37, source=SINGLE_EVAL(id=36, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_uint64(uint64)uint64"), 1arc4u64), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=37)) == hex<"151F7C75">)), uint64), SINGLE_EVAL(id=36)) + (result3, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=37, source=SINGLE_EVAL(id=36, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_uint64(uint64)uint64"), 1_arc4u64), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=37)) == hex<"151F7C75">)), uint64), SINGLE_EVAL(id=36)) assert(result3 == result1) } abimethod test_cases.typed_abi_call.typed_c2c.Greeter.test_native_biguint(app: application): void { - (result1, _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("echo_native_biguint(uint512)uint512"), 2arc4n512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=39)) == hex<"151F7C75">)), biguint), SINGLE_EVAL(id=38)) + (result1, _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("echo_native_biguint(uint512)uint512"), 2_arc4u512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=39)) == hex<"151F7C75">)), biguint), SINGLE_EVAL(id=38)) assert(result1 == 3n) (result2, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=41, source=SINGLE_EVAL(id=40, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_biguint(uint512)uint512"), arc4_encode(2n, arc4.uint512)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=41)) == hex<"151F7C75">)), biguint), SINGLE_EVAL(id=40)) assert(result2 == result1) - (result3, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=43, source=SINGLE_EVAL(id=42, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_biguint(uint512)uint512"), 2arc4n512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=43)) == hex<"151F7C75">)), biguint), SINGLE_EVAL(id=42)) + (result3, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=43, source=SINGLE_EVAL(id=42, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_biguint(uint512)uint512"), 2_arc4u512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=43)) == hex<"151F7C75">)), biguint), SINGLE_EVAL(id=42)) assert(result3 == result1) } abimethod test_cases.typed_abi_call.typed_c2c.Greeter.test_native_tuple(app: application): void { - (result1, txn): tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>,inner_transaction_appl> = (checked_maybe((extract<4, 0>(SINGLE_EVAL(id=45, source=SINGLE_EVAL(id=44, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1arc4u64, 2arc4n512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=45)) == hex<"151F7C75">)), SINGLE_EVAL(id=44)) + (result1, txn): tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>,inner_transaction_appl> = (checked_maybe((extract<4, 0>(SINGLE_EVAL(id=45, source=SINGLE_EVAL(id=44, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1_arc4u64, 2_arc4u512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=45)) == hex<"151F7C75">)), SINGLE_EVAL(id=44)) (s, b, u, bu): tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512> = arc4_decode(result1, tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>) assert(arc4_decode(s, string) == 'echo: s1') assert(arc4_decode(b, bytes) == hex<"6563686F3A206231">) @@ -244,9 +244,9 @@ contract Greeter assert(arc4_decode(bu, biguint) == 3n) (result2, txn): tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>,inner_transaction_appl> = (checked_maybe((extract<4, 0>(SINGLE_EVAL(id=47, source=SINGLE_EVAL(id=46, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), arc4_encode(1u, arc4.uint64), arc4_encode(2n, arc4.uint512)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=47)) == hex<"151F7C75">)), SINGLE_EVAL(id=46)) assert(result1 == result2) - (result3, txn): tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>,inner_transaction_appl> = (checked_maybe((extract<4, 0>(SINGLE_EVAL(id=49, source=SINGLE_EVAL(id=48, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1arc4u64, 2arc4n512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=49)) == hex<"151F7C75">)), SINGLE_EVAL(id=48)) + (result3, txn): tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>,inner_transaction_appl> = (checked_maybe((extract<4, 0>(SINGLE_EVAL(id=49, source=SINGLE_EVAL(id=48, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1_arc4u64, 2_arc4u512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=49)) == hex<"151F7C75">)), SINGLE_EVAL(id=48)) assert(result1 == result3) - (result_native, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=51, source=SINGLE_EVAL(id=50, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1arc4u64, 2arc4n512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=51)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=50)) + (result_native, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=51, source=SINGLE_EVAL(id=50, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1_arc4u64, 2_arc4u512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=51)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=50)) assert(arc4_decode(arc4_decode(result1, tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>)[0], string) == result_native[0]) assert(arc4_decode(arc4_decode(result1, tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>)[1], bytes) == result_native[1]) assert(arc4_decode(arc4_decode(result1, tuple,arc4.dynamic_array,arc4.uint64,arc4.uint512>)[2], uint64) == result_native[2]) @@ -255,7 +255,7 @@ contract Greeter abimethod test_cases.typed_abi_call.typed_c2c.Greeter.test_native_tuple_method_ref(app: application): void { - (result, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=53, source=SINGLE_EVAL(id=52, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1arc4u64, 2arc4n512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=53)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=52)) + (result, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=53, source=SINGLE_EVAL(id=52, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1_arc4u64, 2_arc4u512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=53)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=52)) (s, b, u, bu): tuple = result assert(s == 'echo: s1') assert(b == hex<"6563686F3A206231">) @@ -263,34 +263,34 @@ contract Greeter assert(bu == 3n) (result_2, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=55, source=SINGLE_EVAL(id=54, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), arc4_encode(1u, arc4.uint64), arc4_encode(2n, arc4.uint512)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=55)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=54)) assert(&&(&&(&&(result_2[0] == result[0], result_2[1] == result[1]), result_2[2] == result[2]), result_2[3] == result[3]), comment="expected native arguments to give the same result") - (result_3, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=57, source=SINGLE_EVAL(id=56, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1arc4u64, 2arc4n512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=57)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=56)) + (result_3, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=57, source=SINGLE_EVAL(id=56, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1_arc4u64, 2_arc4u512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=57)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=56)) assert(&&(&&(&&(result_3[0] == result[0], result_3[1] == result[1]), result_3[2] == result[2]), result_3[3] == result[3]), comment="expected arc4 arguments to give the same result") - (result_native, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=59, source=SINGLE_EVAL(id=58, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1arc4u64, 2arc4n512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=59)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=58)) + (result_native, txn): tuple,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=59, source=SINGLE_EVAL(id=58, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_native_tuple(string,byte[],uint64,uint512)(string,byte[],uint64,uint512)"), arc4_encode('s1', arc4.dynamic_array), arc4_encode(hex<"6231">, arc4.dynamic_array), 1_arc4u64, 2_arc4u512), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=59)) == hex<"151F7C75">)), tuple), SINGLE_EVAL(id=58)) assert(&&(&&(&&(result_native[0] == result[0], result_native[1] == result[1]), result_native[2] == result[2]), result_native[3] == result[3])) } abimethod test_cases.typed_abi_call.typed_c2c.Greeter.test_nested_tuples(app: application): void { - (result, txn): tuple>,tuple>,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=61, source=SINGLE_EVAL(id=60, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_nested_tuple(((string,string),(uint64,uint64,byte[])))((string,string),(uint64,uint64,byte[]))"), arc4_encode(((arc4_encode('s1', arc4.dynamic_array), arc4_encode('s2', arc4.dynamic_array)), (1arc4u64, 2arc4u64, arc4_encode(hex<"33">, arc4.dynamic_array))), arc4.tuple,arc4.dynamic_array>,arc4.tuple>>)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=61)) == hex<"151F7C75">)), tuple>,tuple>), SINGLE_EVAL(id=60)) + (result, txn): tuple>,tuple>,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=61, source=SINGLE_EVAL(id=60, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_nested_tuple(((string,string),(uint64,uint64,byte[])))((string,string),(uint64,uint64,byte[]))"), arc4_encode(((arc4_encode('s1', arc4.dynamic_array), arc4_encode('s2', arc4.dynamic_array)), (1_arc4u64, 2_arc4u64, arc4_encode(hex<"33">, arc4.dynamic_array))), arc4.tuple,arc4.dynamic_array>,arc4.tuple>>)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=61)) == hex<"151F7C75">)), tuple>,tuple>), SINGLE_EVAL(id=60)) ((s1, s2), (u64_1, u64_2, bytez)): tuple>,tuple> = result assert(s1 == 'echo: s1') assert(s2 == arc4_encode('echo: s2', arc4.dynamic_array)) assert(u64_1 == 2u) - assert(reinterpret_cast(u64_2) == reinterpret_cast(3arc4u64)) + assert(reinterpret_cast(u64_2) == reinterpret_cast(3_arc4u64)) assert(bytez == hex<"6563686F3A2033">) - (result, txn): tuple>,tuple>,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=63, source=SINGLE_EVAL(id=62, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_nested_tuple(((string,string),(uint64,uint64,byte[])))((string,string),(uint64,uint64,byte[]))"), arc4_encode((('s1', arc4_encode('s2', arc4.dynamic_array)), (1u, 2arc4u64, hex<"33">)), arc4.tuple,arc4.dynamic_array>,arc4.tuple>>)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=63)) == hex<"151F7C75">)), tuple>,tuple>), SINGLE_EVAL(id=62)) + (result, txn): tuple>,tuple>,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=63, source=SINGLE_EVAL(id=62, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_nested_tuple(((string,string),(uint64,uint64,byte[])))((string,string),(uint64,uint64,byte[]))"), arc4_encode((('s1', arc4_encode('s2', arc4.dynamic_array)), (1u, 2_arc4u64, hex<"33">)), arc4.tuple,arc4.dynamic_array>,arc4.tuple>>)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=63)) == hex<"151F7C75">)), tuple>,tuple>), SINGLE_EVAL(id=62)) ((s1, s2), (u64_1, u64_2, bytez)): tuple>,tuple> = result assert(s1 == 'echo: s1') assert(s2 == arc4_encode('echo: s2', arc4.dynamic_array)) assert(u64_1 == 2u) - assert(reinterpret_cast(u64_2) == reinterpret_cast(3arc4u64)) + assert(reinterpret_cast(u64_2) == reinterpret_cast(3_arc4u64)) assert(bytez == hex<"6563686F3A2033">) - (result, txn): tuple>,tuple>,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=65, source=SINGLE_EVAL(id=64, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_nested_tuple(((string,string),(uint64,uint64,byte[])))((string,string),(uint64,uint64,byte[]))"), arc4_encode((arc4_encode((arc4_encode('s1b', arc4.dynamic_array), arc4_encode('s2b', arc4.dynamic_array)), arc4.tuple,arc4.dynamic_array>), arc4_encode((11arc4u64, 21arc4u64, arc4_encode(hex<"3362">, arc4.dynamic_array)), arc4.tuple>)), arc4.tuple,arc4.dynamic_array>,arc4.tuple>>)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=65)) == hex<"151F7C75">)), tuple>,tuple>), SINGLE_EVAL(id=64)) + (result, txn): tuple>,tuple>,inner_transaction_appl> = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=65, source=SINGLE_EVAL(id=64, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("echo_nested_tuple(((string,string),(uint64,uint64,byte[])))((string,string),(uint64,uint64,byte[]))"), arc4_encode((arc4_encode((arc4_encode('s1b', arc4.dynamic_array), arc4_encode('s2b', arc4.dynamic_array)), arc4.tuple,arc4.dynamic_array>), arc4_encode((11_arc4u64, 21_arc4u64, arc4_encode(hex<"3362">, arc4.dynamic_array)), arc4.tuple>)), arc4.tuple,arc4.dynamic_array>,arc4.tuple>>)), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=65)) == hex<"151F7C75">)), tuple>,tuple>), SINGLE_EVAL(id=64)) ((s1, s2), (u64_1, u64_2, bytez)): tuple>,tuple> = result assert(s1 == 'echo: s1b') assert(s2 == arc4_encode('echo: s2b', arc4.dynamic_array)) assert(u64_1 == 12u) - assert(reinterpret_cast(u64_2) == reinterpret_cast(22arc4u64)) + assert(reinterpret_cast(u64_2) == reinterpret_cast(22_arc4u64)) assert(bytez == hex<"6563686F3A203362">) } @@ -299,9 +299,9 @@ contract Greeter (result, _txn): tuple = (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=67, source=SINGLE_EVAL(id=66, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("no_args()uint64")), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=67)) == hex<"151F7C75">)), uint64), SINGLE_EVAL(id=66)) assert(result == 42u) (arc4_result, _txn): tuple = (checked_maybe((extract<4, 0>(SINGLE_EVAL(id=69, source=SINGLE_EVAL(id=68, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("no_args()uint64")), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=69)) == hex<"151F7C75">)), SINGLE_EVAL(id=68)) - assert(reinterpret_cast(arc4_result) == reinterpret_cast(42arc4u64)) + assert(reinterpret_cast(arc4_result) == reinterpret_cast(42_arc4u64)) (arc4_decode(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=71, source=SINGLE_EVAL(id=70, source=submit_txn(create_inner_transaction(Fee=0u, TypeEnum=appl, ApplicationArgs=(Method("no_args()uint64")), ApplicationID=app))).LastLog)), extract<0, 4>(SINGLE_EVAL(id=71)) == hex<"151F7C75">)), uint64), SINGLE_EVAL(id=70)) - assert(reinterpret_cast(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=72, source=itxn())), extract<0, 4>(SINGLE_EVAL(id=72)) == hex<"151F7C75">))) == reinterpret_cast(42arc4u64)) + assert(reinterpret_cast(checked_maybe((extract<4, 0>(SINGLE_EVAL(id=72, source=itxn())), extract<0, 4>(SINGLE_EVAL(id=72)) == hex<"151F7C75">))) == reinterpret_cast(42_arc4u64)) } abimethod test_cases.typed_abi_call.typed_c2c.Greeter.test_named_tuples(app: application): void