TON Дев Чат
OutList ~n
, а OutList n
. Т.е. мы знаем значение n на момент (де)сериализации
Outlist 0
строго один конструктор (empty)
list1:(OutList n1) list2:(OutList n2)
.store(OutList 0).store(OutList 5)
.store(OutList 5).store(OutList 0)
.store(OutList 0).store(OutList 5)кодирует тоже самое, что:
.store(OutList 5).store(OutList 0)и для однозначного восстановления, нужно знать хотя бы одну длину
() recv_internal (int balance, int msg_value, cell in_msg_full, slice in_msg_body)
() recv_internal(slice in_msg)
() recv_internal (int balance, int msg_value, cell in_msg_full, slice in_msg_body)
() recv_internal ()
() recv_internal (slice in_msg_body)
() recv_internal (cell in_msg_full, slice in_msg_body)
() recv_internal (int msg_value, cell in_msg_full, slice in_msg_body)
() recv_internal (int balance, int msg_value, cell in_msg_full, slice in_msg_body)
send_raw_message(msg, 0x64);
() recv_internal (cell in_msg_full)
begin_cell().store_uint(0xc79ef4a2d9f62e3524589863b094, 240).end_cell().begin_parse();
slice my_slice() asm "x{deadbeef} PUSHSLICE";
begin_cell().store_uint(0x18, 6)...и виртуальная машина заменяет пустой адрес (5 и 6 бит) на адрес отправителя.
.store_cell(c)
.store_slice(c.begin_parse())
.store_builder(b)
cell address1 = begin_cell().store_uint(4, 3).store_uint(35, 8).store_uint(11111, 256).end_cell();
cell in_msg_full = begin_cell() ....
.store_slice(address1.begin_parse())
• CF17 — STBR (b b0 – b00), concatenates two Builder s
builder store_builder(builder a, builder b) inline asm "STBR";
tuple stack = unsafe_tuple([balance, msg_value, in_msg_full, in_msg_body]);Вершина стека в unsafe_tuple справа?
return [0, stack, address3, get_c7(), null()];
int equal_slices (slice a, slice b) asm "SDEQ";
int cell_equal? (cell a, cell b) asm "HASHCU SWAP HASHCU EQUAL";
готово).store_ref(begin_cell().store_slice(s).end_cell())
C:\users\nns20\Development\TON\contest-1\tests\2_tests.fc:28:25: error: `;` expected instead of `=`Мне нужна только глобальная константа, т.е. значение задано сразу и известно на этапе компиляции
global builder address1 = begin_cell().store_uint(4, 3).store_uint(35, 8).store_uint(1111, 256);
cell to_cell(builder b);
cell to_cell(slice s);
.to_cell()
cs.end_parse();
cs.end_parse();
throw_unless(137, cs.slice_empty?())
store_slice- мы заносим все содержимое слайса в создающуюся клетку? мы потом можем после этого достать значение из слайса, который заносим, как если бы не было этого промежуточного этапа?
throw_unless(137, cs.slice_empty?())

is not a type identifierint slice_data_equal? (slice a, slice b) asm "SDEQ";
"Asm.fif" include
x{123} x{456} <{ SDEQ }>s runvmcode .s
.store_uint(0x18, 6)
slice ito_slice(int i, int len) inline method_id {
return begin_cell().store_int(i, len).end_cell().begin_parse();
}
body:(Either X ^X) = MessageRelaxed X;
() recv_internal (int balance, int msg_value, cell in_msg_full, slice in_msg_body) {
in_msg_body
ведь всегда будет нужным телом сообщения?[ 3][t 0][2022-04-05 02:26:47.6313859][vm.cpp:558] steps: 98 gas: used=6644, max=9223372036854775807, limit=9223372036854775807, credit=0
[ 3][t 0][2022-04-05 02:26:47.6316385][vm.cpp:558] steps: 54 gas: used=2735, max=1000000000, limit=1000000000, credit=0
[ 3][t 0][2022-04-05 02:26:47.6318017][vm.cpp:558] steps: 210 gas: used=14692, max=9223372036854775807, limit=9223372036854775807, credit=0
INFO: Test [third_1a] status: [SUCCESS] Gas used: [2735]
баланс_сообщения/стоимость_газа
в случае интернал сообщениябаланс_контракта/стоимость_газа
.The aim of two owner wallet is to create smart-contract which send messages then and only then both owners (represented by public keys) authorized it.
when contract get internal message from Manager with 32-bit unsigned op equal to 1 [more on op's here](https://ton.org/docs/#/howto/smart-contract-guidelines?id=internal-messages)
followed by some 64-bit unsigned query_id,
followed by valid MsgAddress, it should store obtained address in the storage.
when address memorizer get any other message it should throw
.store_uint(185333423424123, 240)
[ 1][t 0][2022-04-05 15:45:36.2451927][Fift.cpp:67] top: tuple
level 1: [in append:] ... <continuation 000002718F13CB50> "list" <continuation 000002718F13CAC0> @ dup null? not { <continuation 000002718F1C66D0> } { <continuation 000002718F1C6A00> } cond "list_cnt" <continuation 000002718F13CAC0> @ 1 + tuple **HERE** "list" <continuation 000002718F13CAC0> !
level 2: <while loop condition:> { dup null? not <literal of type 11> @ 1 = xor }
level 3: <text interpreter continuation>
[ 1][t 0][2022-04-05 15:45:36.2454141][fift-main.cpp:204] Error interpreting file `C:\Users\nns20\AppData\Local\Temp\tmptzwjbnu1.fif`: tmptzwjbnu1.fif:76: while:stack underflow
(slice aa, slice bb, slice cc, slice dd, slice ee, int ff) = gg();
lvalue expression constructor is 9
fatal: cannot compile lvalue expression with unknown constructor
(slice, slice, slice, slice, slice, int) third_1b_params() inline method_id {
init();
return (address_1, address_2, address_3, address_4, address_5, 8912341234);
}
функция a() { ... }Вот если функция 'b' была бы ДО функции 'a', несмотря на то, что она её использует не напрямую, а через параметр, то выходит такое мутное сообщение:
функция b(f) {
f();
}
функция c() {
b(a);
}
[ 1][t 0][2022-04-05 16:11:18.2779279][Fift.cpp:67] top: untuple
level 1: [in append:] "list_cnt" <continuation 0000021806A1DBD0> "list" <continuation 0000021806A1DBD0> "list" <continuation 0000021806A1D600> @ dup null? not { <continuation 0000021806AAA510> } { <continuation 0000021806AAAC90> } cond **HERE** "list_cnt" <continuation 0000021806A1D600> @ 1 + tuple "list" <continuation 0000021806A1D600> !
level 2: <literal of type 11> <literal of type 11> append **HERE** <literal of type 11> <literal of type 11> append
level 3: <while loop condition:> { dup null? not <literal of type 11> @ 1 = xor }
level 4: <text interpreter continuation>
[ 1][t 0][2022-04-05 16:11:18.2781274][fift-main.cpp:204] Error interpreting file `C:\Users\nns20\AppData\Local\Temp\tmpqkinvthu.fif`: tmpqkinvthu.fif:76: while:tuple size mismatch
cell_empty?(actions)но получаю ошибку с кодом 7 (Type check error. An argument to a primitive is of incorrect value type)
int cell_empty?(cell c) inline method_id {
return c.begin_parse().slice_empty?();
}
{
dump_stack();
throw(338);`
...
#DEBUG#: stack(4 values) : ??? 102 C{F816E4052CD4BD65094E80CC077F3B8D1FADD6D8C0C5E09DF7FFE0ED34909920} [ 0][t 0][2022-04-05 16:39:30.9055964][refcnt.hpp:288] Check `ptr && "deferencing null Ref"` failed
_ third_1b_check(int exit_code, cell data, tuple stack, cell actions, int gas) method_id(11) {
dump_stack();
throw(335);
...
#DEBUG#: stack(5 values) : 102 C{F816E4052CD4BD65094E80CC077F3B8D1FADD6D8C0C5E09DF7FFE0ED34909920} [0] [ 0][t 0][2022-04-05 16:43:39.6687026][refcnt.hpp:288] Check `ptr && "deferencing null Ref"` failed
#DEBUG#: stack(3 values) : 0 C{465696C8DCF7130470F5D57E32459726C537E45682863A38159EFD3F51530C1C} C{5A0750CCF6132DA7CD2FFB182F092381598D24AADF23E8D78EB4AFFCC67E2E83}Но в этот раз он не падает
print(actions)
actions~dump();
#DEBUG#: s0 = [ 0][t 0][2022-04-05 17:13:28.3422267][refcnt.hpp:288] Check `ptr && "deferencing null Ref"` failed
#DEBUG#: stack(1 values) : C{[ 0][t 0][2022-04-05 17:22:12.317588758][refcnt.hpp:288] Check `ptr && "deferencing null Ref"` failed
int actions_empty?(cell a) inline asm "<{ CTOS DROP 0 PUSHINT }>CONT <{ DROP -1 PUSHINT }>CONT 1 1 TRYARGS";
int imp = actions_empty?(actions);
imp~dump();
var ccs = data.begin_parse();
ccs~impure_touch();
throw(80);
0 pushint
в обратном порядке?recv_interna
l с четырьмя параметрами?() recv_internal (int balance, int msg_value, cell in_msg_full, slice in_msg_body) {
;; testable
() recv_internal (int balance, int msg_value) {
~dump(balance);
~dump(msg_value);
}
;; Set message that our wallet will send
cell message_to_send = begin_cell()
.store_int(123, 32)
.store_int(234, 32)
.end_cell();
tuple stack = unsafe_tuple([balance, msg_value, in_msg_full, in_msg_body]);
int imp = actions_empty?(actions);
imp~dump();
var ccs = data.begin_parse();
ccs~impure_touch();
throw(80);
int actions_empty?2(cell c) inline asm "XLOADQ SWAP DROP";но получаю
[ 1][t 0][2022-04-05 18:50:26.1311399][Fift.cpp:67] top: <text interpreter continuation>
level 1: <continuation 00000155A6BDA2F0>
level 2: <text interpreter continuation>
[ 1][t 0][2022-04-05 18:50:26.1312733][fift-main.cpp:204] Error interpreting file `C:\Users\nns20\AppData\Local\Temp\tmppauq4gsy.fif`: task3_tests.fif:510: XLOADQ:-?
C:\Users\nns20\AppData\Roaming\Python\Python310\site-packages\toncli\lib\fift-libs\Asm.fif
int actions_empty?(cell a) inline asm "<{ CTOS DROP 0 PUSHINT }>CONT <{ DROP -1 PUSHINT }>CONT 1 1 TRYARGS";
set_data()
, если сообщение было успешно обработано, также попадает в actions?
throw(0)
глубоко в if бранчах?
import ed25519
# private: 925ead45b48e2db183bff9ae782230e952495ba95fd3bcf6ca0debb981a18cb801f33ee69d38cba5c759f34570964291ba06ef594092a83f036fb26ee0715a19
# public: 01f33ee69d38cba5c759f34570964291ba06ef594092a83f036fb26ee0715a19
# ^ в комменте вторая пара ключей на всякий
PRIVATE = bytes.fromhex(
'35a18e5c796bfa7c22b9dbd4cb57ce990da253ea6d40c7c4ef00040685c5eeb2' +
'd9ac7c0682a097dbe84a53df6a72a11135be337b71445a056406a37cc024cd0a')
PUBLIC = bytes.fromhex('d9ac7c0682a097dbe84a53df6a72a11135be337b71445a056406a37cc024cd0a')
signing_key = ed25519.SigningKey(PRIVATE)
sign = signing_key.sign(bytes.fromhex(hex(98831049219504741011544657337442627844289035555318487676891727858432755918071)[2:]), encoding='hex')
print(sign[0:64])
print(sign[64:])
tuple my_get_c7() impure asm "c7 PUSH";
[[int, int, int, int, int, int, int, (int), slice, int, [cell, cell]]] inner_get_c7() impure asm "c7 PUSH";
() set_c7(tuple value) impure asm "c7 POP";
() my_change_current_time(int time) impure method_id {
[int a1, int a2, int a3, int a4, int a5, int a6, int a7, (int) a8, slice a9, int a10, [cell, cell] a11] = inner_get_c7().unsafe_tuple().car();
set_c7(unsafe_tuple([[a1, a2, a3, time, a5, a6, a7, a8, a9, a10, a11]]));
}
dict_set
, то читать нужно dict_get
, аdict_set_ref
, то читать нужно dict_get_ref
dict_get
читает оттуда, где есть данные (=в зависимости от того, какой функцией записали)?
.dict_set_ref
, то можно сослаться на абсолютно любую ячейку, а что если используется .dict_set
? Сколько мета-информации хранится в ячейке? Только 256 бит ключа (и есть место для 1023-256 бит данных) или там что-то ещё есть, что занимает место?
key3 = uto_slice(0x66e6d6994c559aa9e8a946abc1feb128d7b7ef5e3cc568240cbf4d5c93668565, key_len);
~dump(key3);
key4 = uto_slice(0x96949133dbe5122b14fe6bc0449170e59bad5dbca927363b2118f8ab4734bd5c, key_len);
~dump(key4);
key5 = uto_slice(0xa3c3128c49472822b5d21f18f1165581dba82c09d4ab7bd3a482cd2eefde9924, key_len);
~dump(key5);
key6 = uto_slice(0xdbab551d6e14cdf1f3f628c03f27a3484df7062e59bd9131a2114b405f224e40, key_len);
~dump(key6);
#DEBUG#: s0 = CS{Cell{004066e6d6994c559aa9e8a946abc1feb128d7b7ef5e3cc568240cbf4d5c93668565} bits: 0..256; refs: 0..0}
#DEBUG#: s0 = CS{Cell{004096949133dbe5122b14fe6bc0449170e59bad5dbca927363b2118f8ab4734bd5c} bits: 0..256; refs: 0..0}
#DEBUG#: s0 = CS{Cell{0040a3c3128c49472822b5d21f18f1165581dba82c09d4ab7bd3a482cd2eefde9924} bits: 0..256; refs: 0..0}
#DEBUG#: s0 = CS{Cell{0040dbab551d6e14cdf1f3f628c03f27a3484df7062e59bd9131a2114b405f224e40} bits: 0..256; refs: 0..0}
init();
~dump(key5);
#DEBUG#: s0 = CS{Cell{004066e6d6994c559aa9e8a946abc1feb128d7b7ef5e3cc568240cbf4d5c93668565} bits: 0..256; refs: 0..0}
#DEBUG#: s0 = ()
#DEBUG#: s0 = CS{Cell{004096949133dbe5122b14fe6bc0449170e59bad5dbca927363b2118f8ab4734bd5c} bits: 0..256; refs: 0..0}
#DEBUG#: s0 = CS{Cell{0040a3c3128c49472822b5d21f18f1165581dba82c09d4ab7bd3a482cd2eefde9924} bits: 0..256; refs: 0..0}
#DEBUG#: s0 = CS{Cell{0040dbab551d6e14cdf1f3f628c03f27a3484df7062e59bd9131a2114b405f224e40} bits: 0..256; refs: 0..0}
[ 3][t 0][2022-04-06 02:46:05.5831700][vm.cpp:558] steps: 131 gas: used=10840, max=9223372036854775807, limit=9223372036854775807, credit=0
[ 1][t 0][2022-04-06 02:46:05.5839593][Fift.cpp:67] top: untuple
level 1: [in run-test:] ... "temp-prev-c5" <continuation 0000021FD006D090> 2 tuple 11 tuple 1 tuple 17 runvmx 0= not { <continuation 0000021FD1B235E0> } if 5 untuple **HERE** dup null? { <continuation 0000021FD1B22BC0> } if "gas-limit" <continuation 0000021FD006CEB0> "c7" <continuation 0000021FD006CEB0> "c4" <continuation 0000021FD006CEB0> "stack" <continuation 0000021FD006CEB0> "function" <continuation 0000021FD006CEB0> "test" <continuation 0000021FD006CEB0> ...
level 2: drop <literal of type 11> @ <literal of type 11> @ get-test run-test **HERE** <literal of type 11> @ swap <literal of type 11> ! swap <literal of type 11> !
level 3: <while loop condition:> { dup 0> }
level 4: <text interpreter continuation>
[ 1][t 0][2022-04-06 02:46:05.5840910][fift-main.cpp:204] Error interpreting file `C:\Users\nns20\AppData\Local\Temp\tmpbjrz4_ql.fif`: tmpbjrz4_ql.fif:195: while:not a tuple
init() impure inline method_id
~dump
вконце внутри или снаружи
IF:<{ }>
фифт код. Поскольку появление такого условия как правило само по себе ошибка - мы пока не правим, чтобы не было сомнений в версии библиотек у участников: поправим после конкурса.
LDDICT (s – D s′)второе в стеке (s') - это то, что осталось от слайса же?
execute LDDICT
[ 85208338799662122639103126216355732827322384173773517984715357586254948655441 80716348486207496276731076897282147363587090687123560087104282620509894221332 CS{Cell{010a62475ae340} bits: 0..40; refs: 0..1} C{E26FC89C284099627BC70384A49E436985FB758FD6499C611B4B06CDA7699447} CS{Cell{0101c0} bits: 1..1; refs: 1..1} ]
execute DROP
[ 85208338799662122639103126216355732827322384173773517984715357586254948655441 80716348486207496276731076897282147363587090687123560087104282620509894221332 CS{Cell{010a62475ae340} bits: 0..40; refs: 0..1} C{E26FC89C284099627BC70384A49E436985FB758FD6499C611B4B06CDA7699447} ]
cell sldreftodict(slice x) asm "LDREFRTOS NIP LDDICT DROP";
cell sldreftodict(slice x) asm "LDREFRTOS SWAP LDDICT DROP";по сути одно и то же, но у второго остается мусор из-за свапа 🤔
init();
slice kkk = key2;
~dump(kkk);
#DEBUG#: s0 = ()
2222.uto_slice(2)
[ 3][t 0][2022-04-06 12:59:31.2461165][vm.cpp:558] steps: 18 gas: used=1343, max=9223372036854775807, limit=9223372036854775807, credit=0
[ 1][t 0][2022-04-06 12:59:31.2469192][Fift.cpp:67] top: untuple
level 1: [in run-test:] ... "temp-prev-c5" <continuation 00000214DA8E8010> 2 tuple 11 tuple 1 tuple 17 runvmx 0= not { <continuation 00000214DA97A700> } if 5 untuple **HERE** dup null? { <continuation 00000214DA97A850> } if "gas-limit" <continuation 00000214DA8E8130> "c7" <continuation 00000214DA8E8130> "c4" <continuation 00000214DA8E8130> "stack" <continuation 00000214DA8E8130> "function" <continuation 00000214DA8E8130> "test" <continuation 00000214DA8E8130> ...
level 2: drop <literal of type 11> @ <literal of type 11> @ get-test run-test **HERE** <literal of type 11> @ swap <literal of type 11> ! swap <literal of type 11> !
level 3: <while loop condition:> { dup 0> }
level 4: <text interpreter continuation>
[ 1][t 0][2022-04-06 12:59:31.2470736][fift-main.cpp:204] Error interpreting file `C:\Users\nns20\AppData\Local\Temp\tmpwbq6iik3.fif`: tmpwbq6iik3.fif:195: while:stack underflow
var zhuk =
begin_cell()
.store_zeros(1000)
.store_uint(1, 24)
.end_cell();
zhuk~impure_touch();
[int, tuple, cell, tuple, int] fourth_1a_data() method_id(0) {
throw(800);
while:stack underflow
valid_until_2 = 22222;
5 6 + 7 8 + *
5 pushint 6 pushint + 7 pushint 8 pushint + *
() f() asm "**************"
9 PUSHPOW2- это получается PUSH 2^9 = 512
PUSHPOW2 xx + 1, (quietly) pushes 2xx+1 for 0 ≤ xx ≤ 255.
x{deadbeef} PUSHSLICE
.store_uint
.store_slice
invokeGetMethod('test', .....
invokeGetMethod(72549, .....
import source from './source.fif';
store_ref
?_ test_example(int exit_code, cell data, tuple stack, cell actions, int gas) method_id(1) {
throw_if(100, exit_code != 0); ;; test need to be passed
var as = actions.begin_parse();
var ref = as~load_ref();
var refs = ref.begin_parse();
~dump(refs);
}
#DEBUG#: s0 = CS{Cell{0000} bits: 0..0; refs: 0..0}
https://github.com/Naltox/ton-contract-executor/blob/main/README.md
node experiment.js
PS C:\Users\nns20\Development\TON\contest-1> node experiment.js
node:internal/errors:465
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ton-contract-executor' imported from C:\Users\nns20\Development\TON\contest-1\experiment.js
...
yarn add ton-contract-executor
"name": "contest-1",
"packageManager": "yarn@3.2.0",
"type": "module",
"dependencies": {
"ton-contract-executor": "^0.4.0"
},
npm install
'C:\Users\nns20\Development\TON\contest-1\node_modules\ton-compiler\bin\macos\func' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\nns20\Development\TON\contest-1\node_modules\ton-contract-executor\dist\vm-exec\vm-exec.js:147
throw ex;
^
Error: Command failed: C:\Users\nns20\Development\TON\contest-1\node_modules\ton-compiler\bin\macos\func -PS -o C:\Users\nns20\AppData\Local\Temp\tmp-11968-N8t4v0UWWWR9 C:\Users\nns20\Development\TON\contest-1\node_modules\ton-compiler\funclib\stdlib.fc C:\Users\nns20\AppData\Local\Temp\tmp-11968-QFTCDo77XVcT
at checkExecSyncError (node:child_process:828:11)
at Object.execSync (node:child_process:899:15)
at executeFunc (C:\Users\nns20\Development\TON\contest-1\node_modules\ton-compiler\dist\index.js:145:11)
at C:\Users\nns20\Development\TON\contest-1\node_modules\ton-compiler\dist\index.js:185:21
at step (C:\Users\nns20\Development\TON\contest-1\node_modules\ton-compiler\dist\index.js:52:23)
at Object.next (C:\Users\nns20\Development\TON\contest-1\node_modules\ton-compiler\dist\index.js:33:53)
at fulfilled (C:\Users\nns20\Development\TON\contest-1\node_modules\ton-compiler\dist\index.js:24:58) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 14924,
stdout: null,
stderr: null
}
Node.js v17.8.0
EQDPDWTfBsnlGYxyhDq0vhSq-LvKqVN8ZIup_jSFrhOVjgGJ
processing fees
- это то, что я собираю руками по гайду https://ton.org/docs/#/smart-contracts/fees?id=tvm-instructions-cost и вгоняю как хардкод, или же это как-то можно узнать прямо в рантайме и подставить в код?incoming value minus processing fees
». inline method_id. В чем может быть проблема? если я объявляю какие-то функции, которые хочу просто использовать в други тестовых функций
.store_grams(10)
throw
, а само собой, например чтением за границей слайса, то ton-contract-executor кидает исключение?Error: Cant execute vm: cannot serialize a null cell reference into a bag of cells
C:\Users\nns20\Development\TON\contest-1\node_modules\ton-contract-executor\dist\vm-exec\vm-exec.js:147
throw ex;
^
Error: Cant execute vm: cannot serialize a null cell reference into a bag of cells
at SmartContract.runContract (C:\Users\nns20\Development\TON\contest-1\node_modules\ton-contract-executor\dist\executor\SmartContract.js:71:19)
at async SmartContract.sendInternalMessage (C:\Users\nns20\Development\TON\contest-1\node_modules\ton-contract-executor\dist\executor\SmartContract.js:100:19)
at async testShort (file:///C:/Users/nns20/Development/TON/contest-1/js/tests_1.ts:43:15)
at async file:///C:/Users/nns20/Development/TON/contest-1/js/tests_1.ts:76:1
Node.js v17.8.0
() recv_internal(slice in_msg) impure {
throw(-3);
sendInternalMessage
возвращают ровно на 500 газа больше
64-bit `valid_until` unixtime
Error: Cant execute vm: invalid bag-of-cells last cell #0: end offset 2 is different from total data size 130но к ней я вряд ли смогу подобрать минимальный пример
at SmartContract.runContract (C:\Users\nns20\Development\TON\contest-1\node_modules\ton-contract-executor\dist\executor\SmartContract.js:71:19)
at async SmartContract.sendInternalMessage (C:\Users\nns20\Development\TON\contest-1\node_modules\ton-contract-executor\dist\executor\SmartContract.js:100:19)
at async testSet (file:///C:/Users/nns20/Development/TON/contest-1/js/tests_4.ts:113:12)
at async file:///C:/Users/nns20/Development/TON/contest-1/js/tests_4.ts:275:3
begin_cell().end_cell()
Your submission has been accepted
, но что-то уверенности в данном файле нет
That means that if, for instance, your message body size is 900 bits long you can not to store it in the same cell with the message header. Indeed, in addition to message header fields, total size of the cell will be more than 1023 bits and during serialization there will be cell overflow exception.
In this case, instead of 0 that stands for "inplace message body flag (Either)" there should be 1 and message body should be stored in reference cell.
Т.е. если я хочу сохранить какой-то cлайс как ссылку, то при формировании сообщения я должен написать вот так?.store_uint(0, 1 + 4 + 4 + 64 + 32 + 1)Или это не играет большую роль и можно оставить просто
.store_uint(1, 1)
.store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1)?
Either X ^X
, и если ты хочешь выбрать ^X
, то нужно поставить 1Either
, будто оно работает и так, и так, но зачем тогда писать, что нужно менять последний бит на 1 🤔
.store_uint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1)
load_msg_addr
. Я правильно понимаю, что она берет какой-то слайс, бежит по нему и возвращает первый попавшейся адрес в нём?
returns both this prefix s' and the remainder s'' of s as slices.
s'
это выходит адресс, а s''
, всё, что идёт после адреса?
EQAyPDNoPgx7_-DTvAlWo1gGLCsCQR57J-1GFODuUPA8InLC
в слайс? ;; slice address1 = begin_cell().store_uint(4, 3).store_uint(wc, 8).store_uint(addr, 256).end_cell();
address_none = begin_cell().store_uint(0, 2).bto_slice();
address_1 = begin_cell().store_uint(4, 3).store_uint(10, 8).store_uint(111, 256).bto_slice();
address_2 = begin_cell().store_uint(4, 3).store_uint(20, 8).store_uint(2222, 256).bto_slice();
address_3 = begin_cell().store_uint(4, 3).store_uint(30, 8).store_uint(33333, 256).bto_slice();
address_4 = begin_cell().store_uint(4, 3).store_uint(40, 8).store_uint(444444, 256).bto_slice();