-
Notifications
You must be signed in to change notification settings - Fork 551
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
Create a blockchain client in Go #2773
Comments
Hi @olfa-dallel-enit, thanks for your report. Can you specify which version of the CLI you are using ? (you can run Also can you confirm the error occurs at this line ? account, err := cosmos.Account(accountName) |
Hello, The version of the CLI : I confirm that the error occurs at the line mentioned (account, err := cosmos.Account(accountName)). Thank you |
Thx @olfa-dallel-enit
|
Hello, the output of the command "testbrokerd keys list" is:
Thank you |
Hmm I was expecting to see an identical error with the Can re-run your chain with |
Not sure if related but i had this error: ./main.go:48:36: cannot use account (variable of type cosmosaccount.Account) as type string in argument to cosmos.BroadcastTx Changing my version: |
Hello, @tbruyelle I got the same error also after running "ignite c serve -r" Thank you |
Indeed @nashqueue, this is something we changed recently and we updated the tutorial as well. |
@olfa-dallel-enit what version of the cosmos-sdk are you using in your |
@olfa-dallel-enit I'm pretty sure your bug is related to a keyring migration included in cosmos v0.46. cosmos/cosmos-sdk#9695 Prior to that, the keyring items were amino encoded, but in v0.46, they are protobuf encoded. If you used a client that depends on cosmos v0.46 to reads your keyring, it automatically migrated the keyring to protobuf encoding. Now the problem is if you try to read again that keyring with a client that depends on an older version of the cosmos-sdk (like your Now if I'm correct the reset flag should have fixed the problem, unless you have run an other client that depends on cosmos-sdk v0.46 after the reset, and that client migrated the keyring. Have you ? If you upgrade cosmos-sdk to v0.46 in your |
This issue is related to #2755. It is indeed happening because of the keyring migration. |
Hello module testbroker go 1.18 require ( require ( replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 Thank you |
So this is again unexpected, I can reproduce the error with a client that depends on cosmos-sdk version <v0.46, but with an up-to-date client, you shouldn't have this error! |
Hello, @tbruyelle these are the repositories for both blog and blogclient projects the ignite version is: Thank you |
Hello @olfa-dallel-enit , thanks for this I was able to reproduce the issue with your code and debug it. So as expected, when you run The related code in cosmos-sdk: // 2. Try to deserialize using proto
k, err := ks.protoUnmarshalRecord(item.Data) // <--- ERROR HAPPENS HERE
// 3. If ok then return the key
if err == nil {
return k, nil
}
// 4. Try to decode with amino
legacyInfo, err := unMarshalLegacyInfo(item.Data)
if err != nil {
return nil, fmt.Errorf("unable to unmarshal item.Data, err: %w", err) // <--- RETURNED ERROR
} Using delve, I was able to print the protobuf decode error, it's Note that if you use the latest develop of CLI (easiest way for that is to clone the CLI repo and add a replace in your blogclient's go.mod), you no longer have the problem, I need to understand what has been fixed between the 2... |
@olfa-dallel-enit I got the confirmation from the team we had to manually register some types [0] due a recent change in cosmos-sdk. I don't know why but the cosmos-sdk team removed that type registration. To conclude, use the latest CLI to fix that bug 🤝 [0] cli/ignite/pkg/cosmosaccount/cosmosaccount.go Line 101 in f17cab1
|
Thank you very much |
Feel free to close the issue if using the latest CLI worked for you. |
It looks like this issue is overall resolved. If you have more info or have other concerns please open a new issue :). |
Hello,
I tried to create a blockchain client in go as mentionned in this tuto
https://docs.ignite.com/guide/blog/connect-blockchain
However, I got this error when trying to extract the account from the the accountName
unable to unmarshal item.Data, err: Bytes left over in UnmarshalBinaryLengthPrefixed, should read 10 more bytes but have 152
exit status 1
Is there any mistake in the tuto??
Thank you
The text was updated successfully, but these errors were encountered: