diff --git a/handlers/validator.go b/handlers/validator.go index bf809e65d7..c1ca534961 100644 --- a/handlers/validator.go +++ b/handlers/validator.go @@ -103,6 +103,16 @@ func Validator(w http.ResponseWriter, r *http.Request) { } validatorPageData.ChurnRate = *churnRate + activationChurnRate := stats.ValidatorActivationChurnLimit + if activationChurnRate == nil { + activationChurnRate = new(uint64) + } + + if *activationChurnRate == 0 { + *activationChurnRate = 4 + logger.Warning("Activation Churn rate not set in config using 4 as default please set minPerEpochChurnLimit") + } + pendingCount := stats.PendingValidatorCount if pendingCount == nil { pendingCount = new(uint64) @@ -558,7 +568,7 @@ func Validator(w http.ResponseWriter, r *http.Request) { return fmt.Errorf("failed to retrieve queue ahead of validator %v: %w", validatorPageData.ValidatorIndex, err) } validatorPageData.QueuePosition = queueAhead + 1 - epochsToWait := queueAhead / *churnRate + epochsToWait := queueAhead / *activationChurnRate // calculate dequeue epoch estimatedActivationEpoch := validatorPageData.Epoch + epochsToWait + 1 // add activation offset diff --git a/services/services.go b/services/services.go index 4d24c2a6ae..9eb3af9e7f 100644 --- a/services/services.go +++ b/services/services.go @@ -1229,6 +1229,7 @@ func GetLatestStats() *types.Stats { ActiveValidatorCount: new(uint64), PendingValidatorCount: new(uint64), ValidatorChurnLimit: new(uint64), + ValidatorActivationChurnLimit: new(uint64), LatestValidatorWithdrawalIndex: new(uint64), } } diff --git a/services/stats.go b/services/stats.go index 8f0ba0b4dc..8fba87f9e9 100644 --- a/services/stats.go +++ b/services/stats.go @@ -88,6 +88,14 @@ func calculateStats() (*types.Stats, error) { stats.ValidatorChurnLimit = &validatorChurnLimit + epoch := LatestEpoch() + validatorActivationChurnLimit, err := getValidatorActivationChurnLimit(activeValidatorCount, epoch) + if err != nil { + logger.WithError(err).Error("error getting total validator churn limit") + } + + stats.ValidatorActivationChurnLimit = &validatorActivationChurnLimit + LatestValidatorWithdrawalIndex, err := db.GetMostRecentWithdrawalValidator() if err != nil { logger.WithError(err).Error("error getting most recent withdrawal validator index") @@ -95,7 +103,6 @@ func calculateStats() (*types.Stats, error) { stats.LatestValidatorWithdrawalIndex = &LatestValidatorWithdrawalIndex - epoch := LatestEpoch() WithdrawableValidatorCount, err := db.GetWithdrawableValidatorCount(epoch) if err != nil { logger.WithError(err).Error("error getting withdrawable validator count") @@ -204,6 +211,7 @@ func getValidatorActivationChurnLimit(validatorCount, epoch uint64) (uint64, err if err != nil { return 0, err } + logger.WithField("vcl", vcl).WithField("epoch", epoch).WithField("mpeacl", utils.Config.Chain.ClConfig.MaxPerEpochActivationChurnLimit).Info("getValidatorActivationChurnLimit") if utils.Config.Chain.ClConfig.DenebForkEpoch > epoch { return vcl, nil }