1
0
mirror of https://github.com/danog/toncontest.git synced 2024-11-30 04:29:14 +01:00

Start debugging

This commit is contained in:
Daniil Gentili 2019-10-09 17:18:04 +02:00
parent 39e4d04231
commit 8fc45f8935
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
4 changed files with 36 additions and 12 deletions

View File

@ -3,12 +3,13 @@
' constant : const ' constant : const
{ file>B B>boc } : load-boc { file>B B>boc } : load-boc
{ {
."usage: " @' $0 type ." <message> <init-message>" cr ."usage: " @' $0 type ." <message> <init-message> <func>" cr
."Runs the TON VM, using code and storage data from <init-message>.boc and <message>.boc as message." cr 1 halt ."Runs the function with ID <func> in the TON VM, using code and storage data from <init-message>.boc and <message>.boc as message." cr 1 halt
} : usage } : usage
$# 2 < ' usage if $# 2 < ' usage if
$1 +".boc" load-boc const message $1 +".boc" load-boc const message-boc
$2 +".boc" load-boc const init-boc $2 +".boc" load-boc const init-boc
$3 parse-int const function
// message$_ {X:Type} info:CommonMsgInfo // message$_ {X:Type} info:CommonMsgInfo
// init:(Maybe (Either StateInit ^StateInit)) // init:(Maybe (Either StateInit ^StateInit))
@ -43,15 +44,15 @@ init-boc <s
1 u@+ swap 1 u@+ swap
1- abort"No code!" 1- abort"No code!"
ref@+ constant code // Load code ref@+ <s constant code // Load code
1 u@+ swap 1 u@+ swap
1- abort"No data!" 1- abort"No data!"
ref@+ <s constant storage // Load storage ref@+ constant storage // Load storage
drop drop
message <s message-boc <s
// External message // External message
7 u@+ swap 68 <> { ."There seems to be an invalid header" cr } if // 1000100 => 68 7 u@+ swap 68 <> { ."There seems to be an invalid header" cr } if // 1000100 => 68
@ -65,7 +66,13 @@ message <s
abort"This seems to be an init message" abort"This seems to be an init message"
constant message constant message
// message
// code // c7
// storage // [ magic:0x076ef1ea actions:Integer msgs_sent:Integer
message code storage .s runvmcode .s // unixtime:Integer block_lt:Integer trans_lt:Integer
// rand_seed:Integer balance_remaining:[Integer (Maybe Cell)]
// myself:MsgAddressInt global_config:(Maybe Cell)
// ] = SmartContractInfo;
0x076ef1ea 0 0 now <b 1234 32 u, b> hash 5 tuple 1 tuple constant ctx
message function code storage ctx .s runvmctx

View File

@ -121,7 +121,7 @@ builder store_keys(builder b, int length, var keys) {
;; multiSigWrapper$0 keys_signatures:(HashmapE 4 Signature) message:(WrappedMessage X) = MultiSigWrapper X; ;; multiSigWrapper$0 keys_signatures:(HashmapE 4 Signature) message:(WrappedMessage X) = MultiSigWrapper X;
() recv_external(slice in_msg) impure { () recv_external(slice in_msg) impure {
;; Check if multiSigWrapper$0 or future unsupported protocol ;; Check if multiSigWrapper$0 or future unsupported protocol
throw_unless(32, in_msg~load_uint(1)); throw_if(32, in_msg~load_uint(1));
;; Check if is hme_empty$0 or hme_root$1 ;; Check if is hme_empty$0 or hme_root$1
;; Throw if empty signature list ;; Throw if empty signature list

View File

@ -15,6 +15,7 @@ PROGRAM{
124239 DECLMETHOD getPartials 124239 DECLMETHOD getPartials
87848 DECLMETHOD getPartialsById 87848 DECLMETHOD getPartialsById
110845 DECLMETHOD getPartialsByKey 110845 DECLMETHOD getPartialsByKey
73634 DECLMETHOD getPartialsByHash
~collect_garbage PROC:<{ ~collect_garbage PROC:<{
-1 PUSHINT -1 PUSHINT
UNTIL:<{ UNTIL:<{
@ -193,7 +194,7 @@ PROGRAM{
recv_external PROC:<{ recv_external PROC:<{
1 LDU 1 LDU
SWAP SWAP
32 THROWIFNOT 32 THROWIF
DUP DUP
1 PLDU 1 PLDU
33 THROWIFNOT 33 THROWIFNOT
@ -455,4 +456,14 @@ PROGRAM{
}> }>
getPartialsById CALLDICT getPartialsById CALLDICT
}> }>
getPartialsByHash PROC:<{
c4 PUSH
CTOS
36 PUSHINT
SDSKIPFIRST
skip_keys CALLDICT
PLDDICT
8 PUSHPOW2
DICTUGETOPTREF
}>
}END>c }END>c

View File

@ -149,6 +149,12 @@ dup hash wc swap 2dup 2constant wallet_addr
<b 0 32 u, -1 32 i, b> <b 0 32 u, -1 32 i, b>
dup ."signing message: " <s csr. cr dup ."signing message: " <s csr. cr
dup hash privkey ed25519_sign_uint rot dup hash privkey ed25519_sign_uint rot
// message$_ {X:Type} info:CommonMsgInfo
// init:(Maybe (Either StateInit ^StateInit))
// body:(Either X ^X) = Message X;
<b b{1000100} s, wallet_addr addr, b{000010} s, swap <s s, b{0} s, swap B, swap <s s, b> <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 dup ."External message for initialization is " <s csr. cr
2 boc+>B dup Bx. cr 2 boc+>B dup Bx. cr