github.com/okex/exchain@v1.8.0/libs/tendermint/privval/messages.go (about)

     1  package privval
     2  
     3  import (
     4  	amino "github.com/tendermint/go-amino"
     5  
     6  	"github.com/okex/exchain/libs/tendermint/crypto"
     7  	"github.com/okex/exchain/libs/tendermint/types"
     8  )
     9  
    10  // SignerMessage is sent between Signer Clients and Servers.
    11  type SignerMessage interface{}
    12  
    13  func RegisterRemoteSignerMsg(cdc *amino.Codec) {
    14  	cdc.RegisterInterface((*SignerMessage)(nil), nil)
    15  	cdc.RegisterConcrete(&PubKeyRequest{}, "tendermint/remotesigner/PubKeyRequest", nil)
    16  	cdc.RegisterConcrete(&PubKeyResponse{}, "tendermint/remotesigner/PubKeyResponse", nil)
    17  	cdc.RegisterConcrete(&SignVoteRequest{}, "tendermint/remotesigner/SignVoteRequest", nil)
    18  	cdc.RegisterConcrete(&SignedVoteResponse{}, "tendermint/remotesigner/SignedVoteResponse", nil)
    19  	cdc.RegisterConcrete(&SignProposalRequest{}, "tendermint/remotesigner/SignProposalRequest", nil)
    20  	cdc.RegisterConcrete(&SignedProposalResponse{}, "tendermint/remotesigner/SignedProposalResponse", nil)
    21  
    22  	cdc.RegisterConcrete(&PingRequest{}, "tendermint/remotesigner/PingRequest", nil)
    23  	cdc.RegisterConcrete(&PingResponse{}, "tendermint/remotesigner/PingResponse", nil)
    24  }
    25  
    26  // TODO: Add ChainIDRequest
    27  
    28  // PubKeyRequest requests the consensus public key from the remote signer.
    29  type PubKeyRequest struct{}
    30  
    31  // PubKeyResponse is a response message containing the public key.
    32  type PubKeyResponse struct {
    33  	PubKey crypto.PubKey
    34  	Error  *RemoteSignerError
    35  }
    36  
    37  // SignVoteRequest is a request to sign a vote
    38  type SignVoteRequest struct {
    39  	Vote *types.Vote
    40  }
    41  
    42  // SignedVoteResponse is a response containing a signed vote or an error
    43  type SignedVoteResponse struct {
    44  	Vote  *types.Vote
    45  	Error *RemoteSignerError
    46  }
    47  
    48  // SignProposalRequest is a request to sign a proposal
    49  type SignProposalRequest struct {
    50  	Proposal *types.Proposal
    51  }
    52  
    53  // SignedProposalResponse is response containing a signed proposal or an error
    54  type SignedProposalResponse struct {
    55  	Proposal *types.Proposal
    56  	Error    *RemoteSignerError
    57  }
    58  
    59  type SignBytesRequest struct {
    60  	Bytes []byte
    61  }
    62  
    63  type SignedBytesResponse struct {
    64  	Bytes []byte
    65  	Error *RemoteSignerError
    66  }
    67  
    68  // PingRequest is a request to confirm that the connection is alive.
    69  type PingRequest struct {
    70  }
    71  
    72  // PingResponse is a response to confirm that the connection is alive.
    73  type PingResponse struct {
    74  }