Skip to content

Commit

Permalink
Adjust info to debug; return err instead of panicking
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Aug 23, 2024
1 parent 62f159e commit 27ef6dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/partial_set_security.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (k Keeper) HandleOptOut(ctx sdk.Context, chainID string, providerAddr types
func (k Keeper) OptInTopNValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator, minPowerToOptIn int64) {
for _, val := range bondedValidators {
// log the validator
k.Logger(ctx).Info("Checking whether to opt in validator because of top N", "validator", val.GetOperator())
k.Logger(ctx).Debug("Checking whether to opt in validator because of top N", "validator", val.GetOperator())

valAddr, err := sdk.ValAddressFromBech32(val.GetOperator())
if err != nil {
Expand All @@ -114,7 +114,7 @@ func (k Keeper) OptInTopNValidators(ctx sdk.Context, chainID string, bondedValid
continue
}

k.Logger(ctx).Info("Opting in validator", "validator", val.GetOperator())
k.Logger(ctx).Debug("Opting in validator", "validator", val.GetOperator())

// if validator already exists it gets overwritten
k.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(consAddr))
Expand Down
3 changes: 1 addition & 2 deletions x/ccv/types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package types

import (
"errors"
fmt "fmt"
"reflect"
"sort"
"strings"
Expand Down Expand Up @@ -132,7 +131,7 @@ func GetLastBondedValidatorsUtil(ctx sdk.Context, stakingKeeper StakingKeeper, l
// get the bonded validators from the staking module, sorted by power
bondedValidators, err := stakingKeeper.GetBondedValidatorsByPower(ctx)
if err != nil {
panic(fmt.Errorf("failed to get bonded validators: %w", err))
return nil, err
}

// get the first maxVals many validators
Expand Down

0 comments on commit 27ef6dc

Please sign in to comment.