Skip to content

Commit

Permalink
misc adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
iurii-ssv committed Oct 26, 2024
1 parent 0cec880 commit 3cb8e32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions operator/duties/attester.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (h *AttesterHandler) HandleDuties(ctx context.Context) {
if reorgEvent.Previous {
h.duties.ResetEpoch(currentEpoch)
h.fetchCurrentEpoch = true
if h.shouldFetchNexEpoch(reorgEvent.Slot) {
if h.shouldFetchNextEpoch(reorgEvent.Slot) {
h.duties.ResetEpoch(currentEpoch + 1)
h.fetchNextEpoch = true
}
Expand All @@ -113,7 +113,7 @@ func (h *AttesterHandler) HandleDuties(ctx context.Context) {
} else if reorgEvent.Current {
// reset & re-fetch next epoch duties if in appropriate slot range,
// otherwise they will be fetched by the appropriate slot tick.
if h.shouldFetchNexEpoch(reorgEvent.Slot) {
if h.shouldFetchNextEpoch(reorgEvent.Slot) {
h.duties.ResetEpoch(currentEpoch + 1)
h.fetchNextEpoch = true
}
Expand All @@ -128,7 +128,7 @@ func (h *AttesterHandler) HandleDuties(ctx context.Context) {
h.fetchCurrentEpoch = true

// reset next epoch duties if in appropriate slot range
if h.shouldFetchNexEpoch(slot) {
if h.shouldFetchNextEpoch(slot) {
h.duties.ResetEpoch(currentEpoch + 1)
h.fetchNextEpoch = true
}
Expand Down Expand Up @@ -157,7 +157,7 @@ func (h *AttesterHandler) processFetching(ctx context.Context, epoch phase0.Epoc
h.fetchCurrentEpoch = false
}

if h.fetchNextEpoch && h.shouldFetchNexEpoch(slot) {
if h.fetchNextEpoch && h.shouldFetchNextEpoch(slot) {
if err := h.fetchAndProcessDuties(ctx, epoch+1); err != nil {
h.logger.Error("failed to fetch duties for next epoch", zap.Error(err))
return
Expand Down Expand Up @@ -310,6 +310,6 @@ func toBeaconCommitteeSubscription(duty *eth2apiv1.AttesterDuty, role spectypes.
}
}

func (h *AttesterHandler) shouldFetchNexEpoch(slot phase0.Slot) bool {
func (h *AttesterHandler) shouldFetchNextEpoch(slot phase0.Slot) bool {
return uint64(slot)%h.network.Beacon.SlotsPerEpoch() > h.network.Beacon.SlotsPerEpoch()/2-2
}
2 changes: 1 addition & 1 deletion operator/validator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ type controller struct {
historySyncBatchSize int
messageValidator validation.MessageValidator

// nonCommittees is a cache of initialized committeeObserver instances
// committeesObservers is a cache of initialized committeeObserver instances
committeesObservers *ttlcache.Cache[spectypes.MessageID, *committeeObserver]
committeesObserversMutex sync.Mutex

Expand Down

0 comments on commit 3cb8e32

Please sign in to comment.