-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Overhaul crypto (Schnorr/Ristretto, HDKD, BIP39) #1795
Conversation
This doesn't rebuild runtime wasm artifacts. Should it? |
I added an |
@pepyakin yes, probably along with a version bump as well so detection of which version to use is possible for APIs. Thank you though, was wondering about local tests not yielding the expected results, I needed to rebuild. |
…e into gav-enable-ristretto
Not compatible with consensus and finality-grandpa modules? Because these modules are hardcoded ed25519. |
node/cli/src/chain_spec.rs
Outdated
let endowed_accounts: Vec<AccountId> = vec![ | ||
hex!["f295940fa750df68a686fcf4abd4111c8a9c5a5a5a83c4c8639c451a94a7adfd"].into(), // 5HYmsxGRAmZMjyZYmf7uGPL2YDQGHEt6NjGrfUuxNEgeGBRN TODO: change once we switch to sr25519 | ||
hex!["343df6f04ffae0840f214f6cb0da00b612c7e9347f980e7afafc520582f79136"].into(), // 5DFCkiP9vky31C1ZP3LpuQYinLAFwQqq6vda7NXa8ALCpq5D TODO: change once we switch to sr25519 |
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.
Is the TODO still valid?
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.
no...
|
||
// signing context | ||
const SIGNING_CTX: &'static [u8] = b"substrate transaction"; |
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.
@kianenigma I changed this, so JS will need update.
@tomusdrw I addressed the grumbles. @kianenigma If you're also happy with the code, then I'd like to merge today. |
} | ||
} | ||
|
||
let re = Regex::new(r"^(?P<phrase>\w+( \w+)*)(?P<path>(//?[^/]+)*)(///(?P<password>.*))?$") |
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.
Yeah, but my point is that it introduces ambiguity in representation (two different strings representing the same derived key), but if we don't care about it then I'm fine.
* Rijig to Ristretto * Rebuild wasm * adds compatibility test with the wasm module * Add Ed25519-BIP39 support * Bump subkey version * Update CLI output * New keys. * Standard phrase/password/path keys. * Subkey uses S-URI for secrets * Move everything to use new HDKD crypto. * Test fixes * Ignore old test vector. * fix the ^^ old test vector. * Fix tests * Test fixes * Cleanups * Fix broken key conversion logic in grandpa CC @rphmeier * Remove legacy Keyring usage * Traitify `Pair` * Replace Ed25519AuthorityId with ed25519::Public * Expunge Ed25519AuthorityId type! * Replace Sr25519AuthorityId with sr25519::Public * Remove dodgy crypto type-punning conversions * Fix some tests * Avoid trait * Deduplicate DeriveJunction string decode * Remove cruft code * Fix test * Minor removals * Build fix * Subkey supports sign and verify * Inspect works for public key URIs * Remove more crypto type-punning * Fix typo * Fix tests
<phrase>/<soft-key>//<hard-key>///<password>
(the///password
may be omitted, and/<soft-key>
and//<hard-key>
maybe repeated and mixed).subkey
and on the CLI for the--key
parameter.AccountKeyring
andAuthorityKeyring
accordingly.Pair
s are now trait impls.AuthorityId
andAccountId
are now type-safe throughout the codebase (ed25519::Public
orsr25519::Public
) and not just opaque, weakly typedH256
s.Keyring
; a lot less.to_raw_public
,.0
and.into
.Ed25519AuthorityId
non-type, replacing with local aliasing ofed25519::Public
toAuthorityId
, ready for a later refactoring that can replace specific sets of instances with BLS or other crypto.UncheckedFrom
andUncheckedInto
traits for the times (actually, there's only one instance) where we do need to break strong typing and force coercion.TODO:
Keyring::One
and::Two
.test-runtime/system.rs
tests.subkey
support public key derivation querying.subkey
support signing.CC @jacogr