From eaa7f6e7ef98fa16b38e6213a194506dc9d50f26 Mon Sep 17 00:00:00 2001 From: Jehan Date: Thu, 18 Aug 2022 16:14:19 -0700 Subject: [PATCH 1/2] Update CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0ec6862b3e..8ef9d6ed60 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,3 @@ # CODEOWNERS: https://help.github.com/articles/about-codeowners/ -* @adityasripal @jtremback @mpoke @sainoe @danwt +* @jtremback @mpoke @sainoe @danwt From d9290b6505cc1c96470043cbbe580fd050d81255 Mon Sep 17 00:00:00 2001 From: Shawn Marshall-Spitzbart <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Mon, 22 Aug 2022 08:44:24 -0700 Subject: [PATCH 2/2] GetProviderClient -> GetProviderClientID --- x/ccv/consumer/keeper/genesis.go | 8 ++++---- x/ccv/consumer/keeper/genesis_test.go | 2 +- x/ccv/consumer/keeper/keeper.go | 14 +++++++------- x/ccv/consumer/keeper/keeper_test.go | 6 +++--- x/ccv/consumer/module_test.go | 2 +- x/ccv/consumer/types/keys.go | 4 ++-- x/ccv/consumer/types/keys_test.go | 2 +- x/ccv/provider/keeper/keeper_test.go | 2 +- x/ccv/provider/provider_test.go | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index 86fcb97b89..849a07662d 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -48,7 +48,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *types.GenesisState) []abci.V // Set default value for valset update ID k.SetHeightValsetUpdateID(ctx, uint64(ctx.BlockHeight()), uint64(0)) // set provider client id. - k.SetProviderClient(ctx, clientID) + k.SetProviderClientID(ctx, clientID) } else { // verify that latest consensus state on provider client matches the initial validator set of restarted chain // thus, IBC genesis MUST run before CCV consumer genesis @@ -87,7 +87,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *types.GenesisState) []abci.V k.SetUnbondingTime(ctx, unbondingTime) // set provider client id - k.SetProviderClient(ctx, state.ProviderClientId) + k.SetProviderClientID(ctx, state.ProviderClientId) // set provider channel id. k.SetProviderChannel(ctx, state.ProviderChannelId) // set all unbonding sequences @@ -110,7 +110,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { } if channelID, ok := k.GetProviderChannel(ctx); ok { - clientID, ok := k.GetProviderClient(ctx) + clientID, ok := k.GetProviderClientID(ctx) if !ok { panic("provider client does not exist") } @@ -131,7 +131,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { gs.MaturingPackets = maturingPackets return gs } - clientID, ok := k.GetProviderClient(ctx) + clientID, ok := k.GetProviderClientID(ctx) // if provider clientID and channelID don't exist on the consumer chain, then CCV protocol is disabled for this chain // return a disabled genesis state if !ok { diff --git a/x/ccv/consumer/keeper/genesis_test.go b/x/ccv/consumer/keeper/genesis_test.go index 9b9c0c8114..88268145d7 100644 --- a/x/ccv/consumer/keeper/genesis_test.go +++ b/x/ccv/consumer/keeper/genesis_test.go @@ -33,7 +33,7 @@ func (suite *KeeperTestSuite) TestGenesis() { portId := suite.consumerChain.App.(*app.App).ConsumerKeeper.GetPort(ctx) suite.Require().Equal(consumertypes.PortID, portId) - clientId, ok := suite.consumerChain.App.(*app.App).ConsumerKeeper.GetProviderClient(ctx) + clientId, ok := suite.consumerChain.App.(*app.App).ConsumerKeeper.GetProviderClientID(ctx) suite.Require().True(ok) clientState, ok := suite.consumerChain.App.GetIBCKeeper().ClientKeeper.GetClientState(ctx, clientId) suite.Require().True(ok) diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index 2885f34382..9c7343333c 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -164,17 +164,17 @@ func (k Keeper) DeleteUnbondingTime(ctx sdk.Context) { store.Delete(types.UnbondingTimeKey()) } -// SetProviderClient sets the provider clientID that is validating the chain. +// SetProviderClientID sets the provider clientID that is validating the chain. // Set in InitGenesis -func (k Keeper) SetProviderClient(ctx sdk.Context, clientID string) { +func (k Keeper) SetProviderClientID(ctx sdk.Context, clientID string) { store := ctx.KVStore(k.storeKey) - store.Set(types.ProviderClientKey(), []byte(clientID)) + store.Set(types.ProviderClientIDKey(), []byte(clientID)) } -// GetProviderClient gets the provider clientID that is validating the chain. -func (k Keeper) GetProviderClient(ctx sdk.Context) (string, bool) { +// GetProviderClientID gets the provider clientID that is validating the chain. +func (k Keeper) GetProviderClientID(ctx sdk.Context) (string, bool) { store := ctx.KVStore(k.storeKey) - clientIdBytes := store.Get(types.ProviderClientKey()) + clientIdBytes := store.Get(types.ProviderClientIDKey()) if clientIdBytes == nil { return "", false } @@ -289,7 +289,7 @@ func (k Keeper) VerifyProviderChain(ctx sdk.Context, channelID string, connectio return sdkerrors.Wrapf(conntypes.ErrConnectionNotFound, "connection not found for connection ID: %s", connectionID) } // Verify that client id is expected clientID - expectedClientId, ok := k.GetProviderClient(ctx) + expectedClientId, ok := k.GetProviderClientID(ctx) if !ok { return sdkerrors.Wrapf(clienttypes.ErrInvalidClient, "could not find provider client id") } diff --git a/x/ccv/consumer/keeper/keeper_test.go b/x/ccv/consumer/keeper/keeper_test.go index d96656f762..3eca6c626f 100644 --- a/x/ccv/consumer/keeper/keeper_test.go +++ b/x/ccv/consumer/keeper/keeper_test.go @@ -99,9 +99,9 @@ func (suite *KeeperTestSuite) SetupTest() { suite.Require().True(found, "consumer client not found") suite.path.EndpointB.ClientID = consumerClient // - set consumer endpoint's clientID - providerClient, found := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClient(suite.consumerChain.GetContext()) + providerClientID, found := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClientID(suite.consumerChain.GetContext()) suite.Require().True(found, "provider client not found") - suite.path.EndpointA.ClientID = providerClient + suite.path.EndpointA.ClientID = providerClientID // - client config providerUnbondingPeriod := suite.providerChain.App.(*appProvider.App).GetStakingKeeper().UnbondingTime(suite.providerChain.GetContext()) suite.path.EndpointB.ClientConfig.(*ibctesting.TendermintConfig).UnbondingPeriod = providerUnbondingPeriod @@ -146,7 +146,7 @@ func (suite *KeeperTestSuite) TestUnbondingTime() { } func (suite *KeeperTestSuite) TestProviderClient() { - providerClient, ok := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClient(suite.ctx) + providerClient, ok := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClientID(suite.ctx) suite.Require().True(ok) clientState, _ := suite.consumerChain.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.ctx, providerClient) diff --git a/x/ccv/consumer/module_test.go b/x/ccv/consumer/module_test.go index 61b3638b56..40fd42615c 100644 --- a/x/ccv/consumer/module_test.go +++ b/x/ccv/consumer/module_test.go @@ -93,7 +93,7 @@ func (suite *ConsumerTestSuite) SetupTest() { suite.Require().True(found, "consumer client not found") suite.path.EndpointB.ClientID = consumerClient // - set consumer endpoint's clientID - providerClient, found := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClient(suite.consumerChain.GetContext()) + providerClient, found := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClientID(suite.consumerChain.GetContext()) suite.Require().True(found, "provider client not found") suite.path.EndpointA.ClientID = providerClient // - client config diff --git a/x/ccv/consumer/types/keys.go b/x/ccv/consumer/types/keys.go index 9e49ae20b8..5f8be6f5b8 100644 --- a/x/ccv/consumer/types/keys.go +++ b/x/ccv/consumer/types/keys.go @@ -89,8 +89,8 @@ func UnbondingTimeKey() []byte { return []byte{UnbondingTimeByteKey} } -// ProviderClientKey returns the key for storing clientID of the provider -func ProviderClientKey() []byte { +// ProviderClientIDKey returns the key for storing clientID of the provider +func ProviderClientIDKey() []byte { return []byte{ProviderClientByteKey} } diff --git a/x/ccv/consumer/types/keys_test.go b/x/ccv/consumer/types/keys_test.go index ff97eb7e57..f3bcc0dd15 100644 --- a/x/ccv/consumer/types/keys_test.go +++ b/x/ccv/consumer/types/keys_test.go @@ -38,7 +38,7 @@ func getSingleByteKeys() [][]byte { keys[i], i = PortKey(), i+1 keys[i], i = LastDistributionTransmissionKey(), i+1 keys[i], i = UnbondingTimeKey(), i+1 - keys[i], i = ProviderClientKey(), i+1 + keys[i], i = ProviderClientIDKey(), i+1 keys[i], i = ProviderChannelKey(), i+1 keys[i], i = PendingChangesKey(), i+1 keys[i], i = []byte{HistoricalInfoBytePrefix}, i+1 diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index 45aac7d579..33e7e00c8c 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -97,7 +97,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.Require().True(found, "consumer client not found") suite.path.EndpointB.ClientID = consumerClient // - set consumer endpoint's clientID - providerClient, found := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClient(suite.consumerChain.GetContext()) + providerClient, found := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClientID(suite.consumerChain.GetContext()) suite.Require().True(found, "provider client not found") suite.path.EndpointA.ClientID = providerClient // - client config diff --git a/x/ccv/provider/provider_test.go b/x/ccv/provider/provider_test.go index 8139aec6ff..37a15a1d89 100644 --- a/x/ccv/provider/provider_test.go +++ b/x/ccv/provider/provider_test.go @@ -92,7 +92,7 @@ func (suite *ProviderTestSuite) SetupTest() { suite.Require().True(found, "consumer client not found") suite.path.EndpointB.ClientID = consumerClient // - set consumer endpoint's clientID - providerClient, found := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClient(suite.consumerChain.GetContext()) + providerClient, found := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClientID(suite.consumerChain.GetContext()) suite.Require().True(found, "provider client not found") suite.path.EndpointA.ClientID = providerClient // - client config