1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

rldp-http-proxy: use tonlib

- rldp-http-proxy used TONLib to resolve domains via DNS smartcontract
- updated tonlib
- bugfixes
This commit is contained in:
ton 2020-02-12 00:14:16 +04:00
parent 1de39f5d7c
commit 493ae2410c
34 changed files with 816 additions and 153 deletions

View file

@ -1082,6 +1082,7 @@ variable @proclist
variable @procdict
variable @procinfo
variable @gvarcnt
variable asm-mode 1 asm-mode !
19 constant @procdictkeylen
32 constant @zcount
{ pair @proclist @ cons @proclist ! } : @proclistadd
@ -1144,8 +1145,18 @@ variable @gvarcnt
{ ."Procedure `" over type ."` index=" 2 pick . ." flags=0x" dup x. cr } : @showprocinfo
// ( proc_name proc_idx f -- ) f:+1=declared, +2=defined, +4=inlined, +8=called, +16=method
{ // @showprocinfo
dup 0x1a and 2 = { 2 pick @remove-proc // over ."Removing " type cr
dup 0x1a and 2 = asm-mode @ 3 and and ?dup {
2 and {
over ."Warning: removing (inlined) procedure `" type ."` from call dictionary" cr
} if
2 pick @remove-proc
} if // remove unused procs
dup 0xc and 0xc = asm-mode @ 4 and and {
over ."Warning: inline procedure `" type ."` is not always inlined" cr
} if
dup 0x1e and 2 = asm-mode @ 8 and and {
over ."Warning: procedure `" type ."` defined but not used" cr
} if
drop 2drop
} : @chkprocdef
{ @chkmaindef
@ -1170,6 +1181,14 @@ forget @proclist forget @proccnt
-3 constant split_prepare
-4 constant split_install
{ asm-mode 0 3 ~! } : asm-no-remove-unused
{ asm-mode 1 1 ~! } : asm-remove-unused // enabled by default
{ asm-mode 3 3 ~! } : asm-warn-remove-unused
{ asm-mode 4 4 ~! } : asm-warn-inline-mix
{ asm-mode 0 4 ~! } : asm-no-warn-inline-mix // disabled by default
{ asm-mode 8 8 ~! } : asm-warn-unused
{ asm-mode 0 8 ~! } : asm-no-warn-unused // disabled by default
// ( c -- ) add vm library for later use with runvmcode
{ <b over ref, b> <s swap hash vmlibs @ 256 udict! not abort"cannot add library" vmlibs ! } : add-lib
// ( x -- c ) make library reference cell

View file

@ -79,12 +79,15 @@ variable base
{ char ) word "$" swap $+ 1 { find 0= abort"undefined parameter" execute } } ::_ $(
// b s -- ?
{ sbitrefs rot brembitrefs rot >= -rot <= and } : s-fits?
// b s x -- ?
{ swap sbitrefs -rot + rot brembitrefs -rot <= -rot <= and } : s-fits-with?
{ 0 swap ! } : 0!
{ tuck @ + swap ! } : +!
{ tuck @ swap - swap ! } : -!
{ 1 swap +! } : 1+!
{ -1 swap +! } : 1-!
{ null swap ! } : null!
{ not 2 pick @ and xor swap ! } : ~!
0 tuple constant nil
{ 1 tuple } : single
{ 2 tuple } : pair

View file

@ -69,6 +69,9 @@ library TonUtil // TON Blockchain Fift Library
// ( b wc addr -- b' ) Serializes address into Builder b
{ -rot 8 i, swap 256 u, } : addr,
{ over 8 fits { rot b{100} s, -rot addr, } {
rot b{110} s, 256 9 u, rot 32 i, swap 256 u, } cond
} : Addr,
// Gram utilities
1000000000 constant Gram
@ -171,3 +174,24 @@ recursive append-long-bytes {
{ dup $len 55 <> abort"not 55 alphanumeric characters" "F" swap $+ Base32>B
33 B| 16 B>u@ over crc16 <> abort"crc16 checksum mismatch"
8 B>u@+ 0x2D <> abort"not a valid adnl address" 256 B>u@ } : $>adnl
{ 65 - dup 0>= { -33 and 10 + dup 16 < } { 17 + dup 0>= over 10 < and } cond ?dup nip } : hex-digit?
// ( S -- x -1 or 0 ) Parses a hexadecimal integer
{ dup $len {
0 {
4 << swap 1 $| -rot (char) hex-digit? // S a d -1 or S a 0
{ + over $len 0= } { drop -1 true } cond
} until
dup 0< { 2drop false } { nip true } cond
} { drop false } cond
} : hex$>u?
// ( S -- x )
{ hex$>u? not abort"not a hexadecimal number" } : hex$>u
{ dup $len 64 = { hex$>u } {
dup $len 55 = { $>adnl } {
true abort"invalid adnl address"
} cond } cond
} : parse-adnl-addr
{ adnl>$ type } : .adnl
{ bl word parse-adnl-addr 1 'nop } ::_ adnl:

View file

@ -18,6 +18,7 @@
*/
#include "func.h"
#include "td/utils/crypto.h"
#include "common/refint.h"
#include <fstream>
namespace sym {
@ -1244,8 +1245,9 @@ void parse_func_def(Lexer& lex) {
}
if (val->method_id.is_null()) {
val->method_id = std::move(method_id);
} else if (val->method_id != method_id) {
lex.cur().error("integer method identifier for `"s + func_name.str + "` changed to a different value");
} else if (td::cmp(val->method_id, method_id) != 0) {
lex.cur().error("integer method identifier for `"s + func_name.str + "` changed from " +
val->method_id->to_dec_string() + " to a different value " + method_id->to_dec_string());
}
}
if (f) {

View file

@ -99,22 +99,44 @@ builder store_maybe_ref(builder b, cell c) asm(c b) "STOPTREF";
[UInt<256b>:new_public_key]
-}
() after_code_upgrade(cell root, slice ops, cont old_code) impure method_id(1666);
(cell, slice) process_op(cell root, slice ops) inline_ref {
int op = ops~load_uint(6);
int is_name_ref = (ops~load_uint(1) == 1);
;; lets assume at this point that special operations 00..09 are handled
throw_if(45, op < 10);
slice name = ops; ;; anything! better do not begin or it costs much gas
cell cat_table = null();
if (op < 10) {
ifnot (op) {
;; 00 Noop: No operation
return (root, ops);
}
if (op == 1) {
;; 01 SMsg: Send Message
var mode = ops~load_uint(8);
send_raw_message(ops~load_ref(), mode);
return (root, ops);
}
if (op == 9) {
;; 09 CodeUpgrade
var new_code = ops~load_ref();
set_code(new_code);
var old_code = get_c3();
set_c3(new_code.begin_parse().bless());
after_code_upgrade(root, ops, old_code);
throw(0);
return (root, ops);
}
throw(45);
return (root, ops);
}
int cat = 0;
if (op < 20) {
;; for operations with codes 10..19 category is required
cat = ops~load_int(16);
}
int zeros = 0;
slice name = null(); ;; any slice value
cell cat_table = null();
if (op < 30) {
;; for operations with codes 10..29 name is required
int is_name_ref = (ops~load_uint(1) == 1);
if (is_name_ref) {
;; name is stored in separate referenced cell
name = ops~load_ref().begin_parse();
@ -129,17 +151,18 @@ builder store_maybe_ref(builder b, cell c) asm(c b) "STOPTREF";
int name_last_byte = name.slice_last(8).preload_uint(8);
throw_if(40, name_last_byte);
;; count zero separators
int zeros = 0;
slice cname = name;
repeat (cname.slice_bits() ^>> 3) {
int c = cname~load_uint(8);
zeros -= (c == 0);
}
;; throw_unless(39, zeros == 1);
name = begin_cell().store_uint(zeros, 7).store_slice(name).end_cell().begin_parse();
}
;; operation with codes 10..19 manipulate category dict
;; lets try to find it and store into a variable
;; operations with codes 20..29 replace / delete dict, no need
name = begin_cell().store_uint(zeros, 7).store_slice(name).end_cell().begin_parse();
if (op < 20) {
;; lets resolve the name here so as not to duplicate the code
(slice pfx, cell val, slice tail, int succ) =
@ -187,17 +210,21 @@ builder store_maybe_ref(builder b, cell c) asm(c b) "STOPTREF";
return (null(), ops);
}
throw(44); ;; invalid operation
return (root, ops);
return (null(), ops);
}
cell process_ops(cell root, slice ops) inline_ref {
var stop = false;
root~touch();
ops~touch();
do {
(root, ops) = process_op(root, ops);
if (ops.slice_refs_empty?()) {
stop = true;
} else {
ops = ops~load_ref().begin_parse();
if (ops.slice_data_empty?()) {
if (ops.slice_refs()) {
ops = ops~load_ref().begin_parse();
} else {
stop = true;
}
}
} until (stop);
return root;
@ -205,24 +232,25 @@ cell process_ops(cell root, slice ops) inline_ref {
() recv_external(slice in_msg) impure {
;; Load data
(int stored_subwalet, int last_cleaned, int public_key, cell root, cell old_queries) = load_data();
(int contract_id, int last_cleaned, int public_key, cell root, cell old_queries) = load_data();
;; validate signature and seqno
slice signature = in_msg~load_bits(512);
int shash = slice_hash(in_msg);
var (contract_id, query_id) = (in_msg~load_uint(32), in_msg~load_uint(64));
var (query_contract, query_id) = (in_msg~load_uint(32), in_msg~load_uint(64));
var bound = (now() << 32);
throw_if(35, query_id < bound);
(_, var found?) = old_queries.udict_get?(64, query_id);
throw_if(32, found?);
throw_unless(34, check_signature(shash, signature, public_key));
throw_unless(34, contract_id == query_contract);
throw_unless(35, check_signature(shash, signature, public_key));
accept_message(); ;; message is signed by owner, sanity not guaranteed yet
int op = in_msg.preload_uint(6);
if (op == 51) {
in_msg~skip_bits(6);
public_key = in_msg~load_uint(256);
} elseif (op) { ;; 00 Contract initialization message
} else {
root = process_ops(root, in_msg);
}
@ -244,6 +272,9 @@ cell process_ops(cell root, slice ops) inline_ref {
store_data(contract_id, last_cleaned, public_key, root, old_queries);
}
() after_code_upgrade(cell root, slice ops, cont old_code) impure method_id(1666) {
}
{-
Data structure:
Root cell: [UInt<32b>:seqno] [UInt<256b>:owner_public_key]
@ -268,6 +299,12 @@ int get_contract_id() method_id {
return get_data().begin_parse().preload_uint(32);
}
int get_public_key() method_id {
var cs = get_data().begin_parse();
cs~load_uint(32 + 64);
return cs.preload_uint(256);
}
;;8m dns-record-value
(int, cell) dnsresolve(slice subdomain, int category) method_id {
int bits = subdomain.slice_bits();

View file

@ -50,7 +50,7 @@ variable order# order# 0!
orders ! order# 1+!
} : add-order
// b body -- b'
{ tuck <s 2dup s-fits? not rot over 1 i, -rot
{ tuck <s 2dup 1 s-fits-with? not rot over 1 i, -rot
{ drop swap ref, } { s, nip } cond
} : append-msg-body
// ng wc addr bounce body -- c

View file

@ -51,7 +51,7 @@ variable order# order# 0!
orders ! order# 1+!
} : add-order
// b body -- b'
{ tuck <s 2dup s-fits? not rot over 1 i, -rot
{ tuck <s 2dup 1 s-fits-with? not rot over 1 i, -rot
{ drop swap ref, } { s, nip } cond
} : append-msg-body
// ng wc addr bounce body -- c

View file

@ -0,0 +1,146 @@
#!/usr/bin/fift -s
"TonUtil.fif" include
"GetOpt.fif" include
{ show-options-help 1 halt } : usage
60 =: timeout // external message expires in 60 seconds
"dns-query.boc" =: savefile
begin-options
" <filename-base> <contract-id> [-t<timeout>] [-o<savefile-boc>] <op> [<op2>...]" +cr +tab
+"Creates a request to managed DNS smart contract created by new-manual-dns.fif, with private key loaded from file <filename-base>.pk "
+"and address from <filename-base>-dns<contract-id>.addr, and saves it into <savefile-boc> ('" savefile $+ +"' by default)"
+cr +"<op> is an operation description, one of" +cr +tab
+"add <subdomain> cat <cat-id> (smc <smc-addr> | next <next-resolver-smc-addr> | adnl <adnl-addr> | text <string>)" +cr +tab
+"delete <subdomain> cat <cat-id>" +cr +tab
+"drop <subdomain>"
disable-digit-options generic-help-setopt
"t" "--timeout" { parse-int =: timeout } short-long-option-arg
"Sets expiration timeout in seconds (" timeout (.) $+ +" by default)" option-help
"o" "--output" { =: savefile } short-long-option-arg
"Sets output file for generated initialization message ('" savefile $+ +"' by default)" option-help
"h" "--help" { usage } short-long-option
"Shows a help message" option-help
parse-options
$# 2 < ' usage if
2 :$1..n
$1 =: file-base
$2 parse-int dup =: contract-id 32 fits ' usage ifnot
{ contract-id (.) $+ } : +contractid
{ $* @ dup null? { second $@ ! } { drop } cond } : @skip
{ $* @ null? } : @end?
{ $* @ uncons $* ! } : @next
@next @next 2drop
variable Actions
{ Actions @ cons Actions ! } : register-action
{ @end? abort"subdomain name expected" @next dup $len 127 > abort"subdomain name too long"
} : parse-domain
{ @end? abort"category number expected" @next (number) 1 <> abort"category must be integer"
dup 16 fits not abort"category does not fit into 16 bit integer"
dup 0= abort"category must be non-zero"
} : parse-cat-num
{ @end? abort"`cat` expected" @next "cat" $= not abort"`cat` expected" parse-cat-num
} : parse-cat
{ @end? abort"smart contract address expected"
@next false parse-load-address drop triple
} : cl-parse-smc-addr
{ @end? abort"adnl address expected"
`adnl @next parse-adnl-addr pair
} : cl-parse-adnl-addr
{ @end? abort"subdomain record value expected" @next
dup "smc" $= { drop `smc cl-parse-smc-addr } {
dup "next" $= { drop `next cl-parse-smc-addr } {
dup "adnl" $= { drop cl-parse-adnl-addr } {
dup "text" $= { drop `text @next pair } {
"unknown record type "' swap $+ +"'" abort
} cond } cond } cond } cond
} : parse-value
{ ."Loading new code BoC from " dup type cr
file>B B>boc
} : load-new-code-from
{ @next dup "add" $= { drop `add parse-domain parse-cat parse-value 4 tuple register-action } {
dup "delete" $= { drop `delete parse-domain parse-cat triple register-action } {
dup "drop" $= { drop `drop parse-domain pair register-action } {
dup "upgrade" $= { drop `upgrade @next load-new-code-from pair register-action } {
"unknown action '" swap $+ +"'" abort
} cond } cond } cond } cond
} : parse-action
{ { @end? not } { parse-action } while } : parse-actions
parse-actions
file-base +".pk" load-keypair nip constant wallet_pk
file-base +"-dns" +contractid +".addr" load-address
2dup 2constant smc_addr
."Managed manual DNS smart contract address = " 2dup .addr cr 6 .Addr cr
."Actions: " Actions @ list-reverse .l cr
// ( S -- S1 .. Sn n )
{ 1 swap { dup "." $pos dup 0>= } { $| 1 $| nip rot 1+ swap } while drop swap
} : split-by-dots
// ( S -- s )
{ dup $len dup 0= abort"subdomain cannot be empty" 126 > abort"subdomain too long"
dup 0 chr $pos 1+ abort"subdomain contains null characters"
split-by-dots <b { // ... S b
swap dup $len 0= abort"empty subdomain component" $, 0 8 u,
} rot times b> <s
} : subdomain>s
// ( b V -- b' )
{ dup first
dup `smc eq? { drop untriple rot nip rot x{9fd3} s, -rot Addr, 0 8 u, } {
dup `next eq? { drop untriple rot nip rot x{ba93} s, -rot Addr, 0 8 u, } {
dup `adnl eq? { drop second swap x{ad01} s, swap 256 u, } {
dup `text eq? { drop second swap x{1eda01} s, over $len 8 u, swap $, } {
abort"unknown value type"
} cond } cond } cond } cond
} : value,
{ subdomain>s dup sbits 3 >>
dup 63 > { drop s>c dict, } { rot swap 7 u, swap s, } cond
} : subdomain,
// ( A -- b )
{ dup first
dup `add eq? {
drop 4 untuple <b swap value, b> -rot
<b 11 6 u, swap 16 i, swap subdomain,
swap dict, nip } {
dup `delete eq? {
drop untriple rot drop
<b 12 6 u, swap 16 i, swap subdomain, } {
dup `drop eq? {
drop second <b 22 6 u, swap subdomain, } {
dup `upgrade eq? {
drop second <b 9 6 u, swap ref, } {
abort"unknown action type"
} cond } cond } cond } cond
} : action>b
// ( -- b )
{ Actions @ dup null? { drop <b 0 6 u, b> } {
uncons swap action>b { over null? not } {
b> swap uncons swap action>b rot ref,
} while nip } cond
} : serialize-actions
serialize-actions
dup brembits 888 < { b> <b 0 6 u, swap ref, } if
dup =: actions-builder b>
."Serialized actions are " <s csr. cr
// create a message
// create external message
now timeout + 32 << actions-builder b> hashu 32 1<<1- and + =: query_id
<b contract-id 32 i, query_id 64 u, actions-builder b+ b>
dup ."signing message: " <s csr. cr
dup hashu wallet_pk ed25519_sign_uint
<b b{1000100} s, smc_addr addr, 0 Gram, b{00} s,
swap B, swap <s s, b>
dup ."resulting external message: " <s csr. cr
2 boc+>B dup Bx. cr
."Query_id is " query_id dup . ."= 0x" X. cr
."Query expires in " timeout . ."seconds" cr
savefile tuck B>file
."(Saved to file " type .")" cr

View file

@ -0,0 +1,63 @@
#!/usr/bin/fift -s
"TonUtil.fif" include
"Asm.fif" include
"GetOpt.fif" include
{ show-options-help 1 halt } : usage
Basechain =: wc // create smart contract in basechain
65536 =: timeout
"new-dns-query.boc" =: savefile
variable dns-dict dictnew dns-dict !
begin-options
" <filename-base> <contract-id> [-w<workchain>] [-t<timeout>] [-o<savefile-boc>]" +cr +tab
+"Creates a new manual dns smart contract with 32-bit identifier <contract-id> managed by private key <filename-base>.pk, "
+"and saves it into <savefile-boc> ('" savefile $+ +"' by default)"
disable-digit-options generic-help-setopt
"w" "--workchain" { parse-workchain-id =: wc } short-long-option-arg
"Selects workchain to create smart contract (" wc (.) $+ +" by default)" option-help
"t" "--timeout" { parse-int =: timeout } short-long-option-arg
"Sets expiration timeout for the initialization message in seconds (" timeout (.) $+ +" by default)" option-help
"o" "--output" { =: savefile } short-long-option-arg
"Sets output file for generated initialization message ('" savefile $+ +"' by default)" option-help
"h" "--help" { usage } short-long-option
"Shows a help message" option-help
parse-options
$# 2 <> ' usage if
2 :$1..n
$1 =: file-base
$2 parse-int dup =: contract-id
32 fits ' usage ifnot
{ contract-id (.) $+ } : +contractid
."Creating new manual DNS smart contract in workchain " wc .
."with contract id " contract-id . cr
// Create new manual DNS; source code included from `auto/dns-manual-code.fif`
"auto/dns-manual-code.fif" include
// code
<b contract-id 32 i, 0 64 u,
file-base +".pk" load-generate-keypair
constant wallet_pk
B, dns-dict @ dict, false 1 i,
b> // data
null // no libraries
<b b{0011} s, 3 roll ref, rot ref, swap dict, b> // create StateInit
dup ."StateInit: " <s csr. cr
dup hashu wc swap 2dup 2constant wallet_addr
."new manual DNS smartcontract address = " 2dup .addr cr
2dup file-base +"-dns" +contractid +".addr" save-address-verbose
."Non-bounceable address (for init): " 2dup 7 .Addr cr
."Bounceable address (for later access): " 6 .Addr cr
now timeout + 32 << 1- dup =: query_id
."Init query_id is " dup . ."(0x" X._ .")" cr
<b contract-id 32 i, query_id 64 u, 0 6 u, b>
dup ."signing message: " <s csr. cr
dup hashu wallet_pk ed25519_sign_uint rot
<b b{1000100} s, wallet_addr addr, b{000010} s, swap <s s, b{0} s, swap B, swap <s s, b>
dup ."External message for initialization is " <s csr. cr
2 boc+>B dup Bx. cr
savefile tuck B>file
."(Saved dns smart-contract creating query to file " type .")" cr

View file

@ -140,6 +140,14 @@ cell dict_set_builder(cell dict, int key_len, slice index, builder value) asm(va
(cell, (int, slice, int)) ~idict::delete_get_max(cell dict, int key_len) asm(-> 0 2 1 3) "DICTIREMMAX" "NULLSWAPIFNOT2";
(cell, slice, slice, int) dict_delete_get_max(cell dict, int key_len) asm(-> 0 2 1 3) "DICTREMMAX" "NULLSWAPIFNOT2";
(cell, (slice, slice, int)) ~dict::delete_get_max(cell dict, int key_len) asm(-> 0 2 1 3) "DICTREMMAX" "NULLSWAPIFNOT2";
(int, slice, int) udict_get_min?(cell dict, int key_len) asm (-> 1 0 2) "DICTUMIN" "NULLSWAPIFNOT2";
(int, slice, int) udict_get_max?(cell dict, int key_len) asm (-> 1 0 2) "DICTUMAX" "NULLSWAPIFNOT2";
(int, cell, int) udict_get_min_ref?(cell dict, int key_len) asm (-> 1 0 2) "DICTUMINREF" "NULLSWAPIFNOT2";
(int, cell, int) udict_get_max_ref?(cell dict, int key_len) asm (-> 1 0 2) "DICTUMAXREF" "NULLSWAPIFNOT2";
(int, slice, int) idict_get_min?(cell dict, int key_len) asm (-> 1 0 2) "DICTIMIN" "NULLSWAPIFNOT2";
(int, slice, int) idict_get_max?(cell dict, int key_len) asm (-> 1 0 2) "DICTIMAX" "NULLSWAPIFNOT2";
(int, cell, int) idict_get_min_ref?(cell dict, int key_len) asm (-> 1 0 2) "DICTIMINREF" "NULLSWAPIFNOT2";
(int, cell, int) idict_get_max_ref?(cell dict, int key_len) asm (-> 1 0 2) "DICTIMAXREF" "NULLSWAPIFNOT2";
(int, slice, int) udict_get_next?(cell dict, int key_len, int pivot) asm(pivot dict key_len -> 1 0 2) "DICTUGETNEXT" "NULLSWAPIFNOT2";
(int, slice, int) udict_get_nexteq?(cell dict, int key_len, int pivot) asm(pivot dict key_len -> 1 0 2) "DICTUGETNEXTEQ" "NULLSWAPIFNOT2";
(int, slice, int) udict_get_prev?(cell dict, int key_len, int pivot) asm(pivot dict key_len -> 1 0 2) "DICTUGETPREV" "NULLSWAPIFNOT2";

View file

@ -55,8 +55,8 @@ dest_addr 2dup bounce 7 + .Addr ." = " .addr
."Body of transfer message is " body-cell <s csr. cr
// create a message
<b b{01} s, bounce 1 i, b{000100} s, dest_addr addr, amount Gram, 0 9 64 32 + + 1+ u,
body-cell <s 2dup s-fits? not rot over 1 i, -rot { drop body-cell ref, } { s, } cond
<b b{01} s, bounce 1 i, b{000} s, dest_addr Addr, amount Gram, 0 9 64 32 + + 1+ u,
body-cell <s 2dup 1 s-fits-with? not rot over 1 i, -rot { drop body-cell ref, } { s, } cond
b>
<b seqno 32 u, now timeout + 32 u, send-mode 8 u, swap ref, b>
dup ."signing message: " <s csr. cr

View file

@ -58,8 +58,8 @@ dest_addr 2dup bounce 7 + .Addr ." = " .addr
."Body of transfer message is " body-cell <s csr. cr
// create a message
<b b{01} s, bounce 1 i, b{000100} s, dest_addr addr, amount Gram, 0 9 64 32 + + 1+ u,
body-cell <s 2dup s-fits? not rot over 1 i, -rot { drop body-cell ref, } { s, } cond
<b b{01} s, bounce 1 i, b{000} s, dest_addr Addr, amount Gram, 0 9 64 32 + + 1+ u,
body-cell <s 2dup 1 s-fits-with? not rot over 1 i, -rot { drop body-cell ref, } { s, } cond
b>
<b subwallet_id 32 u, now timeout + 32 u, seqno 32 u, send-mode 8 u, swap ref, b>
dup ."signing message: " <s csr. cr

View file

@ -54,8 +54,8 @@ dest_addr 2dup bounce 7 + .Addr ." = " .addr
."Body of transfer message is " body-cell <s csr. cr
// create a message
<b b{01} s, bounce 1 i, b{000100} s, dest_addr addr, amount Gram, 0 9 64 32 + + 1+ u,
body-cell <s 2dup s-fits? not rot over 1 i, -rot { drop body-cell ref, } { s, } cond
<b b{01} s, bounce 1 i, b{000} s, dest_addr Addr, amount Gram, 0 9 64 32 + + 1+ u,
body-cell <s 2dup 1 s-fits-with? not rot over 1 i, -rot { drop body-cell ref, } { s, } cond
b>
<b seqno 32 u, send-mode 8 u, swap ref, b>
dup ."signing message: " <s csr. cr

View file

@ -202,13 +202,13 @@ td::Result<td::Ref<vm::Cell>> ManualDns::create_set_value_unsigned(td::int16 cat
vm::CellBuilder cb;
cb.store_long(11, 6);
if (name.size() <= 58 - 2) {
cb.store_long(0, 1);
cb.store_long(category, 16);
cb.store_long(0, 1);
cb.store_long(name.size(), 6);
cb.store_bytes(name);
} else {
cb.store_long(1, 1);
cb.store_long(category, 16);
cb.store_long(1, 1);
cb.store_ref(vm::CellBuilder().store_bytes(name).finalize());
}
cb.store_maybe_ref(std::move(data));
@ -220,16 +220,15 @@ td::Result<td::Ref<vm::Cell>> ManualDns::create_delete_value_unsigned(td::int16
vm::CellBuilder cb;
cb.store_long(12, 6);
if (name.size() <= 58 - 2) {
cb.store_long(0, 1);
cb.store_long(category, 16);
cb.store_long(0, 1);
cb.store_long(name.size(), 6);
cb.store_bytes(name);
} else {
cb.store_long(1, 1);
cb.store_long(category, 16);
cb.store_long(1, 1);
cb.store_ref(vm::CellBuilder().store_bytes(name).finalize());
}
cb.store_long(0, 1);
return cb.finalize();
}
@ -237,7 +236,6 @@ td::Result<td::Ref<vm::Cell>> ManualDns::create_delete_all_unsigned() const {
// 32 TDel: nullify ENTIRE DOMAIN TABLE (x=-)
vm::CellBuilder cb;
cb.store_long(32, 6);
cb.store_long(0, 1);
return cb.finalize();
}
@ -269,7 +267,6 @@ td::Result<td::Ref<vm::Cell>> ManualDns::create_set_all_unsigned(td::Span<Action
vm::CellBuilder cb;
cb.store_long(31, 6);
cb.store_long(1, 1);
cb.store_maybe_ref(pdict.get_root_cell());
@ -291,7 +288,6 @@ td::Result<td::Ref<vm::Cell>> ManualDns::create_delete_name_unsigned(td::Slice n
cb.store_long(1, 1);
cb.store_ref(vm::CellBuilder().store_bytes(name).finalize());
}
cb.store_long(0, 1);
return cb.finalize();
}
td::Result<td::Ref<vm::Cell>> ManualDns::create_set_name_unsigned(td::Slice name, td::Span<Action> entries) const {
@ -344,7 +340,6 @@ td::Result<td::Ref<vm::Cell>> ManualDns::create_init_query(const td::Ed25519::Pr
td::uint32 valid_until) const {
vm::CellBuilder cb;
cb.store_long(0, 6);
cb.store_long(0, 1);
TRY_RESULT(prepared, prepare(cb.finalize(), valid_until));
return sign(private_key, std::move(prepared));

View file

@ -49,19 +49,19 @@ const auto& get_map() {
"0VEyuvKhUUS68qIE+QFUEFX5EPKj9ATR+AB/jhghgBD0eG+hb6EgmALTB9QwAfsAkTLiAbPmWwGkyMsfyx/L/"
"8ntVAAE0DAAEaCZL9qJoa4WPw==");
with_tvm_code("highload-wallet-r2",
"te6ccgEBCAEAmQABFP8A9KQT9LzyyAsBAgEgAgMCAUgEBQC88oMI1xgg0x/TH9Mf+CMTu/Jj7UTQ0x/TH9P/"
"0VEyuvKhUUS68qIE+QFUEFX5EPKj9ATR+AB/jhghgBD0eG+hb6EgmALTB9QwAfsAkTLiAbPmWwGkyMsfyx/L/"
"8ntVAAE0DACAUgGBwAXuznO1E0NM/MdcL/4ABG4yX7UTQ1wsfg=");
"te6ccgEBCAEAlwABFP8A9KQT9LzyyAsBAgEgAgMCAUgEBQC48oMI1xgg0x/TH9Mf+CMTu/Jj7UTQ0x/TH9P/"
"0VEyuvKhUUS68qIE+QFUEFX5EPKj9ATR+AB/jhYhgBD0eG+lIJgC0wfUMAH7AJEy4gGz5lsBpMjLH8sfy//"
"J7VQABNAwAgFIBgcAF7s5ztRNDTPzHXC/+AARuMl+1E0NcLH4");
with_tvm_code("highload-wallet-v2-r1",
"te6ccgEBBwEA1gABFP8A9KQT9KDyyAsBAgEgAgMCAUgEBQHu8oMI1xgg0x/TP/gjqh9TILnyY+1E0NMf0z/T//"
"QE0VNggED0Dm+hMfJgUXO68qIH+QFUEIf5EPKjAvQE0fgAf44YIYAQ9HhvoW+"
"hIJgC0wfUMAH7AJEy4gGz5luDJaHIQDSAQPRDiuYxyBLLHxPLP8v/9ADJ7VQGAATQMABBoZfl2omhpj5jpn+n/"
"mPoCaKkQQCB6BzfQmMktv8ld0fFADgggED0lm+hb6EyURCUMFMDud4gkzM2AZIyMOKz");
with_tvm_code("highload-wallet-v2-r2",
"te6ccgEBCQEA6QABFP8A9KQT9LzyyAsBAgEgAgMCAUgEBQHu8oMI1xgg0x/TP/gjqh9TILnyY+1E0NMf0z/T//"
"QE0VNggED0Dm+hMfJgUXO68qIH+QFUEIf5EPKjAvQE0fgAf44YIYAQ9HhvoW+"
"hIJgC0wfUMAH7AJEy4gGz5luDJaHIQDSAQPRDiuYxyBLLHxPLP8v/9ADJ7VQIAATQMAIBIAYHABe9nOdqJoaa+Y64X/"
"wAQb5fl2omhpj5jpn+n/mPoCaKkQQCB6BzfQmMktv8ld0fFAA4IIBA9JZvoW+hMlEQlDBTA7neIJMzNgGSMjDisw==");
"te6ccgEBCQEA5QABFP8A9KQT9LzyyAsBAgEgAgMCAUgEBQHq8oMI1xgg0x/TP/gjqh9TILnyY+1E0NMf0z/T//"
"QE0VNggED0Dm+hMfJgUXO68qIH+QFUEIf5EPKjAvQE0fgAf44WIYAQ9HhvpSCYAtMH1DAB+wCRMuIBs+"
"ZbgyWhyEA0gED0Q4rmMcgSyx8Tyz/L//QAye1UCAAE0DACASAGBwAXvZznaiaGmvmOuF/8AEG+X5dqJoaY+Y6Z/p/"
"5j6AmipEEAgegc30JjJLb/JXdHxQANCCAQPSWb6UyURCUMFMDud4gkzM2AZIyMOKz");
with_tvm_code("simple-wallet-r1",
"te6ccgEEAQEAAAAAUwAAov8AIN0gggFMl7qXMO1E0NcLH+Ck8mCBAgDXGCDXCx/tRNDTH9P/"
"0VESuvKhIvkBVBBE+RDyovgAAdMfMSDXSpbTB9QC+wDe0aTIyx/L/8ntVA==");

View file

@ -26,7 +26,7 @@
namespace vm {
bool vm_debug_enabled = true;
bool vm_debug_enabled = false;
void set_debug_enabled(bool enable_debug) {
vm_debug_enabled = enable_debug;