dkgtasks

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBigIntSlice

func FormatBigIntSlice(slice []*big.Int) string

FormatBigIntSlice formats a slice of *big.Int's suitably for logging

func FormatPublicKey

func FormatPublicKey(publicKey [2]*big.Int) string

FormatPublicKey formats the public key suitably for logging

func GeneralTaskShouldRetry

func GeneralTaskShouldRetry(ctx context.Context, logger *logrus.Logger,
	eth blockchain.Ethereum, acct accounts.Account, publicKey [2]*big.Int,
	expectedRegistrationEnd uint64, expectedLastBlock uint64) bool

GeneralTaskShouldRetry is the general logic used to determine if a task should try again -- Process is

Types

type CompletionTask

type CompletionTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

CompletionTask contains required state for safely performing a registration

func NewCompletionTask

func NewCompletionTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account, publicKey [2]*big.Int,
	registrationEnd uint64, lastBlock uint64) *CompletionTask

NewCompletionTask creates a background task that attempts to call Complete on ethdkg

func (*CompletionTask) DoDone

func (t *CompletionTask) DoDone()

DoDone creates a log entry saying task is complete

func (*CompletionTask) DoRetry

func (t *CompletionTask) DoRetry(ctx context.Context) bool

DoRetry is all subsequent attempts

func (*CompletionTask) DoWork

func (t *CompletionTask) DoWork(ctx context.Context) bool

DoWork is the first attempt

func (*CompletionTask) ShouldRetry

func (t *CompletionTask) ShouldRetry(ctx context.Context) bool

ShouldRetry checks if it makes sense to try again Predicates: -- we haven't passed the last block -- the registration open hasn't moved, i.e. ETHDKG has not restarted

type DisputeTask

type DisputeTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

DisputeTask stores the data required to dispute shares

func NewDisputeTask

func NewDisputeTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account, publicKey [2]*big.Int, registrationEnd uint64, lastBlock uint64) *DisputeTask

NewDisputeTask creates a new task

func (*DisputeTask) DoDone

func (t *DisputeTask) DoDone()

DoDone creates a log entry saying task is complete

func (*DisputeTask) DoRetry

func (t *DisputeTask) DoRetry(ctx context.Context) bool

DoRetry is subsequent attempts at distributing shares via ethdkg

func (*DisputeTask) DoWork

func (t *DisputeTask) DoWork(ctx context.Context) bool

DoWork is the first attempt at distributing shares via ethdkg

func (*DisputeTask) ShouldRetry

func (t *DisputeTask) ShouldRetry(ctx context.Context) bool

ShouldRetry checks if it makes sense to try again

type GPKJDisputeTask

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

GPKJDisputeTask contains required state for safely performing a registration

func NewGPKJDisputeTask

func NewGPKJDisputeTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account,
	publicKey [2]*big.Int,
	inverse []*big.Int,
	honestIndicies []*big.Int,
	dishonestIndicies []*big.Int,
	registrationEnd uint64, lastBlock uint64) *GPKJDisputeTask

NewGPKJDisputeTask creates a background task that attempts to register with ETHDKG

func (*GPKJDisputeTask) DoDone

func (t *GPKJDisputeTask) DoDone()

DoDone creates a log entry saying task is complete

func (*GPKJDisputeTask) DoRetry

func (t *GPKJDisputeTask) DoRetry(ctx context.Context)

DoRetry is all subsequent attempts at registering with ethdkg

func (*GPKJDisputeTask) DoWork

func (t *GPKJDisputeTask) DoWork(ctx context.Context)

DoWork is the first attempt at registering with ethdkg

func (*GPKJDisputeTask) ShouldRetry

func (t *GPKJDisputeTask) ShouldRetry(ctx context.Context) bool

ShouldRetry checks if it makes sense to try again Predicates: -- we haven't passed the last block -- the registration open hasn't moved, i.e. ETHDKG has not restarted

type GPKSubmissionTask

type GPKSubmissionTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

GPKSubmissionTask contains required state for safely performing a registration

func NewGPKSubmissionTask

func NewGPKSubmissionTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account,
	publicKey [2]*big.Int,
	groupPublicKey [4]*big.Int,
	signature [2]*big.Int,
	registrationEnd uint64, lastBlock uint64) *GPKSubmissionTask

NewGPKSubmissionTask creates a background task that attempts to register with ETHDKG

func (*GPKSubmissionTask) DoDone

func (t *GPKSubmissionTask) DoDone()

DoDone creates a log entry saying task is complete

func (*GPKSubmissionTask) DoRetry

func (t *GPKSubmissionTask) DoRetry(ctx context.Context) bool

DoRetry is all subsequent attempts at registering with ethdkg

func (*GPKSubmissionTask) DoWork

func (t *GPKSubmissionTask) DoWork(ctx context.Context) bool

DoWork is the first attempt at registering with ethdkg

func (*GPKSubmissionTask) ShouldRetry

func (t *GPKSubmissionTask) ShouldRetry(ctx context.Context) bool

ShouldRetry checks if it makes sense to try again Predicates: -- we haven't passed the last block -- the registration open hasn't moved, i.e. ETHDKG has not restarted

type KeyShareStatus

type KeyShareStatus int

KeyShareStatus is an enumeration indicated the current status of keyshare

const (
	UnknownKeyShare KeyShareStatus = iota
	KeyShared
	NoKeyShared
	BadKeyShared
)

The possible key share statuses: * UnknownKeyShare - unknown if the address has shared a key * KeyShared - address has shared the expected key * NoKeyShared - address does not have a key share * BadKeyShared - address has an unexpected key share

func CheckKeyShare

func CheckKeyShare(ctx context.Context, ethdkg *bindings.ETHDKG,
	logger *logrus.Logger,
	callOpts *bind.CallOpts,
	addr common.Address,
	keyshare [2]*big.Int) (KeyShareStatus, error)

CheckKeyShare checks if a given address submitted the keyshare expected

type KeyshareSubmissionTask

type KeyshareSubmissionTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

KeyshareSubmissionTask contains required state for safely performing a registration

func NewKeyshareSubmissionTask

func NewKeyshareSubmissionTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account,
	publicKey [2]*big.Int,
	keyshareG1 [2]*big.Int, keyshareG1Proof [2]*big.Int,
	keyshareG2 [4]*big.Int,
	registrationEnd uint64, lastBlock uint64) *KeyshareSubmissionTask

NewKeyshareSubmissionTask creates a background task that attempts to register with ETHDKG

func (*KeyshareSubmissionTask) DoDone

func (t *KeyshareSubmissionTask) DoDone()

DoDone creates a log entry saying task is complete

func (*KeyshareSubmissionTask) DoRetry

func (t *KeyshareSubmissionTask) DoRetry(ctx context.Context) bool

DoRetry is all subsequent attempts at registering with ethdkg

func (*KeyshareSubmissionTask) DoWork

func (t *KeyshareSubmissionTask) DoWork(ctx context.Context) bool

DoWork is the first attempt at registering with ethdkg

func (*KeyshareSubmissionTask) ShouldRetry

func (t *KeyshareSubmissionTask) ShouldRetry(ctx context.Context) bool

ShouldRetry checks if it makes sense to try again Predicates: -- we haven't passed the last block -- the registration open hasn't moved, i.e. ETHDKG has not restarted

type MPKSubmissionTask

type MPKSubmissionTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MPKSubmissionTask contains required state for safely performing a registration

func NewMPKSubmissionTask

func NewMPKSubmissionTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account,
	publicKey [2]*big.Int,
	masterPublicKey [4]*big.Int,
	registrationEnd uint64, lastBlock uint64) *MPKSubmissionTask

NewMPKSubmissionTask creates a background task that attempts to register with ETHDKG

func (*MPKSubmissionTask) DoDone

func (t *MPKSubmissionTask) DoDone()

DoDone creates a log entry saying task is complete

func (*MPKSubmissionTask) DoRetry

func (t *MPKSubmissionTask) DoRetry(ctx context.Context) bool

DoRetry is all subsequent attempts at registering with ethdkg

func (*MPKSubmissionTask) DoWork

func (t *MPKSubmissionTask) DoWork(ctx context.Context) bool

DoWork is the first attempt at registering with ethdkg

func (*MPKSubmissionTask) ShouldRetry

func (t *MPKSubmissionTask) ShouldRetry(ctx context.Context) bool

ShouldRetry checks if it makes sense to try again Predicates: -- we haven't passed the last block -- the registration open hasn't moved, i.e. ETHDKG has not restarted

type RegisterTask

type RegisterTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

RegisterTask contains required state for safely performing a registration

func NewRegisterTask

func NewRegisterTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account, publicKey [2]*big.Int, lastBlock uint64) *RegisterTask

NewRegisterTask creates a background task that attempts to register with ETHDKG

func (*RegisterTask) DoDone

func (t *RegisterTask) DoDone()

DoDone just creates a log entry saying task is complete

func (*RegisterTask) DoRetry

func (t *RegisterTask) DoRetry(ctx context.Context) bool

DoRetry is all subsequent attempts at registering with ethdkg

func (*RegisterTask) DoWork

func (t *RegisterTask) DoWork(ctx context.Context) bool

DoWork is the first attempt at registering with ethdkg

func (*RegisterTask) ShouldRetry

func (t *RegisterTask) ShouldRetry(ctx context.Context) bool

ShouldRetry checks if it makes sense to try again Predicates: -- we haven't passed the last block -- the registration open hasn't moved, i.e. ETHDKG has not restarted

type RegistrationStatus

type RegistrationStatus int

RegistrationStatus is an enumeration indicating the current status of a registration

const (
	Undefined RegistrationStatus = iota
	Registered
	NoRegistration
	BadRegistration
)

The possible registration statuses: * Undefined - unknown if the address is registered * Registered - address is registered with expected public key * NoRegistration - address does not have a public key registered * BadRegistration - address is regisered with an unexpected public key

func CheckRegistration

func CheckRegistration(ctx context.Context, ethdkg *bindings.ETHDKG,
	logger *logrus.Logger,
	callOpts *bind.CallOpts,
	addr common.Address,
	publicKey [2]*big.Int) (RegistrationStatus, error)

CheckRegistration checks if given address is registered as expected

type ShareDistributionTask

type ShareDistributionTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ShareDistributionTask stores the data required safely distribute shares

func NewShareDistributionTask

func NewShareDistributionTask(logger *logrus.Logger, eth blockchain.Ethereum, acct accounts.Account, publicKey [2]*big.Int, encryptedShares []*big.Int, commitments [][2]*big.Int, registrationEnd uint64, lastBlock uint64) *ShareDistributionTask

NewShareDistributionTask creates a new task

func (*ShareDistributionTask) DoDone

func (t *ShareDistributionTask) DoDone()

DoDone creates a log entry saying task is complete

func (*ShareDistributionTask) DoRetry

func (t *ShareDistributionTask) DoRetry(ctx context.Context) bool

DoRetry is subsequent attempts at distributing shares via ethdkg

func (*ShareDistributionTask) DoWork

func (t *ShareDistributionTask) DoWork(ctx context.Context) bool

DoWork is the first attempt at distributing shares via ethdkg

func (*ShareDistributionTask) ShouldRetry

func (t *ShareDistributionTask) ShouldRetry(ctx context.Context) bool

ShouldRetry checks if it makes sense to try again

Jump to

Keyboard shortcuts

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