duties

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: GPL-3.0 Imports: 26 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(duties *dutystore.Duties[eth2apiv1.AttesterDuty]) *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. ResetEpoch 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) HandleInitialDuties added in v1.2.0

func (b *AttesterHandler) HandleInitialDuties(context.Context)

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, executionClient ExecutionClient, network networkconfig.NetworkConfig, validatorController ValidatorController, executeDuties ExecuteDutiesFunc, slotTickerProvider slotticker.Provider, 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 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 ExecutionClient added in v1.2.2

type ExecutionClient interface {
	BlockByNumber(ctx context.Context, blockNumber *big.Int) (*ethtypes.Block, error)
}

type ExitDescriptor added in v1.2.2

type ExitDescriptor struct {
	PubKey         phase0.BLSPubKey
	ValidatorIndex phase0.ValidatorIndex
	BlockNumber    uint64
}

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) HandleInitialDuties added in v1.2.0

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

HandleInitialDuties 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 ExecutionClient, arg4 networkconfig.NetworkConfig, arg5 ValidatorController, arg6 ExecuteDutiesFunc, arg7 slotticker.Provider, arg8 chan ReorgEvent, arg9 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) HandleInitialDuties added in v1.2.0

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

HandleInitialDuties indicates an expected call of HandleInitialDuties.

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, arg9 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(duties *dutystore.Duties[eth2apiv1.ProposerDuty]) *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. ResetEpoch 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) HandleInitialDuties added in v1.2.0

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

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, executionClient ExecutionClient, network networkconfig.NetworkConfig, validatorController ValidatorController, executeDuties ExecuteDutiesFunc, slotTickerProvider slotticker.Provider, 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

Start initializes the Scheduler and begins its operation. Note: This function includes blocking operations, especially within the handler's HandleInitialDuties call, which will block until initial duties are fully handled.

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
	ExecutionClient     ExecutionClient
	Network             networkconfig.NetworkConfig
	ValidatorController ValidatorController
	ExecuteDuty         ExecuteDutyFunc
	IndicesChg          chan struct{}
	ValidatorExitCh     <-chan ExitDescriptor
	SlotTickerProvider  slotticker.Provider
	BuilderProposals    bool
	DutyStore           *dutystore.Store
}

type SlotTicker added in v1.1.0

type SlotTicker interface {
	Next() <-chan time.Time
	Slot() phase0.Slot
}

type SyncCommitteeHandler added in v1.1.0

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

func NewSyncCommitteeHandler added in v1.1.0

func NewSyncCommitteeHandler(duties *dutystore.SyncCommitteeDuties) *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. ResetEpoch 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) HandleInitialDuties added in v1.2.0

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

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, executionClient ExecutionClient, network networkconfig.NetworkConfig, validatorController ValidatorController, executeDuties ExecuteDutiesFunc, slotTickerProvider slotticker.Provider, reorgEvents chan ReorgEvent, indicesChange chan struct{})

type ValidatorController added in v1.1.0

type ValidatorController interface {
	CommitteeActiveIndices(epoch phase0.Epoch) []phase0.ValidatorIndex
	AllActiveIndices(epoch phase0.Epoch, afterInit bool) []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) HandleInitialDuties added in v1.2.0

func (b *ValidatorRegistrationHandler) HandleInitialDuties(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, executionClient ExecutionClient, network networkconfig.NetworkConfig, validatorController ValidatorController, executeDuties ExecuteDutiesFunc, slotTickerProvider slotticker.Provider, reorgEvents chan ReorgEvent, indicesChange chan struct{})

type VoluntaryExitHandler added in v1.2.2

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

func NewVoluntaryExitHandler added in v1.2.2

func NewVoluntaryExitHandler(validatorExitCh <-chan ExitDescriptor) *VoluntaryExitHandler

func (*VoluntaryExitHandler) HandleDuties added in v1.2.2

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

func (*VoluntaryExitHandler) HandleInitialDuties added in v1.2.2

func (b *VoluntaryExitHandler) HandleInitialDuties(context.Context)

func (*VoluntaryExitHandler) Name added in v1.2.2

func (h *VoluntaryExitHandler) Name() string

func (*VoluntaryExitHandler) Setup added in v1.2.2

func (h *VoluntaryExitHandler) Setup(name string, logger *zap.Logger, beaconNode BeaconNode, executionClient ExecutionClient, network networkconfig.NetworkConfig, validatorController ValidatorController, executeDuties ExecuteDutiesFunc, slotTickerProvider slotticker.Provider, 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