diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 16511f8bde..bdf3b4f42f 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -282,14 +282,7 @@ func (k Keeper) IdentifyConsumerChainIDFromIBCPacket(ctx sdk.Context, packet cha } // HandleSetConsumerCommissionRate sets a per-consumer chain commission rate for the given provider address -// on the condition that the given consumer chain exists. -func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, commissionRate sdk.Dec) error { - // check that the consumer chain exists - if !k.IsConsumerProposedOrRegistered(ctx, chainID) { - return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, - "unknown consumer chain, with id: %s", chainID) - } +func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, commissionRate sdk.Dec) { // set per-consumer chain commission rate for the validator address k.SetConsumerCommissionRate( ctx, @@ -297,6 +290,4 @@ func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, chainID string, providerAddr, commissionRate, ) - - return nil } diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 9e019bcb22..0d9e32a92f 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -213,9 +213,7 @@ func (k msgServer) SetConsumerCommissionRate(goCtx context.Context, msg *types.M return nil, err } - if err := k.HandleSetConsumerCommissionRate(ctx, msg.ChainId, types.NewProviderConsAddress(consAddr), msg.Rate); err != nil { - return nil, err - } + k.HandleSetConsumerCommissionRate(ctx, msg.ChainId, types.NewProviderConsAddress(consAddr), msg.Rate) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go index a6b2ec45e7..7d74853acc 100644 --- a/x/ccv/provider/keeper/partial_set_security_test.go +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -119,18 +119,14 @@ func TestHandleSetConsumerCommissionRate(t *testing.T) { providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) - // trying to set a commission rate to a unknown consumer chain - require.Error(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, "unknownChainID", providerAddr, sdk.ZeroDec())) - // setup a pending consumer chain chainID := "pendingChainID" - providerKeeper.SetPendingConsumerAdditionProp(ctx, &types.ConsumerAdditionProposal{ChainId: chainID}) // check that there's no commission rate set for the validator yet _, found := providerKeeper.GetConsumerCommissionRate(ctx, chainID, providerAddr) require.False(t, found) - require.NoError(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, chainID, providerAddr, sdk.OneDec())) + providerKeeper.HandleSetConsumerCommissionRate(ctx, chainID, providerAddr, sdk.OneDec()) // check that the commission rate is now set cr, found := providerKeeper.GetConsumerCommissionRate(ctx, chainID, providerAddr)