janus

package module
v0.0.0-...-b967b72 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

janus

Janus is a Tendermint PrivateValidator wrapper that implements signature step locking using etcd.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSignatureRejected indicates that the signature is already locked or locking failed
	ErrSignatureRejected = errors.New("signature rejected")
)

Functions

This section is empty.

Types

type EtcdSigningWrapper

type EtcdSigningWrapper struct {
	service.BaseService
	// contains filtered or unexported fields
}

EtcdSigningWrapper implements PrivValidator by wrapping the etcd locking around a PrivValidator

func NewEtcdSigningWrapper

func NewEtcdSigningWrapper(
	logger log.Logger,
	privVal types.PrivValidator,
	timeout time.Duration,
	validatorName string,
	lockerEndpoints []string,
) *EtcdSigningWrapper

NewEtcdSigningWrapper returns an instance of EtcdSigningWrapper.

func (*EtcdSigningWrapper) GetPubKey

func (es *EtcdSigningWrapper) GetPubKey() (crypto.PubKey, error)

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

func (*EtcdSigningWrapper) OnStart

func (es *EtcdSigningWrapper) OnStart() error

OnStart implements cmn.Service.

func (*EtcdSigningWrapper) OnStop

func (es *EtcdSigningWrapper) OnStop()

OnStop implements cmn.Service.

func (*EtcdSigningWrapper) SignProposal

func (es *EtcdSigningWrapper) SignProposal(chainID string, proposal *tmproto.Proposal) error

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

func (*EtcdSigningWrapper) SignVote

func (es *EtcdSigningWrapper) SignVote(chainID string, vote *tmproto.Vote) error

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

type Locker

type Locker struct {
	// contains filtered or unexported fields
}

Locker can be used to lock signature steps in Tendermint using etcd to prevent double signing

func NewLocker

func NewLocker(endpoints []string, timeout time.Duration) (*Locker, error)

NewLocker returns an instance of Locker

func (*Locker) Disconnect

func (l *Locker) Disconnect()

Disconnect closes the underlying etcd connection

func (*Locker) TryLock

func (l *Locker) TryLock(validatorName, lockType string, height int64, round int) (bool, error)

TryLock tries to lock a specific signature step Returns false if the signature step is already locked

func (*Locker) TryLockCheckHash

func (l *Locker) TryLockCheckHash(validatorName, lockType string, height int64, round int, blockHash string) (bool, error)

TryLockCheckHash tries to lock a specific signature step. This should be used for the precommit step. Returns false if the signature step is already locked

func (*Locker) TryLockSetHash

func (l *Locker) TryLockSetHash(validatorName, lockType string, height int64, round int, blockHash string) (bool, error)

TryLockSetHash tries to lock a specific signature step for this h/r pair. This should be used for the prevote step. Returns false if the signature step is already locked

Jump to

Keyboard shortcuts

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