tss

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(host string, port string, timeout time.Duration, logger log.Logger) (*grpc.ClientConn, error)

Connect connects to tofnd gRPC Server

Types

type LockableStream

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

LockableStream is a thread-safe Stream

func NewLockableStream

func NewLockableStream(stream Stream) *LockableStream

NewLockableStream return a new thread-safe stream instance

func (*LockableStream) CloseSend

func (l *LockableStream) CloseSend() error

CloseSend implements the Stream interface

func (*LockableStream) Recv

func (l *LockableStream) Recv() (*tofnd.MessageOut, error)

Recv implements the Stream interface

func (*LockableStream) Send

func (l *LockableStream) Send(in *tofnd.MessageIn) error

Send implements the Stream interface

type Mgr

type Mgr struct {
	Timeout time.Duration

	Logger log.Logger
	// contains filtered or unexported fields
}

Mgr represents an object that manages all communication with the external tss process

func NewMgr

func NewMgr(client rpc.Client, multiSigClient rpc.MultiSigClient, cliCtx sdkClient.Context, timeout time.Duration, principalAddr string, broadcaster broadcasterTypes.Broadcaster, logger log.Logger, cdc *codec.LegacyAmino) *Mgr

NewMgr returns a new tss manager instance

func (*Mgr) ProcessHeartBeatEvent

func (mgr *Mgr) ProcessHeartBeatEvent(e tmEvents.Event) error

ProcessHeartBeatEvent broadcasts the heartbeat

func (*Mgr) ProcessKeygenMsg

func (mgr *Mgr) ProcessKeygenMsg(e tmEvents.Event) error

ProcessKeygenMsg forwards blockchain messages to the keygen protocol

func (*Mgr) ProcessKeygenStart

func (mgr *Mgr) ProcessKeygenStart(e tmEvents.Event) error

ProcessKeygenStart starts the communication with the keygen protocol

func (*Mgr) ProcessNewBlockHeader

func (mgr *Mgr) ProcessNewBlockHeader(blockHeight int64)

ProcessNewBlockHeader handles timeout on new block header

func (*Mgr) ProcessSignMsg

func (mgr *Mgr) ProcessSignMsg(e tmEvents.Event) error

ProcessSignMsg forwards blockchain messages to the sign protocol

func (*Mgr) ProcessSignStart

func (mgr *Mgr) ProcessSignStart(e tmEvents.Event) error

ProcessSignStart starts the communication with the sign protocol

func (*Mgr) Recover

func (mgr *Mgr) Recover(recoverJSON []byte) error

Recover instructs tofnd to recover the node's shares given the recovery info provided

func (*Mgr) RefreshKeys added in v0.17.1

func (mgr *Mgr) RefreshKeys(ctx context.Context) error

RefreshKeys refreshes validator key id to pub key mapping TODO: Allow refreshing by individual key id

type Session

type Session struct {
	ID        string
	TimeoutAt int64
	// contains filtered or unexported fields
}

Session defines a tss session which is either signing or keygen

func (*Session) Timeout

func (s *Session) Timeout()

Timeout signals a session has timed out

func (*Session) WaitForTimeout

func (s *Session) WaitForTimeout()

WaitForTimeout waits until the session has timed out

type Stream

type Stream interface {
	Send(in *tofnd.MessageIn) error
	Recv() (*tofnd.MessageOut, error)
	CloseSend() error
}

Stream is the abstracted communication stream with tofnd

type TimeoutQueue

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

TimeoutQueue is a queue of sessions order by timeoutAt

func NewTimeoutQueue

func NewTimeoutQueue() *TimeoutQueue

NewTimeoutQueue is the constructor for TimeoutQueue

func (*TimeoutQueue) Dequeue

func (q *TimeoutQueue) Dequeue() *Session

Dequeue pops the first session in queue

func (*TimeoutQueue) Enqueue

func (q *TimeoutQueue) Enqueue(ID string, timeoutAt int64) *Session

Enqueue adds a new session with ID and timeoutAt into the queue

func (*TimeoutQueue) Top

func (q *TimeoutQueue) Top() *Session

Top returns the first session in queue

Directories

Path Synopsis
rpc

Jump to

Keyboard shortcuts

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