ton-blockchain / ton

Main TON monorepo
Other
2.95k stars 891 forks source link

fift -s ... runvm #68

Closed Walbr closed 5 years ago

Walbr commented 5 years ago

execute LDSLICEX execute DUP execute LDU 32 execute LDU 32 execute LDU 32 execute NOW handling exception code 5: tuple index out of range default exception handler, terminating vm with exit code 5

ton-blockchain commented 5 years ago

NOW is equivalent to PUSH c7; INDEX 0; INDEX 3 (A.11.4 of TVM documentation), and you have forgotten to properly initialize c7 as explained in 4.4.4 of TON Blockchain documentation. In the true blockchain context, this is done automatically. Fift doesn't do this for you, so you'll need to write a short loader that sets c7 and then executes your smart contract.

Something like this: ... init_c7 <{ your code ... }> <{ TUCK c3 POP c7 POP JMPREF }>s init_data runvm ...