everx-labs / ever-cli

Command line tool for TVM compatible networks (Everscale, TON, Venom, Gosh, etc)
GNU General Public License v3.0
82 stars 32 forks source link

The offline messages sending is not working #43

Closed deedlau closed 3 years ago

deedlau commented 4 years ago

Issue description

There is the inconsistent packing/unpacking of "tonos-cli message" JSONs here in src/call.rs. And then the "offline transactions/messages" feature of tonos-cli is not working.

Steps to reproduce the issue

  1. Run tonos-cli message <wallet_address> submitTransaction '{"dest":"<wallet_address>","value":1000000000,"bounce":true,"allBalance":false,"payload":""}' --abi SafeMultisigWallet.abi.json --sign wallet-key.json --lifetime 3600 (as per the docs: https://docs.ton.dev/86757ecb2/p/94921e-multisignature-wallet-management-in-tonos-cli/t/364e69 "4.8. Create new transaction offline")
  2. Write down the encoded message body
  3. Run tonos-cli send --abi SafeMultisigWallet.abi.json '<message_body>' (as per the docs: https://docs.ton.dev/86757ecb2/p/94921e-multisignature-wallet-management-in-tonos-cli/t/364e69 "4.10. Broadcast previously generated message")

What's the expected result?

 message: <message_body>
     abi: SafeMultisigWallet.abi.json

MessageId: <message_id>
Expire at: <expiry_date>
Calling method submitTransaction with parameters:
{
  "allBalance": false,
  "bounce": true,
  "dest": "<wallet_address>",
  "payload": "te6ccgEBAQEAAgAAAA==",
  "value": "0x3b9aca00"
}
Processing... 
Succeded.
Result: {
  "transId": "0x0"
}

And the transaction message is sent to the network.

What's the actual result?

Input arguments:
 message: <message_body>
     abi: SafeMultisigWallet.abi.json
Connecting to https://net.ton.dev
Error: couldn't find "address" key in message
Error: 1

And the transaction message is not sent to the network.

Additional details

Please note the difference in pack_message: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L112-L119 And unpack_message: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L144-L145 unpack_message expects msg->address field in JSON here: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L144, while the pack_message method is not providing it.

This commit added the "address" JSON field packing/unpacking: https://github.com/tonlabs/tonos-cli/commit/577d54b756463140a156264a7e13eefee3a25576#diff-c5c022d135afc2c596bb0084c03b78ed And this commit removed the packing, but there is unpacking left: https://github.com/tonlabs/tonos-cli/commit/2ba9f080dedc81282e1ec97922a39358f0abd694#diff-c5c022d135afc2c596bb0084c03b78ed

Please make a decision - whether you need this field or not :)

joydark commented 3 years ago

Thanks for reporting. Fixed in https://github.com/tonlabs/tonos-cli/releases/tag/v0.1.27