From 54fd3e14488b3ecfb9bdaaa412d8914843555cd5 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 29 Aug 2024 15:02:01 +0200 Subject: [PATCH] handle error messages --- testutil/ibc_testing/generic_setup.go | 2 +- x/ccv/provider/keeper/grpc_query_test.go | 2 +- x/ccv/provider/keeper/msg_server.go | 20 +++++--- x/ccv/provider/keeper/permissionless.go | 20 ++++---- x/ccv/provider/keeper/permissionless_test.go | 52 ++++++++++---------- x/ccv/provider/keeper/proposal.go | 6 +-- x/ccv/provider/keeper/proposal_test.go | 8 +-- x/ccv/provider/types/errors.go | 1 + 8 files changed, 60 insertions(+), 51 deletions(-) diff --git a/testutil/ibc_testing/generic_setup.go b/testutil/ibc_testing/generic_setup.go index 74bf620080..ca46aff6b4 100644 --- a/testutil/ibc_testing/generic_setup.go +++ b/testutil/ibc_testing/generic_setup.go @@ -164,7 +164,7 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( providerKeeper.SetConsumerInitializationParameters(providerChain.GetContext(), consumerId, initializationParameters) providerKeeper.SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerId, powerShapingParameters) providerKeeper.SetConsumerPhase(providerChain.GetContext(), consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED) - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(providerChain.GetContext(), consumerId, coordinator.CurrentTime) + providerKeeper.AppendConsumerToBeLaunched(providerChain.GetContext(), consumerId, coordinator.CurrentTime) // opt-in all validators lastVals, err := providerApp.GetProviderKeeper().GetLastBondedValidators(providerChain.GetContext()) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 936c2af4a0..9063e1cdd0 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -654,7 +654,7 @@ func TestQueryConsumerChains(t *testing.T) { name: "expect initialized consumers when phase is set to Initialized", setup: func(ctx sdk.Context, pk keeper.Keeper) { consumers[1].Phase = types.ConsumerPhase_CONSUMER_PHASE_INITIALIZED - err := pk.AppendConsumerToBeLaunchedOnSpawnTime(ctx, consumerIds[1], time.Now()) + err := pk.AppendConsumerToBeLaunched(ctx, consumerIds[1], time.Now()) require.NoError(t, err) pk.SetConsumerPhase(ctx, consumerIds[1], types.ConsumerPhase_CONSUMER_PHASE_INITIALIZED) }, diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 27d2d546a5..b10cb883c6 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -91,14 +91,16 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign func (k msgServer) RemoveConsumer(goCtx context.Context, msg *types.MsgRemoveConsumer) (*types.MsgRemoveConsumerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + resp := types.MsgRemoveConsumerResponse{} + consumerId := msg.ConsumerId ownerAddress, err := k.Keeper.GetConsumerOwnerAddress(ctx, consumerId) if err != nil { - return &types.MsgRemoveConsumerResponse{}, errorsmod.Wrapf(types.ErrNoOwnerAddress, "cannot retrieve owner address %s", ownerAddress) + return &resp, errorsmod.Wrapf(types.ErrNoOwnerAddress, "cannot retrieve owner address %s", ownerAddress) } if msg.Signer != ownerAddress { - return &types.MsgRemoveConsumerResponse{}, errorsmod.Wrapf(types.ErrUnauthorized, "expected owner address %s, got %s", ownerAddress, msg.Signer) + return &resp, errorsmod.Wrapf(types.ErrUnauthorized, "expected owner address %s, got %s", ownerAddress, msg.Signer) } phase := k.Keeper.GetConsumerPhase(ctx, consumerId) @@ -109,13 +111,19 @@ func (k msgServer) RemoveConsumer(goCtx context.Context, msg *types.MsgRemoveCon previousStopTime, err := k.Keeper.GetConsumerStopTime(ctx, consumerId) if err == nil { - k.Keeper.RemoveConsumerToBeStoppedFromStopTime(ctx, consumerId, previousStopTime) + if err := k.Keeper.RemoveConsumerToBeStopped(ctx, consumerId, previousStopTime); err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot remove previous stop time: %s", err.Error()) + } } - k.Keeper.SetConsumerStopTime(ctx, consumerId, msg.StopTime) - k.Keeper.AppendConsumerToBeStoppedOnStopTime(ctx, consumerId, msg.StopTime) + if err := k.Keeper.SetConsumerStopTime(ctx, consumerId, msg.StopTime); err != nil { + return &resp, errorsmod.Wrapf(types.ErrInvalidStopTime, "cannot set stop time: %s", err.Error()) + } + if err := k.Keeper.AppendConsumerToBeStopped(ctx, consumerId, msg.StopTime); err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot set consumer to be stop: %s", err.Error()) + } - return &types.MsgRemoveConsumerResponse{}, nil + return &resp, nil } // ChangeRewardDenoms defines a rpc handler method for MsgChangeRewardDenoms diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go index 9b60b6b8e5..f684f8b80d 100644 --- a/x/ccv/provider/keeper/permissionless.go +++ b/x/ccv/provider/keeper/permissionless.go @@ -329,13 +329,13 @@ func (k Keeper) GetConsumersToBeLaunched(ctx sdk.Context, spawnTime time.Time) ( return k.getConsumerIdsBasedOnTime(ctx, types.SpawnTimeToConsumerIdsKey, spawnTime) } -// AppendConsumerToBeLaunchedOnSpawnTime appends the provider consumer id for the given spawn time -func (k Keeper) AppendConsumerToBeLaunchedOnSpawnTime(ctx sdk.Context, consumerId string, spawnTime time.Time) error { +// AppendConsumerToBeLaunched appends the provider consumer id for the given spawn time +func (k Keeper) AppendConsumerToBeLaunched(ctx sdk.Context, consumerId string, spawnTime time.Time) error { return k.appendConsumerIdOnTime(ctx, consumerId, types.SpawnTimeToConsumerIdsKey, spawnTime) } -// RemoveConsumerToBeLaunchedFromSpawnTime removes consumer id from if stored for this specific spawn time -func (k Keeper) RemoveConsumerToBeLaunchedFromSpawnTime(ctx sdk.Context, consumerId string, spawnTime time.Time) error { +// RemoveConsumerToBeLaunched removes consumer id from if stored for this specific spawn time +func (k Keeper) RemoveConsumerToBeLaunched(ctx sdk.Context, consumerId string, spawnTime time.Time) error { return k.removeConsumerIdFromTime(ctx, consumerId, types.SpawnTimeToConsumerIdsKey, spawnTime) } @@ -344,13 +344,13 @@ func (k Keeper) GetConsumersToBeStopped(ctx sdk.Context, stopTime time.Time) (ty return k.getConsumerIdsBasedOnTime(ctx, types.StopTimeToConsumerIdsKey, stopTime) } -// AppendConsumerToBeStoppedOnStopTime appends the provider consumer id for the given stop time -func (k Keeper) AppendConsumerToBeStoppedOnStopTime(ctx sdk.Context, consumerId string, stopTime time.Time) error { +// AppendConsumerToBeStopped appends the provider consumer id for the given stop time +func (k Keeper) AppendConsumerToBeStopped(ctx sdk.Context, consumerId string, stopTime time.Time) error { return k.appendConsumerIdOnTime(ctx, consumerId, types.StopTimeToConsumerIdsKey, stopTime) } -// RemoveConsumerToBeStoppedFromStopTime removes consumer id from if stored for this specific stop time -func (k Keeper) RemoveConsumerToBeStoppedFromStopTime(ctx sdk.Context, consumerId string, stopTime time.Time) error { +// RemoveConsumerToBeStopped removes consumer id from if stored for this specific stop time +func (k Keeper) RemoveConsumerToBeStopped(ctx sdk.Context, consumerId string, stopTime time.Time) error { return k.removeConsumerIdFromTime(ctx, consumerId, types.StopTimeToConsumerIdsKey, stopTime) } @@ -649,12 +649,12 @@ func (k Keeper) PrepareConsumerForLaunch(ctx sdk.Context, consumerId string, pre if !previousSpawnTime.Equal(time.Time{}) { // if this is not the first initialization and hence `previousSpawnTime` does not contain the zero value of `Time` // remove the consumer id from the previous spawn time - err := k.RemoveConsumerToBeLaunchedFromSpawnTime(ctx, consumerId, previousSpawnTime) + err := k.RemoveConsumerToBeLaunched(ctx, consumerId, previousSpawnTime) if err != nil { return err } } - return k.AppendConsumerToBeLaunchedOnSpawnTime(ctx, consumerId, spawnTime) + return k.AppendConsumerToBeLaunched(ctx, consumerId, spawnTime) } // CanLaunch checks on whether the consumer with `consumerId` has set all the initialization parameters set and hence diff --git a/x/ccv/provider/keeper/permissionless_test.go b/x/ccv/provider/keeper/permissionless_test.go index 9358204ed9..f4eb4922c1 100644 --- a/x/ccv/provider/keeper/permissionless_test.go +++ b/x/ccv/provider/keeper/permissionless_test.go @@ -263,28 +263,28 @@ func TestConsumerStopTime(t *testing.T) { require.Error(t, err) } -// TestConsumersToBeLaunched tests `AppendConsumerToBeLaunchedOnSpawnTime`, `GetConsumersToBeLaunched`, and `RemoveConsumerToBeLaunchedFromSpawnTime` +// TestConsumersToBeLaunched tests `AppendConsumerToBeLaunched`, `GetConsumersToBeLaunched`, and `RemoveConsumerToBeLaunched` func TestConsumersToBeLaunched(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() spawnTime := time.Now() - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, "consumerId1", spawnTime) + providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId1", spawnTime) consumers, err := providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) require.NoError(t, err) require.Equal(t, []string{"consumerId1"}, consumers.Ids) - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, "consumerId2", spawnTime) + providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId2", spawnTime) consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) require.NoError(t, err) require.Equal(t, []string{"consumerId1", "consumerId2"}, consumers.Ids) - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, "consumerId3", spawnTime) + providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId3", spawnTime) consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) require.NoError(t, err) require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, consumers.Ids) - err = providerKeeper.RemoveConsumerToBeLaunchedFromSpawnTime(ctx, "consumerId2", spawnTime) + err = providerKeeper.RemoveConsumerToBeLaunched(ctx, "consumerId2", spawnTime) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) require.NoError(t, err) @@ -292,7 +292,7 @@ func TestConsumersToBeLaunched(t *testing.T) { // also add consumer ids under a different spawn time and verify everything under the original spawn time is still there spawnTimePlusOneHour := spawnTime.Add(time.Hour) - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, "consumerId4", spawnTimePlusOneHour) + providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId4", spawnTimePlusOneHour) consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTimePlusOneHour) require.NoError(t, err) require.Equal(t, []string{"consumerId4"}, consumers.Ids) @@ -302,51 +302,51 @@ func TestConsumersToBeLaunched(t *testing.T) { require.Equal(t, []string{"consumerId1", "consumerId3"}, consumers.Ids) // start removing all consumers from `spawnTime` - err = providerKeeper.RemoveConsumerToBeLaunchedFromSpawnTime(ctx, "consumerId3", spawnTime) + err = providerKeeper.RemoveConsumerToBeLaunched(ctx, "consumerId3", spawnTime) require.NoError(t, err) - err = providerKeeper.RemoveConsumerToBeLaunchedFromSpawnTime(ctx, "consumerId1", spawnTime) + err = providerKeeper.RemoveConsumerToBeLaunched(ctx, "consumerId1", spawnTime) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) require.NoError(t, err) require.Empty(t, consumers.Ids) // remove from `spawnTimePlusOneHour` - err = providerKeeper.RemoveConsumerToBeLaunchedFromSpawnTime(ctx, "consumerId4", spawnTimePlusOneHour) + err = providerKeeper.RemoveConsumerToBeLaunched(ctx, "consumerId4", spawnTimePlusOneHour) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTimePlusOneHour) require.NoError(t, err) require.Empty(t, consumers.Ids) // add another consumer for `spawnTime` - err = providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, "consumerId5", spawnTime) + err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId5", spawnTime) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) require.NoError(t, err) require.Equal(t, []string{"consumerId5"}, consumers.Ids) } -// TestConsumersToBeStopped tests `AppendConsumerToBeLaunchedOnSpawnTime`, `GetConsumersToBeLaunched`, and `RemoveConsumerToBeLaunchedFromSpawnTime` +// TestConsumersToBeStopped tests `AppendConsumerToBeLaunched`, `GetConsumersToBeLaunched`, and `RemoveConsumerToBeLaunched` func TestConsumersToBeStopped(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() stopTime := time.Now() - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, "consumerId1", stopTime) + providerKeeper.AppendConsumerToBeStopped(ctx, "consumerId1", stopTime) consumers, err := providerKeeper.GetConsumersToBeStopped(ctx, stopTime) require.NoError(t, err) require.Equal(t, []string{"consumerId1"}, consumers.Ids) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, "consumerId2", stopTime) + providerKeeper.AppendConsumerToBeStopped(ctx, "consumerId2", stopTime) consumers, err = providerKeeper.GetConsumersToBeStopped(ctx, stopTime) require.NoError(t, err) require.Equal(t, []string{"consumerId1", "consumerId2"}, consumers.Ids) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, "consumerId3", stopTime) + providerKeeper.AppendConsumerToBeStopped(ctx, "consumerId3", stopTime) consumers, err = providerKeeper.GetConsumersToBeStopped(ctx, stopTime) require.NoError(t, err) require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, consumers.Ids) - err = providerKeeper.RemoveConsumerToBeStoppedFromStopTime(ctx, "consumerId2", stopTime) + err = providerKeeper.RemoveConsumerToBeStopped(ctx, "consumerId2", stopTime) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeStopped(ctx, stopTime) require.NoError(t, err) @@ -354,7 +354,7 @@ func TestConsumersToBeStopped(t *testing.T) { // also add consumer ids under a different stop time and verify everything under the original stop time is still there stopTimePlusOneHour := stopTime.Add(time.Hour) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, "consumerId4", stopTimePlusOneHour) + providerKeeper.AppendConsumerToBeStopped(ctx, "consumerId4", stopTimePlusOneHour) consumers, err = providerKeeper.GetConsumersToBeStopped(ctx, stopTimePlusOneHour) require.NoError(t, err) require.Equal(t, []string{"consumerId4"}, consumers.Ids) @@ -364,23 +364,23 @@ func TestConsumersToBeStopped(t *testing.T) { require.Equal(t, []string{"consumerId1", "consumerId3"}, consumers.Ids) // start removing all consumers from `stopTime` - err = providerKeeper.RemoveConsumerToBeStoppedFromStopTime(ctx, "consumerId3", stopTime) + err = providerKeeper.RemoveConsumerToBeStopped(ctx, "consumerId3", stopTime) require.NoError(t, err) - err = providerKeeper.RemoveConsumerToBeStoppedFromStopTime(ctx, "consumerId1", stopTime) + err = providerKeeper.RemoveConsumerToBeStopped(ctx, "consumerId1", stopTime) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeStopped(ctx, stopTime) require.NoError(t, err) require.Empty(t, consumers.Ids) // remove from `stopTimePlusOneHour` - err = providerKeeper.RemoveConsumerToBeStoppedFromStopTime(ctx, "consumerId4", stopTimePlusOneHour) + err = providerKeeper.RemoveConsumerToBeStopped(ctx, "consumerId4", stopTimePlusOneHour) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeStopped(ctx, stopTimePlusOneHour) require.NoError(t, err) require.Empty(t, consumers.Ids) // add another consumer for `stopTime` - err = providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, "consumerId5", stopTime) + err = providerKeeper.AppendConsumerToBeStopped(ctx, "consumerId5", stopTime) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeStopped(ctx, stopTime) require.NoError(t, err) @@ -474,9 +474,9 @@ func TestGetInitializedConsumersReadyToLaunch(t *testing.T) { // no chains to-be-launched exist require.Empty(t, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 5)) - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, "consumerId1", time.Unix(10, 0)) - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, "consumerId2", time.Unix(20, 0)) - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, "consumerId3", time.Unix(30, 0)) + providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId1", time.Unix(10, 0)) + providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId2", time.Unix(20, 0)) + providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId3", time.Unix(30, 0)) // time has not yet reached the spawn time of "consumerId1" ctx = ctx.WithBlockTime(time.Unix(9, 999999999)) @@ -507,9 +507,9 @@ func TestGetLaunchedConsumersReadyToStop(t *testing.T) { // no chains to-be-stopped exist require.Empty(t, providerKeeper.GetLaunchedConsumersReadyToStop(ctx, 3)) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, "consumerId1", time.Unix(10, 0)) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, "consumerId2", time.Unix(20, 0)) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, "consumerId3", time.Unix(30, 0)) + providerKeeper.AppendConsumerToBeStopped(ctx, "consumerId1", time.Unix(10, 0)) + providerKeeper.AppendConsumerToBeStopped(ctx, "consumerId2", time.Unix(20, 0)) + providerKeeper.AppendConsumerToBeStopped(ctx, "consumerId3", time.Unix(30, 0)) // time has not yet reached the stop time of "consumerId1" ctx = ctx.WithBlockTime(time.Unix(9, 999999999)) diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 558b0ffda1..6d95a1679f 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -299,7 +299,7 @@ func (k Keeper) BeginBlockInit(ctx sdk.Context) { } // Remove consumer to prevent re-trying launching this chain. // We would only try to re-launch this chain if a new `MsgUpdateConsumer` message is sent. - k.RemoveConsumerToBeLaunchedFromSpawnTime(ctx, consumerId, record.SpawnTime) + k.RemoveConsumerToBeLaunched(ctx, consumerId, record.SpawnTime) cachedCtx, writeFn := ctx.CacheContext() err = k.LaunchConsumer(cachedCtx, consumerId) @@ -326,7 +326,7 @@ func (k Keeper) BeginBlockCCR(ctx sdk.Context) { stopTime, err := k.GetConsumerStopTime(ctx, consumerId) if err != nil { - k.Logger(ctx).Info("chain could not be stopped", + k.Logger(ctx).Error("chain could not be stopped", "consumerId", consumerId, "err", err.Error()) continue @@ -341,7 +341,7 @@ func (k Keeper) BeginBlockCCR(ctx sdk.Context) { } k.SetConsumerPhase(cachedCtx, consumerId, types.ConsumerPhase_CONSUMER_PHASE_STOPPED) - k.RemoveConsumerToBeStoppedFromStopTime(ctx, consumerId, stopTime) + k.RemoveConsumerToBeStopped(ctx, consumerId, stopTime) // The cached context is created with a new EventManager so we merge the event into the original context ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index ca9be3aa32..9e5e094eb2 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -613,7 +613,7 @@ func TestBeginBlockInit(t *testing.T) { providerKeeper.SetConsumerInitializationParameters(ctx, fmt.Sprintf("%d", i), r) // set up the chains in their initialized phase, hence they could launch providerKeeper.SetConsumerPhase(ctx, fmt.Sprintf("%d", i), providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED) - providerKeeper.AppendConsumerToBeLaunchedOnSpawnTime(ctx, fmt.Sprintf("%d", i), r.SpawnTime) + providerKeeper.AppendConsumerToBeLaunched(ctx, fmt.Sprintf("%d", i), r.SpawnTime) } for i, r := range powerShapingParameters { providerKeeper.SetConsumerPowerShapingParameters(ctx, fmt.Sprintf("%d", i), r) @@ -678,11 +678,11 @@ func TestBeginBlockCCR(t *testing.T) { chainIds := []string{"chain1", "chain2", "chain3"} consumerIds := []string{"consumerId1", "consumerId2", "consumerId3"} providerKeeper.SetConsumerStopTime(ctx, consumerIds[0], now.Add(-time.Hour)) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, consumerIds[0], now.Add(-time.Hour)) + providerKeeper.AppendConsumerToBeStopped(ctx, consumerIds[0], now.Add(-time.Hour)) providerKeeper.SetConsumerStopTime(ctx, consumerIds[1], now) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, consumerIds[1], now) + providerKeeper.AppendConsumerToBeStopped(ctx, consumerIds[1], now) providerKeeper.SetConsumerStopTime(ctx, consumerIds[2], now.Add(time.Hour)) - providerKeeper.AppendConsumerToBeStoppedOnStopTime(ctx, consumerIds[2], now.Add(time.Hour)) + providerKeeper.AppendConsumerToBeStopped(ctx, consumerIds[2], now.Add(time.Hour)) // // Mock expectations diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index b7ab44d029..57ab5c2a99 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -48,4 +48,5 @@ var ( ErrInvalidTransformToOptIn = errorsmod.Register(ModuleName, 40, "invalid transform to Opt In chain") ErrCannotCreateTopNChain = errorsmod.Register(ModuleName, 41, "cannot create Top N chain outside permissionlessly") ErrCannotPrepareForLaunch = errorsmod.Register(ModuleName, 42, "cannot prepare chain for launch") + ErrInvalidStopTime = errorsmod.Register(ModuleName, 43, "invalid stop time") )