Download ZIP (114.9 KB)

Testing and Issues

You can test this entry and submit issues during the testing period of the Blockchain Contest contest.

Entries with serious issues will not be able to win the contest, but even minor issues might be important for overall results.




Gentle Clam Oct 17, 2019 at 02:41
TON Macro Assembler Multi-Signature Wallet 

The goal was create an efficient multi signature wallet using only basic TON operation, native data structures and minimise the gas consumption based on the formula Pb := 10 + b + 5r. 

No dictionaries, no procedures call, minimum iterated execution, just macros. 

Smart garbage collection - store nearest expiry date for message array and clean only when needed.

Use mswallet-test.fif to see the performance.

Description is here:

Have a nice ride!
Gentle Clam Oct 25, 2019 at 11:57
Updated DMSWALLET (MSWallet.fif) on GitHub including key and message dictionaries. Check dmswallet-test.fif to see how it performs - n= 10, k = 3 - steps: 527 gas: 16,819
You have not added any comments yet...
by rating


Magic Python Oct 29, 2019 at 15:28
for i in {0..15}; do cp $((i-1)).pubk $i.pubk; fift -s keys-mswallet.fif $i 16; done
fift -s new-mswallet.fif 0 15 16 10
... sendfile 15-query.boc

Account has 1G, nothing happens.
Chic Dolphin Oct 17, 2019 at 16:12
You have whole branch of code without ACCEPT. And as I understand c4 is reverted after throw. <b b> <s 0 <{ 1 INT NEWC 32 STU ENDC c4 POP 1 THROW }>s <b b> | runvmctx <s csr.
Gentle Clam Oct 18, 2019 at 16:11
No ACCEPT before signatures are checked, but you are right don't need the rest of the code before THROW, have updated MSWallet.fif in GitHub. Thanks
Magic Python Oct 21, 2019 at 04:03
Can't create a wallet

fift -s keys-mswallet.fif test 16

Saved new private key to file
Creating new key array for 16  keys
[ 1][t 0][1571630455.403860092][words.cpp:2906] keys-mswallet.fif:49: key&: not a cell
[ 1][t 0][1571630455.403938055][fift-main.cpp:196] Error interpreting file `keys-mswallet.fif`: error interpreting included file `keys-mswallet.fif` : keys-mswallet.fif:49: key&: not a cell
Gentle Clam Oct 23, 2019 at 10:45
Chic Dolphin Oct 22, 2019 at 14:47
After contest I tested similar technique, number encoding in base4 exact path that needs to be taken through cells. n % 4 (0, 1, 2, 3) is cell reference that should be loaded. And once n / 4 is less than 4 (1, 2, or 3) - 1 * 256 it encodes the shift within a cell.

I thought that it was very simple an efficient way to navigate through cell tree. Although I knew exactly which reference to load I still could not beat dictionary in gas usage.

I guess dictionary has super-powers because it is also used for subroutine calls. And you can't make random-access data structure that is faster.
Gentle Clam Oct 24, 2019 at 08:07
Yes, it looks like we don't need to use Cells but always dictionaries. More storage but less gas. New version of macro assembler wallet use the key dictionary is in GitHub 10 keys / 3 sign ~ 7000 gas less than the original version but dictionary is bigger than key[]
Chic Dolphin Oct 18, 2019 at 17:35
Yes, and no accept when you a try to store the signatures either. They are not stored if you don't accept the message. And you don't accept messages which do not have enough signatures.

Here is contract that cannot increase it's sequence number past 6
Magic Python Oct 24, 2019 at 11:05
fift -I$FIFTPATH:lib -s new-mswallet.fif
Just hangs. Nothing happens
Gentle Clam Oct 24, 2019 at 19:26
strange, works in my case
Nobody added any issues yet...