Skip to content

Commit

Permalink
Wrap errors from process_registry_updates for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvanloon committed Jun 27, 2024
1 parent a0abfd3 commit d42415e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions beacon-chain/core/electra/registry_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package electra

import (
"context"
"fmt"

"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/time"
Expand Down Expand Up @@ -43,7 +44,7 @@ func ProcessRegistryUpdates(ctx context.Context, state state.BeaconState) error
if helpers.IsEligibleForActivationQueue(val, currentEpoch) {
val.ActivationEligibilityEpoch = currentEpoch + 1
if err := state.UpdateValidatorAtIndex(primitives.ValidatorIndex(idx), val); err != nil {
return err
return fmt.Errorf("failed to update eligible validator at index %d: %w", idx, err)
}
}
// Handle validator ejections.
Expand All @@ -52,15 +53,15 @@ func ProcessRegistryUpdates(ctx context.Context, state state.BeaconState) error
// exitQueueEpoch and churn arguments are not used in electra.
state, _, err = validators.InitiateValidatorExit(ctx, state, primitives.ValidatorIndex(idx), 0 /*exitQueueEpoch*/, 0 /*churn*/)
if err != nil {
return err
return fmt.Errorf("failed to initiate validator exit at index %d: %w", idx, err)
}
}

// Activate all eligible validators.
if helpers.IsEligibleForActivation(state, val) {
val.ActivationEpoch = activationEpoch
if err := state.UpdateValidatorAtIndex(primitives.ValidatorIndex(idx), val); err != nil {
return err
return fmt.Errorf("failed to activate validator at index %d: %w", idx, err)
}
}
}
Expand Down

0 comments on commit d42415e

Please sign in to comment.