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: