Documentation ¶
Index ¶
- Variables
- func RegisterSocketPVMsg(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) SignHeartbeat(chainID string, heartbeat *types.Heartbeat) error
- 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 PubKeyMsg
- type RemoteSigner
- type RemoteSignerError
- type RemoteSignerOption
- type SignHeartbeatRequest
- type SignProposalRequest
- type SignVoteRequest
- type SignedHeartbeatResponse
- type SignedProposalResponse
- type SignedVoteResponse
- type SocketPV
- func (sc *SocketPV) GetAddress() types.Address
- func (sc *SocketPV) GetPubKey() crypto.PubKey
- func (sc *SocketPV) OnStart() error
- func (sc *SocketPV) OnStop()
- func (sc *SocketPV) SignHeartbeat(chainID string, heartbeat *types.Heartbeat) error
- func (sc *SocketPV) SignProposal(chainID string, proposal *types.Proposal) error
- func (sc *SocketPV) SignVote(chainID string, vote *types.Vote) error
- type SocketPVMsg
- type SocketPVOption
Constants ¶
This section is empty.
Variables ¶
var ( ErrDialRetryMax = errors.New("dialed maximum retries") ErrConnWaitTimeout = errors.New("waited for remote signer for too long") ErrConnTimeout = errors.New("remote signer timed out") ErrUnexpectedResponse = errors.New("received unexpected response") )
Socket errors.
Functions ¶
func RegisterSocketPVMsg ¶
func RegisterSocketPVMsg(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) SignHeartbeat ¶
SignHeartbeat signs a canonical representation of the heartbeat, along with the chainID. Implements PrivValidator.
func (*FilePV) SignProposal ¶
SignProposal signs a canonical representation of the proposal, along with the chainID. Implements PrivValidator.
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 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.
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 SignHeartbeatRequest ¶
SignHeartbeatRequest is a PrivValidatorSocket message containing a Heartbeat.
type SignProposalRequest ¶
SignProposalRequest is a PrivValidatorSocket message containing a Proposal.
type SignVoteRequest ¶
SignVoteRequest is a PrivValidatorSocket message containing a vote.
type SignedHeartbeatResponse ¶
type SignedHeartbeatResponse struct { Heartbeat *types.Heartbeat Error *RemoteSignerError }
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 SocketPV ¶
type SocketPV struct { cmn.BaseService // contains filtered or unexported fields }
SocketPV implements PrivValidator, it uses a socket to request signatures from an external process.
func NewSocketPV ¶
NewSocketPV returns an instance of SocketPV.
func (*SocketPV) GetAddress ¶
GetAddress implements PrivValidator.
func (*SocketPV) SignHeartbeat ¶
SignHeartbeat implements PrivValidator.
func (*SocketPV) SignProposal ¶
SignProposal implements PrivValidator.
type SocketPVMsg ¶
type SocketPVMsg interface{}
SocketPVMsg is sent between RemoteSigner and SocketPV.
type SocketPVOption ¶
type SocketPVOption func(*SocketPV)
SocketPVOption sets an optional parameter on the SocketPV.
func SocketPVAcceptDeadline ¶
func SocketPVAcceptDeadline(deadline time.Duration) SocketPVOption
SocketPVAcceptDeadline sets the deadline for the SocketPV listener. A zero time value disables the deadline.
func SocketPVConnDeadline ¶
func SocketPVConnDeadline(deadline time.Duration) SocketPVOption
SocketPVConnDeadline sets the read and write deadline for connections from external signing processes.
func SocketPVConnWait ¶
func SocketPVConnWait(timeout time.Duration) SocketPVOption
SocketPVConnWait sets the timeout duration before connection of external signing processes are considered to be unsuccessful.
func SocketPVHeartbeat ¶
func SocketPVHeartbeat(period time.Duration) SocketPVOption
SocketPVHeartbeat sets the period on which to check the liveness of the connected Signer connections.