core

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSessionDuration           = 15
	DefaultSessionProposalDuration   = 2
	DefaultSessionAcceptanceDuration = 2
	DefaultSessionSignDuration       = 6

	KeygenSessionDuration       = 13
	KeygenSessionKeygenDuration = 10

	ReshareSessionDuration           = 47
	ReshareSessionProposalDuration   = 2
	ReshareSessionAcceptanceDuration = 2
	ReshareSessionKeygenDuration     = 24
	ReshareSessionSignDuration       = 6
)

Default: 0-2 proposal 3-5 acceptance 6-12 sign 13-15 finish Keygen: 0-10 11-13 finish Reshare 0-2 proposal 3-5 acceptance 6-30 keygen 31-37 sign 38-44 sign 45-47 finish

View Source
const ContextTypeKey = "context_key"

Variables

View Source
var (
	ErrSignerNotAParty  = goerr.New("signer not a party")
	ErrInvalidSignature = goerr.New("invalid signature")
)
View Source
var (
	ErrInvalidSessionID   = goerr.New("invalid session ID")
	ErrInvalidSessionType = goerr.New("invalid session type")
)

Functions

func GetSessionCtx

func GetSessionCtx(ctx context.Context, sessionType types.SessionType) context.Context

func GetTssPartyKey

func GetTssPartyKey(account string) *big.Int

func Initialize

func Initialize(cfg config.Config)

func PartyIds

func PartyIds(parties []*rarimo.Party) tss.SortedPartyIDs

func SetInRegistry

func SetInRegistry(ctxKey ContextKey, key RegistryKey, value any)

Types

type Bounds

type Bounds struct {
	Start uint64
	End   uint64
}

type BoundsManager

type BoundsManager struct {
	SessionStart    uint64
	SessionEnd      uint64
	SessionDuration uint64
	// contains filtered or unexported fields
}

BoundsManager is responsible for managing controllers bounds

func NewBoundsManager

func NewBoundsManager(start uint64, sessionType types.SessionType) *BoundsManager

func (*BoundsManager) Current

func (b *BoundsManager) Current() *Bounds

func (*BoundsManager) NextController

func (b *BoundsManager) NextController(t types.ControllerType) *Bounds

type Context

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

func DefaultGlobalContext

func DefaultGlobalContext(ctx context.Context) Context

func DefaultSessionContext

func DefaultSessionContext(sessionType types.SessionType) Context

func WrapCtx

func WrapCtx(ctx context.Context) Context

func (*Context) Client

func (c *Context) Client() *grpc.ClientConn

func (*Context) Context

func (c *Context) Context() context.Context

func (*Context) Core

func (c *Context) Core() *connectors.CoreConnector

func (*Context) Listener

func (c *Context) Listener() net.Listener

func (*Context) Log

func (c *Context) Log() *logan.Entry

func (*Context) PG

func (c *Context) PG() *pg.Storage

func (*Context) Pool

func (c *Context) Pool() *pool.Pool

func (*Context) SecretStorage

func (c *Context) SecretStorage() secret.Storage

func (*Context) Swagger

func (c *Context) Swagger() *config.SwaggerInfo

func (*Context) Tendermint

func (c *Context) Tendermint() *http.HTTP

func (*Context) Timer

func (c *Context) Timer() *timer.Timer

type ContextKey

type ContextKey uint
const (
	GlobalContextKey         ContextKey = iota
	DefaultSessionContextKey ContextKey = iota
	KeygenSessionContextKey  ContextKey = iota
	ReshareSessionContextKey ContextKey = iota
)

type ISession

type ISession interface {
	ID() uint64
	End() uint64
	Receive(ctx context.Context, request *types.MsgSubmitRequest) error
	// NewBlock is a receiver for timer.Timer
	NewBlock(height uint64)
	NextSession() ISession
}

ISession represents session component that is responsible for launching first session controller, managing controllers execution and creating next sessions.

type InputSet

type InputSet struct {
	IsActive          bool
	GlobalPubKey      string
	N, T              int
	Parties           []*rarimo.Party
	VerifiedParties   []*rarimo.Party
	UnverifiedParties []*rarimo.Party
	LastSignature     string
}

InputSet defines data set (parties, params, etc.) to be used in session

func NewInputSet

func NewInputSet(client *grpc.ClientConn) *InputSet

type RegistryKey

type RegistryKey uint
const (
	PGKey RegistryKey = iota
	SecretKey
	LogKey
	ClientKey
	CoreKey
	PoolKey
	TimerKey
	TendermintKey
	ListenerKey
	SwaggerKey
)

type RequestAuthorizer

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

RequestAuthorizer is responsible for authorizing requests using defined InputSet parties

func NewRequestAuthorizer

func NewRequestAuthorizer(parties []*rarimo.Party, log *logan.Entry) *RequestAuthorizer

func (*RequestAuthorizer) Auth

func (r *RequestAuthorizer) Auth(request *types.MsgSubmitRequest) (*rarimo.Party, error)

type SessionManager

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

SessionManager is responsible for managing session execution

func NewSessionManager

func NewSessionManager() *SessionManager

func (*SessionManager) AddSession

func (s *SessionManager) AddSession(sessionType types.SessionType, session ISession)

func (*SessionManager) ID

func (s *SessionManager) ID(sessionType types.SessionType) (uint64, bool)

func (*SessionManager) NewBlock

func (s *SessionManager) NewBlock(height uint64) error

func (*SessionManager) Receive

func (s *SessionManager) Receive(ctx context.Context, request *types.MsgSubmitRequest) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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