Repository navigation
fix(key): reject word counts other than 12 and 24 in key generate - #366
Olorunshogo wants to merge 1 commit into
Conversation
|
Looks good to me. I'll test it later. |
emma31-dev
left a comment
There was a problem hiding this comment.
Aside that minor issue everything looks good. I have tested everything and its adapted well.
|
Please take a look at this @tvpeter @vadim-anfv |
|
@Olorunshogo it has been 2 days . Relax as older PRs will get reviewed before this |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #366 +/- ##
==========================================
+ Coverage 59.08% 59.12% +0.03%
==========================================
Files 25 25
Lines 4646 4648 +2
==========================================
+ Hits 2745 2748 +3
+ Misses 1901 1900 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8613935 to
a24de07
Compare
|
Thanks for working on this @Olorunshogo I left an optional suggestion inline. |
vadim-anfv
left a comment
There was a problem hiding this comment.
tACK a24de07
Tested locally: all five valid word counts produce a mnemonic of the expected length, and invalid values are rejected at parse time.
a24de07 to
5efd4ec
Compare
vadim-anfv
left a comment
There was a problem hiding this comment.
ACK 5efd4ec
The only change since I tested is the default, now default_value_t = MnemonicWordCount::Words12, which resolves to the same "12".
tvpeter
left a comment
There was a problem hiding this comment.
Concept NACK.
So I have been wondering the genuine utility for this PR. Is it to enable all supported BIP39 word counts because the library support it or it is to validate and establish that only 12 and 24 word counts were supported?
For compatibility, the supported hardware wallet devices - coldcard, Bitbox02, Jade, Ledger and Specter do not support 15 or 21 word counts generation. Most of them support restoring 18 word count but do not offer the option to generate and use them. Also, over 90% of popular BIP39 wallets primarily create and are optimized around 12 and/or 24 words only. Bear in mind that, Core wallet do not use BIP39.
If we are validating that only 12 and 24 BIP39 word count are supported, then I think it is reasonable. Aside that, I don't think there is any real value for enabling them.
I am open to hearing other opinions on this.
Thank you.
|
@tvpeter I could agree there is not much utility in supporting all the BIP39 word counts but that is not the major part of my issue. Currently, the flag |
@tvpeter let's make it the second one. The PR is about the bug in #362, not the word counts: Then the PR only fixes the bug and tightens validation: 12 and 24 as before, anything else rejected instead of silently coerced. @Olorunshogo so drop |
|
Correction: #362 does ask for all five lengths, so 12 and 24 is a deliberate narrowing, not the original scope. I ACKed the five-count version twice and still think it is defensible, just not worth holding the PR over. @Olorunshogo "rest unchanged" was too loose, four more places go with the enum:
|
I agree. |
5efd4ec to
f6f6fe8
Compare
|
Would appreciate a re-ACK on f6f6fe8 when you get a chance. Thanks for the reviews everyone! I have narrowed the scope to 12 and 24 as @vadim-anfv suggested, and covered all four places you listed:
I would appreciate a re-ACK on f6f6fe8 |
PR description
Description
key generate --entropyonly matched12; every other value was silently coerced to a 24-word mnemonic, so15,0or999all produced 24 words with no error.--entropynow parses into aMnemonicWordCountValueEnumlimited to12and24, so any other value is rejected at parse time and--helplists the options. The flag name,-e,WORD_COUNTenv var and default of12are unchanged.Fixes #362
--entropy12/ default2415/18/210/13/999Notes to reviewers
WordCountderives no traits (noClone), so clap can't parse into it directly.MnemonicWordCountmirrors it with aFromimpl, following theCompileScriptTypepattern used bycompile --type.Checklists
All Submissions:
cargo fmtandcargo clippybefore committingBugfixes: