-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proto signing fails when accountNumber = 0 #549
Comments
Nice catch! Thank you for the detailed report. In #550 you find a fix for this. Testing this higher level is not trivial but possible. It would require us to use the private key for the account number 0 (i.e. the validator account), which we don't have a mnemonic for. However, in this case the bug is well understood, so it should work with the PR merged. |
The fix was released yesterday as part of 0.24.0-alpha.10 |
This seems to have crept up again, I'm not entirely sure what's going on but it was fixed...then with the switch to ts-proto it broke again but I'm guessing at 122bb2b (which is not published yet) it will be fixed again? (Judging by the fact the isZero() checks seem to have been added there) @webmaster128 Can you confirm this is the case? (if so, when are you publishing next ? :D) |
Right. With the ts-proto migration PR the adr27 module containing the fix got unused, which is a bug. It was fixed with a ts-proto update, which omits all default values. I'll publish an update by the end of the day. |
Awesome! |
0.24.0-alpha.26 is released, which should fix this again since we regenerated internal types with a version of ts-proto that does not serialize default values like accountNumber = 0. |
At the moment I'm using 0.26.0 version and it seems that the problem has returned. I launched a new chain with 2 accounts (accounts 0 and 1), if I try to make a transaction with account 0 I always receive the incorrect signature error. If I try to carry out the same operations with Account 1 I'm not getting any errors. I performed the same test from Command Line and all two accounts work properly. Do you have any idea on how can I solve this? |
@angelorc could you open a new ticket for you issue to be able to track it? It's probably a different issue. Could you also include Cosmos SDK version, sign mode, @cosmjs/ package you use, wallet type and message type? |
@webmaster128 done #961 |
All the tests for proto signing use
1
as theaccountNumber
:cosmjs/packages/proto-signing/src/signing.spec.ts
Line 94 in c0b714b
cosmjs/packages/proto-signing/src/directsecp256k1hdwallet.spec.ts
Line 71 in c0b714b
cosmjs/packages/proto-signing/src/directsecp256k1wallet.spec.ts
Line 47 in c0b714b
We had a situation where we tried to send tokens from
accountNumber: 0
, which gets converted to aLong
of{low: 0, high: null, unsigned: null}
here:cosmjs/packages/proto-signing/src/signing.ts
Line 44 in c0b714b
omitDefaults
then recursively converts this to a plain JS object of{low: null, high: null, unsigned: null}
here:cosmjs/packages/proto-signing/src/adr27.ts
Line 43 in c0b714b
This leads to an invalid signature (ref: ignite/web#39)
@webmaster128 @jgimeno @vince19972 @fadeev
The text was updated successfully, but these errors were encountered: