storage

package
v1.2.2-unstable Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: GPL-3.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetOperatorData added in v0.2.0

type GetOperatorData = func(index uint64) (*OperatorData, bool, error)

GetOperatorData is a function that returns the operator data

type Nonce added in v1.1.0

type Nonce uint16

type OperatorData added in v0.2.0

type OperatorData struct {
	ID           spectypes.OperatorID `json:"id"`
	PublicKey    []byte               `json:"publicKey"`
	OwnerAddress common.Address       `json:"ownerAddress"`
}

OperatorData the public data of an operator

type Operators added in v0.4.7

type Operators interface {
	GetOperatorDataByPubKey(r basedb.Reader, operatorPubKey []byte) (*OperatorData, bool, error)
	GetOperatorData(r basedb.Reader, id spectypes.OperatorID) (*OperatorData, bool, error)
	OperatorsExist(r basedb.Reader, ids []spectypes.OperatorID) (bool, error)
	SaveOperatorData(rw basedb.ReadWriter, operatorData *OperatorData) (bool, error)
	DeleteOperatorData(rw basedb.ReadWriter, id spectypes.OperatorID) error
	ListOperators(r basedb.Reader, from uint64, to uint64) ([]OperatorData, error)
	GetOperatorsPrefix() []byte
	DropOperators() error
}

Operators is the interface for managing operators data

func NewOperatorsStorage

func NewOperatorsStorage(logger *zap.Logger, db basedb.Database, prefix []byte) Operators

NewOperatorsStorage creates a new instance of Storage

type RecipientData added in v0.4.7

type RecipientData struct {
	Owner        common.Address             `json:"ownerAddress"`
	FeeRecipient bellatrix.ExecutionAddress `json:"feeRecipientAddress"`

	// Nonce: This field represents the 'ValidatorAdded Event' nonce.
	// It serves a crucial role in protecting against replay attacks.
	// Each time a new validator added event is triggered, regardless of whether the event is malformed or not,
	// we increment this nonce by 1.
	// ** The Nonce field can be nil because the 'FeeRecipientAddressUpdatedEvent'
	// might occur before the addition of a validator to the network, and this event does not increment the nonce.
	Nonce *Nonce `json:"nonce"`
}

RecipientData the public data of a recipient

type Recipients added in v0.4.7

type Recipients interface {
	GetRecipientData(r basedb.Reader, owner common.Address) (*RecipientData, bool, error)
	GetRecipientDataMany(r basedb.Reader, owners []common.Address) (map[common.Address]bellatrix.ExecutionAddress, error)
	GetNextNonce(r basedb.Reader, owner common.Address) (Nonce, error)
	BumpNonce(rw basedb.ReadWriter, owner common.Address) error
	SaveRecipientData(rw basedb.ReadWriter, recipientData *RecipientData) (*RecipientData, error)
	DeleteRecipientData(rw basedb.ReadWriter, owner common.Address) error
	DropRecipients() error
	GetRecipientsPrefix() []byte
}

Recipients is the interface for managing recipients data

func NewRecipientsStorage added in v0.4.7

func NewRecipientsStorage(logger *zap.Logger, db basedb.Database, prefix []byte) Recipients

NewRecipientsStorage creates a new instance of Storage

type Shares added in v0.4.7

type Shares interface {
	// Get returns the share for the given public key, or nil if not found.
	Get(txn basedb.Reader, pubKey []byte) *types.SSVShare

	// List returns a list of shares, filtered by the given filters (if any).
	List(txn basedb.Reader, filters ...SharesFilter) []*types.SSVShare

	// Save saves the given shares.
	Save(txn basedb.ReadWriter, shares ...*types.SSVShare) error

	// Delete deletes the share for the given public key.
	Delete(txn basedb.ReadWriter, pubKey []byte) error

	// Drop deletes all shares.
	Drop() error

	// UpdateValidatorMetadata updates validator metadata.
	UpdateValidatorMetadata(pk string, metadata *beaconprotocol.ValidatorMetadata) error
}

Shares is the interface for managing shares.

func NewSharesStorage added in v0.4.7

func NewSharesStorage(logger *zap.Logger, db basedb.Database, prefix []byte) (Shares, error)

type SharesFilter added in v1.1.0

type SharesFilter func(*types.SSVShare) bool

SharesFilter is a function that filters shares.

func ByActiveValidator added in v1.1.0

func ByActiveValidator() SharesFilter

ByActiveValidator filters for active validators.

func ByAttesting added in v1.1.0

func ByAttesting() SharesFilter

ByAttesting filters for attesting validators.

func ByClusterID added in v0.4.7

func ByClusterID(clusterID []byte) SharesFilter

ByClusterID filters by cluster id.

func ByNotLiquidated added in v1.1.0

func ByNotLiquidated() SharesFilter

ByNotLiquidated filters for not liquidated.

func ByOperatorID added in v0.4.7

func ByOperatorID(operatorID spectypes.OperatorID) SharesFilter

ByOperatorID filters by operator ID.

type SharesListFunc added in v1.1.0

type SharesListFunc = func(filters ...SharesFilter) []*types.SSVShare

SharesListFunc is a function that returns a filtered list of shares.

Jump to

Keyboard shortcuts

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