eventhandler

package
v1.2.2-unstable.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: GPL-3.0 Imports: 31 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"
	ValidatorExited            = "ValidatorExited"
)

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,
	networkConfig networkconfig.NetworkConfig,
	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 ExitValidatorTask added in v1.2.2

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

func NewExitValidatorTask added in v1.2.2

func NewExitValidatorTask(executor exitValidatorExecutor, pubKey phase0.BLSPubKey, blockNumber uint64, validatorIndex phase0.ValidatorIndex) *ExitValidatorTask

func (ExitValidatorTask) Execute added in v1.2.2

func (t ExitValidatorTask) Execute() error

type LiquidateClusterTask

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

func NewLiquidateClusterTask

func NewLiquidateClusterTask(
	executor liquidateClusterExecutor,
	owner ethcommon.Address,
	operatorIDs []spectypes.OperatorID,
	toLiquidate []*types.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 []spectypes.OperatorID,
	toReactivate []*types.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 *types.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, pubKey spectypes.ValidatorPK) *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