From 3cb8e32940db55dd5c811d95a22cd7a95cd39b3c Mon Sep 17 00:00:00 2001 From: iurii Date: Sat, 26 Oct 2024 13:31:48 +0300 Subject: [PATCH] misc adjustments --- operator/duties/attester.go | 10 +++++----- operator/validator/controller.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/operator/duties/attester.go b/operator/duties/attester.go index 396ba70cd2..41e803373c 100644 --- a/operator/duties/attester.go +++ b/operator/duties/attester.go @@ -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 } @@ -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 } @@ -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 } @@ -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 @@ -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 } diff --git a/operator/validator/controller.go b/operator/validator/controller.go index 1e2f8997df..1daf078ed2 100644 --- a/operator/validator/controller.go +++ b/operator/validator/controller.go @@ -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