refactor(x/staking): rm dependency on x/distribution (#16531)
This commit is contained in:
parent
1363a02da0
commit
bbb452f609
@ -6,6 +6,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
v1 "github.com/cosmos/cosmos-sdk/x/distribution/migrations/v1"
|
||||
v2staking "github.com/cosmos/cosmos-sdk/x/staking/migrations/v2"
|
||||
)
|
||||
|
||||
// MigrateStore performs in-place store migrations from v0.40 to v0.43. The
|
||||
@ -14,13 +15,13 @@ import (
|
||||
// - Change addresses to be length-prefixed.
|
||||
func MigrateStore(ctx sdk.Context, storeService store.KVStoreService) error {
|
||||
store := runtime.KVStoreAdapter(storeService.OpenKVStore(ctx))
|
||||
MigratePrefixAddress(store, v1.ValidatorOutstandingRewardsPrefix)
|
||||
MigratePrefixAddress(store, v1.DelegatorWithdrawAddrPrefix)
|
||||
MigratePrefixAddressAddress(store, v1.DelegatorStartingInfoPrefix)
|
||||
MigratePrefixAddressBytes(store, v1.ValidatorHistoricalRewardsPrefix)
|
||||
MigratePrefixAddress(store, v1.ValidatorCurrentRewardsPrefix)
|
||||
MigratePrefixAddress(store, v1.ValidatorAccumulatedCommissionPrefix)
|
||||
MigratePrefixAddressBytes(store, v1.ValidatorSlashEventPrefix)
|
||||
v2staking.MigratePrefixAddress(store, v1.ValidatorOutstandingRewardsPrefix)
|
||||
v2staking.MigratePrefixAddress(store, v1.DelegatorWithdrawAddrPrefix)
|
||||
v2staking.MigratePrefixAddressAddress(store, v1.DelegatorStartingInfoPrefix)
|
||||
v2staking.MigratePrefixAddressBytes(store, v1.ValidatorHistoricalRewardsPrefix)
|
||||
v2staking.MigratePrefixAddress(store, v1.ValidatorCurrentRewardsPrefix)
|
||||
v2staking.MigratePrefixAddress(store, v1.ValidatorAccumulatedCommissionPrefix)
|
||||
v2staking.MigratePrefixAddressBytes(store, v1.ValidatorSlashEventPrefix)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@ import (
|
||||
storetypes "cosmossdk.io/core/store"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
v2distribution "github.com/cosmos/cosmos-sdk/x/distribution/migrations/v2"
|
||||
v1 "github.com/cosmos/cosmos-sdk/x/slashing/migrations/v1"
|
||||
v2staking "github.com/cosmos/cosmos-sdk/x/staking/migrations/v2"
|
||||
)
|
||||
|
||||
// MigrateStore performs in-place store migrations from v0.40 to v0.43. The
|
||||
@ -16,9 +16,9 @@ import (
|
||||
// - Change addresses to be length-prefixed.
|
||||
func MigrateStore(ctx context.Context, storeService storetypes.KVStoreService) error {
|
||||
store := runtime.KVStoreAdapter(storeService.OpenKVStore(ctx))
|
||||
v2distribution.MigratePrefixAddress(store, v1.ValidatorSigningInfoKeyPrefix)
|
||||
v2distribution.MigratePrefixAddressBytes(store, v1.ValidatorMissedBlockBitArrayKeyPrefix)
|
||||
v2distribution.MigratePrefixAddress(store, v1.AddrPubkeyRelationKeyPrefix)
|
||||
v2staking.MigratePrefixAddress(store, v1.ValidatorSigningInfoKeyPrefix)
|
||||
v2staking.MigratePrefixAddressBytes(store, v1.ValidatorMissedBlockBitArrayKeyPrefix)
|
||||
v2staking.MigratePrefixAddress(store, v1.AddrPubkeyRelationKeyPrefix)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
v1auth "github.com/cosmos/cosmos-sdk/x/auth/migrations/v1"
|
||||
v2distribution "github.com/cosmos/cosmos-sdk/x/distribution/migrations/v2"
|
||||
v1 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v1"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
)
|
||||
@ -63,15 +62,15 @@ func migrateValidatorsByPowerIndexKey(store storetypes.KVStore) {
|
||||
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey) error {
|
||||
store := ctx.KVStore(storeKey)
|
||||
|
||||
v2distribution.MigratePrefixAddress(store, v1.LastValidatorPowerKey)
|
||||
MigratePrefixAddress(store, v1.LastValidatorPowerKey)
|
||||
|
||||
v2distribution.MigratePrefixAddress(store, v1.ValidatorsKey)
|
||||
v2distribution.MigratePrefixAddress(store, v1.ValidatorsByConsAddrKey)
|
||||
MigratePrefixAddress(store, v1.ValidatorsKey)
|
||||
MigratePrefixAddress(store, v1.ValidatorsByConsAddrKey)
|
||||
migrateValidatorsByPowerIndexKey(store)
|
||||
|
||||
v2distribution.MigratePrefixAddressAddress(store, v1.DelegationKey)
|
||||
v2distribution.MigratePrefixAddressAddress(store, v1.UnbondingDelegationKey)
|
||||
v2distribution.MigratePrefixAddressAddress(store, v1.UnbondingDelegationByValIndexKey)
|
||||
MigratePrefixAddressAddress(store, v1.DelegationKey)
|
||||
MigratePrefixAddressAddress(store, v1.UnbondingDelegationKey)
|
||||
MigratePrefixAddressAddress(store, v1.UnbondingDelegationByValIndexKey)
|
||||
migratePrefixAddressAddressAddress(store, v1.RedelegationKey)
|
||||
migratePrefixAddressAddressAddress(store, v1.RedelegationByValSrcIndexKey)
|
||||
migratePrefixAddressAddressAddress(store, v1.RedelegationByValDstIndexKey)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user