duties

package
v1.0.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package duties is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttesterHandler added in v1.1.0

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

func NewAttesterHandler added in v1.1.0

func NewAttesterHandler() *AttesterHandler

func (*AttesterHandler) HandleDuties added in v1.1.0

func (h *AttesterHandler) HandleDuties(ctx context.Context)

HandleDuties manages the duty lifecycle, handling different cases:

On First Run:

  1. Fetch duties for the current epoch.
  2. If necessary, fetch duties for the next epoch.
  3. Execute duties.

On Re-org:

If the previous dependent root changed:
    1. Fetch duties for the current epoch.
    2. Execute duties.
If the current dependent root changed:
    1. Execute duties.
    2. If necessary, fetch duties for the next epoch.

On Indices Change:

  1. Execute duties.
  2. Reset duties for the current epoch.
  3. Fetch duties for the current epoch.
  4. If necessary, fetch duties for the next epoch.

On Ticker event:

  1. Execute duties.
  2. If necessary, fetch duties for the next epoch.

func (*AttesterHandler) Name added in v1.1.0

func (h *AttesterHandler) Name() string

func (*AttesterHandler) Setup added in v1.1.0

func (h *AttesterHandler) Setup(
	name string,
	logger *zap.Logger,
	beaconNode BeaconNode,
	network networkconfig.NetworkConfig,
	validatorController ValidatorController,
	executeDuties ExecuteDutiesFunc,
	ticker chan phase0.Slot,
	reorgEvents chan ReorgEvent,
	indicesChange chan struct{},
)

type BeaconNode added in v1.1.0

type BeaconNode interface {
	AttesterDuties(ctx context.Context, epoch phase0.Epoch, validatorIndices []phase0.ValidatorIndex) ([]*eth2apiv1.AttesterDuty, error)
	ProposerDuties(ctx context.Context, epoch phase0.Epoch, validatorIndices []phase0.ValidatorIndex) ([]*eth2apiv1.ProposerDuty, error)
	SyncCommitteeDuties(ctx context.Context, epoch phase0.Epoch, indices []phase0.ValidatorIndex) ([]*eth2apiv1.SyncCommitteeDuty, error)
	Events(ctx context.Context, topics []string, handler eth2client.EventHandlerFunc) error
	SubmitBeaconCommitteeSubscriptions(ctx context.Context, subscription []*eth2apiv1.BeaconCommitteeSubscription) error
	SubmitSyncCommitteeSubscriptions(ctx context.Context, subscription []*eth2apiv1.SyncCommitteeSubscription) error
}

type Duties

type Duties[D any] struct {
	// contains filtered or unexported fields
}

func NewDuties

func NewDuties[D any]() *Duties[D]

func (*Duties[D]) Add

func (d *Duties[D]) Add(epoch phase0.Epoch, slot phase0.Slot, duty D)

func (*Duties[D]) Reset

func (d *Duties[D]) Reset(epoch phase0.Epoch)

type EventFeed added in v1.1.0

type EventFeed[T any] struct {
	// contains filtered or unexported fields
}

func NewEventFeed added in v1.1.0

func NewEventFeed[T any]() *EventFeed[T]

func (*EventFeed[T]) FanOut added in v1.1.0

func (f *EventFeed[T]) FanOut(ctx context.Context, in <-chan T)

func (*EventFeed[T]) Send added in v1.1.0

func (f *EventFeed[T]) Send(item T)

func (*EventFeed[T]) Subscribe added in v1.1.0

func (f *EventFeed[T]) Subscribe(ch chan<- T) event.Subscription

type ExecuteDutiesFunc added in v1.1.0

type ExecuteDutiesFunc func(logger *zap.Logger, duties []*spectypes.Duty)

ExecuteDutiesFunc is a non-blocking functions which executes the given duties.

type ExecuteDutyFunc added in v1.1.0

type ExecuteDutyFunc func(logger *zap.Logger, duty *spectypes.Duty)

type MockdutyHandler added in v1.1.0

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

MockdutyHandler is a mock of dutyHandler interface.

func NewMockdutyHandler added in v1.1.0

func NewMockdutyHandler(ctrl *gomock.Controller) *MockdutyHandler

NewMockdutyHandler creates a new mock instance.

func (*MockdutyHandler) EXPECT added in v1.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockdutyHandler) HandleDuties added in v1.1.0

func (m *MockdutyHandler) HandleDuties(arg0 context.Context)

HandleDuties mocks base method.

func (*MockdutyHandler) Name added in v1.1.0

func (m *MockdutyHandler) Name() string

Name mocks base method.

func (*MockdutyHandler) Setup added in v1.1.0

func (m *MockdutyHandler) Setup(arg0 string, arg1 *zap.Logger, arg2 BeaconNode, arg3 networkconfig.NetworkConfig, arg4 ValidatorController, arg5 ExecuteDutiesFunc, arg6 chan phase0.Slot, arg7 chan ReorgEvent, arg8 chan struct{})

Setup mocks base method.

type MockdutyHandlerMockRecorder added in v1.1.0

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

MockdutyHandlerMockRecorder is the mock recorder for MockdutyHandler.

func (*MockdutyHandlerMockRecorder) HandleDuties added in v1.1.0

func (mr *MockdutyHandlerMockRecorder) HandleDuties(arg0 interface{}) *gomock.Call

HandleDuties indicates an expected call of HandleDuties.

func (*MockdutyHandlerMockRecorder) Name added in v1.1.0

Name indicates an expected call of Name.

func (*MockdutyHandlerMockRecorder) Setup added in v1.1.0

func (mr *MockdutyHandlerMockRecorder) Setup(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 interface{}) *gomock.Call

Setup indicates an expected call of Setup.

type ProposerHandler added in v1.1.0

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

func NewProposerHandler added in v1.1.0

func NewProposerHandler() *ProposerHandler

func (*ProposerHandler) HandleDuties added in v1.1.0

func (h *ProposerHandler) HandleDuties(ctx context.Context)

HandleDuties manages the duty lifecycle, handling different cases:

On First Run:

  1. Fetch duties for the current epoch.
  2. Execute duties.

On Re-org (current dependent root changed):

  1. Fetch duties for the current epoch.
  2. Execute duties.

On Indices Change:

  1. Execute duties.
  2. Reset duties for the current epoch.
  3. Fetch duties for the current epoch.

On Ticker event:

  1. Execute duties.
  2. If necessary, fetch duties for the current epoch.

func (*ProposerHandler) Name added in v1.1.0

func (h *ProposerHandler) Name() string

func (*ProposerHandler) Setup added in v1.1.0

func (h *ProposerHandler) Setup(
	name string,
	logger *zap.Logger,
	beaconNode BeaconNode,
	network networkconfig.NetworkConfig,
	validatorController ValidatorController,
	executeDuties ExecuteDutiesFunc,
	ticker chan phase0.Slot,
	reorgEvents chan ReorgEvent,
	indicesChange chan struct{},
)

type ReorgEvent added in v1.1.0

type ReorgEvent struct {
	Slot     phase0.Slot
	Previous bool
	Current  bool
}

type Scheduler added in v1.1.0

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

func NewScheduler added in v1.1.0

func NewScheduler(opts *SchedulerOptions) *Scheduler

func (*Scheduler) ExecuteDuties added in v1.1.0

func (s *Scheduler) ExecuteDuties(logger *zap.Logger, duties []*spectypes.Duty)

ExecuteDuties tries to execute the given duties

func (*Scheduler) HandleHeadEvent added in v1.1.0

func (s *Scheduler) HandleHeadEvent(logger *zap.Logger) func(event *eth2apiv1.Event)

HandleHeadEvent handles the "head" events from the beacon node.

func (*Scheduler) SlotTicker added in v1.1.0

func (s *Scheduler) SlotTicker(ctx context.Context)

SlotTicker handles the "head" events from the beacon node.

func (*Scheduler) Start added in v1.1.0

func (s *Scheduler) Start(ctx context.Context, logger *zap.Logger) error

func (*Scheduler) Wait added in v1.1.0

func (s *Scheduler) Wait() error

type SchedulerOptions added in v1.1.0

type SchedulerOptions struct {
	Ctx                 context.Context
	BeaconNode          BeaconNode
	Network             networkconfig.NetworkConfig
	ValidatorController ValidatorController
	ExecuteDuty         ExecuteDutyFunc
	IndicesChg          chan struct{}
	Ticker              SlotTicker
	BuilderProposals    bool
}

type SlotTicker added in v1.1.0

type SlotTicker interface {
	Subscribe(subscription chan phase0.Slot) event.Subscription
}

type SyncCommitteeDuties

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

func NewSyncCommitteeDuties

func NewSyncCommitteeDuties() *SyncCommitteeDuties

func (*SyncCommitteeDuties) Add

func (d *SyncCommitteeDuties) Add(period uint64, duty *eth2apiv1.SyncCommitteeDuty)

func (*SyncCommitteeDuties) Reset

func (d *SyncCommitteeDuties) Reset(period uint64)

type SyncCommitteeHandler added in v1.1.0

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

func NewSyncCommitteeHandler added in v1.1.0

func NewSyncCommitteeHandler() *SyncCommitteeHandler

func (*SyncCommitteeHandler) HandleDuties added in v1.1.0

func (h *SyncCommitteeHandler) HandleDuties(ctx context.Context)

HandleDuties manages the duty lifecycle, handling different cases:

On First Run:

  1. Fetch duties for the current period.
  2. If necessary, fetch duties for the next period.
  3. Execute duties.

On Re-org:

  1. Execute duties.
  2. If necessary, fetch duties for the next period.

On Indices Change:

  1. Execute duties.
  2. Reset duties for the current period.
  3. Fetch duties for the current period.
  4. If necessary, fetch duties for the next period.

On Ticker event:

  1. Execute duties.
  2. If necessary, fetch duties for the next period.

func (*SyncCommitteeHandler) Name added in v1.1.0

func (h *SyncCommitteeHandler) Name() string

func (*SyncCommitteeHandler) Setup added in v1.1.0

func (h *SyncCommitteeHandler) Setup(
	name string,
	logger *zap.Logger,
	beaconNode BeaconNode,
	network networkconfig.NetworkConfig,
	validatorController ValidatorController,
	executeDuties ExecuteDutiesFunc,
	ticker chan phase0.Slot,
	reorgEvents chan ReorgEvent,
	indicesChange chan struct{},
)

type ValidatorController added in v1.1.0

type ValidatorController interface {
	ActiveValidatorIndices(epoch phase0.Epoch) []phase0.ValidatorIndex
	GetOperatorShares() []*types.SSVShare
}

ValidatorController represents the component that controls validators via the scheduler

type ValidatorRegistrationHandler added in v1.1.0

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

func NewValidatorRegistrationHandler added in v1.1.0

func NewValidatorRegistrationHandler() *ValidatorRegistrationHandler

func (*ValidatorRegistrationHandler) HandleDuties added in v1.1.0

func (h *ValidatorRegistrationHandler) HandleDuties(ctx context.Context)

func (*ValidatorRegistrationHandler) Name added in v1.1.0

func (*ValidatorRegistrationHandler) Setup added in v1.1.0

func (h *ValidatorRegistrationHandler) Setup(
	name string,
	logger *zap.Logger,
	beaconNode BeaconNode,
	network networkconfig.NetworkConfig,
	validatorController ValidatorController,
	executeDuties ExecuteDutiesFunc,
	ticker chan phase0.Slot,
	reorgEvents chan ReorgEvent,
	indicesChange chan struct{},
)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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