Documentation ¶
Overview ¶
Package duties is a generated GoMock package.
Index ¶
- type AttesterHandler
- type BeaconNode
- type Duties
- type EventFeed
- type ExecuteDutiesFunc
- type ExecuteDutyFunc
- type MockdutyHandler
- type MockdutyHandlerMockRecorder
- type ProposerHandler
- type ReorgEvent
- type Scheduler
- func (s *Scheduler) ExecuteDuties(logger *zap.Logger, duties []*spectypes.Duty)
- func (s *Scheduler) HandleHeadEvent(logger *zap.Logger) func(event *eth2apiv1.Event)
- func (s *Scheduler) SlotTicker(ctx context.Context)
- func (s *Scheduler) Start(ctx context.Context, logger *zap.Logger) error
- func (s *Scheduler) Wait() error
- type SchedulerOptions
- type SlotTicker
- type SyncCommitteeDuties
- type SyncCommitteeHandler
- type ValidatorController
- type ValidatorRegistrationHandler
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:
- Fetch duties for the current epoch.
- If necessary, fetch duties for the next epoch.
- 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:
- Execute duties.
- Reset duties for the current epoch.
- Fetch duties for the current epoch.
- If necessary, fetch duties for the next epoch.
On Ticker event:
- Execute duties.
- 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 EventFeed ¶ added in v1.1.0
type EventFeed[T any] struct { // contains filtered or unexported fields }
func NewEventFeed ¶ added in v1.1.0
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
ExecuteDutiesFunc is a non-blocking functions which executes the given duties.
type ExecuteDutyFunc ¶ added in v1.1.0
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
func (m *MockdutyHandler) EXPECT() *MockdutyHandlerMockRecorder
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
func (mr *MockdutyHandlerMockRecorder) Name() *gomock.Call
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:
- Fetch duties for the current epoch.
- Execute duties.
On Re-org (current dependent root changed):
- Fetch duties for the current epoch.
- Execute duties.
On Indices Change:
- Execute duties.
- Reset duties for the current epoch.
- Fetch duties for the current epoch.
On Ticker event:
- Execute duties.
- 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 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
ExecuteDuties tries to execute the given duties
func (*Scheduler) HandleHeadEvent ¶ added in v1.1.0
HandleHeadEvent handles the "head" events from the beacon node.
func (*Scheduler) SlotTicker ¶ added in v1.1.0
SlotTicker handles the "head" events from the beacon node.
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:
- Fetch duties for the current period.
- If necessary, fetch duties for the next period.
- Execute duties.
On Re-org:
- Execute duties.
- If necessary, fetch duties for the next period.
On Indices Change:
- Execute duties.
- Reset duties for the current period.
- Fetch duties for the current period.
- If necessary, fetch duties for the next period.
On Ticker event:
- Execute duties.
- 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 }
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 (h *ValidatorRegistrationHandler) Name() string
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{}, )