ton-blockchain / ton

Main TON monorepo
Other
2.95k stars 891 forks source link

[bug] Invalid wallet address #84

Closed igroman787 closed 5 years ago

igroman787 commented 5 years ago

Hello. When creating a new wallet myWallet_001, an incorrect wallet address was received:

Creating new wallet in workchain 0 
Saved new private key to file myWallet_001.pk
StateInit: x{34_}
 x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}
 x{0000000021549100C863943A30D3DEDB5DB9C93ACA52650530D3F8009730A6A9C3BEBD0D}

new wallet address = 0:f34f14374680af6f3756bf35b22ec60fedf68cef6f031ebc9588adbf5a9b231 
(Saving address to file myWallet_001.addr)
Non-bounceable address (for init): 0QAPNPFDdGgK9vN1a_NbIuxg_t9ozvbwMevJWIrb9amyMe4t
Bounceable address (for later access): kQAPNPFDdGgK9vN1a_NbIuxg_t9ozvbwMevJWIrb9amyMbPo
signing message: x{00000000}

External message for initialization is x{88001E69E286E8D015EDE6EAD7E6B645D8C1FDBED19DEDE063D792B115B7EB5364621190D1573702E16DF75AB831FC0938C61C6159EDF85C836F9F32E6DD6063B521D9760554B0469D1D8D2BD2D55D4A489AF15AD28E6A3BC4F5CE88418F43046A05C0200000001_}
 x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}
 x{0000000021549100C863943A30D3DEDB5DB9C93ACA52650530D3F8009730A6A9C3BEBD0D}

B5EE9C724104030100000000E50002CF88001E69E286E8D015EDE6EAD7E6B645D8C1FDBED19DEDE063D792B115B7EB5364621190D1573702E16DF75AB831FC0938C61C6159EDF85C836F9F32E6DD6063B521D9760554B0469D1D8D2BD2D55D4A489AF15AD28E6A3BC4F5CE88418F43046A05C02000000010010200A2FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED5400480000000021549100C863943A30D3DEDB5DB9C93ACA52650530D3F8009730A6A9C3BEBD0D4E428878
(Saved wallet creating query to file myWallet_001-query.boc)

When we try to get wallet status, we get an error:

getaccount -1:f34f14374680af6f3756bf35b22ec60fedf68cef6f031ebc9588adbf5a9b231
[ 1][t 2][1570167993.382821798][lite-client.cpp:615][!testnode] error: [Error : -1 : cannot parse account address]
[ 1][t 2][1570167993.382949114][lite-client.cpp:793][!testnode] [Error : -1 : cannot parse account address]

I assume that the problem is the incorrect display of the address of the new wallet after creation. The source code for this test is available here: https://github.com/igroman787/myTestTon

igroman787 commented 5 years ago

I think that instead of recording

new wallet address = 0:f34f14374680af6f3756bf35b22ec60fedf68cef6f031ebc9588adbf5a9b231

there should have been recording

new wallet address = 0:0f34f14374680af6f3756bf35b22ec60fedf68cef6f031ebc9588adbf5a9b231
ton-blockchain commented 5 years ago

You are right, that's because Fift scripts use the word x. to display hexadecimal numbers, which never outputs leading zeroes. We'll think about a better output format.

In the meantime, you can instead use the base64-form of the address getaccount kQAPNPFDdGgK9vN1a_NbIuxg_t9ozvbwMevJWIrb9amyMbPo

ton-blockchain commented 5 years ago

This issue has been fixed in commit 7c595294b67dcdd7a6d020a8a5ff1c754480203b