eventhandler

package
v1.0.1-hotfix Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: GPL-3.0 Imports: 28 Imported by: 1

Documentation

Overview

Package eventhandler provides support for handling registry contract events and persisting them to the database.

Index

Constants

View Source
const (
	OperatorAdded              = "OperatorAdded"
	OperatorRemoved            = "OperatorRemoved"
	ValidatorAdded             = "ValidatorAdded"
	ValidatorRemoved           = "ValidatorRemoved"
	ClusterLiquidated          = "ClusterLiquidated"
	ClusterReactivated         = "ClusterReactivated"
	FeeRecipientAddressUpdated = "FeeRecipientAddressUpdated"
)

Event names

Variables

View Source
var (
	ErrAlreadyRegistered            = fmt.Errorf("operator registered with the same operator public key")
	ErrOperatorDataNotFound         = fmt.Errorf("operator data not found")
	ErrIncorrectSharesLength        = fmt.Errorf("shares length is not correct")
	ErrSignatureVerification        = fmt.Errorf("signature verification failed")
	ErrShareBelongsToDifferentOwner = fmt.Errorf("share already exists and belongs to different owner")
	ErrValidatorShareNotFound       = fmt.Errorf("validator share not found")
)
View Source
var (
	// ErrInferiorBlock is returned when trying to process a block that is
	// not higher than the last processed block.
	ErrInferiorBlock = errors.New("block is not higher than the last processed block")
)

Functions

This section is empty.

Types

type EventHandler

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

func New

func New(
	nodeStorage nodestorage.Storage,
	eventParser eventparser.Parser,
	taskExecutor taskExecutor,
	domain spectypes.DomainType,
	operatorData OperatorData,
	shareEncryptionKeyProvider ShareEncryptionKeyProvider,
	keyManager spectypes.KeyManager,
	beacon beaconprotocol.BeaconNode,
	storageMap *qbftstorage.QBFTStores,
	opts ...Option,
) (*EventHandler, error)

func (*EventHandler) HandleBlockEventsStream

func (eh *EventHandler) HandleBlockEventsStream(logs <-chan executionclient.BlockLogs, executeTasks bool) (lastProcessedBlock uint64, err error)

func (*EventHandler) HandleLocalEvents

func (eh *EventHandler) HandleLocalEvents(localEvents []localevents.Event) error

type LiquidateClusterTask

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

func NewLiquidateClusterTask

func NewLiquidateClusterTask(
	executor liquidateClusterExecutor,
	owner ethcommon.Address,
	operatorIDs []uint64,
	toLiquidate []*ssvtypes.SSVShare,
) *LiquidateClusterTask

func (LiquidateClusterTask) Execute

func (t LiquidateClusterTask) Execute() error

type MalformedEventError

type MalformedEventError struct {
	Err error
}

MalformedEventError is returned when event is malformed

func (*MalformedEventError) Error

func (e *MalformedEventError) Error() string

func (*MalformedEventError) Unwrap

func (e *MalformedEventError) Unwrap() error

type OperatorData

type OperatorData interface {
	GetOperatorData() *storage.OperatorData
	SetOperatorData(*storage.OperatorData)
}

type Option

type Option func(*EventHandler)

Option defines EventHandler configuration option.

func WithFullNode

func WithFullNode() Option

WithFullNode signals that node works in a full node state.

func WithLogger

func WithLogger(logger *zap.Logger) Option

WithLogger enables logging.

func WithMetrics

func WithMetrics(metrics metrics) Option

WithMetrics enables reporting metrics.

type ReactivateClusterTask

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

func NewReactivateClusterTask

func NewReactivateClusterTask(
	executor reactivateClusterExecutor,
	owner ethcommon.Address,
	operatorIDs []uint64,
	toReactivate []*ssvtypes.SSVShare,
) *ReactivateClusterTask

func (ReactivateClusterTask) Execute

func (t ReactivateClusterTask) Execute() error

type ShareEncryptionKeyProvider

type ShareEncryptionKeyProvider = func() (*rsa.PrivateKey, bool, error)

type StartValidatorTask

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

func NewStartValidatorTask

func NewStartValidatorTask(executor startValidatorExecutor, share *ssvtypes.SSVShare) *StartValidatorTask

func (StartValidatorTask) Execute

func (t StartValidatorTask) Execute() error

type StopValidatorTask

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

func NewStopValidatorTask

func NewStopValidatorTask(executor stopValidatorExecutor, publicKey []byte) *StopValidatorTask

func (StopValidatorTask) Execute

func (t StopValidatorTask) Execute() error

type Task

type Task interface {
	Execute() error
}

type UpdateFeeRecipientTask

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

func NewUpdateFeeRecipientTask

func NewUpdateFeeRecipientTask(executor updateFeeRecipientExecutor, owner, recipient ethcommon.Address) *UpdateFeeRecipientTask

func (UpdateFeeRecipientTask) Execute

func (t UpdateFeeRecipientTask) Execute() error

Jump to

Keyboard shortcuts

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