Conversation
crypto/keys/ecdsa/ecdsa_pubkey.go
Outdated
| compressed[1] = byte(pk.Y.Bit(0)) | 2 | ||
| pk.X.FillBytes(compressed[2:]) | ||
| return compressed | ||
| } |
There was a problem hiding this comment.
When serializing I'm adding additional byte to add curve information. Alternative design would be to use duplicate structures.
amaury1093
left a comment
There was a problem hiding this comment.
There are still a couple of tmcrypto.Address and XXX lying around, but apart from that I'm good with this PR 👍
| } | ||
|
|
||
| // PrivKey defines a secp256r1 ECDSA private key. | ||
| message PrivKey { |
There was a problem hiding this comment.
Do we even need a PrivKey in protobuf? This should not be created in our keyring but just by hardware devices.
There was a problem hiding this comment.
I created it for completeness. Do you prefer to remove it?
There was a problem hiding this comment.
Hmm... I don't have a strong preference, but generally prefer to not include things which won't/shouldn't be used. For tests we have an internal privkey to use already right?
There was a problem hiding this comment.
yes, tests and private key generation will work with the internal/ecdsa.
There was a problem hiding this comment.
OK, so I will remove the PrivKey proto.
There was a problem hiding this comment.
sdkcrypto.PrivKey interface requires to be proto.Message. While it doesn't need to implement Marsha and Unmarshal method, it's meant to be used in protobuf ecosystem as well as being marshaled (eg proto.Marshal(pb proto.Message). Hence I think it's better to keep the proto file and generated files. What do you think?
aaronc
left a comment
There was a problem hiding this comment.
LGTM. There are a few minor improvements that could be made before merging. Otherwise it has enough approvals
|
I've added and then removed |
aaronc
left a comment
There was a problem hiding this comment.
Merge when you're ready @robert-zaremba
Description
closes: #7718
This design follows the
ecdsadesign in Go stdlib: we have one structure for all ecdsa keysWhen serializing key, we are prepending one byte to store information about the key type. For any other ecdsa key, we don't need to create different structure.
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/) or specification (x/<module>/spec/)godoccomments.Unreleasedsection inCHANGELOG.mdFiles changedin the Github PR explorerCodecov Reportin the comment section below once CI passes