diff --git a/docs/architecture/adr-041-in-place-store-migrations.md b/docs/architecture/adr-041-in-place-store-migrations.md index 2286c6d2d9b..072a121f5d6 100644 --- a/docs/architecture/adr-041-in-place-store-migrations.md +++ b/docs/architecture/adr-041-in-place-store-migrations.md @@ -71,7 +71,7 @@ Since migration functions manipulate legacy code, they should live inside the `l ```go // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v042bank.MigrateStore(ctx, m.keeper.storeKey) // v042bank is package `x/bank/legacy/v042`. + return v043bank.MigrateStore(ctx, m.keeper.storeKey) // v043bank is package `x/bank/legacy/v043`. } ``` diff --git a/x/bank/keeper/migrations.go b/x/bank/keeper/migrations.go index 20ef35e3215..e46b386b81a 100644 --- a/x/bank/keeper/migrations.go +++ b/x/bank/keeper/migrations.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v042 "github.com/cosmos/cosmos-sdk/x/bank/legacy/v042" + v043 "github.com/cosmos/cosmos-sdk/x/bank/legacy/v043" ) // Migrator is a struct for handling in-place store migrations. @@ -17,5 +17,5 @@ func NewMigrator(keeper BaseKeeper) Migrator { // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v042.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) + return v043.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) } diff --git a/x/bank/legacy/v042/store.go b/x/bank/legacy/v043/store.go similarity index 99% rename from x/bank/legacy/v042/store.go rename to x/bank/legacy/v043/store.go index cc0d9d6f5ae..74a560d5e2c 100644 --- a/x/bank/legacy/v042/store.go +++ b/x/bank/legacy/v043/store.go @@ -1,4 +1,4 @@ -package v042 +package v043 import ( "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/bank/legacy/v042/store_test.go b/x/bank/legacy/v043/store_test.go similarity index 91% rename from x/bank/legacy/v042/store_test.go rename to x/bank/legacy/v043/store_test.go index 51256ff3c18..ff4b3c3c08d 100644 --- a/x/bank/legacy/v042/store_test.go +++ b/x/bank/legacy/v043/store_test.go @@ -1,4 +1,4 @@ -package v042_test +package v043_test import ( "testing" @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" v040bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v040" - v042bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v042" + v043bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v043" "github.com/cosmos/cosmos-sdk/x/bank/types" ) @@ -29,7 +29,7 @@ func TestSupplyMigration(t *testing.T) { store.Set(v040bank.SupplyKey, encCfg.Marshaler.MustMarshalBinaryBare(&oldSupply)) // Run migration. - err := v042bank.MigrateStore(ctx, bankKey, encCfg.Marshaler) + err := v043bank.MigrateStore(ctx, bankKey, encCfg.Marshaler) require.NoError(t, err) // New supply is indexed by denom. @@ -55,7 +55,7 @@ func TestBalanceKeysMigration(t *testing.T) { oldKey := append(append(v040bank.BalancesPrefix, addr...), denom...) store.Set(oldKey, value) - err := v042bank.MigrateStore(ctx, bankKey, encCfg.Marshaler) + err := v043bank.MigrateStore(ctx, bankKey, encCfg.Marshaler) require.NoError(t, err) newKey := append(types.CreateAccountBalancesPrefix(addr), denom...) diff --git a/x/distribution/keeper/migrations.go b/x/distribution/keeper/migrations.go index 7c5d40dba4d..7f7273c650b 100644 --- a/x/distribution/keeper/migrations.go +++ b/x/distribution/keeper/migrations.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v042 "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v042" + v043 "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" ) // Migrator is a struct for handling in-place store migrations. @@ -17,5 +17,5 @@ func NewMigrator(keeper Keeper) Migrator { // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v042.MigrateStore(ctx, m.keeper.storeKey) + return v043.MigrateStore(ctx, m.keeper.storeKey) } diff --git a/x/distribution/legacy/v042/helpers.go b/x/distribution/legacy/v043/helpers.go similarity index 99% rename from x/distribution/legacy/v042/helpers.go rename to x/distribution/legacy/v043/helpers.go index afc99cf7088..4394d271c33 100644 --- a/x/distribution/legacy/v042/helpers.go +++ b/x/distribution/legacy/v043/helpers.go @@ -1,4 +1,4 @@ -package v042 +package v043 import ( "github.com/cosmos/cosmos-sdk/store/prefix" diff --git a/x/distribution/legacy/v042/store.go b/x/distribution/legacy/v043/store.go similarity index 98% rename from x/distribution/legacy/v042/store.go rename to x/distribution/legacy/v043/store.go index 31c575b4adc..1cb78ea0be8 100644 --- a/x/distribution/legacy/v042/store.go +++ b/x/distribution/legacy/v043/store.go @@ -1,4 +1,4 @@ -package v042 +package v043 import ( sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/distribution/legacy/v042/store_test.go b/x/distribution/legacy/v043/store_test.go similarity index 94% rename from x/distribution/legacy/v042/store_test.go rename to x/distribution/legacy/v043/store_test.go index 2a4a5df75bb..84843013357 100644 --- a/x/distribution/legacy/v042/store_test.go +++ b/x/distribution/legacy/v043/store_test.go @@ -1,4 +1,4 @@ -package v042_test +package v043_test import ( "bytes" @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" v040distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v040" - v042distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v042" + v043distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" "github.com/cosmos/cosmos-sdk/x/distribution/types" ) @@ -83,7 +83,7 @@ func TestStoreMigration(t *testing.T) { } // Run migrations. - err := v042distribution.MigrateStore(ctx, distributionKey) + err := v043distribution.MigrateStore(ctx, distributionKey) require.NoError(t, err) // Make sure the new keys are set and old keys are deleted. diff --git a/x/gov/keeper/migrations.go b/x/gov/keeper/migrations.go index e0134012258..cad01432bb7 100644 --- a/x/gov/keeper/migrations.go +++ b/x/gov/keeper/migrations.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v042 "github.com/cosmos/cosmos-sdk/x/gov/legacy/v042" + v043 "github.com/cosmos/cosmos-sdk/x/gov/legacy/v043" ) // Migrator is a struct for handling in-place store migrations. @@ -17,5 +17,5 @@ func NewMigrator(keeper Keeper) Migrator { // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v042.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) + return v043.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) } diff --git a/x/gov/legacy/v042/store.go b/x/gov/legacy/v043/store.go similarity index 99% rename from x/gov/legacy/v042/store.go rename to x/gov/legacy/v043/store.go index 4c49d016beb..9189e12f736 100644 --- a/x/gov/legacy/v042/store.go +++ b/x/gov/legacy/v043/store.go @@ -1,4 +1,4 @@ -package v042 +package v043 import ( "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/gov/legacy/v042/store_test.go b/x/gov/legacy/v043/store_test.go similarity index 95% rename from x/gov/legacy/v042/store_test.go rename to x/gov/legacy/v043/store_test.go index 6eaeab7e9bc..22d3e3ba4fb 100644 --- a/x/gov/legacy/v042/store_test.go +++ b/x/gov/legacy/v043/store_test.go @@ -1,4 +1,4 @@ -package v042_test +package v043_test import ( "bytes" @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" v040gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v040" - v042gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v042" + v043gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v043" "github.com/cosmos/cosmos-sdk/x/gov/types" ) @@ -75,7 +75,7 @@ func TestStoreMigration(t *testing.T) { } // Run migrations. - err := v042gov.MigrateStore(ctx, govKey, cdc) + err := v043gov.MigrateStore(ctx, govKey, cdc) require.NoError(t, err) // Make sure the new keys are set and old keys are deleted. diff --git a/x/slashing/keeper/migrations.go b/x/slashing/keeper/migrations.go index b1bda4ab648..84f19c01ab7 100644 --- a/x/slashing/keeper/migrations.go +++ b/x/slashing/keeper/migrations.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v042 "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v042" + v043 "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v043" ) // Migrator is a struct for handling in-place store migrations. @@ -17,5 +17,5 @@ func NewMigrator(keeper Keeper) Migrator { // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v042.MigrateStore(ctx, m.keeper.storeKey) + return v043.MigrateStore(ctx, m.keeper.storeKey) } diff --git a/x/slashing/legacy/v042/store.go b/x/slashing/legacy/v043/store.go similarity index 62% rename from x/slashing/legacy/v042/store.go rename to x/slashing/legacy/v043/store.go index 7864087b10f..4737315e98f 100644 --- a/x/slashing/legacy/v042/store.go +++ b/x/slashing/legacy/v043/store.go @@ -1,8 +1,8 @@ -package v042 +package v043 import ( sdk "github.com/cosmos/cosmos-sdk/types" - v042distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v042" + v043distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" v040slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v040" ) @@ -12,9 +12,9 @@ import ( // - Change addresses to be length-prefixed. func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error { store := ctx.KVStore(storeKey) - v042distribution.MigratePrefixAddress(store, v040slashing.ValidatorSigningInfoKeyPrefix) - v042distribution.MigratePrefixAddressBytes(store, v040slashing.ValidatorMissedBlockBitArrayKeyPrefix) - v042distribution.MigratePrefixAddress(store, v040slashing.AddrPubkeyRelationKeyPrefix) + v043distribution.MigratePrefixAddress(store, v040slashing.ValidatorSigningInfoKeyPrefix) + v043distribution.MigratePrefixAddressBytes(store, v040slashing.ValidatorMissedBlockBitArrayKeyPrefix) + v043distribution.MigratePrefixAddress(store, v040slashing.AddrPubkeyRelationKeyPrefix) return nil } diff --git a/x/slashing/legacy/v042/store_test.go b/x/slashing/legacy/v043/store_test.go similarity index 92% rename from x/slashing/legacy/v042/store_test.go rename to x/slashing/legacy/v043/store_test.go index 60bf43a27b8..f0440c1e841 100644 --- a/x/slashing/legacy/v042/store_test.go +++ b/x/slashing/legacy/v043/store_test.go @@ -1,4 +1,4 @@ -package v042_test +package v043_test import ( "bytes" @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" v040slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v040" - v042slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v042" + v043slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v043" "github.com/cosmos/cosmos-sdk/x/slashing/types" ) @@ -52,7 +52,7 @@ func TestStoreMigration(t *testing.T) { } // Run migrations. - err := v042slashing.MigrateStore(ctx, slashingKey) + err := v043slashing.MigrateStore(ctx, slashingKey) require.NoError(t, err) // Make sure the new keys are set and old keys are deleted. diff --git a/x/staking/keeper/migrations.go b/x/staking/keeper/migrations.go index 948f93ed67a..101ca195b39 100644 --- a/x/staking/keeper/migrations.go +++ b/x/staking/keeper/migrations.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v042 "github.com/cosmos/cosmos-sdk/x/staking/legacy/v042" + v043 "github.com/cosmos/cosmos-sdk/x/staking/legacy/v043" ) // Migrator is a struct for handling in-place store migrations. @@ -17,5 +17,5 @@ func NewMigrator(keeper Keeper) Migrator { // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v042.MigrateStore(ctx, m.keeper.storeKey) + return v043.MigrateStore(ctx, m.keeper.storeKey) } diff --git a/x/staking/legacy/v042/store.go b/x/staking/legacy/v043/store.go similarity index 85% rename from x/staking/legacy/v042/store.go rename to x/staking/legacy/v043/store.go index 2be604e6609..4bd6b31e1f2 100644 --- a/x/staking/legacy/v042/store.go +++ b/x/staking/legacy/v043/store.go @@ -1,11 +1,11 @@ -package v042 +package v043 import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" - v042distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v042" + v043distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" v040staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v040" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -61,15 +61,15 @@ func migrateValidatorsByPowerIndexKey(store sdk.KVStore) { func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error { store := ctx.KVStore(storeKey) - v042distribution.MigratePrefixAddress(store, v040staking.LastValidatorPowerKey) + v043distribution.MigratePrefixAddress(store, v040staking.LastValidatorPowerKey) - v042distribution.MigratePrefixAddress(store, v040staking.ValidatorsKey) - v042distribution.MigratePrefixAddress(store, v040staking.ValidatorsByConsAddrKey) + v043distribution.MigratePrefixAddress(store, v040staking.ValidatorsKey) + v043distribution.MigratePrefixAddress(store, v040staking.ValidatorsByConsAddrKey) migrateValidatorsByPowerIndexKey(store) - v042distribution.MigratePrefixAddressAddress(store, v040staking.DelegationKey) - v042distribution.MigratePrefixAddressAddress(store, v040staking.UnbondingDelegationKey) - v042distribution.MigratePrefixAddressAddress(store, v040staking.UnbondingDelegationByValIndexKey) + v043distribution.MigratePrefixAddressAddress(store, v040staking.DelegationKey) + v043distribution.MigratePrefixAddressAddress(store, v040staking.UnbondingDelegationKey) + v043distribution.MigratePrefixAddressAddress(store, v040staking.UnbondingDelegationByValIndexKey) migratePrefixAddressAddressAddress(store, v040staking.RedelegationKey) migratePrefixAddressAddressAddress(store, v040staking.RedelegationByValSrcIndexKey) migratePrefixAddressAddressAddress(store, v040staking.RedelegationByValDstIndexKey) diff --git a/x/staking/legacy/v042/store_test.go b/x/staking/legacy/v043/store_test.go similarity index 96% rename from x/staking/legacy/v042/store_test.go rename to x/staking/legacy/v043/store_test.go index 963ef02ed9c..0abe8f3b1e8 100644 --- a/x/staking/legacy/v042/store_test.go +++ b/x/staking/legacy/v043/store_test.go @@ -1,4 +1,4 @@ -package v042_test +package v043_test import ( "bytes" @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" v040staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v040" - v042staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v042" + v043staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v043" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -121,7 +121,7 @@ func TestStoreMigration(t *testing.T) { } // Run migrations. - err := v042staking.MigrateStore(ctx, stakingKey) + err := v043staking.MigrateStore(ctx, stakingKey) require.NoError(t, err) // Make sure the new keys are set and old keys are deleted.