Documentation ¶
Index ¶
- Variables
- func RegisterRemoteSignerMsg(cdc *amino.Codec)
- type FilePV
- func (pv *FilePV) GetAddress() types.Address
- func (pv *FilePV) GetPubKey() crypto.PubKey
- func (pv *FilePV) Reset()
- func (pv *FilePV) Save()
- func (pv *FilePV) SignProposal(chainID string, proposal *types.Proposal) error
- func (pv *FilePV) SignVote(chainID string, vote *types.Vote) error
- func (pv *FilePV) String() string
- type IPCRemoteSigner
- type IPCRemoteSignerOption
- type IPCVal
- type IPCValOption
- type PingRequest
- type PingResponse
- type PubKeyMsg
- type RemoteSigner
- type RemoteSignerClient
- func (sc *RemoteSignerClient) GetAddress() types.Address
- func (sc *RemoteSignerClient) GetPubKey() crypto.PubKey
- func (sc *RemoteSignerClient) Ping() error
- func (sc *RemoteSignerClient) SignProposal(chainID string, proposal *types.Proposal) error
- func (sc *RemoteSignerClient) SignVote(chainID string, vote *types.Vote) error
- type RemoteSignerError
- type RemoteSignerMsg
- type RemoteSignerOption
- type SignProposalRequest
- type SignVoteRequest
- type SignedProposalResponse
- type SignedVoteResponse
- type TCPVal
- type TCPValOption
Constants ¶
This section is empty.
Variables ¶
var ( ErrDialRetryMax = errors.New("dialed maximum retries") ErrConnTimeout = errors.New("remote signer timed out") ErrUnexpectedResponse = errors.New("received unexpected response") )
Socket errors.
Functions ¶
func RegisterRemoteSignerMsg ¶
func RegisterRemoteSignerMsg(cdc *amino.Codec)
Types ¶
type FilePV ¶
type FilePV struct { Address types.Address `json:"address"` PubKey crypto.PubKey `json:"pub_key"` LastHeight int64 `json:"last_height"` LastRound int `json:"last_round"` LastStep int8 `json:"last_step"` LastSignature []byte `json:"last_signature,omitempty"` LastSignBytes cmn.HexBytes `json:"last_signbytes,omitempty"` PrivKey crypto.PrivKey `json:"priv_key"` // contains filtered or unexported fields }
FilePV implements PrivValidator using data persisted to disk to prevent double signing. NOTE: the directory containing the pv.filePath must already exist. It includes the LastSignature and LastSignBytes so we don't lose the signature if the process crashes after signing but before the resulting consensus message is processed.
func GenFilePV ¶
GenFilePV generates a new validator with randomly generated private key and sets the filePath, but does not call Save().
func LoadFilePV ¶
LoadFilePV loads a FilePV from the filePath. The FilePV handles double signing prevention by persisting data to the filePath. If the filePath does not exist, the FilePV must be created manually and saved.
func LoadOrGenFilePV ¶
LoadOrGenFilePV loads a FilePV from the given filePath or else generates a new one and saves it to the filePath.
func (*FilePV) GetAddress ¶
GetAddress returns the address of the validator. Implements PrivValidator.
func (*FilePV) GetPubKey ¶
GetPubKey returns the public key of the validator. Implements PrivValidator.
func (*FilePV) Reset ¶
func (pv *FilePV) Reset()
Reset resets all fields in the FilePV. NOTE: Unsafe!
func (*FilePV) SignProposal ¶
SignProposal signs a canonical representation of the proposal, along with the chainID. Implements PrivValidator.
type IPCRemoteSigner ¶
type IPCRemoteSigner struct { cmn.BaseService // contains filtered or unexported fields }
IPCRemoteSigner is a RPC implementation of PrivValidator that listens on a unix socket.
func NewIPCRemoteSigner ¶
func NewIPCRemoteSigner( logger log.Logger, chainID, socketAddr string, privVal types.PrivValidator, ) *IPCRemoteSigner
NewIPCRemoteSigner returns an instance of IPCRemoteSigner.
func (*IPCRemoteSigner) OnStart ¶
func (rs *IPCRemoteSigner) OnStart() error
OnStart implements cmn.Service.
type IPCRemoteSignerOption ¶
type IPCRemoteSignerOption func(*IPCRemoteSigner)
IPCRemoteSignerOption sets an optional parameter on the IPCRemoteSigner.
func IPCRemoteSignerConnDeadline ¶
func IPCRemoteSignerConnDeadline(deadline time.Duration) IPCRemoteSignerOption
IPCRemoteSignerConnDeadline sets the read and write deadline for connections from external signing processes.
func IPCRemoteSignerConnRetries ¶
func IPCRemoteSignerConnRetries(retries int) IPCRemoteSignerOption
IPCRemoteSignerConnRetries sets the amount of attempted retries to connect.
type IPCVal ¶
type IPCVal struct { cmn.BaseService *RemoteSignerClient // contains filtered or unexported fields }
IPCVal implements PrivValidator, it uses a unix socket to request signatures from an external process.
type IPCValOption ¶
type IPCValOption func(*IPCVal)
IPCValOption sets an optional parameter on the SocketPV.
func IPCValConnTimeout ¶
func IPCValConnTimeout(timeout time.Duration) IPCValOption
IPCValConnTimeout sets the read and write timeout for connections from external signing processes.
func IPCValHeartbeat ¶
func IPCValHeartbeat(period time.Duration) IPCValOption
IPCValHeartbeat sets the period on which to check the liveness of the connected Signer connections.
type PingRequest ¶
type PingRequest struct { }
PingRequest is a PrivValidatorSocket message to keep the connection alive.
type PingResponse ¶
type PingResponse struct { }
type RemoteSigner ¶
type RemoteSigner struct { cmn.BaseService // contains filtered or unexported fields }
RemoteSigner implements PrivValidator by dialing to a socket.
func NewRemoteSigner ¶
func NewRemoteSigner( logger log.Logger, chainID, socketAddr string, privVal types.PrivValidator, privKey ed25519.PrivKeyEd25519, ) *RemoteSigner
NewRemoteSigner returns an instance of RemoteSigner.
func (*RemoteSigner) OnStart ¶
func (rs *RemoteSigner) OnStart() error
OnStart implements cmn.Service.
type RemoteSignerClient ¶
type RemoteSignerClient struct {
// contains filtered or unexported fields
}
RemoteSignerClient implements PrivValidator, it uses a socket to request signatures from an external process.
func NewRemoteSignerClient ¶
func NewRemoteSignerClient( conn net.Conn, ) *RemoteSignerClient
NewRemoteSignerClient returns an instance of RemoteSignerClient.
func (*RemoteSignerClient) GetAddress ¶
func (sc *RemoteSignerClient) GetAddress() types.Address
GetAddress implements PrivValidator.
func (*RemoteSignerClient) GetPubKey ¶
func (sc *RemoteSignerClient) GetPubKey() crypto.PubKey
GetPubKey implements PrivValidator.
func (*RemoteSignerClient) Ping ¶
func (sc *RemoteSignerClient) Ping() error
Ping is used to check connection health.
func (*RemoteSignerClient) SignProposal ¶
func (sc *RemoteSignerClient) SignProposal( chainID string, proposal *types.Proposal, ) error
SignProposal implements PrivValidator.
type RemoteSignerError ¶
type RemoteSignerError struct { // TODO(ismail): create an enum of known errors Code int Description string }
RemoteSignerError allows (remote) validators to include meaningful error descriptions in their reply.
func (*RemoteSignerError) Error ¶
func (e *RemoteSignerError) Error() string
type RemoteSignerMsg ¶
type RemoteSignerMsg interface{}
RemoteSignerMsg is sent between RemoteSigner and the RemoteSigner client.
type RemoteSignerOption ¶
type RemoteSignerOption func(*RemoteSigner)
RemoteSignerOption sets an optional parameter on the RemoteSigner.
func RemoteSignerConnDeadline ¶
func RemoteSignerConnDeadline(deadline time.Duration) RemoteSignerOption
RemoteSignerConnDeadline sets the read and write deadline for connections from external signing processes.
func RemoteSignerConnRetries ¶
func RemoteSignerConnRetries(retries int) RemoteSignerOption
RemoteSignerConnRetries sets the amount of attempted retries to connect.
type SignProposalRequest ¶
SignProposalRequest is a PrivValidatorSocket message containing a Proposal.
type SignVoteRequest ¶
SignVoteRequest is a PrivValidatorSocket message containing a vote.
type SignedProposalResponse ¶
type SignedProposalResponse struct { Proposal *types.Proposal Error *RemoteSignerError }
type SignedVoteResponse ¶
type SignedVoteResponse struct { Vote *types.Vote Error *RemoteSignerError }
SignedVoteResponse is a PrivValidatorSocket message containing a signed vote along with a potenial error message.
type TCPVal ¶
type TCPVal struct { cmn.BaseService *RemoteSignerClient // contains filtered or unexported fields }
TCPVal implements PrivValidator, it uses a socket to request signatures from an external process.
type TCPValOption ¶
type TCPValOption func(*TCPVal)
TCPValOption sets an optional parameter on the SocketPV.
func TCPValAcceptDeadline ¶
func TCPValAcceptDeadline(deadline time.Duration) TCPValOption
TCPValAcceptDeadline sets the deadline for the TCPVal listener. A zero time value disables the deadline.
func TCPValConnTimeout ¶
func TCPValConnTimeout(timeout time.Duration) TCPValOption
TCPValConnTimeout sets the read and write timeout for connections from external signing processes.
func TCPValHeartbeat ¶
func TCPValHeartbeat(period time.Duration) TCPValOption
TCPValHeartbeat sets the period on which to check the liveness of the connected Signer connections.