-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Migrate Keyring to Protobuf #7108
Comments
Yes, that's fine. In fact, I think I have a comment in a thread somewhere that alludes to this very idea -- use Amino for legacy key material and use Proto for new key material while also having a built-in and opt-in command to migrate anything that is legacy so we can ultimately phase out Amino entirely from the Keyring logic. |
IMHO keys material does not necessarily have to be encoded with proto. The keyring is a Cosmos SDK pure Go tool and is not meant to be used in conjunction with messages over the wire (e.g. private keys don't travel over the wire). I think the objective of this issue should be |
Could you explain a little bit more @alessio? From what I understand, if we |
Keyring just handle bytes-to-disk serialization of a few internal structures (see |
I'm not familiar with cosmos-sdk/crypto/keyring/info.go Lines 38 to 43 in 54201d1
How will the |
We are seeing another issue on Ethermin due to the fact that the SDK uses |
This is not closed by #7987 |
ScopeCreate a migration for keyring keys:
|
ProblemCurrently, all user keys in keyring are serialized using Amino. This blocks adding new key types to keyring unless we implement Amino codec interface to that types. [outdated] Proposed Migration AlgorithmSee #7108 (comment) below for the algorithm we picked. Add keyring migration for user keys:
All keyring functions must use protobuf for serialization. Ref: discussion on Discord |
Algorithm v2The logic we are implementing is:
Using a version will allow us to do future migrations if needed. |
<!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description The draft PR #9222 Closes: #7108 <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> - implement proto definition for `Record` - rename `Info.go` to `legacyInfo.go` within `keyring` package - implement CLI `migrate` command that migrates all keys from legacyInfo to proto according to @robert-zaremba migration [algorithm](#9222) - remove legacy keybase entirely. - add `Migrate` and `MigrateAll` functions in `keyring.go` for single key and all keys migration - add tests - fix tests --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
<!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description The draft PR cosmos#9222 Closes: cosmos#7108 <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> - implement proto definition for `Record` - rename `Info.go` to `legacyInfo.go` within `keyring` package - implement CLI `migrate` command that migrates all keys from legacyInfo to proto according to @robert-zaremba migration [algorithm](cosmos#9222) - remove legacy keybase entirely. - add `Migrate` and `MigrateAll` functions in `keyring.go` for single key and all keys migration - add tests - fix tests --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This got missed in the migration. I don't consider it a blocker for Stargate so marking this for 0.40.1. Does that sound okay @alexanderbez ?
It would be good if we can do this in a backwards compatible way. i.e. if a keyring is in amino format, it gets read as amino but reserialized to proto after that. We should either make a backup when doing this, or even better just use different files for proto keys and keep the amino ones untouched.
The text was updated successfully, but these errors were encountered: