This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Make MultiSigner use compressed ECDSA public key#4502
Merged
Conversation
bkchr
commented
Dec 27, 2019
primitives/runtime/src/lib.rs
Outdated
| MultiSigner::Sr25519(who) => <[u8; 32]>::from(who).into(), | ||
| MultiSigner::Ecdsa(who) => sp_io::hashing::blake2_256(who.as_ref()).into(), | ||
| MultiSigner::Ecdsa(who) => sp_io::hashing::blake2_256( | ||
| &who.as_compressed().expect("what should we do?")[..], |
Member
Author
There was a problem hiding this comment.
@gavofyork what should we do here? I think the best would be to propagate the error via IdentifyAccount.
Member
There was a problem hiding this comment.
i believe this cannot fail for any valid keypair, so .expect should be fine
MultiSigner
MultiSigner MultiSigner use compressed ECDSA public key
gavofyork
approved these changes
Dec 30, 2019
Member
|
but... what's the point of supporting uncompressed public key format? |
Member
Author
Good question, I just followed the initial implementation. However, I think that for ergonomic reasons the support for both sounds reasonable to me. If you say that people only use the compressed version, I can remove the support for full public keys. |
Member
|
it does leave this annoying |
bkchr
added a commit
that referenced
this pull request
Jan 17, 2020
Some fixes after: #4502 This removes the unwanted `expect`s from `MultiSigner`. Instead we convert from full to compressed in `TryFrom` and can return an error on invalid input.
gavofyork
pushed a commit
that referenced
this pull request
Jan 20, 2020
Some fixes after: #4502 This removes the unwanted `expect`s from `MultiSigner`. Instead we convert from full to compressed in `TryFrom` and can return an error on invalid input.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MultiSignerdid not compressed the ECDSA public key before hashing it butMultiSignatureexpected that the public key is compressed when verifying a signature. Thus, the signature verification could never succeed.This pr changes the following:
MultiSignercompresses the public key before hashing it withblake256.Verify for ecdsa::Signaturecompresses given public key before comparing it.ecdsa::Publicis now an enum that distinguishes between the full and compressed format.Fixes: #4498