You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/v3/documentation/smart-contracts/func/docs/functions.md
+39-2Lines changed: 39 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -301,8 +301,45 @@ When a function is marked with the `inline_ref` specifier, its code is stored in
301
301
302
302
#### method_id
303
303
304
-
In a TVM program, every function has an internal integer ID that determines how it can be called. By default, ordinary functions are assigned sequential numbers starting from `1`, while contract get-methods use `crc16` hashes of their names.
305
-
The `method_id(<some_number>)` specifier allows you to set a function’s ID to a specific value manually. If no ID is specified, the default is calculated as `(crc16(<function_name>) & 0xffff) | 0x10000`. If a function has the `method_id` specifier, it can be invoked by its name as a get-method in lite client or TON explorer.
304
+
In a TVM program, every function has an internal integer ID that determines how it can be called.
305
+
By default, ordinary functions are assigned sequential numbers starting from `1`, while contract get-methods use `crc16` hashes of their names.
306
+
The `method_id(<some_number>)` specifier allows you to set a function's ID to a specific value manually.
307
+
If no ID is specified, the default is calculated as `(crc16(<function_name>) & 0xffff) | 0x10000`.
308
+
If a function has the `method_id` specifier, it can be invoked by its name as a get-method in lite client or TON explorer.
309
+
310
+
:::info
311
+
There is a catch if you try to define specific ID manually:
312
+
- It should not exceed `0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`
313
+
- Due to a lazy check in types it can accept up to `0x6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff` and succesfully compile
314
+
- In TVM it is still a 257-bit unsigned variable, so it should be defined in range
A 65-character hex string represents \( 65 times 4 = 260 \) bits.
337
+
So, `260 < 310 - 2`. Such a number (65 hex digits) can *pass* this initial length check. This check is designed to quickly reject inputs that are grossly too large. The `-2` is a slight margin.
338
+
339
+
After basic parsing into internal `digits_`, it calls `normalize_bool_any()`.
340
+
341
+
If `normalize_bool_any()` returns `false`, `parse_hex_any` will invalidate the `BigInt` and return `0`, indicating a parsing failure. This leads to `td::string_to_int256` returning a `null``RefInt256`.
0 commit comments