-
Notifications
You must be signed in to change notification settings - Fork 352
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
Allow 4-character abbreviations for mnemonic when using the existing-mnemonic workflow #242
Conversation
Thanks for the PR @yorickdowne, very cool! 🦏 This will be especially useful to have implemented as people need to generate their withdrawal keys when withdrawals become possible soon (tm). Some things:
|
Of all these, I like b'') best. It addresses the issue narrowly while keeping the existing UX intact for the vast majority of cases - possibly even all cases. |
|
I opened another PR (https://github.com/yorickdowne/eth2.0-deposit-cli/pull/2) against this branch to address the last few things I'd like to get done before merging this PR.
|
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.
Thanks for all the work & changes @yorickdowne!
For those wondering, the last force-push was a rebase onto dev
Allow 4-character abbreviations for mnemonic when using the existing-mnemonic workflow
This addresses #167
Rationale: Users may store their mnemonic in steel to protect against loss. Steel tablets record the first four characters of each word, not the full words. To recover keys, it is desirable that deposit-cli allow the use of 4-character abbreviations.
Previously submitted as #168 and now re-submitted to a) have a better git workflow and not use the
master
branch directly and b) have a clean history of the PR.All tests run by
python3 -m pytest .
pass.The core of this change is in
staking_deposit/key_handling/key_derivation/mnemonic.py
.Choices made:
To get abbreviations from the word list, I normalize to 'NFKC' and slice to 4 characters or less. This specific normalization was chosen so that combining Unicode characters work and the string doesn't get sliced to 3 visible characters.
I am using a nested
for
list comprehension that compares the full word language map against abbreviations, then flatten the resulting 2D list again. If there's a more elegant way of doing this, please share!Because abbreviations can match several languages, and then merely fail the checksum, I am continuing the search through the languages when a checksum fails.
The
new-mnemonic
workflow has not been touched and still does a straight compare. Allowing abbreviations during the verification step in that workflow would be a different PR.