Skip to content

Commit

Permalink
Fixed some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kirdatatjana committed Oct 21, 2024
1 parent 171246d commit ae2c771
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
10 changes: 5 additions & 5 deletions tests/e2e/steps_partial_set_security.go
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@ func stepsValidatorsDenylistedChain() []Step {
return s
}

// stepsValidatorsAllowlistedChain starts a provider chain and an Opt-In chain with an prioritylist
// stepsValidatorsPrioritylistedChain starts a provider chain and an Opt-In chain with an prioritylist
func stepsValidatorsPrioritylistedChain() []Step {
s := []Step{
{
Expand Down Expand Up @@ -2006,15 +2006,15 @@ func stepsValidatorsPrioritylistedChain() []Step {
ChainID("consu"): ChainState{
ValPowers: &map[ValidatorID]uint{
ValidatorID("alice"): 100,
ValidatorID("bob"): 200,
ValidatorID("carol"): 0,
ValidatorID("bob"): 0,
ValidatorID("carol"): 300,
},
},
ChainID("provi"): ChainState{
HasToValidate: &map[ValidatorID][]ChainID{
ValidatorID("alice"): {"consu"},
ValidatorID("bob"): {"consu"},
ValidatorID("carol"): {},
ValidatorID("bob"): {},
ValidatorID("carol"): {"consu"},
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ where create_consumer.json has the following structure:
"denylist": [],
"min_stake": "0",
"allow_inactive_vals": false,
"prioritylist": []
"prioritylist": []
},
"allowlisted_reward_denoms": {
"denoms": ["ibc/...", "ibc/..."]
Expand Down Expand Up @@ -354,7 +354,7 @@ where update_consumer.json has the following structure:
"denylist": [],
"min_stake": "0",
"allow_inactive_vals": false,
"prioritylist": []
"prioritylist": []
},
"allowlisted_reward_denoms": {
"denoms": ["ibc/...", "ibc/..."]
Expand Down
24 changes: 0 additions & 24 deletions x/ccv/provider/keeper/power_shaping.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,30 +87,6 @@ func (k Keeper) UpdateMinimumPowerInTopN(ctx sdk.Context, consumerId string, old
return nil
}

// CapValidatorSet caps the provided `validators` if chain with `consumerId` is an Opt In chain with a validator-set cap.
// If cap is `k`, `CapValidatorSet` returns the first `k` validators from `validators` with the highest power.
func (k Keeper) CapValidatorSet2(
ctx sdk.Context,
powerShapingParameters types.PowerShapingParameters,
validators []types.ConsensusValidator,
) []types.ConsensusValidator {
if powerShapingParameters.Top_N > 0 {
// is a no-op if the chain is a Top N chain
return validators
}

validatorSetCap := powerShapingParameters.ValidatorSetCap
if validatorSetCap != 0 && int(validatorSetCap) < len(validators) {
sort.Slice(validators, func(i, j int) bool {
return validators[i].Power > validators[j].Power
})

return validators[:int(validatorSetCap)]
} else {
return validators
}
}

// CapValidatorSet caps the provided `validators` if chain with `consumerId` is an Opt In chain with a validator-set cap.
// It prioritizes validators from the priority list and then adds remaining validators up to the cap.
func (k Keeper) CapValidatorSet(
Expand Down

0 comments on commit ae2c771

Please sign in to comment.