diff --git a/crates/acton-config/schemas/acton.schema.json b/crates/acton-config/schemas/acton.schema.json index 51c43f059b..79079e8b8c 100644 --- a/crates/acton-config/schemas/acton.schema.json +++ b/crates/acton-config/schemas/acton.schema.json @@ -874,7 +874,7 @@ }, "pure-function-call-unused": { "title": "E006: pure-function-call-unused", - "description": "### What it does\nChecks for calls to `@pure` functions where the result is not used.\n\n### Why is this bad?\n`@pure` functions have no side effects, so calling them without using the result is a no-op and likely a bug.\n\n### Example\n```tolk twoslash\n@pure\nfun add(a: int, b: int): int { return a + b; }\n\nfun main() {\n add(1, 2);\n// ^^^^^^^^^ E006: result of pure function is not used\n}\n```", + "description": "### What it does\nChecks for calls to `@pure` functions where the result is not used.\n\n### Why is this bad?\n`@pure` functions have no side effects, so calling them without using the result is a no-op and likely a bug.\n\n### Example\n```tolk twoslash\nfun main() {\n createEmptyCell();\n// ^^^^^^^^^^^^^^^^^ E006: result of pure function is not used\n}\n```", "anyOf": [ { "$ref": "#/definitions/LintRuleLevel" diff --git a/crates/tolk-compiler/assets/tolk-stdlib/common.tolk b/crates/tolk-compiler/assets/tolk-stdlib/common.tolk old mode 100644 new mode 100755 index 8039f1126b..3656e5ab78 --- a/crates/tolk-compiler/assets/tolk-stdlib/common.tolk +++ b/crates/tolk-compiler/assets/tolk-stdlib/common.tolk @@ -1,7 +1,7 @@ // Standard library for Tolk (LGPL licence). // It contains common functions that are available out of the box, the user doesn't have to import anything. // More specific functions are required to be imported explicitly, like "@stdlib/gas-payments". -tolk 1.4.2 +tolk 1.5 /** Built-in types. @@ -60,12 +60,12 @@ type never = builtin /// `int8`, `int32`, `int222`, etc. is "a fixed-width signed integer with N bits", N <= 257. /// Note: it's still `int` at runtime, you can assign "100500" to "int8": -/// overflow will happen at serialization to a cell/builder, NOT at assignment. +/// overflow will happen at serialization to a cell/builder, NOT at assignment. type intN = builtin /// `uint32`, `uint64`, `uint111`, etc. is "a fixed-width unsigned integer with N bits", N <= 256. /// Note: it's still `int` at runtime, you can assign "100500" to "uint8": -/// overflow will happen at serialization to a cell/builder, NOT at assignment. +/// overflow will happen at serialization to a cell/builder, NOT at assignment. type uintN = builtin /// `coins` is a special primitive representing "nanograms". One GRAM = 10^9 nanograms. @@ -73,16 +73,16 @@ type uintN = builtin /// Arithmetic operations on `coins` degrade to 257-bit `int` type. type coins = builtin -/// `varint16` is `int` at runtime, but serialized as "variadic signed int", -2^119 <= X < 2^119. +/// `varint16` is `int` at runtime, but serialized as "variadic signed int", -2^119 <= X < 2^119. type varint16 = builtin -/// `varuint16` is `int` at runtime, but serialized as "variadic unsigned int", 0 <= X < 2^120. +/// `varuint16` is `int` at runtime, but serialized as "variadic unsigned int", 0 <= X < 2^120. type varuint16 = builtin -/// `varint32` is `int` at runtime, but serialized as "variadic signed int", -2^247 <= X < 2^247. +/// `varint32` is `int` at runtime, but serialized as "variadic signed int", -2^247 <= X < 2^247. type varint32 = builtin -/// `varuint32` is `int` at runtime, but serialized as "variadic unsigned int", 0 <= X < 2^248. +/// `varuint32` is `int` at runtime, but serialized as "variadic unsigned int", 0 <= X < 2^248. type varuint32 = builtin /// `string` represents text data stored as a cell in snake format. @@ -99,9 +99,6 @@ type string = builtin /// an error will be fired at serialization with [T.toCell] and similar, NOT at assignment. type bitsN = builtin -/// `bytes8`, `bytes99`, etc. is a convenient alias for `bits(N*8)` -type bytesN = builtin - /// `map` is "a map from a key K to a value V". /// Internally, it's an "optional cell": an empty map is `null`, a non-empty points to a root cell. /// Restrictions for K and V types: @@ -217,38 +214,38 @@ fun createEmptyTuple(): array /// If its size exceeds 255, throws a type check exception. @pure fun array.push(mutate self, value: T): void - builtin + asm "TPUSH" // for multi-slot T, the value is first TUPLE'd /// Returns the first element of a non-empty array. @pure fun array.first(self): T - builtin + asm "FIRST" // for multi-slot T, the result is additionally UNTUPLE'd /// Returns the `i`-th element of an array. @pure fun array.get(self, index: int): T - builtin + asm "INDEXVAR" // constant index uses `INDEX n`; multi-slot T is additionally UNTUPLE'd /// Sets the `i`-th element of an array to a specified value /// (an element with this index must already exist, a new element is not created). @pure fun array.set(mutate self, value: T, index: int): void - builtin + asm "SETINDEXVAR" // constant index uses `SETINDEX n`; multi-slot T is first TUPLE'd /// Returns the size of an array (elements count in it). @pure fun array.size(self): int - builtin + asm "TLEN" /// Returns the last element of a non-empty array. @pure fun array.last(self): T - builtin + asm "LAST" // for multi-slot T, the result is additionally UNTUPLE'd /// Pops and returns the last element of a non-empty array. @pure fun array.pop(mutate self): T - builtin + asm "TPOP" // for multi-slot T, the result is additionally UNTUPLE'd /// Packs any object from a stack to a tuple. /// An object occupies N slots on a stack — the tuple will be of size N. @@ -266,14 +263,14 @@ fun array.pop(mutate self): T /// See [T.fromTuple] counterpart. @pure fun T.toTuple(self): array - builtin + asm "1 TUPLE" // 1 is replaced by T's stack width; TUPLEVAR is used above 15 /// Unpacks a tuple back to an object on a stack. /// It works identically as casting `unknown` to an object. /// See [T.toTuple] for explanation and examples. @pure fun T.fromTuple(packedObject: array): T - builtin + asm "1 UNTUPLE" // 1 is replaced by T's stack width; UNTUPLEVAR is used above 15 /** Mathematical primitives. @@ -287,7 +284,7 @@ fun grams(floatString: string): coins builtin /// Deprecated alias for [grams]. -/// From Tolk v1.5, it will become @deprecated("""use `grams("0.05")` instead of `ton("0.05")`""") +@deprecated("""use `grams("0.05")` instead of `ton("0.05")`""") @pure fun ton(floatString: string): coins builtin @@ -332,22 +329,22 @@ fun modDiv(x: int, y: int): (int, int) /// The intermediate result is stored in a 513-bit integer to prevent precision loss. @pure fun mulDivFloor(x: int, y: int, z: int): int - builtin + asm "MULDIV" // constants may fold or use specialized shift/div instructions /// Similar to [mulDivFloor], but rounds the result: round(x * y / z). @pure fun mulDivRound(x: int, y: int, z: int): int - builtin + asm "MULDIVR" // constants may fold or use specialized shift/div instructions /// Similar to [mulDivFloor], but ceils the result: ceil(x * y / z). @pure fun mulDivCeil(x: int, y: int, z: int): int - builtin + asm "MULDIVC" // constants may fold or use specialized shift/div instructions /// Computes the quotient and remainder of (x * y / z). Example: mulDivMod(112,3,10) = (33,6) @pure fun mulDivMod(x: int, y: int, z: int): (int, int) - builtin + asm "MULDIVMOD" /** @@ -788,15 +785,15 @@ struct debug /// Dump a variable to the debug log as a raw TVM stack value. fun debug.print(x: T): void - builtin + asm "s0 DUMP" "DROP" // repeated for every stack slot of multi-slot T /// Dump a string to the debug log. fun debug.printString(x: string): void - builtin + asm "CTOS" "STRDUMP" "DROP" // only the first snake chunk is dumped /// Dumps the stack (at most the top 255 values) and shows the total stack depth. fun debug.dumpStack(): void - builtin + asm "DUMPSTK" /* @@ -822,14 +819,14 @@ fun debug.dumpStack(): void @pure @deprecated("use `[]` instead of `createEmptyMap`") fun createEmptyMap(): map - builtin + asm "NEWDICT" // an empty map is represented by TVM null /// Converts a low-level TVM dictionary to a typed map. /// Actually, does nothing: accepts an "optional cell" and returns the same "optional cell", /// so if you specify key/value types incorrectly, it will fail later, at `map.get` and similar. @pure fun createMapFromLowLevelDict(d: dict): map - builtin + asm "NOP" // map and low-level dict have the same runtime representation /// Converts a high-level map to a low-level TVM dictionary. /// Actually, does nothing: returns the same "optional cell". @@ -847,7 +844,7 @@ fun map.isEmpty(self): bool /// Checks whether a key exists in a map. @pure fun map.exists(self, key: K): bool - builtin + asm "DICTGET" // actual lowering depends on K/V serialization /// Gets an element by key. If not found, does NOT throw, just returns isFound = false. /// ``` @@ -858,12 +855,12 @@ fun map.exists(self, key: K): bool /// ``` @pure fun map.get(self, key: K): MapLookupResult - builtin + asm "DICTGET" // actual lowering depends on K/V serialization /// Gets an element by key and throws if it doesn't exist. @pure fun map.mustGet(self, key: K, throwIfNotFound: int = 9): V - builtin + asm "DICTGET" // actual lowering depends on K/V serialization /// Sets an element by key. /// ``` @@ -872,7 +869,7 @@ fun map.mustGet(self, key: K, throwIfNotFound: int = 9): V /// Since it returns `self`, calls may be chained. @pure fun map.set(mutate self, key: K, value: V): self - builtin + asm "DICTSET" // actual lowering depends on K/V serialization /// Sets an element and returns the previous element at that key. If no previous, isFound = false. /// ``` @@ -883,32 +880,32 @@ fun map.set(mutate self, key: K, value: V): self /// ``` @pure fun map.setAndGetPrevious(mutate self, key: K, value: V): MapLookupResult - builtin + asm "DICTSETGET" // actual lowering depends on K/V serialization /// Sets an element only if the key already exists. Returns whether an element was replaced. @pure fun map.replaceIfExists(mutate self, key: K, value: V): bool - builtin + asm "DICTREPLACE" // actual lowering depends on K/V serialization /// Sets an element only if the key already exists and returns the previous element at that key. @pure fun map.replaceAndGetPrevious(mutate self, key: K, value: V): MapLookupResult - builtin + asm "DICTREPLACEGET" // actual lowering depends on K/V serialization /// Sets an element only if the key does not exist. Returns whether an element was added. @pure fun map.addIfNotExists(mutate self, key: K, value: V): bool - builtin + asm "DICTADD" // actual lowering depends on K/V serialization /// Sets an element only if the key does not exist. If exists, returns an old value. @pure fun map.addOrGetExisting(mutate self, key: K, value: V): MapLookupResult - builtin + asm "DICTADDGET" // actual lowering depends on K/V serialization /// Delete an element at the key. Returns whether an element was deleted. @pure fun map.delete(mutate self, key: K): bool - builtin + asm "DICTDEL" // actual lowering depends on K/V serialization /// Delete an element at the key and returns the deleted element. If not exists, isFound = false. /// ``` @@ -919,7 +916,7 @@ fun map.delete(mutate self, key: K): bool /// ``` @pure fun map.deleteAndGetDeleted(mutate self, key: K): MapLookupResult - builtin + asm "DICTDELGET" // actual lowering depends on K/V serialization /// Finds the first (minimal) element in a map. If key are integers, it's the minimal integer. /// If keys are addresses or complex structures (represented as slices), it's lexicographically smallest. @@ -934,7 +931,7 @@ fun map.deleteAndGetDeleted(mutate self, key: K): MapLookupResult /// ``` @pure fun map.findFirst(self): MapEntry - builtin + asm "DICTMIN" // actual lowering depends on K/V serialization /// Finds the last (maximal) element in a map. If key are integers, it's the maximal integer. /// If keys are addresses or complex structures (represented as slices), it's lexicographically largest. @@ -949,31 +946,31 @@ fun map.findFirst(self): MapEntry /// ``` @pure fun map.findLast(self): MapEntry - builtin + asm "DICTMAX" // actual lowering depends on K/V serialization /// Finds an element with key > pivotKey. /// Don't forget to check `isFound` before using `getKey()` and `loadValue()` of the result. @pure fun map.findKeyGreater(self, pivotKey: K): MapEntry - builtin + asm "DICTGETNEXT" // actual lowering depends on K/V serialization /// Finds an element with key >= pivotKey. /// Don't forget to check `isFound` before using `getKey()` and `loadValue()` of the result. @pure fun map.findKeyGreaterOrEqual(self, pivotKey: K): MapEntry - builtin + asm "DICTGETNEXTEQ" // actual lowering depends on K/V serialization /// Finds an element with key < pivotKey. /// Don't forget to check `isFound` before using `getKey()` and `loadValue()` of the result. @pure fun map.findKeyLess(self, pivotKey: K): MapEntry - builtin + asm "DICTGETPREV" // actual lowering depends on K/V serialization /// Finds an element with key <= pivotKey. /// Don't forget to check `isFound` before using `getKey()` and `loadValue()` of the result. @pure fun map.findKeyLessOrEqual(self, pivotKey: K): MapEntry - builtin + asm "DICTGETPREVEQ" // actual lowering depends on K/V serialization /// Iterate over a map in ascending order. /// ``` @@ -986,7 +983,7 @@ fun map.findKeyLessOrEqual(self, pivotKey: K): MapEntry /// ``` @pure fun map.iterateNext(self, current: MapEntry): MapEntry - builtin + asm "DICTGETNEXT" // actual lowering depends on K/V serialization /// Iterate over a map in reverse order. /// ``` @@ -999,7 +996,7 @@ fun map.iterateNext(self, current: MapEntry): MapEntry /// ``` @pure fun map.iteratePrev(self, current: MapEntry): MapEntry - builtin + asm "DICTGETPREV" // actual lowering depends on K/V serialization /// `MapLookupResult` is a return value of `map.get`, `map.setAndGetPrevious`, and similar. /// Instead of returning a nullable value (that you'd check on null before usage), @@ -1015,7 +1012,6 @@ struct MapLookupResult { isFound: bool } -@pure fun MapLookupResult.loadValue(self): TValue { // it's assumed that you check for `isFound` before calling `loadValue()`; // note that `assertEnd` is called to ensure no remaining data left besides TValue @@ -1024,7 +1020,6 @@ fun MapLookupResult.loadValue(self): TValue { }) } -@pure fun MapLookupResult.loadValue(self): slice { return self.rawSlice! } @@ -1044,14 +1039,12 @@ struct MapEntry { isFound: bool } -@pure fun MapEntry.getKey(self): K { // it's assumed that you check for `isFound` before calling `getKey()`; // (otherwise, it will contain an incorrect stack slot with `null` value, not K) return self.key } -@pure fun MapEntry.loadValue(self): V { // it's assumed that you check for `isFound` before calling `loadValue()`; // note that `assertEnd` is inserted to ensure no remaining data left besides TValue @@ -1060,7 +1053,6 @@ fun MapEntry.loadValue(self): V { }) } -@pure fun MapEntry.loadValue(self): slice { return self.rawValue! } @@ -1183,32 +1175,32 @@ fun slice.preloadRef(self): cell /// Loads a signed len-bit integer from a slice. @pure fun slice.loadInt(mutate self, len: int): int - builtin + asm(-> 1 0) "LDIX" // constant len uses "LDI len" /// Loads an unsigned len-bit integer from a slice. @pure fun slice.loadUint(mutate self, len: int): int - builtin + asm(-> 1 0) "LDUX" // constant len uses "LDU len" /// Loads the first `0 ≤ len ≤ 1023` bits from a slice. @pure fun slice.loadBits(mutate self, len: int): slice - builtin + asm(-> 1 0) "LDSLICEX" // constant len uses "LDSLICE len" /// Preloads a signed len-bit integer from a slice. @pure fun slice.preloadInt(self, len: int): int - builtin + asm "PLDIX" // constant len uses "PLDI len" /// Preloads an unsigned len-bit integer from a slice. @pure fun slice.preloadUint(self, len: int): int - builtin + asm "PLDUX" // constant len uses "PLDU len" /// Preloads the first `0 ≤ len ≤ 1023` bits from a slice. @pure fun slice.preloadBits(self, len: int): slice - builtin + asm "PLDSLICEX" // constant len uses "PLDSLICE len" /// Loads the serialized amount of nanograms (any unsigned integer up to `2^120 - 1`). @pure @@ -1223,7 +1215,7 @@ fun slice.loadBool(mutate self): bool /// Shifts a slice pointer to len bits forward. @pure fun slice.skipBits(mutate self, len: int): self - builtin + asm "SDSKIPFIRST" // constant skips can be merged /// Returns the first `0 ≤ len ≤ 1023` bits of a slice. @pure @@ -1314,12 +1306,12 @@ fun builder.storeRef(mutate self, c: cell): self /// Stores a signed len-bit integer into a builder (`0 ≤ len ≤ 257`). @pure fun builder.storeInt(mutate self, x: int, len: int): self - builtin + asm(x self len) "STIX" // constant len uses "STI len" or even merged to STSLICECONST /// Stores an unsigned len-bit integer into a builder (`0 ≤ len ≤ 256`). @pure fun builder.storeUint(mutate self, x: int, len: int): self - builtin + asm(x self len) "STUX" // constant len uses "STU len" or even merged to STSLICECONST /// Stores a slice into a builder. @pure @@ -1355,12 +1347,12 @@ fun builder.storeAddressNone(mutate self): self /// Stores the amount of nanograms into a builder. @pure fun builder.storeCoins(mutate self, x: coins): self - builtin + asm "STGRAMS" // compile-time zero can be merged with adjacent stores /// Stores a boolean into a builder. @pure fun builder.storeBool(mutate self, x: bool): self - builtin + asm(x self) "1 STI" // compile-time value can be merged with adjacent stores /// Stores a low-level TVM dictionary (optional cell) into a builder. /// In other words, if `c` is null, stores `0`; if `c` is not null, stores `1` and a reference to `c`. @@ -2025,3 +2017,5 @@ fun slice.skipMessageQueryId(mutate self): self @deprecated("use `createMessage` instead of composing messages manually") fun builder.storeMessageQueryId(mutate self, queryId: int): self asm(queryId self) "64 STU" + + diff --git a/crates/tolk-compiler/assets/tolk-stdlib/exotic-cells.tolk b/crates/tolk-compiler/assets/tolk-stdlib/exotic-cells.tolk old mode 100644 new mode 100755 index 23da53fe0e..661d8171d8 --- a/crates/tolk-compiler/assets/tolk-stdlib/exotic-cells.tolk +++ b/crates/tolk-compiler/assets/tolk-stdlib/exotic-cells.tolk @@ -1,5 +1,5 @@ // A part of standard library for Tolk -tolk 1.4.2 +tolk 1.5 enum ExoticCellType: int8 { Ordinary = -1 @@ -46,7 +46,6 @@ fun cell.loadSpecial(self): cell /// Transforms an ordinary or exotic cell into a library reference /// (into an exotic cell with contents "8 bits cell type" + "256 bits lib hash"). -@pure fun cell.toLibraryReference(self): cell { return beginCell() .storeInt(ExoticCellType.LibraryReference, 8) diff --git a/crates/tolk-compiler/assets/tolk-stdlib/gas-payments.tolk b/crates/tolk-compiler/assets/tolk-stdlib/gas-payments.tolk old mode 100644 new mode 100755 index ae692ad427..5dc056acd8 --- a/crates/tolk-compiler/assets/tolk-stdlib/gas-payments.tolk +++ b/crates/tolk-compiler/assets/tolk-stdlib/gas-payments.tolk @@ -1,5 +1,5 @@ // A part of standard library for Tolk -tolk 1.4.2 +tolk 1.5 /** Gas and payment related primitives. diff --git a/crates/tolk-compiler/assets/tolk-stdlib/lisp-lists.tolk b/crates/tolk-compiler/assets/tolk-stdlib/lisp-lists.tolk old mode 100644 new mode 100755 index ab43b6a4ab..c460f9750e --- a/crates/tolk-compiler/assets/tolk-stdlib/lisp-lists.tolk +++ b/crates/tolk-compiler/assets/tolk-stdlib/lisp-lists.tolk @@ -1,5 +1,5 @@ // A part of standard library for Tolk -tolk 1.4.2 +tolk 1.5 /** A lisp-style list is a set of nested 2-element TVM tuples: @@ -21,7 +21,6 @@ tolk 1.4.2 ``` */ -@pure fun lisp_list.isEmpty(self): bool { return self.tvmTuple == null } @@ -29,7 +28,6 @@ fun lisp_list.isEmpty(self): bool { /// Inserts an element an the front. /// Before: `[a b c]`. /// After: `[new a b c]`. -@pure fun lisp_list.prependHead(mutate self, value: T): void { self.tvmTuple = [value, self.tvmTuple as unknown as lisp_list]; } @@ -38,7 +36,6 @@ fun lisp_list.prependHead(mutate self, value: T): void { /// Before: `[a b c]`. /// After: `[b c]`, returns `a`. /// Throws an exceptions if a list is empty. -@pure fun lisp_list.popHead(mutate self): T { var [head, tail] = self.tvmTuple!; self.tvmTuple = tail as unknown as [T, lisp_list]?; @@ -47,21 +44,18 @@ fun lisp_list.popHead(mutate self): T { /// Returns an element from the front: `a` for `[a b c]`. /// Throws an exceptions if a list is empty. -@pure fun lisp_list.getHead(self): T { return self.tvmTuple!.0 } /// Returns all but the frontmost element: `[b c]` for `[a b c]`. /// Throws an exceptions if a list is empty. -@pure fun lisp_list.getTail(self): lisp_list { return self.tvmTuple!.1 } /// Calculates the size of a list by looping all the elements (there is no other way to do it). /// The longer the list — the more gas consumption (O(N) complexity). -@pure fun lisp_list.calculateSize(self): int { var size = 0; var ptr = self; @@ -74,7 +68,6 @@ fun lisp_list.calculateSize(self): int { /// Returns the list with elements in reversed order. /// Given `[a b c]` returns `[c b a]`. -@pure fun lisp_list.calculateReversed(self): lisp_list { var reversed = [] as lisp_list; var ptr = self; @@ -86,7 +79,6 @@ fun lisp_list.calculateReversed(self): lisp_list { /// Returns the concatenation of two lists. /// Given `[a b]` and `[c d]`, returns `[a b c d]`. -@pure fun lisp_list.calculateConcatenation(self, other: lisp_list): lisp_list { var reversed = [] as lisp_list; var ptr = self; @@ -118,6 +110,7 @@ fun createEmptyList(): lisp_list /// `lisp_list` can be serialized if `T` is serializable. It's encoded as reversed snake refs: /// A list `[1 2 3]` (on a stack: `[1 [2 [3 null]]]`) is "3.ref(2.ref(1.ref(empty cell)))". /// An empty list `[]` (on a stack: `null`) is "empty cell" +@inline fun lisp_list.packToBuilder(self, mutate b: builder): void { var tail = createEmptyCell(); var ptr = self; @@ -129,6 +122,7 @@ fun lisp_list.packToBuilder(self, mutate b: builder): void { /// Unserialize `lisp_list` from snake refs: /// From "3.ref(2.ref(1.ref(empty cell)))" get a list `[1 2 3]` (on a stack: `[1 [2 [3 null]]]`). +@inline fun lisp_list.unpackFromSlice(mutate s: slice): lisp_list { var result = [] as lisp_list; var head = s.loadRef().beginParse(); diff --git a/crates/tolk-compiler/assets/tolk-stdlib/reflection.tolk b/crates/tolk-compiler/assets/tolk-stdlib/reflection.tolk old mode 100644 new mode 100755 index 6a1f3578ff..afd88f4b9c --- a/crates/tolk-compiler/assets/tolk-stdlib/reflection.tolk +++ b/crates/tolk-compiler/assets/tolk-stdlib/reflection.tolk @@ -1,5 +1,5 @@ // A part of standard library for Tolk -tolk 1.4.2 +tolk 1.5 /** Reflection API. diff --git a/crates/tolk-compiler/assets/tolk-stdlib/strings.tolk b/crates/tolk-compiler/assets/tolk-stdlib/strings.tolk old mode 100644 new mode 100755 index b9c8ba638d..a85e205154 --- a/crates/tolk-compiler/assets/tolk-stdlib/strings.tolk +++ b/crates/tolk-compiler/assets/tolk-stdlib/strings.tolk @@ -1,5 +1,5 @@ // A part of standard library for Tolk -tolk 1.4.2 +tolk 1.5 /** A string is a language primitive — a cell containing snake-formatted text data. @@ -21,7 +21,6 @@ fun string.depth(self): int /// Calculates length of a string in bytes (not unicode symbols, just bytes). /// Since strings are stored in snake format (chain of cells), this requires traversing all cells. -@pure @inline_ref fun string.calculateLength(self): int { var bits = 0; @@ -38,7 +37,6 @@ fun string.calculateLength(self): int { /// The hash is the same regardless of snake layout: /// "abcd", "ab" + (ref "cd"), "a" + (ref "bcd" + (ref "")) all produce the same hash. /// Uses FNV-1a hashing with standard 128-bit parameters. -@pure @inline_ref fun string.hash(self): uint256 { val FNV_PRIME = 309485009821345068724781371; @@ -59,7 +57,6 @@ fun string.hash(self): uint256 { /// Compares two strings, considering snake cells. /// For example, "abcd" is equal to "ab" + (ref "cd") is equal to "a" + (ref "bc" + (ref "d")). -@pure fun string.equalTo(self, another: string): bool { return self.depth() + another.depth() != 0 // some is snake, so we have "ab->cd" / "a->bc->d" / etc., do full traverse diff --git a/crates/tolk-compiler/assets/tolk-stdlib/tvm-dicts.tolk b/crates/tolk-compiler/assets/tolk-stdlib/tvm-dicts.tolk old mode 100644 new mode 100755 index 216c9c2f5c..c7fb247b2c --- a/crates/tolk-compiler/assets/tolk-stdlib/tvm-dicts.tolk +++ b/crates/tolk-compiler/assets/tolk-stdlib/tvm-dicts.tolk @@ -1,5 +1,5 @@ // A part of standard library for Tolk -tolk 1.4.2 +tolk 1.5 /** Low-level API working with TVM dictionaries. diff --git a/crates/tolk-compiler/assets/tolk-stdlib/tvm-lowlevel.tolk b/crates/tolk-compiler/assets/tolk-stdlib/tvm-lowlevel.tolk old mode 100644 new mode 100755 index 1510d94737..8c2caf6eef --- a/crates/tolk-compiler/assets/tolk-stdlib/tvm-lowlevel.tolk +++ b/crates/tolk-compiler/assets/tolk-stdlib/tvm-lowlevel.tolk @@ -1,5 +1,5 @@ // A part of standard library for Tolk -tolk 1.4.2 +tolk 1.5 /// Usually `c3` has a continuation initialized by the whole code of the contract. It is used for function calls. /// The primitive returns the current value of `c3`. diff --git a/crates/tolk-linter/src/rules/ast/pure_function_call_unused.rs b/crates/tolk-linter/src/rules/ast/pure_function_call_unused.rs index 26b41cc9cd..2857ce51fa 100644 --- a/crates/tolk-linter/src/rules/ast/pure_function_call_unused.rs +++ b/crates/tolk-linter/src/rules/ast/pure_function_call_unused.rs @@ -16,12 +16,9 @@ use tolk_ty::InferenceResult; /// /// ### Example /// ```tolk twoslash -/// @pure -/// fun add(a: int, b: int): int { return a + b; } -/// /// fun main() { -/// add(1, 2); -/// // ^^^^^^^^^ E006: result of pure function is not used +/// createEmptyCell(); +/// // ^^^^^^^^^^^^^^^^^ E006: result of pure function is not used /// } /// ``` #[derive(ViolationMetadata)] diff --git a/crates/tolk-resolver/src/resolve_tests.rs b/crates/tolk-resolver/src/resolve_tests.rs index 7fbe2da9f7..abe6f07d4d 100644 --- a/crates/tolk-resolver/src/resolve_tests.rs +++ b/crates/tolk-resolver/src/resolve_tests.rs @@ -268,7 +268,7 @@ mod tests { } ", expect![[r" - int -> Global(int at common.tolk:352-355) + int -> Global(int at common.tolk:350-353) x -> Local(x at 63-64) "]], ); @@ -1127,14 +1127,12 @@ mod tests { val a: uint128? = 0; val b: int32? = 0; val c: bits256? = null; - val d: bytes32? = null; } ", expect![[r" uint128 -> Global(uintN at common.tolk:3511-3516) - int32 -> Global(intN at common.tolk:3236-3240) - bits256 -> Global(bitsN at common.tolk:5108-5113) - bytes32 -> Global(bytesN at common.tolk:5198-5204) + int32 -> Global(intN at common.tolk:3235-3239) + bits256 -> Global(bitsN at common.tolk:5112-5117) "]], ); } @@ -1470,7 +1468,7 @@ mod tests { "#, ) .check_definition(expect![[r" - getGasConsumedAtTheMoment -> Global(getGasConsumedAtTheMoment at gas-payments.tolk:182-207) + getGasConsumedAtTheMoment -> Global(getGasConsumedAtTheMoment at gas-payments.tolk:180-205) "]]); } diff --git a/crates/tolk-resolver/src/symbol_resolver.rs b/crates/tolk-resolver/src/symbol_resolver.rs index e0a850a535..af5b4dfafe 100644 --- a/crates/tolk-resolver/src/symbol_resolver.rs +++ b/crates/tolk-resolver/src/symbol_resolver.rs @@ -839,9 +839,6 @@ fn parse_builtin_type_base_name(name: &str) -> Option<&'static str> { if parse_numeric_suffix(name, "bits") { return Some("bitsN"); } - if parse_numeric_suffix(name, "bytes") { - return Some("bytesN"); - } None } diff --git a/crates/tolk-ty/tests/testcases/resolving/instance-methods.test b/crates/tolk-ty/tests/testcases/resolving/instance-methods.test index 064167bc68..ca613b50b1 100644 --- a/crates/tolk-ty/tests/testcases/resolving/instance-methods.test +++ b/crates/tolk-ty/tests/testcases/resolving/instance-methods.test @@ -206,7 +206,7 @@ fun test() { foo.toCell(); } ------------------------------------------------------------------------ -4:8 -> 473:6 resolved +4:8 -> 470:6 resolved ======================================================================== Generic struct alias method resolving diff --git a/crates/tolk-ty/tests/testcases/resolving/map-stdlib-methods.test b/crates/tolk-ty/tests/testcases/resolving/map-stdlib-methods.test index a785388ac7..402f757a94 100644 --- a/crates/tolk-ty/tests/testcases/resolving/map-stdlib-methods.test +++ b/crates/tolk-ty/tests/testcases/resolving/map-stdlib-methods.test @@ -29,27 +29,27 @@ fun main() { m.iteratePrev(last); } ------------------------------------------------------------------------ -4:18 -> 935:14 resolved -5:17 -> 950:14 resolved -7:6 -> 836:14 resolved -8:6 -> 843:14 resolved -9:6 -> 848:14 resolved -10:6 -> 859:14 resolved -11:6 -> 864:14 resolved -12:6 -> 873:14 resolved -13:6 -> 884:14 resolved -14:6 -> 889:14 resolved -15:6 -> 894:14 resolved -16:6 -> 899:14 resolved -17:6 -> 904:14 resolved -18:6 -> 909:14 resolved -19:6 -> 920:14 resolved -20:6 -> 956:14 resolved -21:6 -> 962:14 resolved -22:6 -> 968:14 resolved -23:6 -> 974:14 resolved -24:6 -> 987:14 resolved -25:6 -> 1000:14 resolved +4:18 -> 932:14 resolved +5:17 -> 947:14 resolved +7:6 -> 833:14 resolved +8:6 -> 840:14 resolved +9:6 -> 845:14 resolved +10:6 -> 856:14 resolved +11:6 -> 861:14 resolved +12:6 -> 870:14 resolved +13:6 -> 881:14 resolved +14:6 -> 886:14 resolved +15:6 -> 891:14 resolved +16:6 -> 896:14 resolved +17:6 -> 901:14 resolved +18:6 -> 906:14 resolved +19:6 -> 917:14 resolved +20:6 -> 953:14 resolved +21:6 -> 959:14 resolved +22:6 -> 965:14 resolved +23:6 -> 971:14 resolved +24:6 -> 984:14 resolved +25:6 -> 997:14 resolved ======================================================================== stdlib map methods on aliases (lib-like) @@ -79,15 +79,15 @@ fun mainAlias() { prices.exists(1 as uint32); } ------------------------------------------------------------------------ -13:8 -> 873:14 resolved -14:8 -> 859:14 resolved -15:8 -> 864:14 resolved -16:8 -> 909:14 resolved -17:8 -> 836:14 resolved -19:11 -> 873:14 resolved -20:23 -> 935:14 resolved -21:11 -> 987:14 resolved -22:11 -> 848:14 resolved +13:8 -> 870:14 resolved +14:8 -> 856:14 resolved +15:8 -> 861:14 resolved +16:8 -> 906:14 resolved +17:8 -> 833:14 resolved +19:11 -> 870:14 resolved +20:23 -> 932:14 resolved +21:11 -> 984:14 resolved +22:11 -> 845:14 resolved ======================================================================== stdlib map methods inside alias methods (lib-style wrappers) @@ -106,6 +106,6 @@ fun Config.hasParam(self, index: uint32): bool { return self.exists(index); } ------------------------------------------------------------------------ -3:9 -> 873:14 resolved -7:16 -> 859:14 resolved -11:16 -> 848:14 resolved +3:9 -> 870:14 resolved +7:16 -> 856:14 resolved +11:16 -> 845:14 resolved diff --git a/crates/ton-language-server-core/src/languages/tolk/completion/providers/variable_size_types.rs b/crates/ton-language-server-core/src/languages/tolk/completion/providers/variable_size_types.rs index b6a0370e2b..5e880075dc 100644 --- a/crates/ton-language-server-core/src/languages/tolk/completion/providers/variable_size_types.rs +++ b/crates/ton-language-server-core/src/languages/tolk/completion/providers/variable_size_types.rs @@ -5,7 +5,7 @@ use crate::completion::{ }; use crate::{CompletionItem, CompletionItemKind}; -/// Completes variable-width integer, byte, and bit type spellings. +/// Completes variable-width integer and bit type spellings. /// /// Each item inserts a width placeholder, allowing the user to choose the size /// without manually rebuilding the type name. @@ -37,5 +37,5 @@ impl CompletionProvider> for VariableSizeTypeC const VARIABLE_SIZE_TYPES: &[&str] = &[ "uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int8", "int16", "int32", "int64", - "int128", "int256", "int257", "int{X}", "uint{X}", "bytes32", "bytes{X}", "bits256", "bits{X}", + "int128", "int256", "int257", "int{X}", "uint{X}", "bits256", "bits{X}", ]; diff --git a/crates/ton-language-server-core/tests/languages/tolk/completion/providers/statement_snippets.rs b/crates/ton-language-server-core/tests/languages/tolk/completion/providers/statement_snippets.rs index cfb10198c4..5f347863d2 100644 --- a/crates/ton-language-server-core/tests/languages/tolk/completion/providers/statement_snippets.rs +++ b/crates/ton-language-server-core/tests/languages/tolk/completion/providers/statement_snippets.rs @@ -56,8 +56,6 @@ fn completes_statement_and_contextual_catch_snippets() { match Snippet 1:27-1:30 match (${1:condition}) {\n\t$0\n} bits256 TypeParameter 1:27-1:30 bits256 bits{X} TypeParameter 1:27-1:30 bits${1:32} - bytes32 TypeParameter 1:27-1:30 bytes32 - bytes{X} TypeParameter 1:27-1:30 bytes${1:32} int128 TypeParameter 1:27-1:30 int128 int16 TypeParameter 1:27-1:30 int16 int256 TypeParameter 1:27-1:30 int256 diff --git a/crates/ton-language-server-core/tests/languages/tolk/definition.rs b/crates/ton-language-server-core/tests/languages/tolk/definition.rs index 11e0f3adbc..6db83059d0 100644 --- a/crates/ton-language-server-core/tests/languages/tolk/definition.rs +++ b/crates/ton-language-server-core/tests/languages/tolk/definition.rs @@ -78,7 +78,7 @@ fn resolves_stdlib_method_on_string_literal() { "#, |_| {}, expect![[r" - 1:31 -> file:///__tolk_stdlib__/common.tolk 1079:11 resolved"]], + 1:31 -> file:///__tolk_stdlib__/common.tolk 1071:11 resolved"]], ); } @@ -517,8 +517,8 @@ fn resolves_stdlib_static_and_generic_methods() { ", |_| {}, expect![[r" - 4:12 -> file:///__tolk_stdlib__/common.tolk 483:6 resolved - 5:13 -> file:///__tolk_stdlib__/common.tolk 378:13 resolved"]], + 4:12 -> file:///__tolk_stdlib__/common.tolk 480:6 resolved + 5:13 -> file:///__tolk_stdlib__/common.tolk 375:13 resolved"]], ); } @@ -540,11 +540,11 @@ fn resolves_chained_generic_stdlib_methods() { ", |_| {}, expect![[r" - 6:9 -> file:///__tolk_stdlib__/common.tolk 1320:12 resolved - 7:9 -> file:///__tolk_stdlib__/common.tolk 1325:12 resolved - 7:25 -> file:///__tolk_stdlib__/common.tolk 473:6 resolved - 7:34 -> file:///__tolk_stdlib__/common.tolk 562:12 resolved - 8:9 -> file:///__tolk_stdlib__/common.tolk 1299:12 resolved"]], + 6:9 -> file:///__tolk_stdlib__/common.tolk 1312:12 resolved + 7:9 -> file:///__tolk_stdlib__/common.tolk 1317:12 resolved + 7:25 -> file:///__tolk_stdlib__/common.tolk 470:6 resolved + 7:34 -> file:///__tolk_stdlib__/common.tolk 559:12 resolved + 8:9 -> file:///__tolk_stdlib__/common.tolk 1291:12 resolved"]], ); } diff --git a/crates/ton-language-server-core/tests/languages/tolk/definition/upstream.rs b/crates/ton-language-server-core/tests/languages/tolk/definition/upstream.rs index 20364167fe..d05444cbd0 100644 --- a/crates/ton-language-server-core/tests/languages/tolk/definition/upstream.rs +++ b/crates/ton-language-server-core/tests/languages/tolk/definition/upstream.rs @@ -945,7 +945,7 @@ fun test() { foo.toCell(); }"#, |_| {}, - expect![[r#"4:8 -> file:///__tolk_stdlib__/common.tolk 473:6 resolved"#]], + expect![[r#"4:8 -> file:///__tolk_stdlib__/common.tolk 470:6 resolved"#]], ); } diff --git a/crates/ton-language-server-core/tests/languages/tolk/hover.rs b/crates/ton-language-server-core/tests/languages/tolk/hover.rs index 96fb2b9a40..5f405e8d93 100644 --- a/crates/ton-language-server-core/tests/languages/tolk/hover.rs +++ b/crates/ton-language-server-core/tests/languages/tolk/hover.rs @@ -594,7 +594,7 @@ fn shows_tlb_documentation_for_small_large_and_variable_integers() { `uint32`, `uint64`, `uint111`, etc. is "a fixed-width unsigned integer with N bits", N <= 256. Note: it's still `int` at runtime, you can assign "100500" to "uint8": - overflow will happen at serialization to a cell/builder, NOT at assignment. + overflow will happen at serialization to a cell/builder, NOT at assignment. ```tolk type int8 = builtin ``` @@ -605,7 +605,7 @@ fn shows_tlb_documentation_for_small_large_and_variable_integers() { `int8`, `int32`, `int222`, etc. is "a fixed-width signed integer with N bits", N <= 257. Note: it's still `int` at runtime, you can assign "100500" to "int8": - overflow will happen at serialization to a cell/builder, NOT at assignment. + overflow will happen at serialization to a cell/builder, NOT at assignment. ```tolk type int257 = builtin ``` @@ -616,7 +616,7 @@ fn shows_tlb_documentation_for_small_large_and_variable_integers() { `int8`, `int32`, `int222`, etc. is "a fixed-width signed integer with N bits", N <= 257. Note: it's still `int` at runtime, you can assign "100500" to "int8": - overflow will happen at serialization to a cell/builder, NOT at assignment. + overflow will happen at serialization to a cell/builder, NOT at assignment. ```tolk type varuint16 = builtin ``` @@ -625,7 +625,7 @@ fn shows_tlb_documentation_for_small_large_and_variable_integers() { - **Size**: 4 to 124 bits - **TL-B**: varuint16 - `varuint16` is `int` at runtime, but serialized as "variadic unsigned int", 0 <= X < 2^120. + `varuint16` is `int` at runtime, but serialized as "variadic unsigned int", 0 <= X < 2^120. ```tolk type varint32 = builtin ``` @@ -634,7 +634,7 @@ fn shows_tlb_documentation_for_small_large_and_variable_integers() { - **Size**: 5 to 253 bits - **TL-B**: varint32 - `varint32` is `int` at runtime, but serialized as "variadic signed int", -2^247 <= X < 2^247."#]], + `varint32` is `int` at runtime, but serialized as "variadic signed int", -2^247 <= X < 2^247. "#]], ); } diff --git a/crates/ton-objs/artifacts_manifest.toml b/crates/ton-objs/artifacts_manifest.toml index ad59ab3a0a..34d90ebfa6 100644 --- a/crates/ton-objs/artifacts_manifest.toml +++ b/crates/ton-objs/artifacts_manifest.toml @@ -10,17 +10,17 @@ artifact_set_revision = 1 [target.aarch64-apple-darwin.sha256] -libemulator = "4a5579c4866567030836ca53a7c03bc52f490837c87ce252490e03ab707a4f74" -libtolk = "243f14f1dbc213be7a3c12578aa3c2a3a2fd0639a171cd81f38b76211e8fa660" +libemulator = "b1260b0f217e0d80c59b40dc479d6cdf1a60483eee72b0cbf9cac9a04b54a24a" +libtolk = "65d3beddee61ca3a283d3e59a47c3669490fcfa4f27c8af5d249b5e3155878f1" [target.aarch64-unknown-linux-gnu.sha256] -libemulator = "06359c94707f4d559fb65160dbda22e066452f88435976f6335c1500768e726a" -libtolk = "84fcb78e2fd4ca08fe7ff5eb138abbcd461d7003c447b51b8af96b5cd98508b6" +libemulator = "f290885163827405131b34034b32a19726f23b02289b2509ecc3cb48d08fab9a" +libtolk = "13695695e2a6868f420df5ed3e66293d9995137927261aa6196ceee571a69568" [target.x86_64-apple-darwin.sha256] -libemulator = "5a6753dc6bf292cc1ca4cdeec687799aff2b94b79f1f8650ef3f99884769cce7" -libtolk = "9c198c6e1ecfbcef60bcaa701ca0d9e399ec5efc608b652c58f55f0fc3b1c754" +libemulator = "27f6c449279bafccfb7185943a085be6199df903b61393feb3676c1432c435b6" +libtolk = "09f6a2bb0c42475f63ccc85d6f877f90da69acd2277f774f2218d462c6de268a" [target.x86_64-unknown-linux-gnu.sha256] -libemulator = "30878ad39574348d3e3aae094673e38de477f0ac7d3717a14dfbbb4e827affef" -libtolk = "014037b3ab0893af646dee16afb359945ba7b75c732c83beb23cbb8b1d72c150" +libemulator = "801d483cebea9276dabf6c0b392c60766d725c3e3c3b6b8e5ccf1f11e2ba47fd" +libtolk = "46249326d4f04c8d1c3c0395dbb01054985f745fb777a9e229d3449b5aee8350" diff --git a/docs/content/docs/rules/e006-pure-function-call-unused.mdx b/docs/content/docs/rules/e006-pure-function-call-unused.mdx index 2a0542cfdd..57fa25fb79 100644 --- a/docs/content/docs/rules/e006-pure-function-call-unused.mdx +++ b/docs/content/docs/rules/e006-pure-function-call-unused.mdx @@ -23,13 +23,10 @@ Checks for calls to `@pure` functions where the result is not used. ### Example ```tolk twoslash -@pure -fun add(a: int, b: int): int { return a + b; } - fun main() { - add(1, 2); -// ^^^^^^^^^ E006: result of pure function is not used + createEmptyCell(); +// ^^^^^^^^^^^^^^^^^ E006: result of pure function is not used } ``` - + diff --git a/docs/content/docs/standard_library/emulation/network.mdx b/docs/content/docs/standard_library/emulation/network.mdx index 77067aacfd..7ff913f83b 100644 --- a/docs/content/docs/standard_library/emulation/network.mdx +++ b/docs/content/docs/standard_library/emulation/network.mdx @@ -623,7 +623,7 @@ struct ExternalOutSearchParams { Represents a set of parameters to search for an external-out message. - + ## `TlbMessage.matches` @@ -634,7 +634,7 @@ fun TlbMessage.matches( ): bool ``` - + ## `SendResultList.findExternalOutMessage` @@ -667,7 +667,7 @@ txs.findExternalOutMessage({ from: counter.address }); If the message is not found, returns `null`. - + ## `ExternalSendResult.findExternalOutMessage` @@ -682,7 +682,7 @@ fun ExternalSendResult.findExternalOutMessage( Find an external-out message in the trace produced by [net.sendExternal](#netsendexternal). - + ## `SendResultList.findTransaction` @@ -703,7 +703,7 @@ expect(result).toBeNotNull(); val tx = result!; ``` - + ## `SendResultList.getUsedGas` @@ -731,7 +731,7 @@ val gas = txs.getUsedGas({ to: counter.address }); expect(gas).toBeLess(10000); ``` - + ## `net.send` @@ -776,7 +776,7 @@ recursively executing descendants locally. See [testing.processSingleTraceStep](/docs/standard_library/emulation/testing#testingprocesssingletracestep) if you need to send a single message without out message processing. - + ## `ExternalInMessage` @@ -795,7 +795,7 @@ The response from [net.createExternalMessage](#netcreateexternalmessage). It stores an already composed message cell and the destination address used by [net.sendExternal](#netsendexternal) diagnostics. - + ## `net.createExternalMessage` @@ -820,7 +820,7 @@ message$_ {X:Type} info:CommonMsgInfo body:(Either X ^X) = Message X; ``` - + ## `net.sendExternal` @@ -863,7 +863,7 @@ val txs = result.unwrap(); expect(txs).toHaveAllSuccessfulTxs(); ``` - + ## `OutMessage.bounced` @@ -897,7 +897,7 @@ val bouncedMsg = createMessage({ testing.processSingleTraceStep(notDeployer.address, bouncedMsg); ``` - + ## `net.isBroadcasting` @@ -921,7 +921,7 @@ if (net.isBroadcasting()) { } ``` - + ## `net.enableBroadcast` @@ -948,7 +948,7 @@ if (net.isBroadcasting()) { } ``` - + ## `net.disableBroadcast` @@ -970,7 +970,7 @@ if (!net.isBroadcasting()) { } ``` - + ## `net.runGetMethod` @@ -1020,7 +1020,7 @@ val data = net.runGetMethod(wallet.address, "get_jetton_data"); ``` Use [net.runGetMethodExt](#netrungetmethodext) to also obtain gas usage and the VM exit code. - + ## `GetMethodMeta` @@ -1038,7 +1038,7 @@ struct GetMethodMeta { Execution metadata from a completed get-method invocation, including VM failures. These values describe the contract execution, excluding the calling test or script. - + ## `GetMethodResult` @@ -1060,7 +1060,7 @@ Use `unwrap()` to read the typed value or report a VM failure. Metadata is available before decoding, including when Ret does not match the stack. Each result retains its own diagnostics for the lifetime of the test or script. - + ## `net.runGetMethodExt` @@ -1087,7 +1087,7 @@ val balance = execution.unwrap(); expect(execution.meta.gasUsed).toBeLess(1000); ``` - + ## `GetMethodResult.isSuccess` @@ -1100,7 +1100,7 @@ fun GetMethodResult.isSuccess(self): bool Returns whether the VM completed with exit code 0 or 1. This check does not decode the stack or validate it against Ret. - + ## `GetMethodResult.unwrap` @@ -1115,7 +1115,7 @@ Successful nullable getters return null as a value of Ret. An incompatible Ret causes a decoding error. Metadata is available before this call. Repeated calls decode the same stack without executing the getter again. - + ## `Expectation>.toHaveExitCode` @@ -1128,7 +1128,7 @@ fun Expectation>.toHaveExitCode(self, exitCode: int): void Expect a specific VM exit code without decoding the saved stack. A mismatch reports the expected code and the getter's execution diagnostics. - + ## `randomAddress` @@ -1147,7 +1147,7 @@ val address = randomAddress("random_user"); val masterchainAddress = randomAddress("random_user", -1); ``` - + ## `net.registerAddress` @@ -1168,7 +1168,7 @@ Example: net.registerAddress(address, "my_address"); ``` - + ## `net.registerCodeCell` @@ -1186,7 +1186,7 @@ Example: net.registerCodeCell(code, "my_code"); ``` - + ## `net.loadLibrary` @@ -1201,7 +1201,7 @@ fork network for the same hash. Returns null if library is not found. - + ## `tuple.fromTuple` @@ -1209,7 +1209,7 @@ Returns null if library is not found. fun tuple.fromTuple(data: tuple): tuple ``` - + ## `Expectation.toBeAccepted` @@ -1228,7 +1228,7 @@ On failure, Acton reports the external status, emulator reason, VM exit code when available, a known exit-code description or ABI error name, source location, and the full backtrace when the test is run with `--backtrace full`. - + ## `Expectation.toBeNotAccepted` @@ -1240,7 +1240,7 @@ fun Expectation.toBeNotAccepted(self): void Expect the external-in message to be rejected before acceptance. - + ## `Expectation.toHaveExternalVmExitCode` @@ -1255,7 +1255,7 @@ Expect the external send error to have a specific VM exit code. This matcher is intended for rejected external-in messages. For accepted external messages, use transaction matchers on the produced [SendResultList](#sendresultlist). - + ## `Expectation.toHaveSuccessfulDeploy` @@ -1278,7 +1278,7 @@ expect(txs).toHaveSuccessfulDeploy({ }); ``` - + ## `Expectation.toHaveSuccessfulTx` @@ -1307,7 +1307,7 @@ expect(txs).toHaveSuccessfulTx({ }); ``` - + ## `Expectation.toHaveTx` @@ -1330,7 +1330,7 @@ expect(txs).toHaveTx({ }); ``` - + ## `Expectation.toNotHaveTx` @@ -1348,7 +1348,7 @@ expect(txs).toNotHaveTx({ }); ``` - + ## `Expectation.toHaveBouncedTx` @@ -1369,7 +1369,7 @@ expect(txs).toHaveBouncedTx({ }); ``` - + ## `Expectation.toHaveFailedTx` @@ -1398,7 +1398,7 @@ expect(txs).toHaveFailedTx({ }); ``` - + ## `Expectation.toHaveAllSuccessfulTxs` @@ -1414,7 +1414,7 @@ val txs = net.send(wallet.address, msg); expect(txs).toHaveAllSuccessfulTxs(); ``` - + ## `Expectation.toEmitExternalMessage` @@ -1429,7 +1429,7 @@ Example: expect(txs).toEmitExternalMessage(); ``` - + ## `Expectation.toConsumeLessThan` @@ -1445,5 +1445,5 @@ val txs = net.send(deployer.address, message); expect(txs.at(0)).toConsumeLessThan(1000); ``` - + diff --git a/docs/content/docs/tolk_standard_library/common.mdx b/docs/content/docs/tolk_standard_library/common.mdx index 5e28bb24fe..ac328dec60 100644 --- a/docs/content/docs/tolk_standard_library/common.mdx +++ b/docs/content/docs/tolk_standard_library/common.mdx @@ -228,16 +228,6 @@ an error will be fired at serialization with [T.toCell](#ttocell) and similar, N -## `bytesN` - -```tolk -type bytesN = builtin -``` - -`bytes8`, `bytes99`, etc. is a convenient alias for `bits(N*8)` - - - ## `map` ```tolk @@ -252,7 +242,7 @@ Restrictions for K and V types: - a key must be fixed-width; valid: `int32`, `uint64`, `address`, `bits256`, `Point`; invalid: `int`, `coins` - a value must be serializable; valid: `int32`, `coins`, `AnyStruct`, `Cell`; invalid: `int`, `builder` - + ## `array` @@ -268,7 +258,7 @@ On a stack, an array occupies one stack slot regardless of its size. `T` can be any type (complex types are converted to sub-tuples under the hood). Work with array using its methods: `arr.push(v)`, `arr.get(i)`, etc. - + ## `unknown` @@ -288,7 +278,7 @@ u2 as (int, int); // stack: "10 20" (two integers) Be extremely careful using `unknown`, because the compiler is unable to validate the casts. An invalid cast from your side leads to stack corruption, resulting in undefined behavior. - + ## `tuple` @@ -308,7 +298,7 @@ var elem = someTuple.get(0) as int; return elem + 123; ``` - + ## `lisp_list` @@ -332,7 +322,7 @@ list.prependHead(2); list.getHead(); // 2 ``` - + ## `dict` @@ -343,7 +333,7 @@ type dict = cell? Think of it as "a map with unknown keys and unknown values". Prefer using `map`, not `dict`. - + ## `void` @@ -355,7 +345,7 @@ type void = builtin It's similar to both `void` and `unit` in other languages. Note: a function without return type means "auto infer", NOT "void". - + ## `Cell` @@ -381,7 +371,7 @@ Note, that `st = MyStorage.fromSlice(s)` does NOT deep-load any refs; `st.extra` you should manually call `st.extra.load()` to get `T` (ExtraData in this example). Typed cells are comparable with `==` and `!=`, just like raw `cell`. - + ## `createEmptyTuple` @@ -404,7 +394,7 @@ var t = []; // array var numbers: array = []; ``` - + ## `array.push` @@ -416,7 +406,7 @@ fun array.push(mutate self, value: T): void Appends a value to array. If its size exceeds 255, throws a type check exception. - + ## `array.first` @@ -427,7 +417,7 @@ fun array.first(self): T Returns the first element of a non-empty array. - + ## `array.get` @@ -438,7 +428,7 @@ fun array.get(self, index: int): T Returns the `i`-th element of an array. - + ## `array.set` @@ -450,7 +440,7 @@ fun array.set(mutate self, value: T, index: int): void Sets the `i`-th element of an array to a specified value (an element with this index must already exist, a new element is not created). - + ## `array.size` @@ -461,7 +451,7 @@ fun array.size(self): int Returns the size of an array (elements count in it). - + ## `array.last` @@ -472,7 +462,7 @@ fun array.last(self): T Returns the last element of a non-empty array. - + ## `array.pop` @@ -483,7 +473,7 @@ fun array.pop(mutate self): T Pops and returns the last element of a non-empty array. - + ## `T.toTuple` @@ -507,7 +497,7 @@ t.get(0) as int; // 1 It can be used for logging or low-level purposes like running a child VM or custom "equals". See [T.fromTuple](#tfromtuple) counterpart. - + ## `T.fromTuple` @@ -520,7 +510,7 @@ Unpacks a tuple back to an object on a stack. It works identically as casting `unknown` to an object. See [T.toTuple](#ttotuple) for explanation and examples. - + ## `grams` @@ -533,19 +523,19 @@ Converts a constant floating-point string to nanograms. Example: `grams("0.05")` is equal to 50000000. Note, that `grams()` requires a constant string; `grams(some_var)` is an error. - + ## `ton` ```tolk +@deprecated("""use `grams("0.05")` instead of `ton("0.05")`""") @pure fun ton(floatString: string): coins ``` Deprecated alias for [grams](#grams). -From Tolk v1.5, it will become @deprecated("""use `grams("0.05")` instead of `ton("0.05")`""") - + ## `min` @@ -556,7 +546,7 @@ fun min(x: int, y: int): int Computes the minimum of two integers. - + ## `max` @@ -567,7 +557,7 @@ fun max(x: int, y: int): int Computes the maximum of two integers. - + ## `minMax` @@ -579,7 +569,7 @@ fun minMax(x: int, y: int): (int, int) Sorts two integers. Example: `minMax(x, y)` with (x=20, y=10) and with (x=10, y=20) returns (10, 20) - + ## `abs` @@ -590,7 +580,7 @@ fun abs(x: int): int Computes the absolute value of an integer. - + ## `sign` @@ -601,7 +591,7 @@ fun sign(x: int): int Returns the sign of an integer: `-1` if x \< 0, `0` if x == 0, `1` if x > 0. - + ## `divMod` @@ -612,7 +602,7 @@ fun divMod(x: int, y: int): (int, int) Computes the quotient and remainder of x / y. Example: divMod(112,3) = (37,1) - + ## `modDiv` @@ -623,7 +613,7 @@ fun modDiv(x: int, y: int): (int, int) Computes the remainder and quotient of x / y. Example: modDiv(112,3) = (1,37) - + ## `mulDivFloor` @@ -635,7 +625,7 @@ fun mulDivFloor(x: int, y: int, z: int): int Computes multiple-then-divide: floor(x * y / z). The intermediate result is stored in a 513-bit integer to prevent precision loss. - + ## `mulDivRound` @@ -646,7 +636,7 @@ fun mulDivRound(x: int, y: int, z: int): int Similar to [mulDivFloor](#muldivfloor), but rounds the result: round(x * y / z). - + ## `mulDivCeil` @@ -657,7 +647,7 @@ fun mulDivCeil(x: int, y: int, z: int): int Similar to [mulDivFloor](#muldivfloor), but ceils the result: ceil(x * y / z). - + ## `mulDivMod` @@ -668,7 +658,7 @@ fun mulDivMod(x: int, y: int, z: int): (int, int) Computes the quotient and remainder of (x * y / z). Example: mulDivMod(112,3,10) = (33,6) - + ## `contract` @@ -679,7 +669,7 @@ struct contract `contract` is a built-in struct, it has only static methods. Example: `contract.getCode()` and other methods. - + ## `contract.getAddress` @@ -691,7 +681,7 @@ fun contract.getAddress(): address Returns the internal address of the current smart contract. If necessary, it can be parsed further using [address.getWorkchain](#addressgetworkchain) and others. - + ## `contract.getOriginalBalance` @@ -702,7 +692,7 @@ fun contract.getOriginalBalance(): coins Returns the balance (in nanograms) of the smart contract at the start of Computation Phase. - + ## `contract.getOriginalBalanceWithExtraCurrencies` @@ -713,7 +703,7 @@ fun contract.getOriginalBalanceWithExtraCurrencies(): [coins, ExtraCurrenciesMap Same as [contract.getOriginalBalance](#contractgetoriginalbalance), but also returns the balance in extra currencies. - + ## `contract.getData` @@ -724,7 +714,7 @@ fun contract.getData(): cell Returns the persistent contract storage cell. It can be parsed or modified with slice and builder primitives later. - + ## `contract.setData` @@ -734,7 +724,7 @@ fun contract.setData(c: cell): void Sets the persistent contract storage. - + ## `contract.getCode` @@ -745,7 +735,7 @@ fun contract.getCode(): cell Retrieves code of smart-contract from c7. - + ## `contract.setCodePostponed` @@ -755,7 +745,7 @@ fun contract.setCodePostponed(newCode: cell): void Creates an output action that would change this smart contract code after successful termination of the current run. - + ## `MASTERCHAIN` @@ -763,7 +753,7 @@ Creates an output action that would change this smart contract code after succes const MASTERCHAIN = -1 ``` - + ## `BASECHAIN` @@ -771,7 +761,7 @@ const MASTERCHAIN = -1 const BASECHAIN = 0 ``` - + ## `blockchain` @@ -782,7 +772,7 @@ struct blockchain `blockchain` is a built-in struct, it has only static methods. Example: `blockchain.configParam(16)` and other methods. - + ## `blockchain.now` @@ -793,7 +783,7 @@ fun blockchain.now(): int Returns current Unix timestamp (in seconds). - + ## `blockchain.logicalTime` @@ -804,7 +794,7 @@ fun blockchain.logicalTime(): int Returns the logical time of the current transaction. - + ## `blockchain.currentBlockLogicalTime` @@ -815,7 +805,7 @@ fun blockchain.currentBlockLogicalTime(): int Returns the starting logical time of the current block. - + ## `blockchain.configParam` @@ -826,7 +816,7 @@ fun blockchain.configParam(x: int): cell? Returns the value of the global configuration parameter with integer index `i` as a `cell` or `null` value. - + ## `commitContractDataAndActions` @@ -838,7 +828,7 @@ Commits current state of registers `c4` (persistent data) and `c5` (actions) so that the current execution is considered "successful" with the saved values even if an exception in Computation Phase is thrown later. - + ## `PackOptions` @@ -857,7 +847,7 @@ struct PackOptions { PackOptions allows you to control behavior of `obj.toCell()` and similar functions. - + ## `UnpackOptions` @@ -880,7 +870,7 @@ struct UnpackOptions { UnpackOptions allows you to control behavior of `MyStruct.fromCell(c)` and similar functions. - + ## `T.toCell` @@ -897,7 +887,7 @@ contract.setData(st.toCell()); Internally, a builder is created, all fields are serialized one by one, and a builder is flushed (beginCell() + serialize fields + endCell()). - + ## `T.fromCell` @@ -913,7 +903,7 @@ var st = MyStorage.fromCell(contract.getData()); Internally, a cell is unpacked to a slice, and that slice is parsed (packedCell.beginParse() + read from slice). - + ## `T.fromSlice` @@ -931,7 +921,7 @@ If a slice is corrupted, an exception is thrown (most likely, excode 9 "cell und Note, that a passed slice is NOT mutated, its internal pointer is NOT shifted. If you need to mutate it, like `cs.loadInt()`, consider calling `cs.loadAny()`. - + ## `slice.loadAny` @@ -949,7 +939,7 @@ Similar to `MyStorage.fromSlice(cs)`, but called as a slice method and mutates t Note: `options.assertEndAfterReading` is ignored by this function, because it's actually intended to read data from the middle. - + ## `slice.skipAny` @@ -965,7 +955,7 @@ struct TwoInts { a: int32; b: int32; } cs.skipAny(); // skips 64 bits ``` - + ## `builder.storeAny` @@ -980,7 +970,7 @@ Similar to `builder.storeUint()` and others, but allows storing structures. var b = beginCell().storeUint(32).storeAny(msgBody).endCell(); ``` - + ## `T.forceLoadLazyObject` @@ -1005,7 +995,7 @@ match (msg) { // it's a lazy match, without creating a union on the stack Note: while [slice.assertEnd](#sliceassertend) may seem reasonable, these checks are avoided in practice, because the purpose of `lazy` is to auto-detect and load only necessary fields, not up to the end. - + ## `Cell.load` @@ -1023,7 +1013,7 @@ var st = MyStorage.fromCell(contract.getData()); var extra = st.extra.load(); // it's ExtraData, unpacked from loaded ref ``` - + ## `Cell.beginParse` @@ -1034,7 +1024,7 @@ fun Cell.beginParse(self): slice Converts a typed cell into a slice. - + ## `Cell.hash` @@ -1045,7 +1035,7 @@ fun Cell.hash(self): uint256 Returns hash of a typed cell, same as [cell.hash](#cellhash). - + ## `RemainingBitsAndRefs` @@ -1062,7 +1052,7 @@ struct JettonMessage { ``` When you deserialize JettonMessage, forwardPayload contains "everything left after reading fields above". - + ## `createEmptyCell` @@ -1074,7 +1064,7 @@ fun createEmptyCell(): cell Creates a cell with zero bits and references. Equivalent to `beginCell().endCell()`. - + ## `createEmptySlice` @@ -1086,7 +1076,7 @@ fun createEmptySlice(): slice Creates a slice with zero remaining bits and references. Equivalent to `beginCell().endCell().beginParse()`. - + ## `stringCrc32` @@ -1102,7 +1092,7 @@ const op = stringCrc32("some_str") // = 4013618352 = 0xEF3AF4B0 ``` Note: `stringCrc32(slice_var)` does NOT work! It accepts a constant string and works at compile-time. - + ## `stringCrc16` @@ -1118,7 +1108,7 @@ const op = stringCrc16("some_str") // = 53407 = 0xD09F ``` Note: `stringCrc16(slice_var)` does NOT work! It accepts a constant string and works at compile-time. - + ## `stringSha256` @@ -1135,7 +1125,7 @@ const hash = stringSha256("some_crypto_key") Note: it's a compile-time function, `stringSha256(slice_var)` does NOT work! Use [slice.bitsHash](#slicebitshash) or [slice.hash](#slicehash) (declared below) to hash a slice without/with its refs at runtime. - + ## `stringSha256_32` @@ -1151,7 +1141,7 @@ const minihash = stringSha256_32("some_crypto_key") ``` Note: `stringSha256_32(slice_var)` does NOT work! It accepts a constant string and works at compile-time. - + ## `stringToBase256` @@ -1167,7 +1157,7 @@ const value = stringToBase256("AB") // = 16706 (65*256 + 66) ``` Note: `stringToBase256(slice_var)` does NOT work! It accepts a constant string and works at compile-time. - + ## `cell.hash` @@ -1179,7 +1169,7 @@ fun cell.hash(self): uint256 Computes the representation hash of a cell and returns it as a 256-bit unsigned integer. Useful for signing and checking signatures of arbitrary entities represented by a tree of cells. - + ## `slice.hash` @@ -1191,7 +1181,7 @@ fun slice.hash(self): uint256 Computes the hash of a slice and returns it as a 256-bit unsigned integer. The result is the same as [cell.hash](#cellhash) for a cell containing data and references from this slice. - + ## `builder.hash` @@ -1203,7 +1193,7 @@ fun builder.hash(self): uint256 Computes the hash of a builder and returns it as a 256-bit unsigned integer. The same as "transform builder to cell + calc hash of that cell", but without cell creation. - + ## `slice.bitsHash` @@ -1215,7 +1205,7 @@ fun slice.bitsHash(self): uint256 Computes sha256 of the data bits of a slice (without refs). If the bit length is not divisible by eight, throws a cell underflow exception. - + ## `cell.hashEqual` @@ -1227,7 +1217,7 @@ fun cell.hashEqual(self, another: cell): bool Checks whether two cells are equal by comparing their hashes. Used internally by the compiler for operators `==` and `!=` on cells. - + ## `isSignatureValid` @@ -1240,7 +1230,7 @@ Checks an Ed25519 signature where the signed message is the 32-byte big-endian e Use this when off-chain code signed a 32-byte hash or digest value. The signature must contain at least 512 data bits; only the first 512 bits are used. - + ## `isSliceSignatureValid` @@ -1255,7 +1245,7 @@ If the bit length of `data` is not divisible by eight, throws a cell underflow e This function does not hash `data`; if off-chain code signed SHA-256(data), use `isSignatureValid(data.bitsHash(), signature, publicKey)` instead. - + ## `random` @@ -1266,7 +1256,7 @@ struct random `random` is a built-in struct, it has only static methods. Example: `random.uint256()` and other methods. - + ## `random.uint256` @@ -1277,7 +1267,7 @@ fun random.uint256(): uint256 Generates a new pseudo-random unsigned 256-bit integer x. Ensure you've called [random.initialize](#randominitialize) in advance to make it unpredictable! - + ## `random.range` @@ -1289,7 +1279,7 @@ Generates a new pseudo-random integer z in the range 0..limit−1 (or limit..− More precisely, an unsigned random value x is generated as in random; then z := x * limit / 2^256 is computed. Ensure you've called [random.initialize](#randominitialize) in advance to make it unpredictable! - + ## `random.getSeed` @@ -1300,7 +1290,7 @@ fun random.getSeed(): uint256 Returns the current random seed used to generate pseudo-random numbers. - + ## `random.setSeed` @@ -1310,7 +1300,7 @@ fun random.setSeed(seed: uint256): void Sets the random seed to the provided value. - + ## `random.initializeBy` @@ -1320,7 +1310,7 @@ fun random.initializeBy(mixSeedWith: uint256): void Initializes (mixes) random seed with the provided value. - + ## `random.initialize` @@ -1332,7 +1322,7 @@ Mixes the random seed with this transaction's logical time ([blockchain.logicalT LTIME is the network ordering value for this transaction (not unixtime). Typically, call once before [random.uint256](#randomuint256) / [random.range](#randomrange). - + ## `cell.calculateSize` @@ -1351,7 +1341,7 @@ The total count of visited cells `x` cannot exceed non-negative `maxCells`; otherwise the computation is aborted before visiting the `(maxCells + 1)`-st cell and a zero flag is returned to indicate failure. - + ## `slice.calculateSize` @@ -1364,7 +1354,7 @@ Similar to [cell.calculateSize](#cellcalculatesize), but accepting a slice inste The returned value of `x` does not take into account the cell that contains the slice itself; however, its data bits and cell references are accounted for in `y` and `z`. - + ## `cell.calculateSizeStrict` @@ -1374,7 +1364,7 @@ fun cell.calculateSizeStrict(self, maxCells: int): (int, int, int) A non-quiet version of [cell.calculateSize](#cellcalculatesize) that throws a cell overflow exception (`8`) on failure. - + ## `slice.calculateSizeStrict` @@ -1384,7 +1374,7 @@ fun slice.calculateSizeStrict(self, maxCells: int): (int, int, int) A non-quiet version of [slice.calculateSize](#slicecalculatesize) that throws a cell overflow exception (`8`) on failure. - + ## `cell?.depth` @@ -1396,7 +1386,7 @@ fun cell?.depth(self): int Returns the depth of a cell: 0 if no references, otherwise 1 + maximum of depths of all references. When called for `null`, returns 0. - + ## `slice.depth` @@ -1407,7 +1397,7 @@ fun slice.depth(self): int Returns the depth of a cell: 0 if no references, otherwise 1 + maximum of depths of all references. - + ## `builder.depth` @@ -1418,7 +1408,7 @@ fun builder.depth(self): int Returns the depth of a builder: 0 if no references, otherwise 1 + maximum of depths of all references. - + ## `debug` @@ -1429,7 +1419,7 @@ struct debug `debug` is a built-in struct, it has only static methods. Example: `debug.print(v)` and other methods. - + ## `debug.print` @@ -1439,7 +1429,7 @@ fun debug.print(x: T): void Dump a variable to the debug log as a raw TVM stack value. - + ## `debug.printString` @@ -1449,7 +1439,7 @@ fun debug.printString(x: string): void Dump a string to the debug log. - + ## `debug.dumpStack` @@ -1459,7 +1449,7 @@ fun debug.dumpStack(): void Dumps the stack (at most the top 255 values) and shows the total stack depth. - + ## `createEmptyMap` @@ -1478,7 +1468,7 @@ var m: map = createEmptyMap(); var m: map = []; ``` - + ## `createMapFromLowLevelDict` @@ -1491,7 +1481,7 @@ Converts a low-level TVM dictionary to a typed map. Actually, does nothing: accepts an "optional cell" and returns the same "optional cell", so if you specify key/value types incorrectly, it will fail later, at `map.get` and similar. - + ## `map.toLowLevelDict` @@ -1503,7 +1493,7 @@ fun map.toLowLevelDict(self): dict Converts a high-level map to a low-level TVM dictionary. Actually, does nothing: returns the same "optional cell". - + ## `map.isEmpty` @@ -1516,7 +1506,7 @@ Checks whether a map is empty (whether a cell is null). Note: a check `m == null` will not work, use `m.isEmpty()`. - + ## `map.exists` @@ -1527,7 +1517,7 @@ fun map.exists(self, key: K): bool Checks whether a key exists in a map. - + ## `map.get` @@ -1544,7 +1534,7 @@ if (r.isFound) { } ``` - + ## `map.mustGet` @@ -1555,7 +1545,7 @@ fun map.mustGet(self, key: K, throwIfNotFound: int = 9): V Gets an element by key and throws if it doesn't exist. - + ## `map.set` @@ -1570,7 +1560,7 @@ m.set(k, 3); ``` Since it returns `self`, calls may be chained. - + ## `map.setAndGetPrevious` @@ -1587,7 +1577,7 @@ if (prev.isFound) { } ``` - + ## `map.replaceIfExists` @@ -1598,7 +1588,7 @@ fun map.replaceIfExists(mutate self, key: K, value: V): bool Sets an element only if the key already exists. Returns whether an element was replaced. - + ## `map.replaceAndGetPrevious` @@ -1609,7 +1599,7 @@ fun map.replaceAndGetPrevious(mutate self, key: K, value: V): MapLookupRes Sets an element only if the key already exists and returns the previous element at that key. - + ## `map.addIfNotExists` @@ -1620,7 +1610,7 @@ fun map.addIfNotExists(mutate self, key: K, value: V): bool Sets an element only if the key does not exist. Returns whether an element was added. - + ## `map.addOrGetExisting` @@ -1631,7 +1621,7 @@ fun map.addOrGetExisting(mutate self, key: K, value: V): MapLookupResult + ## `map.delete` @@ -1642,7 +1632,7 @@ fun map.delete(mutate self, key: K): bool Delete an element at the key. Returns whether an element was deleted. - + ## `map.deleteAndGetDeleted` @@ -1659,7 +1649,7 @@ if (prev.isFound) { } ``` - + ## `map.findFirst` @@ -1680,7 +1670,7 @@ while (r.isFound) { } ``` - + ## `map.findLast` @@ -1701,7 +1691,7 @@ while (r.isFound) { } ``` - + ## `map.findKeyGreater` @@ -1713,7 +1703,7 @@ fun map.findKeyGreater(self, pivotKey: K): MapEntry Finds an element with key > pivotKey. Don't forget to check `isFound` before using `getKey()` and `loadValue()` of the result. - + ## `map.findKeyGreaterOrEqual` @@ -1725,7 +1715,7 @@ fun map.findKeyGreaterOrEqual(self, pivotKey: K): MapEntry Finds an element with key >= pivotKey. Don't forget to check `isFound` before using `getKey()` and `loadValue()` of the result. - + ## `map.findKeyLess` @@ -1737,7 +1727,7 @@ fun map.findKeyLess(self, pivotKey: K): MapEntry Finds an element with key \< pivotKey. Don't forget to check `isFound` before using `getKey()` and `loadValue()` of the result. - + ## `map.findKeyLessOrEqual` @@ -1749,7 +1739,7 @@ fun map.findKeyLessOrEqual(self, pivotKey: K): MapEntry Finds an element with key \<= pivotKey. Don't forget to check `isFound` before using `getKey()` and `loadValue()` of the result. - + ## `map.iterateNext` @@ -1768,7 +1758,7 @@ while (r.isFound) { } ``` - + ## `map.iteratePrev` @@ -1787,7 +1777,7 @@ while (r.isFound) { } ``` - + ## `MapLookupResult` @@ -1808,25 +1798,23 @@ if (r.isFound) { } ``` - + ## `MapLookupResult.loadValue` ```tolk -@pure fun MapLookupResult.loadValue(self): TValue ``` - + ## `MapLookupResult.loadValue` ```tolk -@pure fun MapLookupResult.loadValue(self): slice ``` - + ## `MapEntry` @@ -1848,34 +1836,31 @@ while (r.isFound) { } ``` - + ## `MapEntry.getKey` ```tolk -@pure fun MapEntry.getKey(self): K ``` - + ## `MapEntry.loadValue` ```tolk -@pure fun MapEntry.loadValue(self): V ``` - + ## `MapEntry.loadValue` ```tolk -@pure fun MapEntry.loadValue(self): slice ``` - + ## `string.beginParse` @@ -1887,7 +1872,7 @@ fun string.beginParse(self): slice Begins parsing the string content. Use for accessing raw bytes. Remember that a string may be a snake: not just "ab", but "a" + (ref "b"). - + ## `string.literalSlice` @@ -1903,7 +1888,7 @@ const s: slice = "hello".literalSlice() ``` Unlike `beginParse()`, it works at compile-time and is allowed in constant expressions. - + ## `string.crc32` @@ -1918,7 +1903,7 @@ const op = "some_str".crc32() // = 4013618352 = 0xEF3AF4B0 ``` Note: this is a compile-time method, it works only with string literals. - + ## `string.crc16` @@ -1933,7 +1918,7 @@ const op = "some_str".crc16() // = 53407 = 0xD09F ``` Note: this is a compile-time method, it works only with string literals. - + ## `string.sha256` @@ -1948,7 +1933,7 @@ const hash = "some_crypto_key".sha256() ``` Note: this is a compile-time method, it works only with string literals. - + ## `string.sha256_32` @@ -1963,7 +1948,7 @@ const minihash = "some_crypto_key".sha256_32() ``` Note: this is a compile-time method, it works only with string literals. - + ## `string.hexToSlice` @@ -1978,7 +1963,7 @@ const v = "abcdef".hexToSlice() // = slice with 3 bytes: 0xAB,0xCD,0xEF ``` Note: this is a compile-time method, it works only with string literals. - + ## `string.toBase256` @@ -1993,7 +1978,7 @@ const value = "AB".toBase256() // = 16706 (65*256 + 66) ``` Note: this is a compile-time method, it works only with string literals. - + ## `stringHexToSlice` @@ -2009,7 +1994,7 @@ const v = stringHexToSlice("abcdef") // = slice with 3 bytes: 0xAB,0xCD,0xEF ``` Note: `stringHexToSlice(slice_var)` does NOT work! It accepts a constant string and works at compile-time. - + ## `cell.beginParse` @@ -2020,7 +2005,7 @@ fun cell.beginParse(self): slice Converts a cell into a slice. - + ## `slice.assertEnd` @@ -2030,7 +2015,7 @@ fun slice.assertEnd(self): void Checks if a slice is empty. If not, throws an exception with code 9. - + ## `slice.loadRef` @@ -2041,7 +2026,7 @@ fun slice.loadRef(mutate self): cell Loads the next reference from a slice. - + ## `slice.preloadRef` @@ -2052,7 +2037,7 @@ fun slice.preloadRef(self): cell Preloads the next reference from a slice. - + ## `slice.loadInt` @@ -2063,7 +2048,7 @@ fun slice.loadInt(mutate self, len: int): int Loads a signed len-bit integer from a slice. - + ## `slice.loadUint` @@ -2074,7 +2059,7 @@ fun slice.loadUint(mutate self, len: int): int Loads an unsigned len-bit integer from a slice. - + ## `slice.loadBits` @@ -2085,7 +2070,7 @@ fun slice.loadBits(mutate self, len: int): slice Loads the first `0 ≤ len ≤ 1023` bits from a slice. - + ## `slice.preloadInt` @@ -2096,7 +2081,7 @@ fun slice.preloadInt(self, len: int): int Preloads a signed len-bit integer from a slice. - + ## `slice.preloadUint` @@ -2107,7 +2092,7 @@ fun slice.preloadUint(self, len: int): int Preloads an unsigned len-bit integer from a slice. - + ## `slice.preloadBits` @@ -2118,7 +2103,7 @@ fun slice.preloadBits(self, len: int): slice Preloads the first `0 ≤ len ≤ 1023` bits from a slice. - + ## `slice.loadCoins` @@ -2129,7 +2114,7 @@ fun slice.loadCoins(mutate self): coins Loads the serialized amount of nanograms (any unsigned integer up to `2^120 - 1`). - + ## `slice.loadBool` @@ -2140,7 +2125,7 @@ fun slice.loadBool(mutate self): bool Loads a boolean from a slice. - + ## `slice.skipBits` @@ -2151,7 +2136,7 @@ fun slice.skipBits(mutate self, len: int): self Shifts a slice pointer to len bits forward. - + ## `slice.getFirstBits` @@ -2162,7 +2147,7 @@ fun slice.getFirstBits(self, len: int): slice Returns the first `0 ≤ len ≤ 1023` bits of a slice. - + ## `slice.removeLastBits` @@ -2173,7 +2158,7 @@ fun slice.removeLastBits(mutate self, len: int): self Returns all but the last `0 ≤ len ≤ 1023` bits of a slice. - + ## `slice.getLastBits` @@ -2184,7 +2169,7 @@ fun slice.getLastBits(self, len: int): slice Returns the last `0 ≤ len ≤ 1023` bits of a slice. - + ## `slice.getMiddleBits` @@ -2196,7 +2181,7 @@ fun slice.getMiddleBits(self, offset: int, len: int): slice Returns `0 ≤ len ≤ 1023` bits of a slice starting from `0 ≤ offset ≤ 1023`. (in other words, extracts a bit substring `[offset, len)` out of the slice) - + ## `slice.loadDict` @@ -2207,7 +2192,7 @@ fun slice.loadDict(mutate self): dict Loads a dictionary (TL HashMapE structure, represented as TVM cell) from a slice. - + ## `slice.preloadDict` @@ -2218,7 +2203,7 @@ fun slice.preloadDict(self): dict Preloads a dictionary (cell) from a slice. - + ## `slice.skipDict` @@ -2229,7 +2214,7 @@ fun slice.skipDict(mutate self): self Skip a dictionary from a slice. - + ## `slice.loadMaybeRef` @@ -2241,7 +2226,7 @@ fun slice.loadMaybeRef(mutate self): cell? Loads (Maybe ^Cell) from a slice. In other words, loads 1 bit: if it's true, loads the first ref, otherwise returns `null`. - + ## `slice.preloadMaybeRef` @@ -2252,7 +2237,7 @@ fun slice.preloadMaybeRef(self): cell? Preloads (Maybe ^Cell) from a slice. - + ## `slice.skipMaybeRef` @@ -2263,7 +2248,7 @@ fun slice.skipMaybeRef(mutate self): self Skips (Maybe ^Cell) in a slice. - + ## `slice.loadString` @@ -2274,7 +2259,7 @@ fun slice.loadString(mutate self): string Loads a string from a slice. A string is a nested ref, so just load a ref. - + ## `beginCell` @@ -2285,7 +2270,7 @@ fun beginCell(): builder Creates a new empty builder. - + ## `builder.endCell` @@ -2296,7 +2281,7 @@ fun builder.endCell(self): cell Converts a builder into an ordinary cell. - + ## `builder.toSlice` @@ -2308,7 +2293,7 @@ fun builder.toSlice(self): slice Converts a builder into a slice. The same as `b.endCell().beginParse()` - + ## `builder.storeRef` @@ -2319,7 +2304,7 @@ fun builder.storeRef(mutate self, c: cell): self Stores a reference to a cell into a builder. - + ## `builder.storeInt` @@ -2330,7 +2315,7 @@ fun builder.storeInt(mutate self, x: int, len: int): self Stores a signed len-bit integer into a builder (`0 ≤ len ≤ 257`). - + ## `builder.storeUint` @@ -2341,7 +2326,7 @@ fun builder.storeUint(mutate self, x: int, len: int): self Stores an unsigned len-bit integer into a builder (`0 ≤ len ≤ 256`). - + ## `builder.storeSlice` @@ -2352,7 +2337,7 @@ fun builder.storeSlice(mutate self, s: slice): self Stores a slice into a builder. - + ## `builder.storeString` @@ -2363,7 +2348,7 @@ fun builder.storeString(mutate self, s: string): self Stores a string into a builder (it's a TVM cell, stored as a ref). - + ## `builder.storeAddress` @@ -2374,7 +2359,7 @@ fun builder.storeAddress(mutate self, addr: address): self Stores an internal address into a builder. - + ## `builder.storeAddressOpt` @@ -2386,7 +2371,7 @@ fun builder.storeAddressOpt(mutate self, addrOrNull: address?): self Stores an internal address or '00' if the parameter is `null`. '00' (two zero bits) is a standard representation of a "missing" ("none") address. - + ## `builder.storeAddressAny` @@ -2397,7 +2382,7 @@ fun builder.storeAddressAny(mutate self, addrAny: any_address): self Stores "any address" (internal/external/none) into a builder. - + ## `builder.storeAddressNone` @@ -2408,7 +2393,7 @@ fun builder.storeAddressNone(mutate self): self Stores a "none address": '00' (two zero bits) is TL addr_none$00. - + ## `builder.storeCoins` @@ -2419,7 +2404,7 @@ fun builder.storeCoins(mutate self, x: coins): self Stores the amount of nanograms into a builder. - + ## `builder.storeBool` @@ -2430,7 +2415,7 @@ fun builder.storeBool(mutate self, x: bool): self Stores a boolean into a builder. - + ## `builder.storeDict` @@ -2442,7 +2427,7 @@ fun builder.storeDict(mutate self, c: dict): self Stores a low-level TVM dictionary (optional cell) into a builder. In other words, if `c` is null, stores `0`; if `c` is not null, stores `1` and a reference to `c`. - + ## `builder.storeMaybeRef` @@ -2454,7 +2439,7 @@ fun builder.storeMaybeRef(mutate self, c: cell?): self Stores (Maybe ^Cell) into a builder. In other words, if `c` is null, stores `0`; if `c` is not null, stores `1` and a reference to `c`. - + ## `builder.storeBuilder` @@ -2465,7 +2450,7 @@ fun builder.storeBuilder(mutate self, from: builder): self Concatenates two builders. - + ## `slice.remainingRefsCount` @@ -2476,7 +2461,7 @@ fun slice.remainingRefsCount(self): int Returns the number of references in a slice. - + ## `slice.remainingBitsCount` @@ -2487,7 +2472,7 @@ fun slice.remainingBitsCount(self): int Returns the number of data bits in a slice. - + ## `slice.remainingBitsAndRefsCount` @@ -2498,7 +2483,7 @@ fun slice.remainingBitsAndRefsCount(self): (int, int) Returns both the number of data bits and the number of references in a slice. - + ## `slice.isEmpty` @@ -2509,7 +2494,7 @@ fun slice.isEmpty(self): bool Checks whether a slice is empty (i.e., contains no bits of data and no cell references). - + ## `slice.isEndOfBits` @@ -2520,7 +2505,7 @@ fun slice.isEndOfBits(self): bool Checks whether a slice has no bits of data. - + ## `slice.isEndOfRefs` @@ -2531,7 +2516,7 @@ fun slice.isEndOfRefs(self): bool Checks whether a slice has no references. - + ## `slice.bitsEqual` @@ -2542,7 +2527,7 @@ fun slice.bitsEqual(self, b: slice): bool Checks whether data parts of two slices coincide. - + ## `builder.refsCount` @@ -2553,7 +2538,7 @@ fun builder.refsCount(self): int Returns the number of cell references already stored in a builder. - + ## `builder.bitsCount` @@ -2564,7 +2549,7 @@ fun builder.bitsCount(self): int Returns the number of data bits already stored in a builder. - + ## `address` @@ -2580,7 +2565,7 @@ address("0:527964d55cfa6eb731f4bfc07e9d025098097ef8505519e853986279bd8400d8") ``` Returns `address`, which can be stored in a struct, compared with `==`, etc. - + ## `address.getWorkchainAndHash` @@ -2591,7 +2576,7 @@ fun address.getWorkchainAndHash(self): (int8, uint256) Extracts workchain and hash from a standard (internal) address. - + ## `address.getWorkchain` @@ -2602,7 +2587,7 @@ fun address.getWorkchain(self): int8 Extracts workchain from a standard (internal) address. - + ## `createAddressNone` @@ -2616,7 +2601,7 @@ Note! Use this in combination with EXTERNAL addresses (e.g. for [createExternalL To represent "internal or none" address (which you most likely need to), use `address?` (nullable) and `null` accordingly. - + ## `any_address.isNone` @@ -2628,7 +2613,7 @@ fun any_address.isNone(self): bool Returns if "any address" is "none". In TL/B, it's addr_none$00. - + ## `any_address.isInternal` @@ -2641,7 +2626,7 @@ Returns if "any address" is a standard (internal) address: workchain + hash. Then it can be safely cast to `address`. In TL/B, it's addr_std$10. - + ## `any_address.isExternal` @@ -2653,7 +2638,7 @@ fun any_address.isExternal(self): bool Returns if "any address" is an external address, used to communication with the outside world. In TL/B, it's addr_extern$01. - + ## `any_address.getWorkchainAndHash` @@ -2665,7 +2650,7 @@ fun any_address.getWorkchainAndHash(self): (int8, uint256) Extracts workchain and hash from a standard (internal) address. If the address is not internal, throws a cell deserialization exception. - + ## `any_address.getWorkchain` @@ -2677,7 +2662,7 @@ fun any_address.getWorkchain(self): int8 Extracts workchain from a standard (internal) address. If the address is not internal, throws a cell deserialization exception. - + ## `any_address.castToInternal` @@ -2690,7 +2675,7 @@ Casts `any_address` to `address` checking that "any" is actually "internal". E.g., `addr = myAny.castToInternal()` does the check and returns `address`. To skip the runtime check, use unsafe type casting instead: `addr = myAny as address`. - + ## `address.bitsEqual` @@ -2704,7 +2689,7 @@ Checks whether two addresses are equal. Equivalent to `a == b`. Deprecated! Left for smoother transition from FunC, where you used `slice` everywhere. Use just `a == b` and `a != b` to compare addresses, don't use bitsEqual. - + ## `slice.loadAddress` @@ -2716,7 +2701,7 @@ fun slice.loadAddress(mutate self): address Loads a standard (internal) address (containing workchain + hash). In TL/B, it's `MsgAddressInt`. If an address is incorrect or is not internal, throws a deserialization exception (code 9). - + ## `slice.loadAddressOpt` @@ -2730,7 +2715,7 @@ If an address is incorrect or is not internal/none, throws a deserialization exc '00' (two zero bits) is a standard representation of a "missing" ("none") address. As a result, you get either `address` (for internal) or `null` (for none). - + ## `slice.loadAddressAny` @@ -2741,7 +2726,7 @@ fun slice.loadAddressAny(mutate self): any_address Loads a valid "any address" (internal/external/none). In TL/B, it's `MsgAddress`. - + ## `RESERVE_MODE_EXACT_AMOUNT` @@ -2751,7 +2736,7 @@ const RESERVE_MODE_EXACT_AMOUNT = 0 mode = 0: Reserve exact amount of nanograms - + ## `RESERVE_MODE_ALL_BUT_AMOUNT` @@ -2761,7 +2746,7 @@ const RESERVE_MODE_ALL_BUT_AMOUNT = 1 +1: Actually reserves all but amount, meaning `currentContractBalance - amount` - + ## `RESERVE_MODE_AT_MOST` @@ -2771,7 +2756,7 @@ const RESERVE_MODE_AT_MOST = 2 +2: Actually set `min(amount, currentContractBalance)` (without this mode, if amount is greater, the action will fail) - + ## `RESERVE_MODE_INCREASE_BY_ORIGINAL_BALANCE` @@ -2781,7 +2766,7 @@ const RESERVE_MODE_INCREASE_BY_ORIGINAL_BALANCE = 4 +4: `amount` is increased by the _original_ balance of the current account (before the compute phase). - + ## `RESERVE_MODE_NEGATE_AMOUNT` @@ -2791,7 +2776,7 @@ const RESERVE_MODE_NEGATE_AMOUNT = 8 +8: Actually sets `amount = -amount` before performing any further actions. - + ## `RESERVE_MODE_BOUNCE_ON_ACTION_FAIL` @@ -2801,7 +2786,7 @@ const RESERVE_MODE_BOUNCE_ON_ACTION_FAIL = 16 +16: If this action fails, the transaction will be bounced. - + ## `reserveGramsOnBalance` @@ -2812,7 +2797,7 @@ fun reserveGramsOnBalance(nanoGrams: coins, reserveMode: int): void Creates an output action which would reserve GRAMs on balance. For `reserveMode` consider constants above. - + ## `reserveToncoinsOnBalance` @@ -2823,7 +2808,7 @@ fun reserveToncoinsOnBalance(nanoGrams: coins, reserveMode: int): void Deprecated alias for [reserveGramsOnBalance](#reservegramsonbalance). - + ## `reserveExtraCurrenciesOnBalance` @@ -2834,7 +2819,7 @@ fun reserveExtraCurrenciesOnBalance(nanoGrams: coins, extraAmount: dict, reserve Similar to [reserveGramsOnBalance](#reservegramsonbalance), but also accepts a dictionary extraAmount (represented by a cell or null) with extra currencies. In this way currencies other than GRAM can be reserved. - + ## `SEND_MODE_REGULAR` @@ -2844,7 +2829,7 @@ const SEND_MODE_REGULAR = 0 mode = 0 is used for ordinary messages; the gas fees are deducted from the sending amount; action phases should NOT be ignored. - + ## `SEND_MODE_PAY_FEES_SEPARATELY` @@ -2854,7 +2839,7 @@ const SEND_MODE_PAY_FEES_SEPARATELY = 1 +1 means that the sender wants to pay transfer fees separately. - + ## `SEND_MODE_IGNORE_ERRORS` @@ -2864,7 +2849,7 @@ const SEND_MODE_IGNORE_ERRORS = 2 +2 means that any errors arising while processing this message during the action phase should be ignored. - + ## `SEND_MODE_BOUNCE_ON_ACTION_FAIL` @@ -2874,7 +2859,7 @@ const SEND_MODE_BOUNCE_ON_ACTION_FAIL = 16 in the case of action fail - bounce transaction. No effect if SEND_MODE_IGNORE_ERRORS (+2) is used. - + ## `SEND_MODE_DESTROY` @@ -2884,7 +2869,7 @@ const SEND_MODE_DESTROY = 32 mode = 32 means that the current account must be destroyed if its resulting balance is zero. - + ## `SEND_MODE_CARRY_ALL_REMAINING_MESSAGE_VALUE` @@ -2894,7 +2879,7 @@ const SEND_MODE_CARRY_ALL_REMAINING_MESSAGE_VALUE = 64 mode = 64 is used for messages that carry all the remaining value of the inbound message in addition to the value initially indicated in the new message. - + ## `SEND_MODE_CARRY_ALL_BALANCE` @@ -2904,7 +2889,7 @@ const SEND_MODE_CARRY_ALL_BALANCE = 128 mode = 128 is used for messages that are to carry all the remaining balance of the current smart contract (instead of the value originally indicated in the message). - + ## `SEND_MODE_ESTIMATE_FEE_ONLY` @@ -2914,7 +2899,7 @@ const SEND_MODE_ESTIMATE_FEE_ONLY = 1024 do not create an action, only estimate fee. - + ## `ExtraCurrenciesMap` @@ -2926,7 +2911,7 @@ type ExtraCurrenciesMap = map They can be attached to a message (incoming and outgoing) and stored on contract's balance. It's a dictionary `[currencyID => amount]` (amount is like `coins`, but encoded with a high precision). - + ## `ContractState` @@ -2940,7 +2925,7 @@ struct ContractState { `ContractState` is "code + data" of a contract. Used in outgoing messages (StateInit) to initialize a destination contract. - + ## `AddressShardingOptions` @@ -2954,7 +2939,7 @@ struct AddressShardingOptions { `AddressShardingOptions` provides settings to calculate an address in another shard. Consider [createMessage](#createmessage) and [address.calculateSameAddressInAnotherShard](#addresscalculatesameaddressinanothershard) for usage. - + ## `AutoDeployAddress` @@ -2984,7 +2969,7 @@ because in TON, the address of a contract, by definition, is a hash of its initi You can also use it without sending a message. See [AutoDeployAddress.calculateAddress](#autodeployaddresscalculateaddress). - + ## `AutoDeployAddress.buildAddress` @@ -2999,7 +2984,7 @@ Since late 2025 (TVM 12 has a cheap "builder-to-slice" instruction), there is no need to use this function. Historically its purpose was to avoid creating a cell and to return `builder` with a valid address. - + ## `AutoDeployAddress.calculateAddress` @@ -3016,7 +3001,7 @@ val jwAddress = jwDeployed.calculateAddress(); ``` Just instead of `dest` for [createMessage](#createmessage), you use it is to calculate a jetton/nft address. - + ## `AutoDeployAddress.addressMatches` @@ -3035,7 +3020,7 @@ val fromJW = jwDeployed.addressMatches(senderAddress); Just instead of `dest` for [createMessage](#createmessage), you use it is to check whether a sender is a jetton/nft. Deprecated since late 2025 (TVM 12 with a cheap "builder-to-slice" instruction), to be removed later. - + ## `BounceMode` @@ -3066,7 +3051,7 @@ fun onBouncedMessage(in: InMessageBounced) { } ``` - + ## `OldBounceMode` @@ -3078,7 +3063,7 @@ type OldBounceMode = bool Before TVM-12, `bounce` was only true or false. Now, use `enum BounceMode` instead. "true" behaves like `Only256BitsOfBody`. - + ## `CreateMessageOptions` @@ -3101,7 +3086,7 @@ struct CreateMessageOptions { Options for creating an outgoing message. Consider [createMessage](#createmessage) for examples. - + ## `createMessage` @@ -3127,7 +3112,7 @@ Hint: don't call `body.toCell()`, pass `body` directly! (if body is large, the compiler will automatically wrap it into a cell) If you need an empty body, just miss the field `body`, fill other 3 fields. - + ## `ExtOutLogBucket` @@ -3147,7 +3132,7 @@ body: DepositData { ... } and external indexers can index your emitted logs by destination address without parsing body. Serialization details: '01' (addr_extern) + 256 (len) + 0x00 (prefix) + 248 bits = 267 in total - + ## `CreateExternalLogMessageOptions` @@ -3165,7 +3150,7 @@ struct CreateExternalLogMessageOptions { Options for creating an external outgoing message. Consider [createExternalLogMessage](#createexternallogmessage) for examples. - + ## `createExternalLogMessage` @@ -3188,7 +3173,7 @@ Hint: don't call `body.toCell()`, pass `body` directly! (if body is small, it will be inlined without an expensive cell creation) (if body is large, the compiler will automatically wrap it into a cell) - + ## `UnsafeBodyNoRef` @@ -3214,7 +3199,7 @@ createMessage({ Another example: your body contains `builder` or `RemainingBitsAndRefs`: unpredictable size. If you guarantee it's small and refs won't clash with code/data, avoid creating a cell. - + ## `OutMessage` @@ -3227,7 +3212,7 @@ struct OutMessage { OutMessage is a result of [createMessage](#createmessage). Essentially, it's a composed message cell, ready to be sent. - + ## `OutMessage.send` @@ -3238,7 +3223,7 @@ fun OutMessage.send(self, sendMode: int): void Sends a ready message cell. For `sendMode`, see the constants above (SEND_MODE_*). - + ## `OutMessage.sendAndEstimateFee` @@ -3246,7 +3231,7 @@ For `sendMode`, see the constants above (SEND_MODE_*). fun OutMessage.sendAndEstimateFee(self, sendMode: int): coins ``` - + ## `OutMessage.estimateFeeWithoutSending` @@ -3255,7 +3240,7 @@ fun OutMessage.sendAndEstimateFee(self, sendMode: int): coins fun OutMessage.estimateFeeWithoutSending(self, sendMode: int): coins ``` - + ## `OutMessage.hash` @@ -3264,7 +3249,7 @@ fun OutMessage.estimateFeeWithoutSending(self, sendMode: int): coins fun OutMessage.hash(self): uint256 ``` - + ## `StateInit` @@ -3283,7 +3268,7 @@ But for everyday tasks, it's too complicated. It is not used in practice. To represent code+data, consider [ContractState](#contractstate). To represent sharding (fixedPrefixLength, formerly splitDepth), consider [AutoDeployAddress](#autodeployaddress). - + ## `StateInit.calcHashCodeData` @@ -3300,7 +3285,7 @@ createMessage({ ... ``` - + ## `StateInit.calcHashPrefixCodeData` @@ -3311,7 +3296,7 @@ fun StateInit.calcHashPrefixCodeData(fixedPrefixLength: uint5, code: cell, data: Calculates a hash of StateInit if fixedPrefixLength+code+data are set. - + ## `address.buildSameAddressInAnotherShard` @@ -3326,7 +3311,7 @@ Since late 2025 (TVM 12 has a cheap "builder-to-slice" instruction), there is no need to use this function. Historically its purpose was to avoid creating a cell and to return `builder` with a valid address. - + ## `address.calculateSameAddressInAnotherShard` @@ -3346,7 +3331,7 @@ result | 01010101aaa...aaa | address of A in same shard as B More precisely, self (input) is 267 bits: '100' (std addr no anycast) + workchainA + "aaaa...a". The result is also 267 bits: '100' + workchainB + "bb" (D bits) + "aa...a" (256-D bits). - + ## `address.fromValidBuilder` @@ -3360,7 +3345,7 @@ Converts a builder containing a valid address to `address` (slice under the hood Deprecated! Since late 2025 (TVM 12 has a cheap "builder-to-slice" instruction), all compiler built-ins return `address` directly, not `builder`. - + ## `address.fromWorkchainAndHash` @@ -3376,7 +3361,7 @@ createMessage({ ... // so, don't call this function in such a case ``` - + ## `sendRawMessage` @@ -3387,7 +3372,7 @@ fun sendRawMessage(msg: cell, mode: int): void Sends a raw message — a correctly serialized TL object `Message X`. In practice, you'll use a high-level wrapper [createMessage](#createmessage). - + ## `InMessage` @@ -3412,7 +3397,7 @@ fun onInternalMessage(in: InMessage) { in.body // actually gets from a TVM stack ``` - + ## `InMessageBounced` @@ -3440,7 +3425,7 @@ fun onBouncedMessage(in: InMessageBounced) { val originalOpcode = in.bouncedBody.loadUint(32); ``` - + ## `RichBounceBody` @@ -3465,7 +3450,7 @@ fun onBouncedMessage(in: InMessageBounced) { // use rich.xxx to get exitCode, gasUsed, and so on ``` - + ## `RichBounceComputePhaseInfo` @@ -3478,7 +3463,7 @@ struct RichBounceComputePhaseInfo { Describes compute phase details of a bounced message. - + ## `RichBounceOriginalMsgInfo` @@ -3498,7 +3483,7 @@ createMessage({ value: grams("0.05") // it will be `valueCoins` if this message is bounced ``` - + ## `slice.skipBouncedPrefix` @@ -3510,7 +3495,7 @@ fun slice.skipBouncedPrefix(mutate self): self Skip 0xFFFFFFFF prefix (when a message is bounced). Used when parsing `in.bounceBody` for "not rich" `BounceMode.Only256BitsOfBody` bounces. - + ## `slice.loadMessageFlags` @@ -3522,7 +3507,7 @@ fun slice.loadMessageFlags(mutate self): int Load msgFlags from incoming message body (4 bits). - + ## `slice.loadMessageOp` @@ -3533,7 +3518,7 @@ fun slice.loadMessageOp(mutate self): int Loads a message opcode (32-bit integer) when parsing message body manually. - + ## `builder.storeMessageOp` @@ -3545,7 +3530,7 @@ fun builder.storeMessageOp(mutate self, op: int): self Stores a message opcode (32-bit integer) when composing an output message manually. - + ## `slice.loadMessageQueryId` @@ -3557,7 +3542,7 @@ fun slice.loadMessageQueryId(mutate self): int Loads a message queryId (64-bit integer, immediately following the opcode) when parsing message body manually. - + ## `slice.skipMessageQueryId` @@ -3567,7 +3552,7 @@ Loads a message queryId (64-bit integer, immediately following the opcode) when fun slice.skipMessageQueryId(mutate self): self ``` - + ## `builder.storeMessageQueryId` @@ -3577,5 +3562,5 @@ fun slice.skipMessageQueryId(mutate self): self fun builder.storeMessageQueryId(mutate self, queryId: int): self ``` - + diff --git a/docs/content/docs/tolk_standard_library/exotic-cells.mdx b/docs/content/docs/tolk_standard_library/exotic-cells.mdx index ec2a57851a..197d4a6c65 100644 --- a/docs/content/docs/tolk_standard_library/exotic-cells.mdx +++ b/docs/content/docs/tolk_standard_library/exotic-cells.mdx @@ -92,7 +92,6 @@ If the cell is already ordinary, does nothing. Throws an exception if cannot be ## `cell.toLibraryReference` ```tolk -@pure fun cell.toLibraryReference(self): cell ``` diff --git a/docs/content/docs/tolk_standard_library/lisp-lists.mdx b/docs/content/docs/tolk_standard_library/lisp-lists.mdx index 1a70142349..6e00c8d0d6 100644 --- a/docs/content/docs/tolk_standard_library/lisp-lists.mdx +++ b/docs/content/docs/tolk_standard_library/lisp-lists.mdx @@ -13,7 +13,6 @@ import { SourceCodeLink } from '@/components/SourceCodeLink'; ## `lisp_list.isEmpty` ```tolk -@pure fun lisp_list.isEmpty(self): bool ``` @@ -22,7 +21,6 @@ fun lisp_list.isEmpty(self): bool ## `lisp_list.prependHead` ```tolk -@pure fun lisp_list.prependHead(mutate self, value: T): void ``` @@ -30,12 +28,11 @@ Inserts an element an the front. Before: `[a b c]`. After: `[new a b c]`. - + ## `lisp_list.popHead` ```tolk -@pure fun lisp_list.popHead(mutate self): T ``` @@ -44,67 +41,62 @@ Before: `[a b c]`. After: `[b c]`, returns `a`. Throws an exceptions if a list is empty. - + ## `lisp_list.getHead` ```tolk -@pure fun lisp_list.getHead(self): T ``` Returns an element from the front: `a` for `[a b c]`. Throws an exceptions if a list is empty. - + ## `lisp_list.getTail` ```tolk -@pure fun lisp_list.getTail(self): lisp_list ``` Returns all but the frontmost element: `[b c]` for `[a b c]`. Throws an exceptions if a list is empty. - + ## `lisp_list.calculateSize` ```tolk -@pure fun lisp_list.calculateSize(self): int ``` Calculates the size of a list by looping all the elements (there is no other way to do it). The longer the list — the more gas consumption (O(N) complexity). - + ## `lisp_list.calculateReversed` ```tolk -@pure fun lisp_list.calculateReversed(self): lisp_list ``` Returns the list with elements in reversed order. Given `[a b c]` returns `[c b a]`. - + ## `lisp_list.calculateConcatenation` ```tolk -@pure fun lisp_list.calculateConcatenation(self, other: lisp_list): lisp_list ``` Returns the concatenation of two lists. Given `[a b]` and `[c d]`, returns `[a b c d]`. - + ## `createEmptyList` @@ -124,11 +116,12 @@ var list = createEmptyList(); var t = lisp_list []; ``` - + ## `lisp_list.packToBuilder` ```tolk +@inline fun lisp_list.packToBuilder(self, mutate b: builder): void ``` @@ -136,16 +129,17 @@ fun lisp_list.packToBuilder(self, mutate b: builder): void A list `[1 2 3]` (on a stack: `[1 [2 [3 null]]]`) is "3.ref(2.ref(1.ref(empty cell)))". An empty list `[]` (on a stack: `null`) is "empty cell" - + ## `lisp_list.unpackFromSlice` ```tolk +@inline fun lisp_list.unpackFromSlice(mutate s: slice): lisp_list ``` Unserialize `lisp_list` from snake refs: From "3.ref(2.ref(1.ref(empty cell)))" get a list `[1 2 3]` (on a stack: `[1 [2 [3 null]]]`). - + diff --git a/docs/content/docs/tolk_standard_library/strings.mdx b/docs/content/docs/tolk_standard_library/strings.mdx index 2f4ddd2dcb..42836c678e 100644 --- a/docs/content/docs/tolk_standard_library/strings.mdx +++ b/docs/content/docs/tolk_standard_library/strings.mdx @@ -27,7 +27,6 @@ Example: "a" + (ref "bc" + (ref "d" + (ref ""))) has depth 3. ## `string.calculateLength` ```tolk -@pure @inline_ref fun string.calculateLength(self): int ``` @@ -40,7 +39,6 @@ Since strings are stored in snake format (chain of cells), this requires travers ## `string.hash` ```tolk -@pure @inline_ref fun string.hash(self): uint256 ``` @@ -50,19 +48,18 @@ The hash is the same regardless of snake layout: "abcd", "ab" + (ref "cd"), "a" + (ref "bcd" + (ref "")) all produce the same hash. Uses FNV-1a hashing with standard 128-bit parameters. - + ## `string.equalTo` ```tolk -@pure fun string.equalTo(self, another: string): bool ``` Compares two strings, considering snake cells. For example, "abcd" is equal to "ab" + (ref "cd") is equal to "a" + (ref "bc" + (ref "d")). - + ## `int.toDecimalString` @@ -73,7 +70,7 @@ fun int.toDecimalString(self): string Converts an integer to its decimal string representation. Returns a string (a TVM cell on a stack). - + ## `StringBuilder` @@ -90,7 +87,7 @@ var s = StringBuilder.create().append("Hello, ").append(userName).append("!").bu ``` After this, `s` will be a chain of cells: "Hello, " + (ref userName + (ref "!")) - + ## `StringBuilder.create` @@ -103,7 +100,7 @@ Creates an empty `StringBuilder`. var s = StringBuilder.create().append(...).build(); ``` - + ## `StringBuilder.append` @@ -113,7 +110,7 @@ fun StringBuilder.append(mutate self, s: string): self Appends a string to the builder. The string may itself be a snake chain. - + ## `StringBuilder.appendInt` @@ -125,7 +122,7 @@ fun StringBuilder.appendInt(mutate self, n: int): self Appends an integer as its decimal representation. For example, `sb.appendInt(-42)` appends "-42". - + ## `StringBuilder.build` @@ -138,7 +135,7 @@ Builds the final string by concatenating all appended parts into a snake chain. The result is a valid snake-format string where each cell contains data and optionally a ref to next. Throws an exception if `append()` was not called (a builder is empty). - + ## `string_prefixed0x` @@ -152,7 +149,7 @@ By standard, offchain explorers/APIs may treat contents of a string based on 0xX - 0x01 + "str" — means "this is an off-chain content URL" Used in jettons and NFTs for responses from GET methods to comply with TEPs (token standards). - + ## `string.prefixWith00` @@ -164,7 +161,7 @@ Given "str", prefix it with 0x00 byte. Logically it makes a string "\x00str"; physically, it's 0x00 + ref "str". See [string_prefixed0x](#string_prefixed0x). - + ## `string.prefixWith01` @@ -176,5 +173,5 @@ Given "str", prefix it with 0x01 byte. Logically it makes a string "\x01str"; physically, it's 0x01 + ref "str". See [string_prefixed0x](#string_prefixed0x). - + diff --git a/lib/emulation/network.tolk b/lib/emulation/network.tolk index 90a034ae39..889bc342c5 100644 --- a/lib/emulation/network.tolk +++ b/lib/emulation/network.tolk @@ -580,6 +580,7 @@ fun impl.unwrapScalar(field: (T -> bool) | T | null): T? { /// [0, null] = absent /// [1, cont] = user predicate /// [2, cont, original_value] = value converted to predicate (original kept for display) +@noinline fun impl.toPredicate(field: (T -> bool) | T | null): tuple { match (field) { (T -> bool) => { diff --git a/src/commands/library/librarian/librarian.tolk b/src/commands/library/librarian/librarian.tolk index d1c36b32eb..baee072d38 100644 --- a/src/commands/library/librarian/librarian.tolk +++ b/src/commands/library/librarian/librarian.tolk @@ -1,4 +1,4 @@ -tolk 1.4.2 +tolk 1.5 import "@stdlib/gas-payments" diff --git a/src/commands/new/templates/jetton-app/wrappers-ts/JettonMinter.gen.ts b/src/commands/new/templates/jetton-app/wrappers-ts/JettonMinter.gen.ts index 6b33bce782..cb89610b42 100644 --- a/src/commands/new/templates/jetton-app/wrappers-ts/JettonMinter.gen.ts +++ b/src/commands/new/templates/jetton-app/wrappers-ts/JettonMinter.gen.ts @@ -990,7 +990,7 @@ function calculateDeployedAddress(code: c.Cell, data: c.Cell, options: DeployedA } export class JettonMinter implements c.Contract { - static CodeCell = c.Cell.fromBase64('te6ccgECGAEABisAART/APSkE/S88sgLAQIBYgIDBPbQ+JGOI9MfMe1E0AHXLCC8aijM8r/TPzH6ADAB+gACocgB+gLOye1U4NcsI97svvTjAtcsIWO1y5zjAtcsIyFb6DzjAtcsIygPmqSOJu1E0PoA+lD6UDH4kiLHBfLgSQPTPzH6SDDIUAP6AvpU+lTOye1U4NcsJ9xHCMwEBQYHAgEgCgsB3u1E0IgC0z/6APpI+lAw+JL4KCPIz4Qg+lL6Usl4UYjIz4PLBM+FoMzM+RaE97ATgAtQCNckyM+KAEDOFsv3z1DHBfLgSgL6AAOhyAH6AhLOye1UIW6RW+DIz4UIEvpSghDVMnbbzwuOyz/JgEL7AA4B1NM/+kjXCgCVIMj6UsmRbeJtIvpEMJEyjrMwiPgoI8jPhCD6UvpSyXhRIsjPg8sEz4WgzMz5FoT3sBOAC1AE1yTIz4oAQM4Sy/fPUAHi+JLIz4UI+lKCENFzVADPC44Tyz/6VPQAyYBQ+wAOAfjtRND6ACD6UDD4kscF8uBJAtM/MfpI+gDXTCL6RDDy0U0g0NcsILxqKMzy4EjTPzH6APpQMfpQMfoA9AQBbpEwkdHi+JNw+DohcnHjBPg5IG6BGLci4wQhboEdE1gD4wRQI6gToHOBAyxw+DygAnD4NhKgAXD4NqBzgQQCCAH+jiMw7UTQ+gD6UDH6UPiSIscF8uBJbchQBPoCEvpUEvpUzsntVODXLCOhj5EMjiMw7UTQ+gD6UPpQMfiSWMcF8uBJbW3IUAT6AvpUEvpUzsntVODXLCZcMUgUjiPtRND6APpQ+lAw+JIixwXy4EkD10zIUAP6AvpUEvpUzMntVAkByoIQCWYBgHD4N6AjufKwFKDIAfoCFM7J7VSCCJiWgHD7Aoj4KCLIz4Qg+lL6Usl4yM+JiAFUcjHIz4PLBM+FoMzM+RaE97AFgAsj1yQyzhPL91AE+gKBFQ3PC3UTzBLMzMmAEfsADgBe4NcsIShGs1SOF+1E0PoAMfpQMPiSxwXy4EnU10z7BO1U4NcsJpuQrGQx3IQP8vAAHb2a32omh9ABj9KBj9KBhAICcQwNAWWtvMR8FBFkZ8IQfSl9KWS8KJFkZ8HlgmfC0GZmfItCe9gJQAWoAeuSZGfFACBnZfvnqEAOASWvFvaiaEQA/QB9KGumELdZgYJADgEU/wD0pBP0vPLICw8CAWIQEQPE0PiRjjTTHzHXLCC8aijMltM/MfoAMI4R1ywj3uy+9JLyP+HTPzH6ADDi7UTQ+gACoMgB+gLOye1U4NcsILxqKMzjAtcsIHxT9SzjAtcsIsr4PeTjAtcsJpuQrGQx3IQP8vASExQAHaD2BdqJofQB9JH0kGHwVQLm7UTQAdM/+gD6UPpQ+gAG+gAg+kj6SDD4kiHHBZEwjjr4kvgqKMjPhCD6UhP6Usl4KVQSQsjPg8sEz4WgzMz5FoT3sBOAC1AE1yTIz4oAQM4Sy/fPUMcF8uBK4lEmoMgB+gLOye1UIZNbNFvjDSFukVvjDhUWAf7TP/oA+kj6UPQB+gAg9AQBbpEwkdHiI/pEMPLRTfiX+JNw+DojcnHjBPg5IG6BGLci4wQhboEdE1gD4wRQI6gloHOBAyxw+DygAXD4NqABcPg2oHOBBAKCEAlmAYBw+DegvPKw7UTQ+gAg+kj6SDD4kiLHBfLgSVM4vvKvUTihFwDg+Jf4OSBugRCeWOMEcYEC8nD4OAFw+DaggQ/ncPg2oLzysO1E0PoAIPpI+kgw+JIixwXy4EkE0z/6APpQMFNRvvKvUVGhyAH6AhTOye1UyM+R73Zfess/WPoC+lL6VMnIz4WIEvpScc8LbszJgFD7AABSyM+RzYtCcibPCz9QBfoCE/pUFc7JyM+FCBP6UgH6AnHPC2rMyYAR+wAAaPgnbxD4l6H4L6BzgQQCghAJZgGAcPg3tgly+wLIz4UIEvpSghDVMnbbzwuOyz/JgQCC+wAAwMgB+gISzsntVPgqJsjPhCD6UhP6Usl4yM+QXjUUZhrLP1AI+gL6VBT6VFj6As7JyM+JiAFUdCXIz4PLBM+FoMzM+RaE97AEgAsn1yQ2Fc4Sy/eBFQ3PC3nMzMzJgFD7AA=='); + static CodeCell = c.Cell.fromBase64('te6ccgECGAEABioAART/APSkE/S88sgLAQIBYgIDBPbQ+JGOI9MfMe1E0AHXLCC8aijM8r/TPzH6ADAB+gACocgB+gLOye1U4NcsI97svvTjAtcsIWO1y5zjAtcsIyFb6DzjAtcsIygPmqSOJu1E0PoA+lD6UDH4kiLHBfLgSQPTPzH6SDDIUAP6AvpU+lTOye1U4NcsJ9xHCMwEBQYHAgEgCgsB3u1E0IgC0z/6APpI+lAw+JL4KCPIz4Qg+lL6Usl4UYjIz4PLBM+FoMzM+RaE97ATgAtQCNckyM+KAEDOFsv3z1DHBfLgSgL6AAOhyAH6AhLOye1UIW6RW+DIz4UIEvpSghDVMnbbzwuOyz/JgEL7AA4B1NM/+kjXCgCVIMj6UsmRbeJtIvpEMJEyjrMwiPgoI8jPhCD6UvpSyXhRIsjPg8sEz4WgzMz5FoT3sBOAC1AE1yTIz4oAQM4Sy/fPUAHi+JLIz4UI+lKCENFzVADPC44Tyz/6VPQAyYBQ+wAOAfjtRND6ACD6UDD4kscF8uBJAtM/MfpI+gDXTCL6RDDy0U0g0NcsILxqKMzy4EjTPzH6APpQMfpQMfoA9AQBbpEwkdHi+JNw+DohcnHjBPg5IG6BGLci4wQhboEdE1gD4wRQI6gToHOBAyxw+DygAnD4NhKgAXD4NqBzgQQCCAH+jiMw7UTQ+gD6UDH6UPiSIscF8uBJbchQBPoCEvpUEvpUzsntVODXLCOhj5EMjiMw7UTQ+gD6UPpQMfiSWMcF8uBJbW3IUAT6AvpUEvpUzsntVODXLCZcMUgUjiPtRND6APpQ+lAw+JIixwXy4EkD10zIUAP6AvpUEvpUzMntVAkByoIQCWYBgHD4N6AjufKwFKDIAfoCFM7J7VSCCJiWgHD7Aoj4KCLIz4Qg+lL6Usl4yM+JiAFUcjHIz4PLBM+FoMzM+RaE97AFgAsj1yQyzhPL91AE+gKBFQ3PC3UTzBLMzMmAEfsADgBe4NcsIShGs1SOF+1E0PoAMfpQMPiSxwXy4EnU10z7BO1U4NcsJpuQrGQx3IQP8vAAHb2a32omh9ABj9KBj9KBhAICcQwNAWWtvMR8FBFkZ8IQfSl9KWS8KJFkZ8HlgmfC0GZmfItCe9gJQAWoAeuSZGfFACBnZfvnqEAOASWvFvaiaEQA/QB9KGumELdZgYJADgEU/wD0pBP0vPLICw8CAWIQEQPE0PiRjjTTHzHXLCC8aijMltM/MfoAMI4R1ywj3uy+9JLyP+HTPzH6ADDi7UTQ+gACoMgB+gLOye1U4NcsILxqKMzjAtcsIHxT9SzjAtcsIsr4PeTjAtcsJpuQrGQx3IQP8vASExQAHaD2BdqJofQB9JH0kGHwVQL67UTQAdM/+gD6UPpQ+gAG+gAg+kj6SDD4kiHHBZEwjjr4kvgqKMjPhCD6UhP6Usl4KVQSQsjPg8sEz4WgzMz5FoT3sBOAC1AE1yTIz4oAQM4Sy/fPUMcF8uBK4lEmoMgB+gLOye1UIZNbNFvjDSFukVvg+CdvEPiXofgvoHMVFgH+0z/6APpI+lD0AfoAIPQEAW6RMJHR4iP6RDDy0U34l/iTcPg6I3Jx4wT4OSBugRi3IuMEIW6BHRNYA+MEUCOoJaBzgQMscPg8oAFw+DagAXD4NqBzgQQCghAJZgGAcPg3oLzysO1E0PoAIPpI+kgw+JIixwXy4ElTOL7yr1E4oRcA4PiX+DkgboEQnljjBHGBAvJw+DgBcPg2oIEP53D4NqC88rDtRND6ACD6SPpIMPiSIscF8uBJBNM/+gD6UDBTUb7yr1FRocgB+gIUzsntVMjPke92X3rLP1j6AvpS+lTJyM+FiBL6UnHPC27MyYBQ+wAAUsjPkc2LQnImzws/UAX6AhP6VBXOycjPhQgT+lIB+gJxzwtqzMmAEfsAAFKBBAKCEAlmAYBw+De2CXL7AsjPhQgS+lKCENUydtvPC47LP8mBAIL7AADAyAH6AhLOye1U+ComyM+EIPpSE/pSyXjIz5BeNRRmGss/UAj6AvpUFPpUWPoCzsnIz4mIAVR0JcjPg8sEz4WgzMz5FoT3sASACyfXJDYVzhLL94EVDc8LeczMzMmAUPsA'); static Errors = { 'Errors.NotEnoughGas': 48, diff --git a/src/commands/new/templates/jetton-app/wrappers-ts/JettonWallet.gen.ts b/src/commands/new/templates/jetton-app/wrappers-ts/JettonWallet.gen.ts index 7a3f24846f..4be4b63596 100644 --- a/src/commands/new/templates/jetton-app/wrappers-ts/JettonWallet.gen.ts +++ b/src/commands/new/templates/jetton-app/wrappers-ts/JettonWallet.gen.ts @@ -747,7 +747,7 @@ function calculateDeployedAddress(code: c.Cell, data: c.Cell, options: DeployedA } export class JettonWallet implements c.Contract { - static CodeCell = c.Cell.fromBase64('te6ccgECCgEAArgAART/APSkE/S88sgLAQIBYgIDA8TQ+JGONNMfMdcsILxqKMyW0z8x+gAwjhHXLCPe7L70kvI/4dM/MfoAMOLtRND6AAKgyAH6As7J7VTg1ywgvGoozOMC1ywgfFP1LOMC1ywiyvg95OMC1ywmm5CsZDHchA/y8AQFBgAdoPYF2omh9AH0kfSQYfBVAubtRNAB0z/6APpQ+lD6AAb6ACD6SPpIMPiSIccFkTCOOviS+CooyM+EIPpSE/pSyXgpVBJCyM+DywTPhaDMzPkWhPewE4ALUATXJMjPigBAzhLL989QxwXy4EriUSagyAH6As7J7VQhk1s0W+MNIW6RW+MOBwgB/tM/+gD6SPpQ9AH6ACD0BAFukTCR0eIj+kQw8tFN+Jf4k3D4OiNyceME+DkgboEYtyLjBCFugR0TWAPjBFAjqCWgc4EDLHD4PKABcPg2oAFw+Dagc4EEAoIQCWYBgHD4N6C88rDtRND6ACD6SPpIMPiSIscF8uBJUzi+8q9ROKEJAOD4l/g5IG6BEJ5Y4wRxgQLycPg4AXD4NqCBD+dw+DagvPKw7UTQ+gAg+kj6SDD4kiLHBfLgSQTTP/oA+lAwU1G+8q9RUaHIAfoCFM7J7VTIz5Hvdl96yz9Y+gL6UvpUycjPhYgS+lJxzwtuzMmAUPsAAFLIz5HNi0JyJs8LP1AF+gIT+lQVzsnIz4UIE/pSAfoCcc8LaszJgBH7AABo+CdvEPiXofgvoHOBBAKCEAlmAYBw+De2CXL7AsjPhQgS+lKCENUydtvPC47LP8mBAIL7AADAyAH6AhLOye1U+ComyM+EIPpSE/pSyXjIz5BeNRRmGss/UAj6AvpUFPpUWPoCzsnIz4mIAVR0JcjPg8sEz4WgzMz5FoT3sASACyfXJDYVzhLL94EVDc8LeczMzMmAUPsA'); + static CodeCell = c.Cell.fromBase64('te6ccgECCgEAArcAART/APSkE/S88sgLAQIBYgIDA8TQ+JGONNMfMdcsILxqKMyW0z8x+gAwjhHXLCPe7L70kvI/4dM/MfoAMOLtRND6AAKgyAH6As7J7VTg1ywgvGoozOMC1ywgfFP1LOMC1ywiyvg95OMC1ywmm5CsZDHchA/y8AQFBgAdoPYF2omh9AH0kfSQYfBVAvrtRNAB0z/6APpQ+lD6AAb6ACD6SPpIMPiSIccFkTCOOviS+CooyM+EIPpSE/pSyXgpVBJCyM+DywTPhaDMzPkWhPewE4ALUATXJMjPigBAzhLL989QxwXy4EriUSagyAH6As7J7VQhk1s0W+MNIW6RW+D4J28Q+Jeh+C+gcwcIAf7TP/oA+kj6UPQB+gAg9AQBbpEwkdHiI/pEMPLRTfiX+JNw+DojcnHjBPg5IG6BGLci4wQhboEdE1gD4wRQI6gloHOBAyxw+DygAXD4NqABcPg2oHOBBAKCEAlmAYBw+DegvPKw7UTQ+gAg+kj6SDD4kiLHBfLgSVM4vvKvUTihCQDg+Jf4OSBugRCeWOMEcYEC8nD4OAFw+DaggQ/ncPg2oLzysO1E0PoAIPpI+kgw+JIixwXy4EkE0z/6APpQMFNRvvKvUVGhyAH6AhTOye1UyM+R73Zfess/WPoC+lL6VMnIz4WIEvpScc8LbszJgFD7AABSyM+RzYtCcibPCz9QBfoCE/pUFc7JyM+FCBP6UgH6AnHPC2rMyYAR+wAAUoEEAoIQCWYBgHD4N7YJcvsCyM+FCBL6UoIQ1TJ2288Ljss/yYEAgvsAAMDIAfoCEs7J7VT4KibIz4Qg+lIT+lLJeMjPkF41FGYayz9QCPoC+lQU+lRY+gLOycjPiYgBVHQlyM+DywTPhaDMzPkWhPewBIALJ9ckNhXOEsv3gRUNzwt5zMzMyYBQ+wA='); static Errors = { 'Errors.BalanceError': 47, diff --git a/src/commands/new/templates/nft-app/wrappers-ts/NftCollection.gen.ts b/src/commands/new/templates/nft-app/wrappers-ts/NftCollection.gen.ts index d7cff8fd67..fd8b9e9083 100644 --- a/src/commands/new/templates/nft-app/wrappers-ts/NftCollection.gen.ts +++ b/src/commands/new/templates/nft-app/wrappers-ts/NftCollection.gen.ts @@ -683,7 +683,7 @@ function calculateDeployedAddress(code: c.Cell, data: c.Cell, options: DeployedA } export class NftCollection implements c.Contract { - static CodeCell = c.Cell.fromBase64('te6ccgECEQEAAnAAART/APSkE/S88sgLAQIBYgIDAvjQ+JGRMOAg1ywgAAAADI5oMe1E0PpI0z8g1DHXTPiSJMcF8uGRBNM/MdM/+gDXTFMku/LhklMkuvgoBMjLPxT6UsnIz4mIAVMYyM+E0MzM+RbPC/9QA/oCgQCNzwtwF8zMFczJcfsAA5ukAcj6Uss/zsntVJJfA+LgidcnBAUCASAKCwAIaT05UAT+jjkx7UTQAdcLPwHUMdQx10z4kgHQ0w/TD/pI0cjPhQgU+lKCEKjLAK3PC44Uyz/LDxLLD/pSyYBA+wDg1ywgAAAAFI6zMe1E0PpI0z8g1DHXTPiSJMcF8uGRcAXTPzH0BSCAQPSGb6WQiuhfBDMByPpSyz/Oye1U4InXJ+MCMAYHCAkAvAekIIEA+rny4Y9Ud3W7mhdfB4EBkTKg8vDhAvoA1NH4KCTIyz/6UskmyM+JiAFTIcjPhNDMzPkWzwv/UAT6AoEAjc8LcBPMEszMyXH7AFEVupMEpATeUWGAQPR8b6UACAAAAAMAODHtRND6SPiSWMcF8uGRAdM/MfpIMMj6Us7J7VQADoQPAccA8vQCASAMDQAfvILfaiaH0kaZ/rpmhrpixAE7uLXTHtRNDXTNBvAAHUMddMb4wBb4zbPMjPhAbMyYDgIBIA8QAIggb4shb4ilII43pVMgb4HQINdkjiVvACHXZJcB1AHQWW+M5AFvjCBviKUgmlxvgcjOFMzJA6XkMG8Q3sjOEszJAeQwMQAntdr9qJoahjqGOumaGmH6Yf9JGjAAS7T0faiaGoY66Z8FAFkZZ+JfSlkgORnwmhmZnyLZGfFACBl/+eoQ'); + static CodeCell = c.Cell.fromBase64('te6ccgECEQEAAm8AART/APSkE/S88sgLAQIBYgIDAvbQ+JGRMOAg1ywgAAAADI5nMe1E0PpI0z8g1DHXTPiSJMcF8uGRBNM/MdM/+gDXTFMku/LhklMkuvgoBMjLPxT6UsnIz4mIAVMYyM+E0MzM+RbPC/9QA/oCgQCNzwtwF8zMFczJcfsAA5ukAcj6Uss/zsntVOBfA+CJ1ycEBQIBIAoLAAhpPTlQBP6OOTHtRNAB1ws/AdQx1DHXTPiSAdDTD9MP+kjRyM+FCBT6UoIQqMsArc8LjhTLP8sPEssP+lLJgED7AODXLCAAAAAUjrMx7UTQ+kjTPyDUMddM+JIkxwXy4ZFwBdM/MfQFIIBA9IZvpZCK6F8EMwHI+lLLP87J7VTgidcn4wIwBgcICQC8B6QggQD6ufLhj1R3dbuaF18HgQGRMqDy8OEC+gDU0fgoJMjLP/pSySbIz4mIAVMhyM+E0MzM+RbPC/9QBPoCgQCNzwtwE8wSzMzJcfsAURW6kwSkBN5RYYBA9HxvpQAIAAAAAwA4Me1E0PpI+JJYxwXy4ZEB0z8x+kgwyPpSzsntVAAOhA8BxwDy9AIBIAwNAB+8gt9qJofSRpn+umaGumLEATu4tdMe1E0NdM0G8AAdQx10xvjAFvjNs8yM+EBszJgOAgEgDxAAiCBviyFviKUgjjelUyBvgdAg12SOJW8AIddklwHUAdBZb4zkAW+MIG+IpSCaXG+ByM4UzMkDpeQwbxDeyM4SzMkB5DAxACe12v2omhqGOoY66ZoaYfph/0kaMABLtPR9qJoahjrpnwUAWRln4l9KWSA5GfCaGZmfItkZ8UAIGX/56hA='); static Errors = { 'Errors.BatchLimitExceeded': 399, diff --git a/src/commands/new/templates/nft-app/wrappers-ts/NftItem.gen.ts b/src/commands/new/templates/nft-app/wrappers-ts/NftItem.gen.ts index 72988cf88f..a4bdc93479 100644 --- a/src/commands/new/templates/nft-app/wrappers-ts/NftItem.gen.ts +++ b/src/commands/new/templates/nft-app/wrappers-ts/NftItem.gen.ts @@ -649,13 +649,13 @@ function calculateDeployedAddress(code: c.Cell, data: c.Cell, options: DeployedA } export class NftItem implements c.Contract { - static CodeCell = c.Cell.fromBase64('te6ccgECBwEAAWYAART/APSkE/S88sgLAQIBYgIDAeTQ+JHyQO1E0NM/+kggxwCOHDD4kiHHBfLhlQL6SNTRAsjLPxP6UhL6UszJ7VTg+kjXTCTXLCL+Yeik4wJsIdcsIX5ZNRSOITMC1ws/+JLIz4UI+lKCEIt3FzXPC47LP8v/+lLJgED7AOBfA4QPAccA8vQEADWhH5/aiaGmf/SQQY4BKmDgstrbwfSRrpj+qmEC+jX4kiLHBfLhkQTTP/pI+lD0AfoAINdLIfLixCLXCwCfAcABlMABwwCSMHDi8uLEkVviI/pEMPLRTfiTcPg6+CdvEIIK+vCAoSOUUzGgod4kbpExmCT6RDDy0U2i4iDC//LhkiKSNlvjDSBukxNfA+MOAsjLP/pS+lLMye1UBQYASMjPkBRONkYmzws/F/pSzsnIz4UIUkD6Ulj6AnHPC2rMyXH7AAAyyM+FCPpSUAP6AoIQ1TJ2288Liss/yXH7AA=='); + static CodeCell = c.Cell.fromBase64('te6ccgECBwEAAWYAART/APSkE/S88sgLAQIBYgIDAeTQ+JHyQO1E0NM/+kggxwCOHDD4kiHHBfLhlQL6SNTRAsjLPxP6UhL6UszJ7VTg+kjXTCTXLCL+Yeik4wJsIdcsIX5ZNRSOITMC1ws/+JLIz4UI+lKCEIt3FzXPC47LP8v/+lLJgED7AOBfA4QPAccA8vQEADWhH5/aiaGmf/SQQY4BKmDgstrbwfSRrpj+qmEC+jX4kiLHBfLhkwTTP/pI+lD0AfoAINdLIfLixCLXCwCfAcABlMABwwCSMHDi8uLEkVviI/pEMPLRTfiTcPg6+CdvEIIK+vCAoSOUUzGgod4kbpExmCT6RDDy0U2i4iDC//LhliKSNlvjDSBukxNfA+MOAsjLP/pS+lLMye1UBQYASMjPkBRONkYmzws/F/pSzsnIz4UIUkD6Ulj6AnHPC2rMyXH7AAAyyM+FCPpSUAP6AoIQ1TJ2288Liss/yXH7AA=='); static Errors = { 'Errors.InvalidWorkchain': 333, - 'Errors.NotFromOwner': 401, - 'Errors.TooSmallRestAmount': 402, + 'Errors.NotFromOwner': 403, 'Errors.NotFromCollection': 405, + 'Errors.TooSmallRestAmount': 406, 'Errors.IncorrectForwardPayload': 708, } diff --git a/src/commands/new/templates/nft/contracts/errors.tolk b/src/commands/new/templates/nft/contracts/errors.tolk index 07672167e8..61f4412f03 100644 --- a/src/commands/new/templates/nft/contracts/errors.tolk +++ b/src/commands/new/templates/nft/contracts/errors.tolk @@ -1,12 +1,13 @@ -// these error codes are quite strange, but they are exactly the same as in FunC implementation +// Codes match the FunC NFT, except NotFromOwner and TooSmallRestAmount. +// Tolk 1.5 rejects duplicate enum values, so those two no longer share 401 and 402. enum Errors { BatchLimitExceeded = 399 InvalidWorkchain = 333 NotFromAdmin = 401 - NotFromOwner = 401 + NotFromOwner = 403 NotFromCollection = 405 InvalidItemIndex = 402 - TooSmallRestAmount = 402 + TooSmallRestAmount = 406 IncorrectForwardPayload = 708 } diff --git a/src/commands/new/templates/w5-extension-app/wrappers-ts/WalletV5.gen.ts b/src/commands/new/templates/w5-extension-app/wrappers-ts/WalletV5.gen.ts index add9208434..bce125335b 100644 --- a/src/commands/new/templates/w5-extension-app/wrappers-ts/WalletV5.gen.ts +++ b/src/commands/new/templates/w5-extension-app/wrappers-ts/WalletV5.gen.ts @@ -557,7 +557,7 @@ function calculateDeployedAddress(code: c.Cell, data: c.Cell, options: DeployedA } export class WalletV5 implements c.Contract { - static CodeCell = c.Cell.fromBase64('te6ccgECEwEAAxcAART/APSkE/S88sgLAQIBIAIDAgFIBAUC4PIggwjXIgGDCNcjINcsI5tLO3Ty4IrTH9Mf0x/0BNIA7UTQ0gDTHyDTH9P/9AUMyM75FkDd+RDy4IcJbhKx8uCEUUS68uCFUFe68uCGAvgjvPLgiPgApMjPg8sfE87J7VT4D3AibpEy4w6Ogts84FsQEQP40CDXLCObS3Okj3Ah10mBAoC+kVvhIYMI1yICgwjXI+1E0NIA0x8g0x/T//QFBsjO+RZAiPkQkl8G4QNuErHy4IQC0x/TH9Mf9ATSAFE3uvLghVBHuvLghgH4I7zy4IgDpMjPg8sfEs7J7VRwIW6RMeMOAo6DAds8kVvi4AYRBwIBIAgJAGhwItc5MI4iINdLwALy4JPAKPLgk9csIHYeQ2zy4JPXTNc5MAGkIccAEuYwhAe78uCTAe1VAfQx1ywjK8OjdI7u+JL6RPgo+kQwWL2RW+DtRNCBAUHXIfQFgwf0Dm+hMZEw4dM/MfQE0gB/I26RM440cCTXOTCOIiDXS8AC8uCTwCjy4JPXLCB2HkNs8uCT10zXOTABpCHHABLmMIQHu/LgkwPtVeIBjoMB2zyRW+LgMBECASAKCwAZvl8PaiaECAoOuQ+gLAIBbgwNAgFIDg8AF63OdqJoaaAY64X/wAAXrx32omhpkBjrhY/AABezJftRNDTADHXCx+AAEbJi+1E0NcKAIAB2cCPXOTCOKSDXS8AC8uCTwCjy4JPXLCB2HkNs8uCT1NcLB3Kw8uCJ1zkwAaQhxwAS5jCEB7vy4JMC7VUBkO2i7fvrIdcsCBSOLfpIMPpE+Cj6RDBYuvLgke1E0IEBQdcY9AXIz4NAM4MH9FPy4IsByM70AMntVOMOIddKk1vbMeEB10zQARIA7NcsCByONvpIMPpE+Cj6RDBYuvLgke1E0NIAgQFA1xj0BRODB/Rb8uCMIZUgbvLQkN8ByMoAEs70AMntVI431ywIJJPywI3hIfLgku1E0AHXCgAB0gAggQFA1yH0BVEjvfLgjyKRMZUBbvLQjuIByMoAzsntVOI='); + static CodeCell = c.Cell.fromBase64('te6ccgECFAEAAxgAART/APSkE/S88sgLAQIBIAIDAgFIBAUC4PIggwjXIgGDCNcjINcsI5tLO3Ty4IrTH9Mf0x/0BNIA7UTQ0gDTHyDTH9P/9AUMyM75FkDd+RDy4IcJbhKx8uCEUUS68uCFUFe68uCGAvgjvPLgiPgApMjPg8sfE87J7VT4D3AibpEy4w6Ogts84FsREgP40CDXLCObS3Okj28h10mBAoC+kVvhIYMI1yICgwjXI+1E0NIA0x8g0x/T//QFBsjO+RZAiPkQkl8G4QNuErHy4IQC0x/TH9Mf9ATSAFE3uvLghVBHuvLghgH4I7zy4IgDpMjPg8sfEs7J7VRwIW6RMeMOAo6DAds84FvgMQYSBwIBIAkKAGhwItc5MI4iINdLwALy4JPAKPLgk9csIHYeQ2zy4JPXTNc5MAGkIccAEuYwhAe78uCTAe1VAuiJ1yeO7fiS+kT4KPpEMFi9kVvg7UTQgQFB1yH0BYMH9A5voTGRMOHTPzH0BNIAfyNukTOONHAk1zkwjiIg10vAAvLgk8Ao8uCT1ywgdh5DbPLgk9dM1zkwAaQhxwAS5jCEB7vy4JMD7VXiAY6DAds84FvgMAgSAAhleHRuAgEgCwwAGb5fD2omhAgKDrkPoCwCAW4NDgIBSA8QABetznaiaGmgGOuF/8AAF68d9qJoaZAY64WPwAAXsyX7UTQ0wAx1wsfgABGyYvtRNDXCgCAAdnAj1zkwjikg10vAAvLgk8Ao8uCT1ywgdh5DbPLgk9TXCwdysPLgidc5MAGkIccAEuYwhAe78uCTAu1VAZDtou376yHXLAgUji36SDD6RPgo+kQwWLry4JHtRNCBAUHXGPQFyM+DQDODB/RT8uCLAcjO9ADJ7VTjDiHXSpNb2zHhAddM0AETAOzXLAgcjjb6SDD6RPgo+kQwWLry4JHtRNDSAIEBQNcY9AUTgwf0W/LgjCGVIG7y0JDfAcjKABLO9ADJ7VSON9csCCST8sCN4SHy4JLtRNAB1woAAdIAIIEBQNch9AVRI73y4I8ikTGVAW7y0I7iAcjKAM7J7VTi'); static Errors = { 'Errors.SignatureDisabled': 132, diff --git a/src/commands/new/templates/w5-extension/contracts/walletv5/c5-register-validation.tolk b/src/commands/new/templates/w5-extension/contracts/walletv5/c5-register-validation.tolk index 7a2687f2b6..e02aa1ddf1 100644 --- a/src/commands/new/templates/w5-extension/contracts/walletv5/c5-register-validation.tolk +++ b/src/commands/new/templates/w5-extension/contracts/walletv5/c5-register-validation.tolk @@ -38,7 +38,7 @@ fun OutActionsCell.verifyC5Actions(self, isExternal: bool): self { ) throw Errors.ExternalSendMessageMustHaveIgnoreErrorsSendMode; } - cs = outAction.prev.beginParseAllowExotic(); + cs = (outAction.prev as OutActionsCell).beginParseAllowExotic(); count += 1; } while (!cs.isEmpty()); diff --git a/src/commands/new/templates/w5-extension/wrappers/utils.tolk b/src/commands/new/templates/w5-extension/wrappers/utils.tolk index 244c46c050..209076e355 100644 --- a/src/commands/new/templates/w5-extension/wrappers/utils.tolk +++ b/src/commands/new/templates/w5-extension/wrappers/utils.tolk @@ -167,7 +167,7 @@ fun WalletV5.sendExtensionActionRaw( struct SignedBody { payload: InternalSignedRequest - signature: bytes64 + signature: bits512 } fun WalletV5.sendSignedBody( @@ -206,7 +206,7 @@ fun createSignedBody( validUntil: int? = null, ): SignedBody { val payload = buildSignedPayload(walletId, seqno, actions, validUntil); - val signature = crypto.sign(keyPair.privateKey, payload.toCell()) as bytes64; + val signature = crypto.sign(keyPair.privateKey, payload.toCell()) as bits512; return SignedBody { payload, signature }; } @@ -234,7 +234,7 @@ fun deployWalletWithKey(keyPair: KeyPair): (WalletV5, Treasury) { struct ExternalSignedBody { payload: ExternalSignedRequest - signature: bytes64 + signature: bits512 } fun buildExternalSignedPayload( @@ -264,7 +264,7 @@ fun createExternalSignedBody( validUntil: int? = null, ): ExternalSignedBody { val payload = buildExternalSignedPayload(walletId, seqno, actions, validUntil); - val signature = crypto.sign(keyPair.privateKey, payload.toCell()) as bytes64; + val signature = crypto.sign(keyPair.privateKey, payload.toCell()) as bits512; return ExternalSignedBody { payload, signature }; } diff --git a/src/ffi/io.rs b/src/ffi/io.rs index bce87d53dd..b9239812cf 100644 --- a/src/ffi/io.rs +++ b/src/ffi/io.rs @@ -750,10 +750,16 @@ fn is_top_level_string_ty_idx(source_map: &SourceMap, ty_idx: TyIdx) -> bool { fn is_send_result_list_type(source_map: &SourceMap, ty_idx: TyIdx) -> bool { match source_map.ty_by_idx(ty_idx) { Some(Ty::AliasRef { alias_name, .. }) if alias_name == "SendResultList" => true, - Some(Ty::AliasRef { - alias_name, - type_args_ty_idx: Some(type_args), - }) if alias_name == "BigArray" => type_args + Some( + Ty::AliasRef { + alias_name, + type_args_ty_idx: Some(type_args), + } + | Ty::StructRef { + struct_name: alias_name, + type_args_ty_idx: Some(type_args), + }, + ) if alias_name == "BigArray" => type_args .first() .is_some_and(|&item_ty_idx| is_send_result_type(source_map, item_ty_idx)), Some(Ty::Nullable { inner_ty_idx, .. }) => { diff --git a/tests/integration/check/pure_function_call_unused_tests.rs b/tests/integration/check/pure_function_call_unused_tests.rs index 6d1747c423..2f2878cd66 100644 --- a/tests/integration/check/pure_function_call_unused_tests.rs +++ b/tests/integration/check/pure_function_call_unused_tests.rs @@ -13,13 +13,8 @@ fn test_check_pure_function_call_unused() { run_simple_test( "pure_function_call_unused", r" - @pure - fun add(a: int, b: int): int { - return a + b; - } - fun main() { - add(1, 2); + createEmptyCell(); } ", function_name!(), diff --git a/tests/integration/coverage_tests.rs b/tests/integration/coverage_tests.rs index b239eb55e0..a42c8b8390 100644 --- a/tests/integration/coverage_tests.rs +++ b/tests/integration/coverage_tests.rs @@ -121,7 +121,7 @@ fn build_partial_coverage_project(name: &str) -> ProjectBuilder { .contract("simple", SIMPLE_CONTRACT) .file( "code/math", - r" + r"@noinline fun classify(x: int): int { if (x > 0) { return 1; @@ -812,7 +812,7 @@ fn test_coverage_runtime_branch_opcodes_text_snapshot() { .contract("simple", SIMPLE_CONTRACT) .file( "code/branches", - r" + r"@noinline fun choose(x: int): int { if (x > 0) { return 1; diff --git a/tests/integration/formatter/mod.rs b/tests/integration/formatter/mod.rs index ad0d87fb6a..c6e7cd751a 100644 --- a/tests/integration/formatter/mod.rs +++ b/tests/integration/formatter/mod.rs @@ -228,7 +228,7 @@ enum FmAbiMegaMode { struct FmAbiMegaLeaf { amount: coins owner: address? - tag: bytes4 + tag: bits32 } type FmAbiMegaLeafAlias = FmAbiMegaLeaf @@ -257,7 +257,7 @@ struct FmAbiMegaScalarValues { varAmount: varuint32 varDebt: varint16 nibble: bits12 - bytesTag: bytes4 + bytesTag: bits32 rawCell: cell mode: FmAbiMegaMode } @@ -1712,7 +1712,7 @@ fn formatter_decoded_body_renders_supported_compiler_abi_types() { get fun `test formatter decoded body supported compiler abi types`() { val (sender, friend, sinkAddress) = deployFmAbiMegaHarness(); val nibble = beginCell().storeUint(0xABC, 12).endCell().beginParse() as bits12; - val bytesTag = "CAFEBABE".hexToSlice() as bytes4; + val bytesTag = "CAFEBABE".hexToSlice() as bits32; val rawCell = beginCell() .storeUint(0xCA, 8) .storeRef(beginCell().storeUint(0xFE, 8).endCell()) @@ -1731,24 +1731,24 @@ get fun `test formatter decoded body supported compiler abi types`() { items.set(1 as uint16, FmAbiMegaLeaf { amount: grams("0.01"), owner: sender.address, - tag: "01020304".hexToSlice() as bytes4, + tag: "01020304".hexToSlice() as bits32, }); items.set(2 as uint16, FmAbiMegaLeaf { amount: grams("0.02"), owner: null, - tag: "0A0B0C0D".hexToSlice() as bytes4, + tag: "0A0B0C0D".hexToSlice() as bits32, }); var boxedItems = createEmptyMap>(); boxedItems.set(1 as uint8, FmAbiMegaLeaf { amount: grams("0.2"), owner: sender.address, - tag: "A1B2C3D4".hexToSlice() as bytes4, + tag: "A1B2C3D4".hexToSlice() as bits32, }.toCell() as Cell); boxedItems.set(2 as uint8, FmAbiMegaLeaf { amount: grams("0.3"), owner: friend.address, - tag: "0BADF00D".hexToSlice() as bytes4, + tag: "0BADF00D".hexToSlice() as bits32, }.toCell() as Cell); val scalarAddressesCell = FmAbiMegaScalarAddresses { @@ -1781,17 +1781,17 @@ get fun `test formatter decoded body supported compiler abi types`() { maybeLeaf: FmAbiMegaLeaf { amount: grams("0.05"), owner: friend.address, - tag: "11223344".hexToSlice() as bytes4, + tag: "11223344".hexToSlice() as bits32, }, aliasLeaf: FmAbiMegaLeaf { amount: grams("0.06"), owner: null, - tag: "55667788".hexToSlice() as bytes4, + tag: "55667788".hexToSlice() as bits32, }, boxedLeaf: FmAbiMegaLeaf { amount: grams("0.07"), owner: sender.address, - tag: "99AABBCC".hexToSlice() as bytes4, + tag: "99AABBCC".hexToSlice() as bits32, }.toCell() as Cell, nested: FmAbiMegaInner { nonce: 77 as uint32, @@ -1800,7 +1800,7 @@ get fun `test formatter decoded body supported compiler abi types`() { meta: FmAbiMegaLeaf { amount: grams("0.08"), owner: sender.address, - tag: "DDEEFF00".hexToSlice() as bytes4, + tag: "DDEEFF00".hexToSlice() as bits32, }, }.toCell() as Cell, }.toCell() as Cell; @@ -1876,7 +1876,7 @@ get fun `test formatter decoded body supported compiler abi types`() { expect(objects.maybeLeaf!.amount).toEqual(grams("0.05")); expect(objects.aliasLeaf.owner).toEqual(null); expect(objects.boxedLeaf.load().amount).toEqual(grams("0.07")); - expect(objects.nested.load().meta!.tag).toEqual("DDEEFF00".hexToSlice() as bytes4); + expect(objects.nested.load().meta!.tag).toEqual("DDEEFF00".hexToSlice() as bits32); expect(collections.items).toHaveLength(2); expect(collections.boxedItems).toHaveLength(2); expect(collections.items.get(1 as uint16).loadValue().amount).toEqual(grams("0.01")); diff --git a/tests/integration/println_tests.rs b/tests/integration/println_tests.rs index ef6115d157..7960f9fb37 100644 --- a/tests/integration/println_tests.rs +++ b/tests/integration/println_tests.rs @@ -30,7 +30,7 @@ fn test_println_big_array() { println("values={}", numbers); println(Collection { values: numbers, next: 42 }); println(Collection { values: null, next: 43 }); - println([numbers, BigArray.createEmpty()]); + println([numbers as BigArray, BigArray.createEmpty()]); println(BigArray.createFromArray([ Point { x: 1, y: 2 }, Point { x: 3, y: 4 } ])); diff --git a/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_aggregates_multiple_contract_compile_errors_with_per_contract_sections.stderr.txt b/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_aggregates_multiple_contract_compile_errors_with_per_contract_sections.stderr.txt index 81053494b3..47466a942d 100644 --- a/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_aggregates_multiple_contract_compile_errors_with_per_contract_sections.stderr.txt +++ b/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_aggregates_multiple_contract_compile_errors_with_per_contract_sections.stderr.txt @@ -1,14 +1,17 @@ Error: In broken_syntax: -[ROOT]/contracts/broken_syntax[LINE]: error: expected , got `;` +error: expected , got `;` + --> [ROOT]/contracts/broken_syntax[LINE] + | 2 | val broken = ; | ^ In missing_symbol: -[ROOT]/contracts/missing_symbol[LINE]: error: undefined symbol `missing_identifier` - - // in function `onInternalMessage` +error: undefined symbol `missing_identifier` + --> [ROOT]/contracts/missing_symbol[LINE] + | in function onInternalMessage + | 2 | val x = missing_identifier; | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_combines_boc_decode_and_compile_errors_with_stable_contract_order.stderr.txt b/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_combines_boc_decode_and_compile_errors_with_stable_contract_order.stderr.txt index c8c59145b5..e1e3e462ce 100644 --- a/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_combines_boc_decode_and_compile_errors_with_stable_contract_order.stderr.txt +++ b/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_combines_boc_decode_and_compile_errors_with_stable_contract_order.stderr.txt @@ -3,7 +3,9 @@ Error: In aa_decode_failure: Failed to decode BoC file contracts/aa_decode_failure.boc: unknown BOC tag In zz_compile_failure: -[ROOT]/contracts/zz_compile_failure[LINE]: error: expected , got `;` +error: expected , got `;` + --> [ROOT]/contracts/zz_compile_failure[LINE] + | 2 | val broken = ; | ^ diff --git a/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_reports_dependency_failure_for_parent_when_generated_dependency_file_is_missing.stderr.txt b/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_reports_dependency_failure_for_parent_when_generated_dependency_file_is_missing.stderr.txt index 0b7b672866..be14b27170 100644 --- a/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_reports_dependency_failure_for_parent_when_generated_dependency_file_is_missing.stderr.txt +++ b/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_reports_dependency_failure_for_parent_when_generated_dependency_file_is_missing.stderr.txt @@ -1,12 +1,16 @@ Error: In child: -[ROOT]/contracts/child[LINE]: error: expected , got `;` +error: expected , got `;` + --> [ROOT]/contracts/child[LINE] + | 2 | val childValue = ; | ^ In parent: -[ROOT]/contracts/parent[LINE]: error: Failed to import: [NOT_FOUND] +error: Failed to import: [NOT_FOUND] + --> [ROOT]/contracts/parent[LINE] + | 1 | import "../gen/child.code.tolk" | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_sorts_multi_error_sections_by_contract_name_and_keeps_messages_consistent.stderr.txt b/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_sorts_multi_error_sections_by_contract_name_and_keeps_messages_consistent.stderr.txt index b1cc0a4d9b..129330f5f7 100644 --- a/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_sorts_multi_error_sections_by_contract_name_and_keeps_messages_consistent.stderr.txt +++ b/tests/integration/snapshots/build/build_cmd_diagnostics_tests/build_sorts_multi_error_sections_by_contract_name_and_keeps_messages_consistent.stderr.txt @@ -1,12 +1,16 @@ Error: In a_parent: -[ROOT]/contracts/a_parent[LINE]: error: Failed to import: [NOT_FOUND] +error: Failed to import: [NOT_FOUND] + --> [ROOT]/contracts/a_parent[LINE] + | 1 | import "../gen/child.code.tolk" | ^^^^^^^^^^^^^^^^^^^^^^^^ In child: -[ROOT]/contracts/child[LINE]: error: expected , got `;` +error: expected , got `;` + --> [ROOT]/contracts/child[LINE] + | 2 | val childValue = ; | ^ diff --git a/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_output_abi_cli_flag_overrides_configured_directory.abi.json b/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_output_abi_cli_flag_overrides_configured_directory.abi.json index 52c93fc50d..52801ea11a 100644 --- a/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_output_abi_cli_flag_overrides_configured_directory.abi.json +++ b/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_output_abi_cli_flag_overrides_configured_directory.abi.json @@ -2,7 +2,7 @@ "abi_schema_version": "1.0", "alias_instantiations": [], "compiler_name": "tolk", - "compiler_version": "1.4.2", + "compiler_version": "1.5.0", "contract_name": "Counter", "declarations": [ { diff --git a/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_writes_contract_abi_to_configured_directory.abi.json b/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_writes_contract_abi_to_configured_directory.abi.json index 52c93fc50d..52801ea11a 100644 --- a/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_writes_contract_abi_to_configured_directory.abi.json +++ b/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_writes_contract_abi_to_configured_directory.abi.json @@ -2,7 +2,7 @@ "abi_schema_version": "1.0", "alias_instantiations": [], "compiler_name": "tolk", - "compiler_version": "1.4.2", + "compiler_version": "1.5.0", "contract_name": "Counter", "declarations": [ { diff --git a/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_writes_contract_abi_to_default_directory.abi.json b/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_writes_contract_abi_to_default_directory.abi.json index 52c93fc50d..52801ea11a 100644 --- a/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_writes_contract_abi_to_default_directory.abi.json +++ b/tests/integration/snapshots/build/build_cmd_output_abi_tests/build_writes_contract_abi_to_default_directory.abi.json @@ -2,7 +2,7 @@ "abi_schema_version": "1.0", "alias_instantiations": [], "compiler_name": "tolk", - "compiler_version": "1.4.2", + "compiler_version": "1.5.0", "contract_name": "Counter", "declarations": [ { diff --git a/tests/integration/snapshots/build/test_build_compilation_error.stderr.txt b/tests/integration/snapshots/build/test_build_compilation_error.stderr.txt index d00fe996e6..d6c84f2552 100644 --- a/tests/integration/snapshots/build/test_build_compilation_error.stderr.txt +++ b/tests/integration/snapshots/build/test_build_compilation_error.stderr.txt @@ -1,8 +1,9 @@ Error: In broken: -[ROOT]/contracts/broken[LINE]: error: undefined symbol `nonexistent` - - // in function `onInternalMessage` +error: undefined symbol `nonexistent` + --> [ROOT]/contracts/broken[LINE] + | in function onInternalMessage + | 3 | val x = nonexistent; // This will cause compilation error | ^^^^^^^^^^^ diff --git a/tests/integration/snapshots/build/test_build_contract_from_boc_with_invalid_types_file_reports_error/stderr.txt b/tests/integration/snapshots/build/test_build_contract_from_boc_with_invalid_types_file_reports_error/stderr.txt index 59db481e8b..607632b024 100644 --- a/tests/integration/snapshots/build/test_build_contract_from_boc_with_invalid_types_file_reports_error/stderr.txt +++ b/tests/integration/snapshots/build/test_build_contract_from_boc_with_invalid_types_file_reports_error/stderr.txt @@ -1,6 +1,8 @@ Error: In precompiled: -Failed to compile types file [ROOT]/contracts/precompiled.types.tolk for precompiled: [ROOT]/contracts/precompiled.types[LINE]: error: unknown type name `MissingMessage` +Failed to compile types file [ROOT]/contracts/precompiled.types.tolk for precompiled: error: unknown type name `MissingMessage` + --> [ROOT]/contracts/precompiled.types[LINE] + | 3 | incomingMessages: MissingMessage | ^^^^^^^^^^^^^^ Build failed with 1 error diff --git a/tests/integration/snapshots/build/test_build_contract_from_boc_with_types_writes_abi/abi.json b/tests/integration/snapshots/build/test_build_contract_from_boc_with_types_writes_abi/abi.json index eee0ce7b67..4370c9088f 100644 --- a/tests/integration/snapshots/build/test_build_contract_from_boc_with_types_writes_abi/abi.json +++ b/tests/integration/snapshots/build/test_build_contract_from_boc_with_types_writes_abi/abi.json @@ -2,7 +2,7 @@ "abi_schema_version": "1.0", "alias_instantiations": [], "compiler_name": "tolk", - "compiler_version": "1.4.2", + "compiler_version": "1.5.0", "contract_name": "Precompiled", "declarations": [ { diff --git a/tests/integration/snapshots/build/test_build_contract_from_uppercase_boc_with_types_writes_abi/abi.json b/tests/integration/snapshots/build/test_build_contract_from_uppercase_boc_with_types_writes_abi/abi.json index eee0ce7b67..4370c9088f 100644 --- a/tests/integration/snapshots/build/test_build_contract_from_uppercase_boc_with_types_writes_abi/abi.json +++ b/tests/integration/snapshots/build/test_build_contract_from_uppercase_boc_with_types_writes_abi/abi.json @@ -2,7 +2,7 @@ "abi_schema_version": "1.0", "alias_instantiations": [], "compiler_name": "tolk", - "compiler_version": "1.4.2", + "compiler_version": "1.5.0", "contract_name": "Precompiled", "declarations": [ { diff --git a/tests/integration/snapshots/build/test_build_contract_syntax_error.stderr.txt b/tests/integration/snapshots/build/test_build_contract_syntax_error.stderr.txt index 2c2784353f..ea5ca52aaa 100644 --- a/tests/integration/snapshots/build/test_build_contract_syntax_error.stderr.txt +++ b/tests/integration/snapshots/build/test_build_contract_syntax_error.stderr.txt @@ -1,6 +1,8 @@ Error: In broken: -[ROOT]/contracts/broken[LINE]: error: expected , got `;` +error: expected , got `;` + --> [ROOT]/contracts/broken[LINE] + | 3 | val x = ; | ^ diff --git a/tests/integration/snapshots/build/test_build_good_and_bad_contracts_with_syntax_error.stderr.txt b/tests/integration/snapshots/build/test_build_good_and_bad_contracts_with_syntax_error.stderr.txt index df48fcf864..b00145b962 100644 --- a/tests/integration/snapshots/build/test_build_good_and_bad_contracts_with_syntax_error.stderr.txt +++ b/tests/integration/snapshots/build/test_build_good_and_bad_contracts_with_syntax_error.stderr.txt @@ -1,6 +1,8 @@ Error: In ok2: -[ROOT]/contracts/ok2[LINE]: error: expected , got `;` +error: expected , got `;` + --> [ROOT]/contracts/ok2[LINE] + | 3 | val x =; | ^ diff --git a/tests/integration/snapshots/build/test_build_several_contracts_with_syntax_error.stderr.txt b/tests/integration/snapshots/build/test_build_several_contracts_with_syntax_error.stderr.txt index 79e1e938da..77ae67cb86 100644 --- a/tests/integration/snapshots/build/test_build_several_contracts_with_syntax_error.stderr.txt +++ b/tests/integration/snapshots/build/test_build_several_contracts_with_syntax_error.stderr.txt @@ -1,14 +1,19 @@ Error: In broken1: -[ROOT]/contracts/broken1[LINE]: error: expected , got `;` +error: expected , got `;` + --> [ROOT]/contracts/broken1[LINE] + | 3 | val x = ; | ^ In broken2: -[ROOT]/contracts/broken2[LINE]: error: provide a type for a variable, because its default value is omitted: - > var x: ; +error: provide a type for a variable, because its default value is omitted + --> [ROOT]/contracts/broken2[LINE] + | 3 | val x; | ^ +hint: +> var x: ; Build failed with 2 errors diff --git a/tests/integration/snapshots/build/test_build_with_dependency_with_compilation_error.stderr.txt b/tests/integration/snapshots/build/test_build_with_dependency_with_compilation_error.stderr.txt index 782166f291..be987fd3ca 100644 --- a/tests/integration/snapshots/build/test_build_with_dependency_with_compilation_error.stderr.txt +++ b/tests/integration/snapshots/build/test_build_with_dependency_with_compilation_error.stderr.txt @@ -1,12 +1,16 @@ Error: In child: -[ROOT]/contracts/child[LINE]: error: expected `;`, got `a` +error: expected `;`, got `a` + --> [ROOT]/contracts/child[LINE] + | 3 | let a = 10; | ^ In parent: -[ROOT]/contracts/parent[LINE]: error: Failed to import: [NOT_FOUND] +error: Failed to import: [NOT_FOUND] + --> [ROOT]/contracts/parent[LINE] + | 2 | import "../gen/child.code.tolk" | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/check/prefer_grams/deprecated_without_prefer_grams.txt b/tests/integration/snapshots/check/prefer_grams/deprecated_without_prefer_grams.txt index a5ac01c4b7..d76182e6b3 100644 --- a/tests/integration/snapshots/check/prefer_grams/deprecated_without_prefer_grams.txt +++ b/tests/integration/snapshots/check/prefer_grams/deprecated_without_prefer_grams.txt @@ -2,7 +2,7 @@ warning[E003]: usage of deprecated symbol --> [ROOT]/contracts/main[LINE] | 2 | fun main(): coins { return ton("0.1"); } - | ^^^ ton is deprecated and should not be used. use grams instead + | ^^^ ton is deprecated and should not be used. use `grams("0.05")` instead of `ton("0.05")` | = deprecated symbols may be removed in future versions @@ -10,7 +10,7 @@ warning[E003]: usage of deprecated symbol --> [ROOT]/contracts/main[LINE] | 3 | fun shadowed(grams: int): coins { return ton("0.2"); } - | ^^^ ton is deprecated and should not be used. use grams instead + | ^^^ ton is deprecated and should not be used. use `grams("0.05")` instead of `ton("0.05")` | = deprecated symbols may be removed in future versions diff --git a/tests/integration/snapshots/check/pure_function_call_unused/test_check_pure_function_call_unused.txt b/tests/integration/snapshots/check/pure_function_call_unused/test_check_pure_function_call_unused.txt index e6328f45db..0223a574cc 100644 --- a/tests/integration/snapshots/check/pure_function_call_unused/test_check_pure_function_call_unused.txt +++ b/tests/integration/snapshots/check/pure_function_call_unused/test_check_pure_function_call_unused.txt @@ -1,8 +1,8 @@ warning[E006]: result of pure function is not used --> [ROOT]/contracts/main[LINE] | -8 | add(1, 2); - | ^^^^^^^^^ result of pure function `add` is not used +3 | createEmptyCell(); + | ^^^^^^^^^^^^^^^^^ result of pure function `createEmptyCell` is not used | = functions marked with `@pure` have no side effects. Calling them without using the result does nothing and may indicate a bug diff --git a/tests/integration/snapshots/compile/test_compile_import_from_symlink_file.stderr.txt b/tests/integration/snapshots/compile/test_compile_import_from_symlink_file.stderr.txt index 7dd15563a5..4582cdd77e 100644 --- a/tests/integration/snapshots/compile/test_compile_import_from_symlink_file.stderr.txt +++ b/tests/integration/snapshots/compile/test_compile_import_from_symlink_file.stderr.txt @@ -1,4 +1,6 @@ -Error: [ROOT]/contracts/main[LINE]: error: Failed to import: Cannot import symlink file +Error: error: Failed to import: Cannot import symlink file + --> [ROOT]/contracts/main[LINE] + | 2 | import "./linked-lib.tolk"; | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/config/test_gas_profile_format_collapsed_via_config_exports_collapsed_stacks.collapsed b/tests/integration/snapshots/config/test_gas_profile_format_collapsed_via_config_exports_collapsed_stacks.collapsed index 6d5ac03823..0f4e380f64 100644 --- a/tests/integration/snapshots/config/test_gas_profile_format_collapsed_via_config_exports_collapsed_stacks.collapsed +++ b/tests/integration/snapshots/config/test_gas_profile_format_collapsed_via_config_exports_collapsed_stacks.collapsed @@ -1,4 +1,4 @@ acton;test gas profile heavy unit helper 360 acton;test gas profile heavy unit helper;X.create 26 -acton;test gas profile heavy unit helper;X.heavyJob 2304 -acton;test gas profile heavy unit helper;X.heavyJob;X.mix 496 +acton;test gas profile heavy unit helper;X.heavyJob 2224 +acton;test gas profile heavy unit helper;X.heavyJob;X.mix 352 diff --git a/tests/integration/snapshots/config/test_gas_profile_via_config_exports_devtools_profile.cpuprofile b/tests/integration/snapshots/config/test_gas_profile_via_config_exports_devtools_profile.cpuprofile index 4e90b56001..287c8e54a2 100644 --- a/tests/integration/snapshots/config/test_gas_profile_via_config_exports_devtools_profile.cpuprofile +++ b/tests/integration/snapshots/config/test_gas_profile_via_config_exports_devtools_profile.cpuprofile @@ -1,5 +1,5 @@ { - "endTime": 3186, + "endTime": 2962, "nodes": [ { "callFrame": { @@ -53,7 +53,7 @@ "children": [ 5 ], - "hitCount": 69, + "hitCount": 61, "id": 4 }, { @@ -65,7 +65,7 @@ "url": "[ROOT]/tests/profile.test.tolk" }, "children": [], - "hitCount": 24, + "hitCount": 16, "id": 5 } ], @@ -84,8 +84,6 @@ 4, 4, 4, - 4, - 5, 5, 5, 4, @@ -95,11 +93,8 @@ 4, 4, 4, - 4, 5, 5, - 5, - 4, 4, 4, 4, @@ -109,7 +104,6 @@ 4, 5, 5, - 5, 4, 4, 4, @@ -117,8 +111,6 @@ 4, 4, 4, - 4, - 5, 5, 5, 4, @@ -128,11 +120,8 @@ 4, 4, 4, - 4, 5, 5, - 5, - 4, 4, 4, 4, @@ -142,7 +131,6 @@ 4, 5, 5, - 5, 4, 4, 4, @@ -150,8 +138,6 @@ 4, 4, 4, - 4, - 5, 5, 5, 4, @@ -161,8 +147,6 @@ 4, 4, 4, - 4, - 5, 5, 5, 4, @@ -182,91 +166,75 @@ 18, 18, 18, - 18, - 18, + 26, 26, 26, 34, 276, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, diff --git a/tests/integration/snapshots/coverage/test_coverage_basic_output.stdout.txt b/tests/integration/snapshots/coverage/test_coverage_basic_output.stdout.txt index bd0638e503..9cecf147de 100644 --- a/tests/integration/snapshots/coverage/test_coverage_basic_output.stdout.txt +++ b/tests/integration/snapshots/coverage/test_coverage_basic_output.stdout.txt @@ -17,7 +17,7 @@ ─────────────────────────────────────────────────────────────────────────────────────────────────── File Covered Total Lines % Lines Covered Total Branches % Branches Score ─────────────────────────────────────────────────────────────────────────────────────────────────── - All files 4 4 100.0% 2 2 100.0% 100.0% - code/math.tolk 4 4 100.0% 2 2 100.0% 100.0% + All files 4 4 100.0% 0 0 n/a 100.0% + code/math.tolk 4 4 100.0% 0 0 n/a 100.0% Text coverage file saved in coverage.txt diff --git a/tests/integration/snapshots/coverage/test_coverage_basic_output.txt b/tests/integration/snapshots/coverage/test_coverage_basic_output.txt index 05e3dd2183..427e3dfd56 100644 --- a/tests/integration/snapshots/coverage/test_coverage_basic_output.txt +++ b/tests/integration/snapshots/coverage/test_coverage_basic_output.txt @@ -10,7 +10,7 @@ Annotated Code: 4 | } | 5 | | 6 | fun isPositive(x: int): bool { | - 7 ✓ | if (x > 0) { | hits:2 branches:true=1 false=1 + 7 ✓ | if (x > 0) { | hits:2 8 ✓ | return true; | hits:1 9 | } else { | 10 ✓ | return false; | hits:1 diff --git a/tests/integration/snapshots/coverage/test_coverage_minimum_percent_via_cli.txt b/tests/integration/snapshots/coverage/test_coverage_minimum_percent_via_cli.txt index 020be8ef65..ae3b0f7854 100644 --- a/tests/integration/snapshots/coverage/test_coverage_minimum_percent_via_cli.txt +++ b/tests/integration/snapshots/coverage/test_coverage_minimum_percent_via_cli.txt @@ -4,7 +4,7 @@ Total Hits: 2 File: [ROOT]/code/math.tolk Annotated Code: -1 | | +1 | @noinline | 2 | fun classify(x: int): int { | 3 ✓ | if (x > 0) { | hits:1 branches:true=1 false=0 4 ✓ | return 1; | hits:1 diff --git a/tests/integration/snapshots/coverage/test_coverage_minimum_percent_via_config.txt b/tests/integration/snapshots/coverage/test_coverage_minimum_percent_via_config.txt index 020be8ef65..ae3b0f7854 100644 --- a/tests/integration/snapshots/coverage/test_coverage_minimum_percent_via_config.txt +++ b/tests/integration/snapshots/coverage/test_coverage_minimum_percent_via_config.txt @@ -4,7 +4,7 @@ Total Hits: 2 File: [ROOT]/code/math.tolk Annotated Code: -1 | | +1 | @noinline | 2 | fun classify(x: int): int { | 3 ✓ | if (x > 0) { | hits:1 branches:true=1 false=0 4 ✓ | return 1; | hits:1 diff --git a/tests/integration/snapshots/coverage/test_coverage_runtime_branch_opcodes.txt b/tests/integration/snapshots/coverage/test_coverage_runtime_branch_opcodes.txt index af25793aa2..f01eaa67cb 100644 --- a/tests/integration/snapshots/coverage/test_coverage_runtime_branch_opcodes.txt +++ b/tests/integration/snapshots/coverage/test_coverage_runtime_branch_opcodes.txt @@ -4,7 +4,7 @@ Total Hits: 16 File: [ROOT]/code/branches.tolk Annotated Code: - 1 | | + 1 | @noinline | 2 | fun choose(x: int): int { | 3 ✓ | if (x > 0) { | hits:2 branches:true=1 false=1 4 ✓ | return 1; | hits:1 diff --git a/tests/integration/snapshots/coverage/test_coverage_with_failing_tests.stdout.txt b/tests/integration/snapshots/coverage/test_coverage_with_failing_tests.stdout.txt index f61f8d5f48..cc41fedb80 100644 --- a/tests/integration/snapshots/coverage/test_coverage_with_failing_tests.stdout.txt +++ b/tests/integration/snapshots/coverage/test_coverage_with_failing_tests.stdout.txt @@ -23,10 +23,10 @@ Some tests failed. COVERAGE -─────────────────────────────────────────────────────────────────────────────────────────────────────── - File Covered Total Lines % Lines Covered Total Branches % Branches Score -─────────────────────────────────────────────────────────────────────────────────────────────────────── - All files 2 3 66.7% 1 2 50.0% 60.0% - code/validator.tolk 2 3 66.7% 1 2 50.0% 60.0% +──────────────────────────────────────────────────────────────────────────────────────────────────────── + File Covered Total Lines % Lines Covered Total Branches % Branches Score +──────────────────────────────────────────────────────────────────────────────────────────────────────── + All files 2 2 100.0% 0 0 n/a 100.0% + code/validator.tolk 2 2 100.0% 0 0 n/a 100.0% Text coverage file saved in coverage.txt diff --git a/tests/integration/snapshots/coverage/test_coverage_with_failing_tests.txt b/tests/integration/snapshots/coverage/test_coverage_with_failing_tests.txt index be7bb6b37e..9759596bac 100644 --- a/tests/integration/snapshots/coverage/test_coverage_with_failing_tests.txt +++ b/tests/integration/snapshots/coverage/test_coverage_with_failing_tests.txt @@ -1,15 +1,15 @@ Coverage Summary: -Lines: 2/3 (66.67%) +Lines: 2/2 (100.00%) Total Hits: 4 File: [ROOT]/code/validator.tolk Annotated Code: 1 | | 2 | fun validate(value: int): bool { | -3 ✓ | if (value > 0) { | hits:2 branches:true=2 false=0 +3 ✓ | if (value > 0) { | hits:2 4 ✓ | return true; | hits:2 5 | } | -6 ✗ | return false; | hits:0 +6 | return false; | 7 | } | 8 | | diff --git a/tests/integration/snapshots/create_app/test_init_create_app_scaffolds_empty_ui_into_app_directory.contracts.yml b/tests/integration/snapshots/create_app/test_init_create_app_scaffolds_empty_ui_into_app_directory.contracts.yml index d3ae317e23..81b90e6286 100644 --- a/tests/integration/snapshots/create_app/test_init_create_app_scaffolds_empty_ui_into_app_directory.contracts.yml +++ b/tests/integration/snapshots/create_app/test_init_create_app_scaffolds_empty_ui_into_app_directory.contracts.yml @@ -32,7 +32,7 @@ jobs: persist-credentials: false - name: Setup Acton - uses: ton-blockchain/setup-acton@0f9f436843d740466cae2d7411ff59072dde942e # v1.2.0 + uses: ton-blockchain/setup-acton@0f9f436843d740466cae2d7411ff59072dde942e # [ACTON_VERSION] - name: Build run: acton build diff --git a/tests/integration/snapshots/debugger/counter/test_real_counter_step_in.trace.txt b/tests/integration/snapshots/debugger/counter/test_real_counter_step_in.trace.txt index 8cc0980ac3..a077c843f4 100644 --- a/tests/integration/snapshots/debugger/counter/test_real_counter_step_in.trace.txt +++ b/tests/integration/snapshots/debugger/counter/test_real_counter_step_in.trace.txt @@ -1009,7 +1009,7 @@ Step 57 (step_in): 38| 39| match (msg) { 40| IncreaseCounter => { - ^ + ^ 41| handleIncreaseCounter(msg.increaseBy); Variables: in: InMessage diff --git a/tests/integration/snapshots/debugger/counter/test_real_counter_tx_cursor_step_in.trace.txt b/tests/integration/snapshots/debugger/counter/test_real_counter_tx_cursor_step_in.trace.txt index a8296593a9..6fa10960e0 100644 --- a/tests/integration/snapshots/debugger/counter/test_real_counter_tx_cursor_step_in.trace.txt +++ b/tests/integration/snapshots/debugger/counter/test_real_counter_tx_cursor_step_in.trace.txt @@ -699,7 +699,7 @@ Step 40 (step_in): 38| 39| match (msg) { 40| IncreaseCounter => { - ^ + ^ 41| handleIncreaseCounter(msg.increaseBy); Variables: in: InMessage diff --git a/tests/integration/snapshots/disasm/test_disasm_json_includes_source_map_blocks.stdout.txt b/tests/integration/snapshots/disasm/test_disasm_json_includes_source_map_blocks.stdout.txt index 9e9295b00b..015d3a3658 100644 --- a/tests/integration/snapshots/disasm/test_disasm_json_includes_source_map_blocks.stdout.txt +++ b/tests/integration/snapshots/disasm/test_disasm_json_includes_source_map_blocks.stdout.txt @@ -94,7 +94,7 @@ "source": { "file": "[ROOT]/contracts/counter.tolk", "line": 9, - "column": 28, + "column": 9, "end_line": 13, "end_column": 10 }, @@ -207,7 +207,7 @@ "source": { "file": "[ROOT]/contracts/counter.tolk", "line": 14, - "column": 25, + "column": 9, "end_line": 18, "end_column": 10 }, diff --git a/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile.stdout.txt b/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile.stdout.txt index d832c869b4..9ac8b1e85f 100644 --- a/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile.stdout.txt +++ b/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile.stdout.txt @@ -26,7 +26,7 @@ DICTPUSHCONST 19 [ PUSHCONT { // contracts/counter[LINE] // 9 | IncreaseCounter => { - // | ^ + // | ^^^^^^^^^^^^^^^^^^^^ // .. | ... 3 lines omitted ... // 13 | } // | ^ @@ -80,7 +80,7 @@ DICTPUSHCONST 19 [ PUSHCONT { // contracts/counter[LINE] // 14 | ResetCounter => { - // | ^ + // | ^^^^^^^^^^^^^^^^^ // .. | ... 3 lines omitted ... // 18 | } // | ^ diff --git a/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_hashes.stdout.txt b/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_hashes.stdout.txt index e37bde7eea..e479a2be3f 100644 --- a/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_hashes.stdout.txt +++ b/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_hashes.stdout.txt @@ -26,7 +26,7 @@ DICTPUSHCONST 19 [ PUSHCONT { // 6F7AF2ED8B0B84F321FC02C7729BE99A9DB9D94DF3940C9C80E274319E5C9FEF offset 119 // contracts/counter[LINE] // 9 | IncreaseCounter => { - // | ^ + // | ^^^^^^^^^^^^^^^^^^^^ // .. | ... 3 lines omitted ... // 13 | } // | ^ @@ -80,7 +80,7 @@ DICTPUSHCONST 19 [ PUSHCONT { // 6F7AF2ED8B0B84F321FC02C7729BE99A9DB9D94DF3940C9C80E274319E5C9FEF offset 399 // contracts/counter[LINE] // 14 | ResetCounter => { - // | ^ + // | ^^^^^^^^^^^^^^^^^ // .. | ... 3 lines omitted ... // 18 | } // | ^ diff --git a/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_hashes_and_offsets.stdout.txt b/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_hashes_and_offsets.stdout.txt index a07147ae86..1c1a427ccf 100644 --- a/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_hashes_and_offsets.stdout.txt +++ b/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_hashes_and_offsets.stdout.txt @@ -28,7 +28,7 @@ off │ instruction 112 │ PUSHCONT { // 6F7AF2ED8B0B84F321FC02C7729BE99A9DB9D94DF3940C9C80E274319E5C9FEF offset 119 │ // contracts/counter[LINE] │ // 9 | IncreaseCounter => { - │ // | ^ + │ // | ^^^^^^^^^^^^^^^^^^^^ │ // .. | ... 3 lines omitted ... │ // 13 | } │ // | ^ @@ -82,7 +82,7 @@ off │ instruction 392 │ PUSHCONT { // 6F7AF2ED8B0B84F321FC02C7729BE99A9DB9D94DF3940C9C80E274319E5C9FEF offset 399 │ // contracts/counter[LINE] │ // 14 | ResetCounter => { - │ // | ^ + │ // | ^^^^^^^^^^^^^^^^^ │ // .. | ... 3 lines omitted ... │ // 18 | } │ // | ^ diff --git a/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_offsets.stdout.txt b/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_offsets.stdout.txt index 4219c82d5a..6f2eaae886 100644 --- a/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_offsets.stdout.txt +++ b/tests/integration/snapshots/disasm/test_disasm_reads_source_map_emitted_by_compile_with_show_offsets.stdout.txt @@ -28,7 +28,7 @@ off │ instruction 112 │ PUSHCONT { │ // contracts/counter[LINE] │ // 9 | IncreaseCounter => { - │ // | ^ + │ // | ^^^^^^^^^^^^^^^^^^^^ │ // .. | ... 3 lines omitted ... │ // 13 | } │ // | ^ @@ -82,7 +82,7 @@ off │ instruction 392 │ PUSHCONT { │ // contracts/counter[LINE] │ // 14 | ResetCounter => { - │ // | ^ + │ // | ^^^^^^^^^^^^^^^^^ │ // .. | ... 3 lines omitted ... │ // 18 | } │ // | ^ diff --git a/tests/integration/snapshots/doc/test_doc_abi_local_contract_by_abi_name.stdout.json.txt b/tests/integration/snapshots/doc/test_doc_abi_local_contract_by_abi_name.stdout.json.txt index 97ed9f295d..284457dcf0 100644 --- a/tests/integration/snapshots/doc/test_doc_abi_local_contract_by_abi_name.stdout.json.txt +++ b/tests/integration/snapshots/doc/test_doc_abi_local_contract_by_abi_name.stdout.json.txt @@ -95,5 +95,5 @@ "get_methods": [], "thrown_errors": [], "compiler_name": "tolk", - "compiler_version": "1.4.2" + "compiler_version": "1.5.0" } diff --git a/tests/integration/snapshots/fixture/test_basic_fixture_with_gas_limit.stdout.txt b/tests/integration/snapshots/fixture/test_basic_fixture_with_gas_limit.stdout.txt index c1ffcbea26..98fa362d11 100644 --- a/tests/integration/snapshots/fixture/test_basic_fixture_with_gas_limit.stdout.txt +++ b/tests/integration/snapshots/fixture/test_basic_fixture_with_gas_limit.stdout.txt @@ -9,7 +9,7 @@ > tests/counter.test.tolk (2 tests) ✗ should increase counter [TIME] - └─ Gas limit exceeded: used 134322, limit 100 + └─ Gas limit exceeded: used 120638, limit 100 ✓ should reset counter [TIME] ✓ 1 passed, ✗ 1 failed in 1 file diff --git a/tests/integration/snapshots/fixture/test_compilation_error_fixture.stderr.txt b/tests/integration/snapshots/fixture/test_compilation_error_fixture.stderr.txt index 2cc7020fd3..80fc83f77e 100644 --- a/tests/integration/snapshots/fixture/test_compilation_error_fixture.stderr.txt +++ b/tests/integration/snapshots/fixture/test_compilation_error_fixture.stderr.txt @@ -1,8 +1,9 @@ Error: In counter: -[ROOT]/contracts/counter[LINE]: error: field `body2` doesn't exist in type `InMessage` - - // in function `onInternalMessage` +error: field `body2` doesn't exist in type `InMessage` + --> [ROOT]/contracts/counter[LINE] + | in function onInternalMessage + | 6 | val msg = lazy AllowedMessage.fromSlice(in.body2); | ^^^^^ diff --git a/tests/integration/snapshots/flags/test_gas_profile_flag_exports_devtools_profile_for_unit_test.cpuprofile b/tests/integration/snapshots/flags/test_gas_profile_flag_exports_devtools_profile_for_unit_test.cpuprofile index 4e90b56001..287c8e54a2 100644 --- a/tests/integration/snapshots/flags/test_gas_profile_flag_exports_devtools_profile_for_unit_test.cpuprofile +++ b/tests/integration/snapshots/flags/test_gas_profile_flag_exports_devtools_profile_for_unit_test.cpuprofile @@ -1,5 +1,5 @@ { - "endTime": 3186, + "endTime": 2962, "nodes": [ { "callFrame": { @@ -53,7 +53,7 @@ "children": [ 5 ], - "hitCount": 69, + "hitCount": 61, "id": 4 }, { @@ -65,7 +65,7 @@ "url": "[ROOT]/tests/profile.test.tolk" }, "children": [], - "hitCount": 24, + "hitCount": 16, "id": 5 } ], @@ -84,8 +84,6 @@ 4, 4, 4, - 4, - 5, 5, 5, 4, @@ -95,11 +93,8 @@ 4, 4, 4, - 4, 5, 5, - 5, - 4, 4, 4, 4, @@ -109,7 +104,6 @@ 4, 5, 5, - 5, 4, 4, 4, @@ -117,8 +111,6 @@ 4, 4, 4, - 4, - 5, 5, 5, 4, @@ -128,11 +120,8 @@ 4, 4, 4, - 4, 5, 5, - 5, - 4, 4, 4, 4, @@ -142,7 +131,6 @@ 4, 5, 5, - 5, 4, 4, 4, @@ -150,8 +138,6 @@ 4, 4, 4, - 4, - 5, 5, 5, 4, @@ -161,8 +147,6 @@ 4, 4, 4, - 4, - 5, 5, 5, 4, @@ -182,91 +166,75 @@ 18, 18, 18, - 18, - 18, + 26, 26, 26, 34, 276, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, - 18, - 18, + 26, 26, 26, 34, 126, 18, - 18, 26, 5, 5, diff --git a/tests/integration/snapshots/flags/test_gas_profile_format_collapsed_exports_collapsed_stacks_for_unit_test.collapsed b/tests/integration/snapshots/flags/test_gas_profile_format_collapsed_exports_collapsed_stacks_for_unit_test.collapsed index 6d5ac03823..0f4e380f64 100644 --- a/tests/integration/snapshots/flags/test_gas_profile_format_collapsed_exports_collapsed_stacks_for_unit_test.collapsed +++ b/tests/integration/snapshots/flags/test_gas_profile_format_collapsed_exports_collapsed_stacks_for_unit_test.collapsed @@ -1,4 +1,4 @@ acton;test gas profile heavy unit helper 360 acton;test gas profile heavy unit helper;X.create 26 -acton;test gas profile heavy unit helper;X.heavyJob 2304 -acton;test gas profile heavy unit helper;X.heavyJob;X.mix 496 +acton;test gas profile heavy unit helper;X.heavyJob 2224 +acton;test gas profile heavy unit helper;X.heavyJob;X.mix 352 diff --git a/tests/integration/snapshots/flags/test_project_root_build_from_nested_directory.source.json b/tests/integration/snapshots/flags/test_project_root_build_from_nested_directory.source.json index 442a3ce2be..56f495f9d8 100644 --- a/tests/integration/snapshots/flags/test_project_root_build_from_nested_directory.source.json +++ b/tests/integration/snapshots/flags/test_project_root_build_from_nested_directory.source.json @@ -3,15 +3,15 @@ "compiler": { "language": "tolk", "params": { - "compiler_version": "1.4.2" + "compiler_version": "1.5.0" }, - "version": "1.4.2" + "version": "1.5.0" }, "compiler_abi": { "abi_schema_version": "1.0", "alias_instantiations": [], "compiler_name": "tolk", - "compiler_version": "1.4.2", + "compiler_version": "1.5.0", "contract_name": "", "declarations": [], "emitted_events": [], @@ -76,15 +76,15 @@ "path": "contracts/simple.tolk" }, { - "content": "{\"abi_schema_version\":\"1.0\",\"contract_name\":\"\",\"unique_types\":[{\"kind\":\"void\"},{\"kind\":\"int\"},{\"kind\":\"slice\"},{\"kind\":\"cell\"},{\"kind\":\"builder\"},{\"kind\":\"bool\"},{\"kind\":\"coins\"},{\"kind\":\"address\"},{\"kind\":\"intN\",\"n\":32},{\"kind\":\"uintN\",\"n\":32},{\"kind\":\"intN\",\"n\":64},{\"kind\":\"uintN\",\"n\":64}],\"struct_instantiations\":[],\"alias_instantiations\":[],\"declarations\":[],\"incoming_messages\":[],\"incoming_external\":[],\"outgoing_messages\":[],\"emitted_events\":[],\"storage\":{},\"get_methods\":[],\"thrown_errors\":[],\"compiler_name\":\"tolk\",\"compiler_version\":\"1.4.2\"}\n", - "content_hash": "e5c984dceabf492c794b993ce4a9f1f74948891e6eff569d4b5c2a7d05ade124", + "content": "{\"abi_schema_version\":\"1.0\",\"contract_name\":\"\",\"unique_types\":[{\"kind\":\"void\"},{\"kind\":\"int\"},{\"kind\":\"slice\"},{\"kind\":\"cell\"},{\"kind\":\"builder\"},{\"kind\":\"bool\"},{\"kind\":\"coins\"},{\"kind\":\"address\"},{\"kind\":\"intN\",\"n\":32},{\"kind\":\"uintN\",\"n\":32},{\"kind\":\"intN\",\"n\":64},{\"kind\":\"uintN\",\"n\":64}],\"struct_instantiations\":[],\"alias_instantiations\":[],\"declarations\":[],\"incoming_messages\":[],\"incoming_external\":[],\"outgoing_messages\":[],\"emitted_events\":[],\"storage\":{},\"get_methods\":[],\"thrown_errors\":[],\"compiler_name\":\"tolk\",\"compiler_version\":\"1.5.0\"}\n", + "content_hash": "afa9e5a2bcffbab2bee454b886e4be0950b3e57e014704c6e97c55d000f53f88", "has_include_directives": null, "include_in_command": null, "is_stdlib": null, "path": "output/simple.abi.json" } ], - "source_bundle_hash": "f2f64f07b291e34027854b171c8924ee0166e76068b91c9ea1691b487cbe1424", + "source_bundle_hash": "4d06b046fad823695f658beda629a0a4d3ac6d119acbefe6dfa06df0cc718368", "source_map": { "code_boc64": "te6ccgEBAgEAFAABFP8A9KQT9LzyyAsBAArTMPiR3A==", "debug_marks_base64": "te6ccgEBFwEAqgACASABAgFDv9DqPnecvp53Ip1be9RbjsFl8qyckXeCPUJds3mi5hRAsAMBQ7/LUUtpEnlC4z33SeGHxRhIq/htUa7i3D8ghbwxhQTn4/ARAgPOQAQFAgEgBgcCAWoPDwIBIBQIAgEgCQoCASAVCwIBIAsMAQFIDgEBIA0BASAOAASoCAAEqBgBASAQAASoIAIDzkASEwEB/BYCAUgUFAIBIBUVAQEgFgAB1Q==", @@ -244,7 +244,7 @@ "file_id": 0, "file_name": "@stdlib/common.tolk", "imports": [], - "size_chars": 75306 + "size_chars": 77804 }, { "file_id": 1, diff --git a/tests/integration/snapshots/library/test_library_publish_compilation_error.stderr.txt b/tests/integration/snapshots/library/test_library_publish_compilation_error.stderr.txt index cf7dabd4cb..649d347bd0 100644 --- a/tests/integration/snapshots/library/test_library_publish_compilation_error.stderr.txt +++ b/tests/integration/snapshots/library/test_library_publish_compilation_error.stderr.txt @@ -1,4 +1,6 @@ -Error: [ROOT]/contracts/broken[LINE]: error: expected , got `;` +Error: error: expected , got `;` + --> [ROOT]/contracts/broken[LINE] + | 1 | fun main() { return 1 +; } | ^ diff --git a/tests/integration/snapshots/mappings/missing_file.txt b/tests/integration/snapshots/mappings/missing_file.txt index ccb74d72e2..91eba764e2 100644 --- a/tests/integration/snapshots/mappings/missing_file.txt +++ b/tests/integration/snapshots/mappings/missing_file.txt @@ -1,4 +1,6 @@ -Error: [ROOT]/contracts/main[LINE]: error: Failed to import: [NOT_FOUND] +Error: error: Failed to import: [NOT_FOUND] + --> [ROOT]/contracts/main[LINE] + | 2 | import "@core/math" | ^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/mappings/symlink_target.txt b/tests/integration/snapshots/mappings/symlink_target.txt index 72fc3ef07a..a8e9833b93 100644 --- a/tests/integration/snapshots/mappings/symlink_target.txt +++ b/tests/integration/snapshots/mappings/symlink_target.txt @@ -1,4 +1,6 @@ -Error: [ROOT]/contracts/main[LINE]: error: Failed to import: Cannot import symlink file +Error: error: Failed to import: Cannot import symlink file + --> [ROOT]/contracts/main[LINE] + | 2 | import "@core/math" | ^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/mappings/unknown_prefix.txt b/tests/integration/snapshots/mappings/unknown_prefix.txt index b239b54f6d..300aee01f0 100644 --- a/tests/integration/snapshots/mappings/unknown_prefix.txt +++ b/tests/integration/snapshots/mappings/unknown_prefix.txt @@ -1,4 +1,6 @@ -Error: [ROOT]/contracts/main[LINE]: error: Failed to import: Unknown path mapping '@core' +Error: error: Failed to import: Unknown path mapping '@core' + --> [ROOT]/contracts/main[LINE] + | 2 | import "@core/math" | ^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/new/test_new_empty_project_with_app_flag.contracts.yml b/tests/integration/snapshots/new/test_new_empty_project_with_app_flag.contracts.yml index d3ae317e23..81b90e6286 100644 --- a/tests/integration/snapshots/new/test_new_empty_project_with_app_flag.contracts.yml +++ b/tests/integration/snapshots/new/test_new_empty_project_with_app_flag.contracts.yml @@ -32,7 +32,7 @@ jobs: persist-credentials: false - name: Setup Acton - uses: ton-blockchain/setup-acton@0f9f436843d740466cae2d7411ff59072dde942e # v1.2.0 + uses: ton-blockchain/setup-acton@0f9f436843d740466cae2d7411ff59072dde942e # [ACTON_VERSION] - name: Build run: acton build diff --git a/tests/integration/snapshots/retrace/test_retrace_contract_compile_error_is_reported_before_logs_are_created.stderr.txt b/tests/integration/snapshots/retrace/test_retrace_contract_compile_error_is_reported_before_logs_are_created.stderr.txt index 4ba04b76ec..9ef57f8ce9 100644 --- a/tests/integration/snapshots/retrace/test_retrace_contract_compile_error_is_reported_before_logs_are_created.stderr.txt +++ b/tests/integration/snapshots/retrace/test_retrace_contract_compile_error_is_reported_before_logs_are_created.stderr.txt @@ -1,3 +1,5 @@ -Error: Failed to compile contract broken for source-level retrace: [ROOT]/contracts/broken[LINE]: error: expected , got `;` +Error: Failed to compile contract broken for source-level retrace: error: expected , got `;` + --> [ROOT]/contracts/broken[LINE] + | 3 | val broken = ; | ^ diff --git a/tests/integration/snapshots/rpc/test_rpc_info_localnet_jetton_master.stdout.txt b/tests/integration/snapshots/rpc/test_rpc_info_localnet_jetton_master.stdout.txt index 2c92f8d897..7ceb7a7bc3 100644 --- a/tests/integration/snapshots/rpc/test_rpc_info_localnet_jetton_master.stdout.txt +++ b/tests/integration/snapshots/rpc/test_rpc_info_localnet_jetton_master.stdout.txt @@ -1,12 +1,12 @@ Basic Information Network: localnet - Raw Address: 0:8d32dec20975c75304a43b10706e936493752be687b8e2f0f7048669851d87c0 + Raw Address: 0:fbc156fec7561688e475444cf9fda438ebccd7a9107d8d1b35a7a35caf00dac5 Status: active Contract: JettonMinter Balance: [TON_BALANCE] GRAM Last Tx LT: 10 Last Tx Hash: [TX_HASH] - Code Hash: 0x6bf8f48ca97d3fd9c8e553344efe7af030c322459e2ee2197a052162f1961bfb + Code Hash: 0x37fb274466a01db790720de6ea3e5b2797aadaa517cad7f9dc6e35d49b189c4f Data Hash: 0xf9b9a2eb10e4944277bcc0022ca221459455a953dad9feb016c814319c221e87 Jetton Master diff --git a/tests/integration/snapshots/rpc/test_rpc_info_localnet_jetton_wallet.stdout.txt b/tests/integration/snapshots/rpc/test_rpc_info_localnet_jetton_wallet.stdout.txt index 7f92a1dbc9..0f8cd9a512 100644 --- a/tests/integration/snapshots/rpc/test_rpc_info_localnet_jetton_wallet.stdout.txt +++ b/tests/integration/snapshots/rpc/test_rpc_info_localnet_jetton_wallet.stdout.txt @@ -1,13 +1,13 @@ Basic Information Network: localnet - Raw Address: 0:51df56f242f58abd2cd6ba689723e86fc5159cdc340bbd92788034f219d5cf04 + Raw Address: 0:519659f3c31bb363916db3cd1a8874970c5ee1cfdd1fd610daface106d4b8bc9 Status: active Contract: JettonWallet Balance: [TON_BALANCE] GRAM Last Tx LT: 8 Last Tx Hash: [TX_HASH] - Code Hash: 0x7bfa53bce90ce26cd368ec2989eba2bd15d286104742f0e04659f485a03012ba - Data Hash: 0x2b38f60246fffa2ba1ee616f4bdb1ab7bf7525d4d445dab6a178f61e5cee7006 + Code Hash: 0xfdd0e33b685ba04a6a5b6beb6b103b76312b5649ac0c55a1ebe680e08d83efee + Data Hash: 0x1afde2bca66d1ca6d8dfb9c2912b50b1624f9dba5c164b64d021641e9e472cfd Jetton Wallet Token: Acton Sample Jetton (ACTON) diff --git a/tests/integration/snapshots/runtime-build/broken-dependency.stdout.txt b/tests/integration/snapshots/runtime-build/broken-dependency.stdout.txt index 1124f34461..b10042bc1f 100644 --- a/tests/integration/snapshots/runtime-build/broken-dependency.stdout.txt +++ b/tests/integration/snapshots/runtime-build/broken-dependency.stdout.txt @@ -2,6 +2,8 @@ Script finished with [EXIT_STATUS] 7 Description: Type check error Phase: Compute phase Re-run with --backtrace full to get more information -Failed to build 'leaf' required by 'parent': Compilation failed: [ROOT]/contracts/leaf.tolk:1: error: expected top-level declaration, got `invalid` +Failed to build 'leaf' required by 'parent': Compilation failed: error: expected top-level declaration, got `invalid` + --> [ROOT]/contracts/leaf.tolk:1 + | 1 | invalid tolk | ^^^^^^^ diff --git a/tests/integration/snapshots/script/test_script_compilation_error.stderr.txt b/tests/integration/snapshots/script/test_script_compilation_error.stderr.txt index 993b17ff44..58d2aa3cc3 100644 --- a/tests/integration/snapshots/script/test_script_compilation_error.stderr.txt +++ b/tests/integration/snapshots/script/test_script_compilation_error.stderr.txt @@ -1,6 +1,7 @@ -Error: Cannot compile script file [ROOT]/scripts/broken[LINE]: error: undefined symbol `nonexistent_function` - - // in function `main` +Error: Cannot compile script file error: undefined symbol `nonexistent_function` + --> [ROOT]/scripts/broken[LINE] + | in function main + | 3 | val x = nonexistent_function(); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/script/test_script_fork_localnet_explicit_block_preserves_history_and_formats_trace.deploy_block.stdout.txt b/tests/integration/snapshots/script/test_script_fork_localnet_explicit_block_preserves_history_and_formats_trace.deploy_block.stdout.txt index bdd7fb7cf9..7f64e55998 100644 --- a/tests/integration/snapshots/script/test_script_fork_localnet_explicit_block_preserves_history_and_formats_trace.deploy_block.stdout.txt +++ b/tests/integration/snapshots/script/test_script_fork_localnet_explicit_block_preserves_history_and_formats_trace.deploy_block.stdout.txt @@ -3,7 +3,7 @@ FORK_TRACE_BEGIN N/A -> fork_sender A └── TriggerForward 0.4 GRAM -> forwarder B gas=1701 target: [WALLET_ADDRESS_BASE] (receiver C) - └── empty 0.2 GRAM -> receiver C gas=1750 + └── empty 0.2 GRAM -> receiver C gas=1406 FORK_TRACE_END FORK_RECEIVER_AFTER=2 diff --git a/tests/integration/snapshots/script/test_script_fork_localnet_explicit_block_preserves_history_and_formats_trace.triggered_block.stdout.txt b/tests/integration/snapshots/script/test_script_fork_localnet_explicit_block_preserves_history_and_formats_trace.triggered_block.stdout.txt index ef16c8bce4..5dfa7bd7e3 100644 --- a/tests/integration/snapshots/script/test_script_fork_localnet_explicit_block_preserves_history_and_formats_trace.triggered_block.stdout.txt +++ b/tests/integration/snapshots/script/test_script_fork_localnet_explicit_block_preserves_history_and_formats_trace.triggered_block.stdout.txt @@ -3,7 +3,7 @@ FORK_TRACE_BEGIN N/A -> fork_sender A └── TriggerForward 0.4 GRAM -> forwarder B gas=1701 target: [WALLET_ADDRESS_BASE] (receiver C) - └── empty 0.2 GRAM -> receiver C gas=1750 + └── empty 0.2 GRAM -> receiver C gas=1406 FORK_TRACE_END FORK_RECEIVER_AFTER=3 diff --git a/tests/integration/snapshots/script/test_script_wait_for_trace_returns_full_trace_on_localnet.stdout.txt b/tests/integration/snapshots/script/test_script_wait_for_trace_returns_full_trace_on_localnet.stdout.txt index b5b13677a8..bc119c3c91 100644 --- a/tests/integration/snapshots/script/test_script_wait_for_trace_returns_full_trace_on_localnet.stdout.txt +++ b/tests/integration/snapshots/script/test_script_wait_for_trace_returns_full_trace_on_localnet.stdout.txt @@ -3,7 +3,7 @@ TRACE_OUTPUT_BEGIN N/A -> external └── [EXT_IN_OPCODE] -> kQBRPs..l6nM9M A gas=3308 └── TriggerForward 0.4 GRAM -> kQDnzm..T3h-gG B gas=1701 - └── empty 0.2 GRAM -> kQDGH2..HvQRPm C gas=1750 + └── empty 0.2 GRAM -> kQDObL..tVtRfE C gas=1406 TRACE_OUTPUT_END TRACE_READY=true diff --git a/tests/integration/snapshots/test-runner/cmd_agent_h/save_test_trace_without_path_uses_default_directory.contract.txt b/tests/integration/snapshots/test-runner/cmd_agent_h/save_test_trace_without_path_uses_default_directory.contract.txt index e252c1b667..4c0e13cb47 100644 --- a/tests/integration/snapshots/test-runner/cmd_agent_h/save_test_trace_without_path_uses_default_directory.contract.txt +++ b/tests/integration/snapshots/test-runner/cmd_agent_h/save_test_trace_without_path_uses_default_directory.contract.txt @@ -3,7 +3,7 @@ "abi_schema_version": "1.0", "alias_instantiations": [], "compiler_name": "tolk", - "compiler_version": "1.4.2", + "compiler_version": "1.5.0", "contract_name": "", "declarations": [], "emitted_events": [], @@ -69,7 +69,7 @@ "file_id": 0, "file_name": "@stdlib/common.tolk", "imports": [], - "size_chars": 75306 + "size_chars": 77804 }, { "file_id": 1, diff --git a/tests/integration/snapshots/test-runner/reporters/dot/test_dot_failures_before_coverage.stdout.txt b/tests/integration/snapshots/test-runner/reporters/dot/test_dot_failures_before_coverage.stdout.txt index 47d7c9b6c4..b1b1ae2f34 100644 --- a/tests/integration/snapshots/test-runner/reporters/dot/test_dot_failures_before_coverage.stdout.txt +++ b/tests/integration/snapshots/test-runner/reporters/dot/test_dot_failures_before_coverage.stdout.txt @@ -20,8 +20,8 @@ Some tests failed. COVERAGE -─────────────────────────────────────────────────────────────────────────────────────────────────────── - File Covered Total Lines % Lines Covered Total Branches % Branches Score -─────────────────────────────────────────────────────────────────────────────────────────────────────── - All files 2 3 66.7% 1 2 50.0% 60.0% - code/validator.tolk 2 3 66.7% 1 2 50.0% 60.0% +──────────────────────────────────────────────────────────────────────────────────────────────────────── + File Covered Total Lines % Lines Covered Total Branches % Branches Score +──────────────────────────────────────────────────────────────────────────────────────────────────────── + All files 2 2 100.0% 0 0 n/a 100.0% + code/validator.tolk 2 2 100.0% 0 0 n/a 100.0% diff --git a/tests/integration/snapshots/test-runner/reporters/dot/test_dot_runtime_failure_details.stdout.txt b/tests/integration/snapshots/test-runner/reporters/dot/test_dot_runtime_failure_details.stdout.txt index 9900e0442b..69be0892cf 100644 --- a/tests/integration/snapshots/test-runner/reporters/dot/test_dot_runtime_failure_details.stdout.txt +++ b/tests/integration/snapshots/test-runner/reporters/dot/test_dot_runtime_failure_details.stdout.txt @@ -6,7 +6,7 @@ Running tests xx -✗ test dot gas limit exceeded: Gas limit exceeded: used 122056, limit 100 +✗ test dot gas limit exceeded: Gas limit exceeded: used 103984, limit 100 ✗ test dot wrong expected [EXIT_STATUS]: Expected exit_code=42, got=99 exit_code=99 diff --git a/tests/integration/snapshots/test-runner/test_runner_mutate/mutate_reports_dependency_build_failure.stderr.txt b/tests/integration/snapshots/test-runner/test_runner_mutate/mutate_reports_dependency_build_failure.stderr.txt index 7a79a622fd..6967bdf301 100644 --- a/tests/integration/snapshots/test-runner/test_runner_mutate/mutate_reports_dependency_build_failure.stderr.txt +++ b/tests/integration/snapshots/test-runner/test_runner_mutate/mutate_reports_dependency_build_failure.stderr.txt @@ -1,12 +1,16 @@ Error: Failed to prepare project for mutation testing: Error: In dependency: -[ROOT]/contracts/dependency[LINE]: error: expected `;`, got `IS` +error: expected `;`, got `IS` + --> [ROOT]/contracts/dependency[LINE] + | 3 | THIS IS A SYNTAX ERROR | ^^ In main: -[ROOT]/contracts/main[LINE]: error: Failed to import: [NOT_FOUND] +error: Failed to import: [NOT_FOUND] + --> [ROOT]/contracts/main[LINE] + | 2 | import "../gen/dependency.code.tolk" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/test/test_invalid_test_file_syntax.stderr.txt b/tests/integration/snapshots/test/test_invalid_test_file_syntax.stderr.txt index a91fcd9006..6ed2ff651d 100644 --- a/tests/integration/snapshots/test/test_invalid_test_file_syntax.stderr.txt +++ b/tests/integration/snapshots/test/test_invalid_test_file_syntax.stderr.txt @@ -1,3 +1,5 @@ -[ROOT]/tests/test.test[LINE]: error: expected `;`, got `a` +error: expected `;`, got `a` + --> [ROOT]/tests/test.test[LINE] + | 3 | let a = 10; | ^ diff --git a/tests/integration/snapshots/verify/test_verify_compilation_error.stderr.txt b/tests/integration/snapshots/verify/test_verify_compilation_error.stderr.txt index f8430aaa6f..f1928fbe8e 100644 --- a/tests/integration/snapshots/verify/test_verify_compilation_error.stderr.txt +++ b/tests/integration/snapshots/verify/test_verify_compilation_error.stderr.txt @@ -1,6 +1,7 @@ -Error: [ROOT]/contracts/broken[LINE]: error: undefined symbol `nonexistent_symbol` - - // in function `onInternalMessage` +Error: error: undefined symbol `nonexistent_symbol` + --> [ROOT]/contracts/broken[LINE] + | in function onInternalMessage + | 3 | val x = nonexistent_symbol(); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/wrapper/test_wrapper_for_boc_contract_with_invalid_types_file_reports_error/stderr.txt b/tests/integration/snapshots/wrapper/test_wrapper_for_boc_contract_with_invalid_types_file_reports_error/stderr.txt index 29154cb143..563592ab22 100644 --- a/tests/integration/snapshots/wrapper/test_wrapper_for_boc_contract_with_invalid_types_file_reports_error/stderr.txt +++ b/tests/integration/snapshots/wrapper/test_wrapper_for_boc_contract_with_invalid_types_file_reports_error/stderr.txt @@ -1,3 +1,5 @@ -Error: Failed to compile types file [ROOT]/contracts/precompiled.types.tolk for precompiled: [ROOT]/contracts/precompiled.types[LINE]: error: unknown type name `MissingMessage` +Error: Failed to compile types file [ROOT]/contracts/precompiled.types.tolk for precompiled: error: unknown type name `MissingMessage` + --> [ROOT]/contracts/precompiled.types[LINE] + | 3 | incomingMessages: MissingMessage | ^^^^^^^^^^^^^^ diff --git a/tests/integration/snapshots/wrapper/test_wrapper_generation_typescript_from_boc_contract_with_types/abi.json b/tests/integration/snapshots/wrapper/test_wrapper_generation_typescript_from_boc_contract_with_types/abi.json index c3731e29a9..437b8d6891 100644 --- a/tests/integration/snapshots/wrapper/test_wrapper_generation_typescript_from_boc_contract_with_types/abi.json +++ b/tests/integration/snapshots/wrapper/test_wrapper_generation_typescript_from_boc_contract_with_types/abi.json @@ -3,7 +3,7 @@ "alias_instantiations": [], "code_boc64": "te6ccgEBBAEAaAABFP8A9KQT9LzyyAsBAgFiAwIAEaFM8dqJoaZ/owCS0PiRkTDgIO1E0NM/0aYGyMs/ye1U1ywgAAAAHI4TW/iSyM+FCPpScM8LbsmBAKD7AODXLCAAAAAUljH6ADDy8OAwhA8BxwDy9A==", "compiler_name": "tolk", - "compiler_version": "1.4.2", + "compiler_version": "1.5.0", "contract_name": "Precompiled", "declarations": [ { diff --git a/tests/integration/test_runner/config_storage_prices_get_initial_empty_dict_falls_back_to_zero_prices_tests.rs b/tests/integration/test_runner/config_storage_prices_get_initial_empty_dict_falls_back_to_zero_prices_tests.rs index 2bff810b82..19a3f81576 100644 --- a/tests/integration/test_runner/config_storage_prices_get_initial_empty_dict_falls_back_to_zero_prices_tests.rs +++ b/tests/integration/test_runner/config_storage_prices_get_initial_empty_dict_falls_back_to_zero_prices_tests.rs @@ -25,7 +25,7 @@ fn config_storage_prices_get_initial_prefers_zero_key_when_present() { "dp-stdlib-config-storage-prices-get-initial-prefers-zero-key", r" get fun `test dp stdlib config storage prices get initial prefers zero key`() { - var prices = map []; + var prices = StoragePricesDict []; prices.set(0, StoragePrices { initialUnixTime: 0, bitPrice: 101, diff --git a/tests/integration/test_runner/config_storage_prices_multi_entry_roundtrip_keeps_initial_and_future_entries_tests.rs b/tests/integration/test_runner/config_storage_prices_multi_entry_roundtrip_keeps_initial_and_future_entries_tests.rs index c80ca850e2..b485a8fa9a 100644 --- a/tests/integration/test_runner/config_storage_prices_multi_entry_roundtrip_keeps_initial_and_future_entries_tests.rs +++ b/tests/integration/test_runner/config_storage_prices_multi_entry_roundtrip_keeps_initial_and_future_entries_tests.rs @@ -30,7 +30,7 @@ get fun `test bc stdlib config storage prices multi entry roundtrip`() { val extraTs: uint32 = 1000000; var config = testing.getConfig(); - var prices = createEmptyMap(); + var prices = StoragePricesDict []; prices.setInitial(StoragePrices { initialUnixTime: 0, bitPrice: 11, @@ -83,7 +83,7 @@ get fun `test bc stdlib config storage prices set initial overwrites index zero` val extraTs: uint32 = 2000000; var config = testing.getConfig(); - var prices = createEmptyMap(); + var prices = StoragePricesDict []; prices.setInitial(StoragePrices { initialUnixTime: 0, bitPrice: 101, diff --git a/tests/integration/test_runner/config_storage_prices_roundtrip_preserves_multiple_timestamp_entries_tests.rs b/tests/integration/test_runner/config_storage_prices_roundtrip_preserves_multiple_timestamp_entries_tests.rs index bc69e8b261..d6013ec2b0 100644 --- a/tests/integration/test_runner/config_storage_prices_roundtrip_preserves_multiple_timestamp_entries_tests.rs +++ b/tests/integration/test_runner/config_storage_prices_roundtrip_preserves_multiple_timestamp_entries_tests.rs @@ -31,7 +31,7 @@ get fun `test dr stdlib config storage prices multi entry roundtrip`() { val tsA: uint32 = 1700000000; val tsB: uint32 = 1700003600; - var prices = createEmptyMap(); + var prices = StoragePricesDict []; prices.set(0, StoragePrices { initialUnixTime: 0, bitPrice: 11, @@ -101,7 +101,7 @@ get fun `test dr stdlib config storage prices second write replacement`() { val oldTsB: uint32 = 1800003600; val newTs: uint32 = 1900000000; - var first = createEmptyMap(); + var first = StoragePricesDict []; first.set(0, StoragePrices { initialUnixTime: 0, bitPrice: 9, @@ -128,7 +128,7 @@ get fun `test dr stdlib config storage prices second write replacement`() { config.setStoragePrices(first); expect(testing.setConfig(config)).toBeTrue(); - var second = map []; + var second = StoragePricesDict []; second.set(0, StoragePrices { initialUnixTime: 0, bitPrice: 901, diff --git a/tests/integration/test_runner/config_storage_prices_set_initial_overwrites_zero_and_preserves_future_entries_tests.rs b/tests/integration/test_runner/config_storage_prices_set_initial_overwrites_zero_and_preserves_future_entries_tests.rs index 693780e24e..8929638482 100644 --- a/tests/integration/test_runner/config_storage_prices_set_initial_overwrites_zero_and_preserves_future_entries_tests.rs +++ b/tests/integration/test_runner/config_storage_prices_set_initial_overwrites_zero_and_preserves_future_entries_tests.rs @@ -31,7 +31,7 @@ get fun `test dq stdlib config storage prices set initial overwrite preserves fu val futureTsB: uint32 = 2000000; var config = testing.getConfig(); - var prices = createEmptyMap(); + var prices = StoragePricesDict []; prices.setInitial(StoragePrices { initialUnixTime: 0, bitPrice: 11,