tendermint-rs
tendermint-rs copied to clipboard
Refactor public keys
What you got in mind for this? Worth capturing in a follow-up issue?
Yeah, probably.
I think it'd be good to switch to using the k256::PublicKey
or k256::ecdsa::VerifyingKey
types as the tendermint::public_key::Secp256k1
key type.
Those types ensure that the public key represents a valid elliptic curve point. It's presently using an EncodedPoint
type which represents a SEC1 serialization of an elliptic curve point that isn't guaranteed to be valid.
One drawback of this approach is that tendermint::PublicKey::as_bytes()
couldn't exist in its current form, since the k256
types represent a decoded curve point and require an extra step to re-serialize them.
Originally posted by @tarcieri in https://github.com/informalsystems/tendermint-rs/issues/872#issuecomment-830206219