Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nit: remove type prefix from consumer phase enum #2220

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions proto/interchain_security/ccv/provider/v1/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ message ConsumerIds { repeated string ids = 1; }

// ConsumerPhase indicates the phases of a consumer chain according to ADR 019
enum ConsumerPhase {
option (gogoproto.goproto_enum_prefix) = false;

// UNSPECIFIED defines an empty phase.
CONSUMER_PHASE_UNSPECIFIED = 0;
// REGISTERED defines the phase in which a consumer chain has been assigned a unique consumer id.
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,9 @@ func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool {
chains := make(map[ChainID]bool)
for _, c := range arr {
phase := c.Get("phase").String()
if phase == types.ConsumerPhase_name[int32(types.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)] ||
phase == types.ConsumerPhase_name[int32(types.ConsumerPhase_CONSUMER_PHASE_REGISTERED)] ||
phase == types.ConsumerPhase_name[int32(types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED)] {
if phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_INITIALIZED)] ||
phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_REGISTERED)] ||
phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_LAUNCHED)] {
id := c.Get("chain_id").String()
chains[ChainID(id)] = true
}
Expand Down Expand Up @@ -1019,8 +1019,8 @@ func (tr Commands) GetProposedConsumerChains(chain ChainID) []string {
for _, c := range arr {
cid := c.Get("chain_id").String()
phase := c.Get("phase").String()
if phase == types.ConsumerPhase_name[int32(types.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)] ||
phase == types.ConsumerPhase_name[int32(types.ConsumerPhase_CONSUMER_PHASE_REGISTERED)] {
if phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_INITIALIZED)] ||
phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_REGISTERED)] {
chains = append(chains, cid)
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (suite *CCVTestSuite) SetupTest() {
// 1. the consumer chain is added to the coordinator
// 2. MakeGenesis is called on the provider chain
// 3. ibc/testing sets the tendermint header for the consumer chain app
providerKeeper.SetConsumerPhase(suite.providerCtx(), icstestingutils.FirstConsumerID, providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
providerKeeper.SetConsumerPhase(suite.providerCtx(), icstestingutils.FirstConsumerID, providertypes.CONSUMER_PHASE_INITIALIZED)
preProposalKeyAssignment(suite, icstestingutils.FirstConsumerID)

// start consumer chains
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/stop_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *CCVTestSuite) TestStopConsumerChain() {
}

// stop the consumer chain
providerKeeper.SetConsumerPhase(s.providerCtx(), firstBundle.ConsumerId, types.ConsumerPhase_CONSUMER_PHASE_STOPPED)
providerKeeper.SetConsumerPhase(s.providerCtx(), firstBundle.ConsumerId, types.CONSUMER_PHASE_STOPPED)
err = providerKeeper.DeleteConsumerChain(s.providerCtx(), firstBundle.ConsumerId)
s.Require().NoError(err)

Expand All @@ -107,7 +107,7 @@ func (s *CCVTestSuite) TestStopConsumerOnChannelClosed() {
providerKeeper := s.providerApp.GetProviderKeeper()

// stop the consumer chain
providerKeeper.SetConsumerPhase(s.providerCtx(), s.getFirstBundle().ConsumerId, types.ConsumerPhase_CONSUMER_PHASE_STOPPED)
providerKeeper.SetConsumerPhase(s.providerCtx(), s.getFirstBundle().ConsumerId, types.CONSUMER_PHASE_STOPPED)
err := providerKeeper.DeleteConsumerChain(s.providerCtx(), s.getFirstBundle().ConsumerId)
s.Require().NoError(err)

Expand Down
2 changes: 1 addition & 1 deletion testutil/ibc_testing/generic_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp](
s.Require().NoError(err)
err = providerKeeper.SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerId, powerShapingParameters)
s.Require().NoError(err)
providerKeeper.SetConsumerPhase(providerChain.GetContext(), consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
providerKeeper.SetConsumerPhase(providerChain.GetContext(), consumerId, providertypes.CONSUMER_PHASE_INITIALIZED)
err = providerKeeper.AppendConsumerToBeLaunched(providerChain.GetContext(), consumerId, coordinator.CurrentTime)
s.Require().NoError(err)

Expand Down
4 changes: 2 additions & 2 deletions testutil/keeper/unit_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func SetupForDeleteConsumerChain(t *testing.T, ctx sdk.Context,
require.NoError(t, err)

// set the chain to initialized so that we can create a consumer client
providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_INITIALIZED)

err = providerKeeper.CreateConsumerClient(ctx, consumerId)
require.NoError(t, err)
Expand All @@ -251,7 +251,7 @@ func SetupForDeleteConsumerChain(t *testing.T, ctx sdk.Context,
require.NoError(t, err)

// set the chain to stopped sto the chain can be deleted
providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_STOPPED)
providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_STOPPED)
}

// TestProviderStateIsCleanedAfterConsumerChainIsDeleted executes test assertions for the provider's state being cleaned
Expand Down
10 changes: 5 additions & 5 deletions x/ccv/provider/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) {
setup: func(ctx sdk.Context,
k keeper.Keeper, mocks testkeeper.MockedKeepers,
) {
k.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
k.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED)
gomock.InOrder(
mocks.MockStakingKeeper.EXPECT().GetValidator(
ctx, providerCryptoId.SDKValOpAddress(),
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) {
setup: func(ctx sdk.Context,
k keeper.Keeper, mocks testkeeper.MockedKeepers,
) {
k.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
k.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED)
gomock.InOrder(
mocks.MockStakingKeeper.EXPECT().GetValidator(
ctx, providerCryptoId.SDKValOpAddress(),
Expand All @@ -103,7 +103,7 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) {
setup: func(ctx sdk.Context,
k keeper.Keeper, mocks testkeeper.MockedKeepers,
) {
k.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
k.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED)

// Use the consumer key already used by some other validator
k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr2)
Expand All @@ -127,7 +127,7 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) {
setup: func(ctx sdk.Context,
k keeper.Keeper, mocks testkeeper.MockedKeepers,
) {
k.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
k.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED)

// Use the consumer key already
k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr)
Expand All @@ -149,7 +149,7 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) {
setup: func(ctx sdk.Context,
k keeper.Keeper, mocks testkeeper.MockedKeepers,
) {
k.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
k.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED)

// Use the consumer key already used by some other validator
k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr2)
Expand Down
12 changes: 6 additions & 6 deletions x/ccv/provider/keeper/consumer_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (k Keeper) PrepareConsumerForLaunch(ctx sdk.Context, consumerId string, pre
func (k Keeper) CanLaunch(ctx sdk.Context, consumerId string) (time.Time, bool) {
// a chain that is already launched or stopped cannot launch again
phase := k.GetConsumerPhase(ctx, consumerId)
if phase == types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED || phase == types.ConsumerPhase_CONSUMER_PHASE_STOPPED {
if phase == types.CONSUMER_PHASE_LAUNCHED || phase == types.CONSUMER_PHASE_STOPPED {
return time.Time{}, false
}

Expand Down Expand Up @@ -160,7 +160,7 @@ func (k Keeper) LaunchConsumer(ctx sdk.Context, consumerId string) error {
return errorsmod.Wrapf(types.ErrInvalidConsumerGenesis, "consumer genesis initial validator set is empty - no validators opted in consumer id: %s", consumerId)
}

k.SetConsumerPhase(ctx, consumerId, types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED)
k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_LAUNCHED)

return nil
}
Expand All @@ -174,7 +174,7 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, consumerId string) error {
}

phase := k.GetConsumerPhase(ctx, consumerId)
if phase != types.ConsumerPhase_CONSUMER_PHASE_INITIALIZED {
if phase != types.CONSUMER_PHASE_INITIALIZED {
return errorsmod.Wrapf(types.ErrInvalidPhase,
"cannot create client for consumer chain that is not in the Initialized phase but in phase %d: %s", phase, consumerId)
}
Expand Down Expand Up @@ -359,7 +359,7 @@ func (k Keeper) MakeConsumerGenesis(
func (k Keeper) StopAndPrepareForConsumerRemoval(ctx sdk.Context, consumerId string) error {
// The phase of the chain is immediately set to stopped, albeit its state is removed later (see below).
// Setting the phase here helps in not considering this chain when we look at launched chains (e.g., in `QueueVSCPackets)
k.SetConsumerPhase(ctx, consumerId, types.ConsumerPhase_CONSUMER_PHASE_STOPPED)
k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_STOPPED)

// state of this chain is removed once UnbondingPeriod elapses
unbondingPeriod, err := k.stakingKeeper.UnbondingTime(ctx)
Expand Down Expand Up @@ -466,7 +466,7 @@ func (k Keeper) GetConsumersReadyToStop(ctx sdk.Context, limit uint32) []string
// DeleteConsumerChain cleans up the state of the given consumer chain
func (k Keeper) DeleteConsumerChain(ctx sdk.Context, consumerId string) (err error) {
phase := k.GetConsumerPhase(ctx, consumerId)
if phase != types.ConsumerPhase_CONSUMER_PHASE_STOPPED {
if phase != types.CONSUMER_PHASE_STOPPED {
return fmt.Errorf("cannot delete non-stopped chain: %s", consumerId)
}

Expand Down Expand Up @@ -519,7 +519,7 @@ func (k Keeper) DeleteConsumerChain(ctx sdk.Context, consumerId string) (err err
// Note that we do not delete ConsumerIdToChainIdKey and ConsumerIdToPhase, as well
// as consumer metadata, initialization and power-shaping parameters.

k.SetConsumerPhase(ctx, consumerId, types.ConsumerPhase_CONSUMER_PHASE_DELETED)
k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_DELETED)
k.Logger(ctx).Info("consumer chain deleted from provider", "consumerId", consumerId)

return nil
Expand Down
34 changes: 17 additions & 17 deletions x/ccv/provider/keeper/consumer_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestCanLaunch(t *testing.T) {
require.False(t, canLaunch)

// cannot launch a chain without initialization parameters
providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED)
_, canLaunch = providerKeeper.CanLaunch(ctx, "consumerId")
require.False(t, canLaunch)

Expand All @@ -71,17 +71,17 @@ func TestCanLaunch(t *testing.T) {
require.NoError(t, err)

// cannot launch a launched chain
providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED)
providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_LAUNCHED)
_, canLaunch = providerKeeper.CanLaunch(ctx, "consumerId")
require.False(t, canLaunch)

// cannot launch a stopped chain
providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_STOPPED)
providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_STOPPED)
_, canLaunch = providerKeeper.CanLaunch(ctx, "consumerId")
require.False(t, canLaunch)

// initialized chain can launch
providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED)
_, canLaunch = providerKeeper.CanLaunch(ctx, "consumerId")
require.True(t, canLaunch)

Expand Down Expand Up @@ -255,7 +255,7 @@ func TestBeginBlockLaunchConsumers(t *testing.T) {
err := providerKeeper.SetConsumerInitializationParameters(ctx, fmt.Sprintf("%d", i), r)
require.NoError(t, err)
// 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.SetConsumerPhase(ctx, fmt.Sprintf("%d", i), providertypes.CONSUMER_PHASE_INITIALIZED)
err = providerKeeper.AppendConsumerToBeLaunched(ctx, fmt.Sprintf("%d", i), r.SpawnTime)
require.NoError(t, err)
}
Expand All @@ -280,33 +280,33 @@ func TestBeginBlockLaunchConsumers(t *testing.T) {

// first chain was successfully launched
phase := providerKeeper.GetConsumerPhase(ctx, "0")
require.Equal(t, providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED, phase)
require.Equal(t, providertypes.CONSUMER_PHASE_LAUNCHED, phase)
_, found := providerKeeper.GetConsumerGenesis(ctx, "0")
require.True(t, found)

// second chain was successfully launched
phase = providerKeeper.GetConsumerPhase(ctx, "1")
require.Equal(t, providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED, phase)
require.Equal(t, providertypes.CONSUMER_PHASE_LAUNCHED, phase)
_, found = providerKeeper.GetConsumerGenesis(ctx, "1")
require.True(t, found)

// third chain was not launched because its spawn time has not passed
phase = providerKeeper.GetConsumerPhase(ctx, "2")
require.Equal(t, providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED, phase)
require.Equal(t, providertypes.CONSUMER_PHASE_INITIALIZED, phase)
_, found = providerKeeper.GetConsumerGenesis(ctx, "2")
require.False(t, found)

// fourth chain corresponds to an Opt-In chain with one opted-in validator and hence the chain gets
// successfully executed
phase = providerKeeper.GetConsumerPhase(ctx, "3")
require.Equal(t, providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED, phase)
require.Equal(t, providertypes.CONSUMER_PHASE_LAUNCHED, phase)
_, found = providerKeeper.GetConsumerGenesis(ctx, "3")
require.True(t, found)

// fifth chain corresponds to an Opt-In chain with no opted-in validators and hence the
// chain launch is NOT successful
phase = providerKeeper.GetConsumerPhase(ctx, "4")
require.Equal(t, providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED, phase)
require.Equal(t, providertypes.CONSUMER_PHASE_INITIALIZED, phase)
_, found = providerKeeper.GetConsumerGenesis(ctx, "4")
require.False(t, found)
}
Expand Down Expand Up @@ -362,7 +362,7 @@ func TestCreateConsumerClient(t *testing.T) {
{
description: "No state mutation, new client should be created",
setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) {
providerKeeper.SetConsumerPhase(ctx, "0", providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
providerKeeper.SetConsumerPhase(ctx, "0", providertypes.CONSUMER_PHASE_INITIALIZED)

// Valid client creation is asserted with mock expectations here
testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) // returns empty validator set
Expand All @@ -375,7 +375,7 @@ func TestCreateConsumerClient(t *testing.T) {
{
description: "chain for this consumer id has already launched, and hence client was created, NO new one is created",
setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) {
providerKeeper.SetConsumerPhase(ctx, "0", providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED)
providerKeeper.SetConsumerPhase(ctx, "0", providertypes.CONSUMER_PHASE_LAUNCHED)

// Expect none of the client creation related calls to happen
mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Times(0)
Expand Down Expand Up @@ -695,7 +695,7 @@ func TestBeginBlockStopConsumers(t *testing.T) {
require.NoError(t, err)
err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, testkeeper.GetTestPowerShapingParameters())
require.NoError(t, err)
providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_INITIALIZED)
providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_INITIALIZED)
providerKeeper.SetConsumerClientId(ctx, consumerId, "clientID")

err = providerKeeper.CreateConsumerClient(ctx, consumerId)
Expand All @@ -704,7 +704,7 @@ func TestBeginBlockStopConsumers(t *testing.T) {
require.NoError(t, err)

// the chain is considered to be stopped and ready for deletion (i.e., `StopAndPrepareForConsumerRemoval` is called)
providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_STOPPED)
providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_STOPPED)
}

//
Expand All @@ -715,12 +715,12 @@ func TestBeginBlockStopConsumers(t *testing.T) {

// Only the 3rd (final) proposal is still stored as pending
phase := providerKeeper.GetConsumerPhase(ctx, consumerIds[0])
require.Equal(t, providertypes.ConsumerPhase_CONSUMER_PHASE_DELETED, phase)
require.Equal(t, providertypes.CONSUMER_PHASE_DELETED, phase)
phase = providerKeeper.GetConsumerPhase(ctx, consumerIds[1])
require.Equal(t, providertypes.ConsumerPhase_CONSUMER_PHASE_DELETED, phase)
require.Equal(t, providertypes.CONSUMER_PHASE_DELETED, phase)
// third chain had a removal time in the future and hence did not get deleted
phase = providerKeeper.GetConsumerPhase(ctx, consumerIds[2])
require.Equal(t, providertypes.ConsumerPhase_CONSUMER_PHASE_STOPPED, phase)
require.Equal(t, providertypes.CONSUMER_PHASE_STOPPED, phase)
}

func TestGetConsumersReadyToStop(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestInitAndExportGenesis(t *testing.T) {
*ccv.DefaultConsumerGenesisState(),
[]ccv.ValidatorSetChangePacketData{},
[]string{"slashedValidatorConsAddress"},
providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED,
providertypes.CONSUMER_PHASE_LAUNCHED,
),
providertypes.NewConsumerStates(
cChainIDs[1],
Expand All @@ -61,7 +61,7 @@ func TestInitAndExportGenesis(t *testing.T) {
*ccv.DefaultConsumerGenesisState(),
[]ccv.ValidatorSetChangePacketData{{ValsetUpdateId: vscID}},
nil,
providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED,
providertypes.CONSUMER_PHASE_LAUNCHED,
),
},
params,
Expand Down
10 changes: 5 additions & 5 deletions x/ccv/provider/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu
consumerIds := []string{}
for _, consumerID := range k.GetAllConsumerIds(ctx) {
phase := k.GetConsumerPhase(ctx, consumerID)
if req.Phase != types.ConsumerPhase_CONSUMER_PHASE_UNSPECIFIED && req.Phase != phase {
if req.Phase != types.CONSUMER_PHASE_UNSPECIFIED && req.Phase != phase {
// ignore consumer chain
continue
}
Expand Down Expand Up @@ -308,7 +308,7 @@ func (k Keeper) QueryConsumerValidators(goCtx context.Context, req *types.QueryC

// get the consumer phase
phase := k.GetConsumerPhase(ctx, consumerId)
if phase == types.ConsumerPhase_CONSUMER_PHASE_UNSPECIFIED {
if phase == types.CONSUMER_PHASE_UNSPECIFIED {
return nil, status.Errorf(codes.InvalidArgument, "cannot find a phase for consumer: %s", consumerId)
}

Expand All @@ -318,13 +318,13 @@ func (k Keeper) QueryConsumerValidators(goCtx context.Context, req *types.QueryC
var err error

// if the consumer launched, the consumer valset has been persisted
if phase == types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED {
if phase == types.CONSUMER_PHASE_LAUNCHED {
consumerValSet, err = k.GetConsumerValSet(ctx, consumerId)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
// if the consumer hasn't been launched or stopped, compute the consumer validator set
} else if phase != types.ConsumerPhase_CONSUMER_PHASE_STOPPED {
} else if phase != types.CONSUMER_PHASE_STOPPED {
bondedValidators, err := k.GetLastBondedValidators(ctx)
if err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("failed to get last validators: %s", err))
Expand Down Expand Up @@ -572,7 +572,7 @@ func (k Keeper) QueryConsumerChain(goCtx context.Context, req *types.QueryConsum
}

phase := k.GetConsumerPhase(ctx, consumerId)
if phase == types.ConsumerPhase_CONSUMER_PHASE_UNSPECIFIED {
if phase == types.CONSUMER_PHASE_UNSPECIFIED {
return nil, status.Errorf(codes.InvalidArgument, "cannot retrieve phase for consumer id: %s", consumerId)
}

Expand Down
Loading
Loading