Remove the old message PublicKey proto oneof (#7390)
* Remove unused PublicKey type and update docs * Update wording * Update proto/cosmos/base/crypto/v1beta1/crypto.proto Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com> * Edit docs * Move crypto.proto to multisig * Proto linting * Update docs/architecture/adr-020-protobuf-transaction-encoding.md Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com> * Update wording for Public Key Encoding Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
This commit is contained in:
co-authored by
Amaury Martiny
mergify[bot]
Robert Zaremba
parent
5e1954439a
commit
489599b70f
@@ -10,6 +10,7 @@
|
||||
- 2020 June 08: Store `TxBody` and `AuthInfo` as bytes in `SignDoc`; Document `TxRaw` as broadcast and storage type.
|
||||
- 2020 August 07: Use ADR 027 for serializing `SignDoc`.
|
||||
- 2020 August 19: Move sequence field from `SignDoc` to `SignerInfo`.
|
||||
- 2020 September 25: Remove `PublicKey` type in favor of `secp256k1.PubKey`, `ed25519.PubKey` and `multisig.LegacyAminoPubKey`.
|
||||
|
||||
## Status
|
||||
|
||||
@@ -284,27 +285,21 @@ and `FileDescriptor`s and returns a boolean result.
|
||||
|
||||
### Public Key Encoding
|
||||
|
||||
Public keys in the Cosmos SDK implement Tendermint's `crypto.PubKey` interface,
|
||||
so a natural solution might be to use `Any` as we are doing for other interfaces.
|
||||
There are, however, a limited number of public keys in existence and new ones
|
||||
aren't created overnight. The proposed solution is to use a `oneof` that:
|
||||
|
||||
- attempts to catalog all known key types even if a given app can't use them all
|
||||
- has an `Any` member that can be used when a key type isn't present in the `oneof`
|
||||
Public keys in the Cosmos SDK implement Tendermint's `crypto.PubKey` interface.
|
||||
We propose to use `Any` for protobuf encoding as we are doing with other interfaces (e.g. in `BaseAccount` `PubKey` or `SignerInfo` `PublicKey`).
|
||||
Following public keys are implemented: secp256k1, ed25519 and multisignature.
|
||||
|
||||
Ex:
|
||||
|
||||
```proto
|
||||
message PublicKey {
|
||||
oneof sum {
|
||||
bytes secp256k1 = 1;
|
||||
bytes ed25519 = 2;
|
||||
...
|
||||
google.protobuf.Any any_pubkey = 15;
|
||||
}
|
||||
message PubKey {
|
||||
bytes key = 1;
|
||||
}
|
||||
```
|
||||
|
||||
`multisig.LegacyAminoPubKey` has an array of `Any`'s member to support any
|
||||
protobuf public key type.
|
||||
|
||||
Apps should only attempt to handle a registered set of public keys that they
|
||||
have tested. The provided signature verification ante handler decorators will
|
||||
enforce this.
|
||||
|
||||
Reference in New Issue
Block a user