Skip to content

Commit

Permalink
remove default PowerShapingParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke committed Aug 29, 2024
1 parent b8a8eb8 commit 9ef762b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,12 @@ func (k msgServer) UpdateConsumer(goCtx context.Context, msg *types.MsgUpdateCon
// remains a Top N chain.
currentOwnerAddress, err := k.Keeper.GetConsumerOwnerAddress(ctx, consumerId)
if err != nil {
return &resp, errorsmod.Wrapf(types.ErrNoOwnerAddress, "cannot retrieve owner address %s: %s", ownerAddress, err.Error())
return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot retrieve owner address %s: %s", ownerAddress, err.Error())
}

currentPowerShapingParameters, err := k.Keeper.GetConsumerPowerShapingParameters(ctx, consumerId)
if err != nil {
return &resp, errorsmod.Wrapf(types.ErrInvalidPowerShapingParameters, "cannot retrieve power shaping parameters: %s", err.Error())
return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot retrieve power shaping parameters: %s", err.Error())
}

if currentPowerShapingParameters.Top_N != 0 && currentOwnerAddress != k.GetAuthority() {
Expand Down
16 changes: 4 additions & 12 deletions x/ccv/provider/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,13 @@ func (k Keeper) MakeConsumerGenesis(
) (gen ccv.ConsumerGenesisState, nextValidatorsHash []byte, err error) {
initializationRecord, err := k.GetConsumerInitializationParameters(ctx, consumerId)
if err != nil {
return gen, nil, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters,
"initialization record for consumer id: %s is missing", consumerId)

return gen, nil, errorsmod.Wrapf(ccv.ErrInvalidConsumerState,
"cannot retrieve initialization parameters: %s", err.Error())
}
powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId)
if err != nil {
powerShapingParameters = types.PowerShapingParameters{
Top_N: 0,
ValidatorsPowerCap: 0,
ValidatorSetCap: 0,
Allowlist: []string{},
Denylist: []string{},
MinStake: 0,
AllowInactiveVals: false,
}
return gen, nil, errorsmod.Wrapf(ccv.ErrInvalidConsumerState,
"cannot retrieve power shaping parameters: %s", err.Error())
}

providerUnbondingPeriod, err := k.stakingKeeper.UnbondingTime(ctx)
Expand Down

0 comments on commit 9ef762b

Please sign in to comment.