privval

package
v0.19.7-rc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDialRetryMax    = errors.New("dialed maximum retries")
	ErrConnWaitTimeout = errors.New("waited for remote signer for too long")
	ErrConnTimeout     = errors.New("remote signer timed out")
)

Socket errors.

Functions

func RegisterSocketPVMsg added in v0.19.0

func RegisterSocketPVMsg(cdc *amino.Codec)

Types

type FilePV added in v0.19.0

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 crypto.Signature `json:"last_signature,omitempty"` // so we dont lose signatures XXX Why would we lose signatures?
	LastSignBytes cmn.HexBytes     `json:"last_signbytes,omitempty"` // so we dont lose signatures XXX Why would we lose signatures?
	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.

func GenFilePV added in v0.19.0

func GenFilePV(filePath string) *FilePV

GenFilePV generates a new validator with randomly generated private key and sets the filePath, but does not call Save().

func LoadFilePV added in v0.19.0

func LoadFilePV(filePath string) *FilePV

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 added in v0.19.0

func LoadOrGenFilePV(filePath string) *FilePV

LoadOrGenFilePV loads a FilePV from the given filePath or else generates a new one and saves it to the filePath.

func (*FilePV) GetAddress added in v0.19.0

func (pv *FilePV) GetAddress() types.Address

GetAddress returns the address of the validator. Implements PrivValidator.

func (*FilePV) GetPubKey added in v0.19.0

func (pv *FilePV) GetPubKey() crypto.PubKey

GetPubKey returns the public key of the validator. Implements PrivValidator.

func (*FilePV) Reset added in v0.19.0

func (pv *FilePV) Reset()

Reset resets all fields in the FilePV. NOTE: Unsafe!

func (*FilePV) Save added in v0.19.0

func (pv *FilePV) Save()

Save persists the FilePV to disk.

func (*FilePV) SignHeartbeat added in v0.19.0

func (pv *FilePV) SignHeartbeat(chainID string, heartbeat *types.Heartbeat) error

SignHeartbeat signs a canonical representation of the heartbeat, along with the chainID. Implements PrivValidator.

func (*FilePV) SignProposal added in v0.19.0

func (pv *FilePV) SignProposal(chainID string, proposal *types.Proposal) error

SignProposal signs a canonical representation of the proposal, along with the chainID. Implements PrivValidator.

func (*FilePV) SignVote added in v0.19.0

func (pv *FilePV) SignVote(chainID string, vote *types.Vote) error

SignVote signs a canonical representation of the vote, along with the chainID. Implements PrivValidator.

func (*FilePV) String added in v0.19.0

func (pv *FilePV) String() string

String returns a string representation of the FilePV.

type PubKeyMsg

type PubKeyMsg struct {
	PubKey crypto.PubKey
}

PubKeyMsg is a PrivValidatorSocket message containing the public key.

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 crypto.PrivKeyEd25519,
) *RemoteSigner

NewRemoteSigner returns an instance of RemoteSigner.

func (*RemoteSigner) OnStart

func (rs *RemoteSigner) OnStart() error

OnStart implements cmn.Service.

func (*RemoteSigner) OnStop

func (rs *RemoteSigner) OnStop()

OnStop implements cmn.Service.

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 SignHeartbeatMsg

type SignHeartbeatMsg struct {
	Heartbeat *types.Heartbeat
}

SignHeartbeatMsg is a PrivValidatorSocket message containing a Heartbeat.

type SignProposalMsg

type SignProposalMsg struct {
	Proposal *types.Proposal
}

SignProposalMsg is a PrivValidatorSocket message containing a Proposal.

type SignVoteMsg

type SignVoteMsg struct {
	Vote *types.Vote
}

SignVoteMsg is a PrivValidatorSocket message containing a vote.

type SocketPV added in v0.19.0

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 added in v0.19.0

func NewSocketPV(
	logger log.Logger,
	socketAddr string,
	privKey crypto.PrivKeyEd25519,
) *SocketPV

NewSocketPV returns an instance of SocketPV.

func (*SocketPV) GetAddress added in v0.19.0

func (sc *SocketPV) GetAddress() types.Address

GetAddress implements PrivValidator.

func (*SocketPV) GetPubKey added in v0.19.0

func (sc *SocketPV) GetPubKey() crypto.PubKey

GetPubKey implements PrivValidator.

func (*SocketPV) OnStart added in v0.19.0

func (sc *SocketPV) OnStart() error

OnStart implements cmn.Service.

func (*SocketPV) OnStop added in v0.19.0

func (sc *SocketPV) OnStop()

OnStop implements cmn.Service.

func (*SocketPV) SignHeartbeat added in v0.19.0

func (sc *SocketPV) SignHeartbeat(
	chainID string,
	heartbeat *types.Heartbeat,
) error

SignHeartbeat implements PrivValidator.

func (*SocketPV) SignProposal added in v0.19.0

func (sc *SocketPV) SignProposal(
	chainID string,
	proposal *types.Proposal,
) error

SignProposal implements PrivValidator.

func (*SocketPV) SignVote added in v0.19.0

func (sc *SocketPV) SignVote(chainID string, vote *types.Vote) error

SignVote implements PrivValidator.

type SocketPVMsg added in v0.19.0

type SocketPVMsg interface{}

SocketPVMsg is sent between RemoteSigner and SocketPV.

type SocketPVOption added in v0.19.0

type SocketPVOption func(*SocketPV)

SocketPVOption sets an optional parameter on the SocketPV.

func SocketPVAcceptDeadline added in v0.19.0

func SocketPVAcceptDeadline(deadline time.Duration) SocketPVOption

SocketPVAcceptDeadline sets the deadline for the SocketPV listener. A zero time value disables the deadline.

func SocketPVConnDeadline added in v0.19.0

func SocketPVConnDeadline(deadline time.Duration) SocketPVOption

SocketPVConnDeadline sets the read and write deadline for connections from external signing processes.

func SocketPVConnWait added in v0.19.0

func SocketPVConnWait(timeout time.Duration) SocketPVOption

SocketPVConnWait sets the timeout duration before connection of external signing processes are considered to be unsuccessful.

func SocketPVHeartbeat added in v0.19.0

func SocketPVHeartbeat(period time.Duration) SocketPVOption

SocketPVHeartbeat sets the period on which to check the liveness of the connected Signer connections.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL