From 8f3424b08a00930ba84cb12d25bfd5d7219ea766 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 6 Oct 2019 20:34:05 +0200 Subject: [PATCH] Update --- test/README.md | 24 ++++++++++++++++++++++++ test/test.fif | 8 ++++++++ wallet/a.pubkey | 1 + wallet/b.pubkey | 1 + wallet/c.pubkey | 1 + wallet/d.pubkey | 1 + wallet/e.pubkey | 1 + wallet/wallet-code.fif | 1 - wallet/wallet-create.fif | 28 +++++++++++++++++----------- 9 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 test/README.md create mode 100644 test/test.fif create mode 100644 wallet/a.pubkey create mode 100644 wallet/b.pubkey create mode 100644 wallet/c.pubkey create mode 100644 wallet/d.pubkey create mode 100644 wallet/e.pubkey diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..be59590 --- /dev/null +++ b/test/README.md @@ -0,0 +1,24 @@ +From https://github.com/ton-blockchain/ton/issues/96: + +Errors triggered by code inside a coroutine currently being called by the `times` loop keyword surface with an invalid line number, as if the error was triggered by the `times` keyword, instead of the actual keyword that originated the exception (basically, we're missing full stack traces here). + +``` +[daniil@daniil-arch test]$ cat test.fif +{ abort"This is an error thrown inside a times loop" } : throw + +{ + ."Printing stuff at line 4" cr + ."Printing stuff at line 5" cr + throw // line 6 + ."Printing stuff at line 7" cr +} 3 times // line 8 + +[daniil@daniil-arch test]$ fift -s test.fif +Printing stuff at line 4 +Printing stuff at line 5 +[ 1][t 0][1570377741.616638660][words.cpp:2804] test.fif:8: times: stack underflow +[ 1][t 0][1570377741.616738081][fift-main.cpp:198] Error interpreting file `test.fif`: error interpreting included file `test.fif` : test.fif:8: times: stack underflow +``` + +Fift indicates that the error was thrown at line 8 by the `times` keyword (`test.fif:8: times:`): while it is true that the exception surfaced at that point in the code, the rest of the stack trace is missing, making it hard to debug exceptions thrown inside loops. +It would be nice to have a full stack trace, for example indicating that the error was first thrown in `test.fif:1: abort`, then surfaced in `test.fif:6: throw`, finally surfacing as `test.fif:8: times`. diff --git a/test/test.fif b/test/test.fif new file mode 100644 index 0000000..be4e7bb --- /dev/null +++ b/test/test.fif @@ -0,0 +1,8 @@ +{ abort"This is an error thrown inside a times loop" } : throw + +{ + ."Printing stuff at line 4" cr + ."Printing stuff at line 5" cr + throw // line 6 + ."Printing stuff at line 7" cr +} 3 times // line 8 diff --git a/wallet/a.pubkey b/wallet/a.pubkey new file mode 100644 index 0000000..f2d4cbf --- /dev/null +++ b/wallet/a.pubkey @@ -0,0 +1 @@ +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ No newline at end of file diff --git a/wallet/b.pubkey b/wallet/b.pubkey new file mode 100644 index 0000000..5a5be04 --- /dev/null +++ b/wallet/b.pubkey @@ -0,0 +1 @@ +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \ No newline at end of file diff --git a/wallet/c.pubkey b/wallet/c.pubkey new file mode 100644 index 0000000..62499bf --- /dev/null +++ b/wallet/c.pubkey @@ -0,0 +1 @@ +cccccccccccccccccccccccccccccccc \ No newline at end of file diff --git a/wallet/d.pubkey b/wallet/d.pubkey new file mode 100644 index 0000000..00ea360 --- /dev/null +++ b/wallet/d.pubkey @@ -0,0 +1 @@ +dddddddddddddddddddddddddddddddd \ No newline at end of file diff --git a/wallet/e.pubkey b/wallet/e.pubkey new file mode 100644 index 0000000..bf2780e --- /dev/null +++ b/wallet/e.pubkey @@ -0,0 +1 @@ +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee \ No newline at end of file diff --git a/wallet/wallet-code.fif b/wallet/wallet-code.fif index 95d2b00..e432f6c 100644 --- a/wallet/wallet-code.fif +++ b/wallet/wallet-code.fif @@ -216,4 +216,3 @@ PROGRAM{ 32 PLDU }> }END>c -2 boc+>B "RS" B>file diff --git a/wallet/wallet-create.fif b/wallet/wallet-create.fif index b3f1dc2..1d9ec97 100644 --- a/wallet/wallet-create.fif +++ b/wallet/wallet-create.fif @@ -10,11 +10,12 @@ file>B B>boc } : load-boc -{ ."usage: " @' $0 type ." [ ...] [ ]" cr cr - ."Creates a new multisignature wallet in specified workchain composed of (1-10) public keys." cr +{ ."usage: " @' $0 type ." [ ...] [ ]" cr cr + ."Creates a new multisignature wallet in specified workchain composed of (1-10) keys." cr + ."The first of the keys must be a private key (pre-existing or not), used to generate the wallet; the rest MUST be public keys." cr + ."Create or generate public key files from private keys using gen-pub.fif privkey" cr cr ."Min (1-10) signatures required to send an order; load pre-existing public keys from files ." cr ."Optionally load a number of pre-generated partially signed orders to preload into the contract." cr cr - ."Create or generate public key files from private keys using gen-pub.fif key" cr cr 1 halt } : usage $# 5 < ' usage if @@ -31,7 +32,9 @@ k n <= not abort" must smaller than or equal to " $# 4 n + < abort"Not enough keys were provided in args!" -5 { dup $() +".pubkey" load-pubkey swap 1+ } n times drop +$5 +".pk" load-generate-keypair { 256 B>u@ swap } 2 times const privkey + +6 { dup $() +".pubkey" load-pubkey swap 1+ } n 1- times drop n tuple constant keys 5 n + { dup $() +".boc" load-boc swap 1+ } m times drop @@ -108,7 +111,7 @@ dictnew messages swap [] // Get n-th value v dup 0 } { n >= minSigs } { n <= 10 } { minSigs <= 10 } = Storage X; - - // no libraries null // create StateInit - +// _ split_depth:(Maybe (## 5)) special:(Maybe TickTock) +// code:(Maybe ^Cell) data:(Maybe ^Cell) +// library:(HashmapE 256 SimpleLib) = StateInit; +// split_depth 0 special 0 code 1 data 1 +// + + dup ."StateInit: " dup ."signing message: " dup ."External message for initialization is " B dup Bx. cr