Skip to content

Commit

Permalink
chore: addressing small nits for channel capability migrations (#2258)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Sep 13, 2022
1 parent 489fdf4 commit c2ce323
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ import (
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"

"github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"
controllertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"
)

// MigrateICS27ChannelCapability performs a search on a prefix store using the provided store key and module name.
// It retrieves the associated channel capability index and reassigns ownership to the ICS27 controller submodule.
func MigrateICS27ChannelCapability(
ctx sdk.Context,
cdc codec.BinaryCodec,
storeKey storetypes.StoreKey,
capabilityStoreKey storetypes.StoreKey,
capabilityKeeper *capabilitykeeper.Keeper,
module string, // the name of the scoped keeper for the underlying app module
) error {
// construct a prefix store using the x/capability index prefix: index->capability owners
prefixStore := prefix.NewStore(ctx.KVStore(storeKey), capabilitytypes.KeyPrefixIndexCapability)
prefixStore := prefix.NewStore(ctx.KVStore(capabilityStoreKey), capabilitytypes.KeyPrefixIndexCapability)
iterator := sdk.KVStorePrefixIterator(prefixStore, nil)
defer iterator.Close()

Expand All @@ -38,7 +38,7 @@ func MigrateICS27ChannelCapability(
owners.Remove(owner)

// reassign the owner module to icacontroller
owner.Module = types.SubModuleName
owner.Module = controllertypes.SubModuleName

// add the controller submodule to the set of owners
if err := owners.Set(owner); err != nil {
Expand Down

0 comments on commit c2ce323

Please sign in to comment.