-
Notifications
You must be signed in to change notification settings - Fork 211
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
Introduce SomeMnemonic as source of root keys (instead of entropy) #1343
Conversation
039e19a
to
8fd159b
Compare
|
||
dummyMnemonic :: SomeMnemonic | ||
dummyMnemonic = either (error . show) id $ | ||
SomeMnemonic . entropyToMnemonic @12 <$> mkEntropy (BS.pack $ replicate 16 0) |
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.
Originally seeds of different lengths were used.
Also, matching the 12 with the 16
bytes has to be done manually. We could maybe define a helper:
mkEntropyFromByteStringOfSize @16 $ replicate 16 0
arbitraryMnemonic :: [Text] | ||
arbitraryMnemonic = | ||
arbitraryMnemonic :: SomeMnemonic | ||
arbitraryMnemonic = either (error . show) id $ fromMnemonic @'[12] |
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.
Having to explicitly tell (@'[12]
) which mnemonic lengths are supported, when we are hard-coding the mnemonic, could be considered cumbersome.
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.
Alternatively, use: unsafeMkMnemonic
from Cardano.Wallet.Unsafe
lib/core/test/unit/Cardano/Wallet/Primitive/AddressDerivation/IcarusSpec.hs
Outdated
Show resolved
Hide resolved
lib/core/test/unit/Cardano/Wallet/Primitive/AddressDerivation/ByronSpec.hs
Outdated
Show resolved
Hide resolved
33e5c18
to
fe71acd
Compare
bors try |
tryBuild succeeded |
ba87902
to
922eed3
Compare
lib/core/test/unit/Cardano/Wallet/Primitive/AddressDerivation/IcarusSpec.hs
Show resolved
Hide resolved
lib/jormungandr/test/unit/Cardano/Wallet/Jormungandr/TransactionSpec.hs
Outdated
Show resolved
Hide resolved
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.
Looks good overall, but some minor tweaks to go through before merging 👍
e644810
to
58820d4
Compare
lib/core/test/unit/Cardano/Wallet/Primitive/AddressDerivation/ByronSpec.hs
Outdated
Show resolved
Hide resolved
lib/core/test/unit/Cardano/Wallet/Primitive/AddressDerivationSpec.hs
Outdated
Show resolved
Hide resolved
lib/core/test/unit/Cardano/Wallet/Primitive/AddressDiscovery/SequentialSpec.hs
Outdated
Show resolved
Hide resolved
|
||
dummyMnemonic :: SomeMnemonic | ||
dummyMnemonic = | ||
unsafeMkSomeMnemonicFromEntropy (Proxy @12) (BS.pack $ replicate 16 0) |
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.
Replacing both 16- and 32- bytes long entropies in this module with 16, seems iffy.
Adding a dummyMnemonic :: (many constraints) => Proxy mw -> SomeMnemonic
sounds tempting…
But in-doubt, I will not, I think.
Will remove dummyMnemonic
.
bors r+ |
1343: Introduce SomeMnemonic as source of root keys (instead of entropy) r=Anviking a=Anviking # Issue Number #1316, preliminary work to unblock #1321 <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> # Overview - Add SomeMnemonic as return type of fromMnemonic - Make e.g. unsafeGenerateKeyFromSeed take a SomeMnemonic instead entropy. This is more similar to `Icarus.generateKeyFromHardwareLedger` - Add genMnemonic helper in a shared location # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
(IMO, this is a good case where the last commits don't bring much to the story the PR is telling. Because they're simply correcting stuff introduced earlier in the PR itself. This is a good case for squashing 😉) |
9a8b250
to
ff18a7f
Compare
Canceled |
Argh! 😄 bors r+ |
1343: Introduce SomeMnemonic as source of root keys (instead of entropy) r=Anviking a=Anviking # Issue Number #1316, preliminary work to unblock #1321 <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> # Overview - Add SomeMnemonic as return type of fromMnemonic - Make e.g. unsafeGenerateKeyFromSeed take a SomeMnemonic instead entropy. This is more similar to `Icarus.generateKeyFromHardwareLedger` - Add genMnemonic helper in a shared location # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
But maybe the indirect path from A to B in the PR was interesting… which the author of the PR might be biased when judging 😉 |
Was it ? ( ) |
Build failed |
c78d1ba
to
bc410a0
Compare
- Add SomeMnemonic as return type of fromMnemonic - Make e.g. unsafeGenerateKeyFromSeed take a SomeMnemonic instead entropy. This is more similar to `Icarus.generateKeyFromHardwareLedger` This is from a patch by Matthias without modifications. Co-authored-by: KtorZ <matthias.benkort@gmail.com>
bc410a0
to
984e7cc
Compare
bors r+ |
1343: Introduce SomeMnemonic as source of root keys (instead of entropy) r=Anviking a=Anviking # Issue Number #1316, preliminary work to unblock #1321 <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> # Overview - Add SomeMnemonic as return type of fromMnemonic - Make e.g. unsafeGenerateKeyFromSeed take a SomeMnemonic instead entropy. This is more similar to `Icarus.generateKeyFromHardwareLedger` - Add genMnemonic helper in a shared location # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
Build succeeded |
Issue Number
#1316, preliminary work to unblock #1321
Overview
entropy. This is more similar to
Icarus.generateKeyFromHardwareLedger
Comments