Skip to content

Remove amino overhead from KMS related communication #2830

@liamsi

Description

@liamsi

As discussed in the tendermint-dev call, there are a few places where we use some amino-specifics in the communication with the KMS. It might be worth investigating if we could/should do without them:

in secret connection:

  • the interface crypto.PubKey (used in authSigMessage) currently always is a ed25519 key:
    type authSigMessage struct {
    Key crypto.PubKey
    Sig []byte
    }
  • the keys shared via shareEphPubKey are send as raw bytes but they are length prefixed "twice" (once for the total message, once for the length of the byte slice); we probably do not need that (use marshalbinarybare instead):
    var trs, _ = cmn.Parallel(
    func(_ int) (val interface{}, err error, abort bool) {
    var _, err1 = cdc.MarshalBinaryLengthPrefixedWriter(conn, locEphPub)
    if err1 != nil {
    return nil, err1, true // abort
    }
    return nil, nil, false
    },
    func(_ int) (val interface{}, err error, abort bool) {
    var _remEphPub [32]byte
    var _, err2 = cdc.UnmarshalBinaryLengthPrefixedReader(conn, &_remEphPub, 1024*1024) // TODO

other usages of interfaces:

  • PubKeyMsg contains a crypto.PubKey (again only ed25519 is currently used AFAIK):
    type PubKeyMsg struct {
    PubKey crypto.PubKey
    }
  • RemoteSignerMsg is an interface; it only has a few implementations though:
    type RemoteSignerMsg interface{}
    func RegisterRemoteSignerMsg(cdc *amino.Codec) {
    cdc.RegisterInterface((*RemoteSignerMsg)(nil), nil)
    cdc.RegisterConcrete(&PubKeyMsg{}, "tendermint/remotesigner/PubKeyMsg", nil)
    cdc.RegisterConcrete(&SignVoteRequest{}, "tendermint/remotesigner/SignVoteRequest", nil)
    cdc.RegisterConcrete(&SignedVoteResponse{}, "tendermint/remotesigner/SignedVoteResponse", nil)
    cdc.RegisterConcrete(&SignProposalRequest{}, "tendermint/remotesigner/SignProposalRequest", nil)
    cdc.RegisterConcrete(&SignedProposalResponse{}, "tendermint/remotesigner/SignedProposalResponse", nil)
    cdc.RegisterConcrete(&SignHeartbeatRequest{}, "tendermint/remotesigner/SignHeartbeatRequest", nil)
    cdc.RegisterConcrete(&SignedHeartbeatResponse{}, "tendermint/remotesigner/SignedHeartbeatResponse", nil)
    (this could be replaced by oneof IMHO; currently not supported by amino though)

cc @ValarDragon @ebuchman

ref tendermint/tmkms#91

Metadata

Metadata

Assignees

Labels

C:p2pComponent: P2P pkgT:breakingType: Breaking ChangeT:validatorType: Validator related

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions