Skip to content

Commit 42f916e

Browse files
feat: Remove consumer genesis migration on provider (backport #997) (#1012)
feat: Remove consumer genesis migration on provider (#997) * Update keys.go * tests * fix another bug * remove consumer genesis deletion, link to test * remove unused bond denom method * Revert "remove unused bond denom method" This reverts commit f930eca. * remove test too * update changelog (cherry picked from commit e2ac974) Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com>
1 parent e8230bc commit 42f916e

File tree

3 files changed

+6
-31
lines changed

3 files changed

+6
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state m
1919

2020
## Notable PRs included in v2.0.0
2121

22-
* (feat) v1->v2 migrations to accommodate a bugfix having to do with store keys, introduce new params, and deal with consumer genesis state schema changes [#975](https://github.com/cosmos/interchain-security/pull/975)
22+
* (fix) cosumer key prefix order to avoid complex migrations [#963](https://github.com/cosmos/interchain-security/pull/963) and [#991](https://github.com/cosmos/interchain-security/pull/991). The latter PR is the proper fix.
23+
* (feat) v1->v2 migrations to accommodate a bugfix having to do with store keys, introduce new params, and deal with consumer genesis state schema changes [#975](https://github.com/cosmos/interchain-security/pull/975) and [#997](https://github.com/cosmos/interchain-security/pull/997)
2324
* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.4.0 to 4.4.2 [#982](https://github.com/cosmos/interchain-security/pull/982)
2425
* (fix) partially revert key assignment type safety PR [#980](https://github.com/cosmos/interchain-security/pull/980)
2526
* (fix) Remove panics on failure to send IBC packets [#876](https://github.com/cosmos/interchain-security/pull/876)
26-
* (fix) consumer key prefix order to avoid complex migrations [#963](https://github.com/cosmos/interchain-security/pull/963)
2727
* (fix) Prevent denom DOS [#931](https://github.com/cosmos/interchain-security/pull/931)
2828
* (fix) multisig for assigning consumer key, use json [#916](https://github.com/cosmos/interchain-security/pull/916)
2929
* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.3.0 to 4.4.0 [#902](https://github.com/cosmos/interchain-security/pull/902)

x/ccv/provider/keeper/migration.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ func (m Migrator) Migratev1Tov2(ctx sdk.Context) error {
3333
sdk.NewCoin(m.ccvProviderKeeper.BondDenom(ctx), sdk.NewInt(10000000)),
3434
)
3535

36-
// Delete select consumer genesis states for consumers that're launched
37-
MigrateConsumerGenesisStatesv1Tov2(ctx, m.ccvProviderKeeper)
36+
// Consumer genesis states persisted on the provider do not need to be migrated,
37+
// as protobuf serialization is able to gracefully handle unpopulated fields when deserializing.
38+
// See https://github.com/smarshall-spitzbart/ics-migration-tests/commit/b589e3982c26783ed66e954051f7da1ead16de68
39+
// which passes, proving the addition of preCCV will not break things.
3840

3941
// Migrate keys to accommodate fix from https://github.com/cosmos/interchain-security/pull/786
4042
MigrateKeysv1Tov2(ctx, m.ccvProviderKeeper)
@@ -80,14 +82,6 @@ func MigrateParamsv1Tov2(ctx sdk.Context, paramsSubspace paramtypes.Subspace, co
8082
paramsSubspace.SetParamSet(ctx, &newParams)
8183
}
8284

83-
func MigrateConsumerGenesisStatesv1Tov2(ctx sdk.Context, providerKeeper Keeper) {
84-
// We could try to migrate existing ConsumerGenesisStates, but they're not needed after consumer launch.
85-
// Hence we delete them strategically.
86-
providerKeeper.DeleteConsumerGenesis(ctx, "neutron-1") // See https://github.com/neutron-org/mainnet-assets#parameters
87-
88-
// TODO: determine if any other ConsumerGenesisStates need to be deleted, or actually migrated!
89-
}
90-
9185
// Due to https://github.com/cosmos/interchain-security/pull/786,
9286
// validators' slash logs are stored under the key prefix for slash acks.
9387
// This method will extract "slash logs" from the slash acks part of the store, and put the slash logs

x/ccv/provider/keeper/migration_test.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
types2 "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types"
1414
"github.com/cosmos/interchain-security/v2/testutil/crypto"
1515
testutil "github.com/cosmos/interchain-security/v2/testutil/keeper"
16-
consumertypes "github.com/cosmos/interchain-security/v2/x/ccv/consumer/types"
1716
providerkeeper "github.com/cosmos/interchain-security/v2/x/ccv/provider/keeper"
1817
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"
1918
ccvtypes "github.com/cosmos/interchain-security/v2/x/ccv/types"
@@ -124,24 +123,6 @@ type v1Params struct {
124123
MaxThrottledPackets int64 `protobuf:"varint,8,opt,name=max_throttled_packets,json=maxThrottledPackets,proto3" json:"max_throttled_packets,omitempty"`
125124
}
126125

127-
func TestMigrateConsumerGenesisv1Tov2(t *testing.T) {
128-
providerKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, testutil.NewInMemKeeperParams(t))
129-
defer ctrl.Finish()
130-
131-
_, found := providerKeeper.GetConsumerGenesis(ctx, "neutron-1")
132-
require.False(t, found)
133-
134-
providerKeeper.SetConsumerGenesis(ctx, "neutron-1", consumertypes.GenesisState{})
135-
136-
_, found = providerKeeper.GetConsumerGenesis(ctx, "neutron-1")
137-
require.True(t, found)
138-
139-
providerkeeper.MigrateConsumerGenesisStatesv1Tov2(ctx, providerKeeper)
140-
141-
_, found = providerKeeper.GetConsumerGenesis(ctx, "neutron-1")
142-
require.False(t, found)
143-
}
144-
145126
func TestMigrateKeysv1Tov2(t *testing.T) {
146127
providerKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, testutil.NewInMemKeeperParams(t))
147128
defer ctrl.Finish()

0 commit comments

Comments
 (0)