Skip to content
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

Add support for Protobuf-based Keyring #925

Closed
7 tasks done
adizere opened this issue May 11, 2021 · 0 comments · Fixed by #936
Closed
7 tasks done

Add support for Protobuf-based Keyring #925

adizere opened this issue May 11, 2021 · 0 comments · Fixed by #936
Assignees
Labels
I: dependencies Internal: related to dependencies
Milestone

Comments

@adizere
Copy link
Member

adizere commented May 11, 2021

Crate

relayer

Summary

We should update Hermes to add support for reading Protobuf-based keyring files.
Many thanks to @colin-axner for help with looking into this.

Problem Definition

Gaia/SDK v0.43+ now generates the key seed file in what they call a "protobuf format".
Relevant issues & PR:
cosmos/cosmos-sdk#7477 -- removes bech32 encoding of pub key (in particular client/keys/add.go)
cosmos/cosmos-sdk#7108
cosmos/cosmos-sdk#9222

If we use a 0.43-based gaiad, then the generated key_seed.json file looks like this:

{"name":"user","type":"local","address":"cosmos1j22jtrmzmhfnjdmppa9ux39z3racypzrj0xv9z","pubkey":"{\"@type\":\"/cosmos.crypto.secp256k1.PubKey\",\"key\":\"Ay0GCrKEf1dla8pjc3ncpHOHkHmwJjaORmAydmjvxy61\"}","mnemonic":"decline clown adult umbrella captain layer pool census neck dilemma stick pink sudden answer bounce forum assist trial royal arch quick flame notice country"}

The relevant field that changed is "pubkey" which contains {\"@type\":\"/cosmos.crypto.secp256k1.PubKey\",\"key....
Previously, the key_seed.json file looked as follows:

{"name":"user","type":"local","address":"cosmos14lu5st469lphc6n2qa9xjm8d7rjj9sf6lrfz3l","pubkey":"cosmospub1addwnpepqvg2584naygs2clsxglt8a4e490dz0qv7evqqkcdthnn5ympfuk62z85lyn","mnemonic":"cushion orbit whisper decide mystery tattoo oval goose piano lesson current nurse wet rhythm record worry bird nothing punch shadow rule bean adult east"}

With the relevant field: "pubkey":"cosmospub1addwnpepqvg2584naygs2clsxglt8a4e490dz0qv7evqqkcdthnn5ympfuk62z85lyn"

If we run the command:

cargo run -q --bin hermes -- -c /Users/adi/.hermes/config.toml keys add ibc-0 -f /Users/adi/Hammers/ibc-rs/data/ibc-0/key_seed.json
Error: cannot generate bech32 account: invalid length

The error can also manifest as:

Error: cannot generate bech32 account: mixed-case strings not allowed

for the input file:

{"name":"user","type":"local","address":"cosmos1gurcj9vwvhxrwk4pknsf4qzqrhqupusnuxd6f8","pubkey":"{\"@type\":\"/cosmos.crypto.secp256k1.PubKey\",\"key\":\"A1+BajmD1O5KcEmQwFJfaZWbpzV2t4Nw29CDEOoxX3UZ\"}","mnemonic":"laptop elegant crater chaos proud number already garbage shadow nerve excuse earn couple build space trip weather twenty burst swift similar region crack bid"}

Acceptance Criteria

These criteria should be further refined, but roughly speaking we'd like to:

  • support the new file format
  • add an option to convert from the old file format into the newer one, or alternatively make Hermes automatically understand both formats

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@adizere adizere added the I: dependencies Internal: related to dependencies label May 11, 2021
@adizere adizere self-assigned this May 11, 2021
@adizere adizere added this to the 05.2021 milestone May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: dependencies Internal: related to dependencies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant