Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clean up ctx unwrapping in channel/v2/keeper. #7497

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions modules/core/04-channel/v2/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ func (k *Keeper) GetChannel(ctx context.Context, channelID string) (types.Channe

// GetCreator returns the creator of the channel.
func (k *Keeper) GetCreator(ctx context.Context, channelID string) (string, bool) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
bz := k.ChannelStore(sdkCtx, channelID).Get([]byte(types.CreatorKey))
bz := k.ChannelStore(ctx, channelID).Get([]byte(types.CreatorKey))
if len(bz) == 0 {
return "", false
}
Expand All @@ -92,14 +91,12 @@ func (k *Keeper) GetCreator(ctx context.Context, channelID string) (string, bool

// SetCreator sets the creator of the channel.
func (k *Keeper) SetCreator(ctx context.Context, channelID, creator string) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
k.ChannelStore(sdkCtx, channelID).Set([]byte(types.CreatorKey), []byte(creator))
k.ChannelStore(ctx, channelID).Set([]byte(types.CreatorKey), []byte(creator))
}

// DeleteCreator deletes the creator associated with the channel.
func (k *Keeper) DeleteCreator(ctx context.Context, channelID string) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
k.ChannelStore(sdkCtx, channelID).Delete([]byte(types.CreatorKey))
k.ChannelStore(ctx, channelID).Delete([]byte(types.CreatorKey))
}

// GetPacketReceipt returns the packet receipt from the packet receipt path based on the channelID and sequence.
Expand Down
4 changes: 2 additions & 2 deletions modules/core/04-channel/v2/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const (
// SubModuleName defines the channelv2 module name.
SubModuleName = "channelv2"

// ChannelKey is the key used to store channel in the client store.
// ChannelKey is the key used to store channels in the channel store.
// the channel key is imported from types instead of host because
// the channel key is not a part of the ics-24 host specification
ChannelKey = "channel"

// CreatorKey is the key used to store the client creator in the client store
// CreatorKey is the key used to store the channel creator in the channel store
// the creator key is imported from types instead of host because
// the creator key is not a part of the ics-24 host specification
CreatorKey = "creator"
Expand Down
Loading