-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
refactor!: Keyring migration #9695
Conversation
…berbono3/keyring-migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre approving
-
Keyring.List()
should not return nil keys - remove not needed printlns
Thanks for your comments Andrei - they help with the final review.
cmd.PrintErrln("Migration complete.") | ||
|
||
return err | ||
cmd.Println("Keys migration has been successfully executed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one you can leave. But you should remove most of other printlns.
} | ||
|
||
return priv, nil | ||
// case legacyLedgerInfo, legacyOfflineInfo, LegacyMultiInfo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error is better than panic.
crypto/keyring/legacy_info.go
Outdated
return priv, nil | ||
// case legacyLedgerInfo, legacyOfflineInfo, LegacyMultiInfo: | ||
default: | ||
return nil, errors.New("only works on local private keys") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the error message, please add the legacyLocalInfo
, eg:
fmt.Errorf("only works on local private keys, provided %s", linfo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Comment what other printlns do you mean, @robert-zaremba ?
See Comment What other printlns do you mean, @robert-zaremba ? |
require.Equal(t, newKey.GetType(), oldKey.GetType()) | ||
} | ||
func requireEqualRenamedKey(t *testing.T, key *Record, mnemonic *Record, nameMatch bool) { | ||
if nameMatch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added 'nameMatch' argument to requireEqualRenamedKey
as in some cases i dont need name check ( e.g. at L1319). If it is set to true, it checks if key.Name
and mnemonic.Name
match as you can see below. I hope it sounds good to you, @robert-zaremba
a9aa77c
to
1b7b8af
Compare
…berbono3/keyring-migration
Thanks a lot @cyberbono3 for your work on this PR! |
I hope this work was completed putting legacy clients first and ensuring that Cosmos Hub users would not stumble on any disruption whatsoever. Else, you will hear people shouting very, very loud and from all directions with the next release. As a word of advice, I'd test this thoroughly before releasing it. |
<!-- 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)
Description
The draft PR #9222
Closes: #7108
Record
Info.go
tolegacyInfo.go
withinkeyring
packagemigrate
command that migrates all keys from legacyInfo to proto according to @robert-zaremba migration algorithmMigrate
andMigrateAll
functions inkeyring.go
for single key and all keys migrationAuthor 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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change